aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-06-19 22:36:38 -0400
committerRalph Amissah <ralph@amissah.com>2014-06-19 22:36:38 -0400
commitea5affb331624b72a7a5a7ac5614e2d19f347c4d (patch)
tree2db6a88dc15f0019741254a2a3ea5f78236ef2ff
parentdebian/changelog (5.4.0-1) (diff)
parentvim syntax, code block, language syntax; box group; quote (diff)
Merge tag 'sisu_5.4.1' into debian/sid
SiSU 5.4.1
-rw-r--r--data/doc/sisu/CHANGELOG_v562
-rw-r--r--data/doc/sisu/CHANGELOG_v631
-rw-r--r--data/doc/sisu/sisu.org4
-rw-r--r--data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim15
-rw-r--r--data/sisu/v5/v/version.yml6
-rw-r--r--data/sisu/v6/v/version.yml6
-rw-r--r--lib/sisu/v5/ao.rb31
-rw-r--r--lib/sisu/v5/ao_doc_objects.rb104
-rw-r--r--lib/sisu/v5/ao_doc_str.rb294
-rw-r--r--lib/sisu/v5/ao_expand_insertions.rb4
-rw-r--r--lib/sisu/v5/ao_misc_arrange.rb43
-rw-r--r--lib/sisu/v5/ao_numbering.rb15
-rw-r--r--lib/sisu/v5/constants.rb5
-rw-r--r--lib/sisu/v5/digests.rb17
-rw-r--r--lib/sisu/v5/harvest_topics.rb77
-rw-r--r--lib/sisu/v5/qrcode.rb8
-rw-r--r--lib/sisu/v5/xml_docbook5.rb74
-rw-r--r--lib/sisu/v5/xml_fictionbook2.rb68
-rw-r--r--lib/sisu/v5/xml_scaffold_structure_collapsed.rb53
-rw-r--r--lib/sisu/v5/xml_scaffold_structure_sisu.rb55
-rw-r--r--lib/sisu/v6/ao.rb31
-rw-r--r--lib/sisu/v6/ao_doc_objects.rb153
-rw-r--r--lib/sisu/v6/ao_doc_str.rb412
-rw-r--r--lib/sisu/v6/ao_expand_insertions.rb4
-rw-r--r--lib/sisu/v6/ao_misc_arrange.rb83
-rw-r--r--lib/sisu/v6/ao_numbering.rb15
-rw-r--r--lib/sisu/v6/ao_syntax.rb3
-rw-r--r--lib/sisu/v6/constants.rb5
-rw-r--r--lib/sisu/v6/digests.rb17
-rw-r--r--lib/sisu/v6/harvest_topics.rb77
-rw-r--r--lib/sisu/v6/qrcode.rb8
-rw-r--r--lib/sisu/v6/shared_metadata.rb66
-rw-r--r--lib/sisu/v6/txt_shared.rb9
-rw-r--r--lib/sisu/v6/xml_docbook5.rb144
-rw-r--r--lib/sisu/v6/xml_fictionbook2.rb68
-rw-r--r--lib/sisu/v6/xml_scaffold_structure_collapsed.rb53
-rw-r--r--lib/sisu/v6/xml_scaffold_structure_sisu.rb55
-rw-r--r--lib/sisu/v6/xml_shared.rb49
-rw-r--r--lib/sisu/v6/xml_tables.rb58
-rw-r--r--rbuild4
40 files changed, 1392 insertions, 894 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index fe2834c2..74dd197e 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -31,6 +31,21 @@ v2 branch is removed; it is available in sisu =< 3.3.2
%% Reverse Chronological:
+%% 5.4.1.orig.tar.xz (2014-06-19:24/4)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.4.1
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.4.1-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_5.4.1.orig.tar.xz
+ sisu_5.4.1.orig.tar.xz
+ sisu_5.4.1-1.dsc
+
+* ao,
+ * regex match for tics "```" followed by space tweaked
+ * Symbol to match grouped text open & close (instead of String)
+ * introduce way of removing unrecognized tic markers
+ * turn id numbers (for tags) into a hash
+ * code blocks, clean trailing newlines
+ * misc, minorish
+
%% 5.4.0.orig.tar.xz (2014-05-25:20/7)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.4.0
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.4.0-1
@@ -38,6 +53,53 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.4.0.orig.tar.xz
sisu_5.4.0.orig.tar.xz
sisu_5.4.0-1.dsc
+* v5: merge v6 to v5, version bump to 5.4.*, reason adds structure check
+ * ao, document structure check, stop processing on major error
+ (with error message & text at location of failure)
+ [reason for version bump the addition of structure check]
+ * utils, add ok code marker
+ * ao, heading with no ocn, distinguish ~# from -#
+ * ~# is general & means no ocn (for any object to which it is applied)
+ * -# is relevant only for 1~ dummy headings & instructs that they should be
+ removed from output where possible
+ * applied so far to pdf, odt & plaintext
+ * ao_images, reduce warnings when ruby RMagic absent as program used directly
+ * reduced dependency on ruby RMagic library (as some time way back had
+ issues)
+ * ao, document markup structure check, skip processing file on major error
+ * with error message & text at location of failure
+ * texpdf, urls in creator cause breakage
+ * texpdf, mailto markup links set for normal text objects
+ * texpdf, '&' in heading breaks toc (now removed from toc (not heading)), bug
+ * revisit, bug
+ * texpdf, for urls switch to sans serif (small fontsize)
+ * instead of typewriter, latex default
+ * texpdf, pdf colored hyperlinks configurable
+ * --pdf-hyperlinks-color
+ --pdf-hyperlinks-no-color or --pdf-hyperlinks-monochrome
+ * ['default']['pdf_hyperlinks']='color'
+ (other options switch hyperlink color off 'no-color' 'color-off'
+ 'monochrome')
+ * texpdf, pdf default font size configurable (cli & sisurc.yml) (no fractions)
+ * --pdf-fontsize-12 --pdf-fontsize-8
+ * default:
+ texpdf_fontsize: 12
+ * texpdf, headings and table of contents representation
+ * fixes 1~ and 2~ result in the same formatting
+ 1~ 2~ & 3~ now differentiated, see discussion in sisu.org under #744383
+ * fixes :A smaller formatted than :B
+ A~ B~ C~ now the same size, see discussion in sisu.org under #744383
+ * :B and :C result in the same formatting, issue explained see sisu.org
+ * texpdf, (internal coding) fontface, rename texpdf_font texpdf_fontface
+ * texpdf, (internal coding) use symbols to identify page orientation
+ * param, metadata rights, line-breaks instead of semicolons separating rights
+ * fixes remove trailing semicolon after :copyright:
+ * digests sha512 option implemented
+ * options sha512 sha256 md5
+ * command line --sha512
+ * rcconf.yml ['defsault']['digest'] = sha512
+ * xml object citation numbering (docbook fictionbook)
+
%% 5.3.6.orig.tar.xz (2014-05-18:19/7)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.3.6
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.3.6-1
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index d58762a9..4d324faa 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -21,6 +21,37 @@ v2 branch is removed; it is available in sisu =< 3.3.2
%% Reverse Chronological:
+%% 6.0.8.orig.tar.xz (2014-06-19:24/4)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.8
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.8-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.8.orig.tar.xz
+ sisu_6.0.8.orig.tar.xz
+ sisu_6.0.8-1.dsc
+
+* ao,
+ * regex match for tics "```" followed by space tweaked
+ * Symbol to match grouped text open & close (instead of String)
+ * introduce way of removing unrecognized tic markers
+ * syntax, able optionally to indicate the language syntax of a code block
+ * syntax, introduce box text block/group
+ * syntax, introduce tics quotes markup (blockquote equivalent)
+ * turn id numbers (for tags) into a hash
+ * code blocks, clean trailing newlines
+ * misc, minorish
+
+* docbook,
+ * ocn & footnote numbers (as xml comments)
+ * metadata header (docinfo)
+ * quotes (blockquote)
+ * tables
+ * images
+ * code block
+
+* vim syntax, add
+ * code block, language syntax, optional
+ * box block
+ * quote block
+
%% 6.0.7.orig.tar.xz (2014-05-25:20/7)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_6.0.7
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_6.0.7-1
diff --git a/data/doc/sisu/sisu.org b/data/doc/sisu/sisu.org
index f8817e68..341cdd52 100644
--- a/data/doc/sisu/sisu.org
+++ b/data/doc/sisu/sisu.org
@@ -271,6 +271,10 @@ The package is divided into the following components:
``` box:red:"Warn" (select color and lead text of box, else instead
select color box & use regular single line bold markup ^!_ Warn$)
+*** TODO [#D] blockquotes implement? :feature:ponder:
+ ``` quote
+ not sure how best to represent
+
*** TODO [#D] bibliography :feature:ponder:
*** TODO speaker, as e.g. play (irc?) :feature:ponder:
diff --git a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim
index d88720f4..03e1766f 100644
--- a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim
+++ b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim
@@ -1,7 +1,7 @@
" SiSU Vim syntax file
" SiSU Maintainer: Ralph Amissah <ralph@amissah.com>
-" SiSU Markup: SiSU (sisu-5.2.0)
-" Last Change: 2014-01-06
+" SiSU Markup: SiSU (sisu-6.0.8)
+" Last Change: 2014-06-19
" URL: <http://git.sisudoc.org/?p=code/sisu.git;a=blob;f=data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim;hb=HEAD>
"(originally looked at Ruby Vim by Mirko Nasato)
@@ -103,11 +103,16 @@ syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_c
syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+table" end="^```\(\s\|$\)"
syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$"
" block, group, poem, alt
-syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\(block\|group\|poem\|alt\)"
+syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(block\|group\|poem\|alt\){" end="^}\1"
syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+\(block\|group\|poem\|alt\)" end="^```\(\s\|$\)"
+" box
+syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^box\(\.[a-z]\+\)\?{" end="^}box"
+syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^```\s\+\box\(\.[a-z]\+\)\?" end="^```\(\s\|$\)"
" code
-syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code"
-syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^```\s\+code" end="^```\(\s\|$\)"
+syn region sisu_content_alt contains=sisu_error,@NoSpell matchgroup=sisu_contain start="^code\(\.[a-z][0-9a-z_]\+\)\?{" end="^}code"
+syn region sisu_content_alt contains=sisu_error,@NoSpell matchgroup=sisu_contain start="^```\s\+code\(\.[a-z][0-9a-z_]\+\)\?" end="^```\(\s\|$\)"
+" quote
+syn region sisu_normal contains=sisu_fontface,sisu_bold,sisu_control,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_contain start="^```\s\+quote" end="^```\(\s\|$\)"
"% "Endnotes:
" regular endnote or asterisk or plus sign endnote
diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml
index 959947ba..ec9d1cde 100644
--- a/data/sisu/v5/v/version.yml
+++ b/data/sisu/v5/v/version.yml
@@ -1,5 +1,5 @@
---
:project: SiSU
-:version: 5.4.0
-:date_stamp: 2014w20/7
-:date: "2014-05-25"
+:version: 5.4.1
+:date_stamp: 2014w24/4
+:date: "2014-06-19"
diff --git a/data/sisu/v6/v/version.yml b/data/sisu/v6/v/version.yml
index 098c97b5..563a9713 100644
--- a/data/sisu/v6/v/version.yml
+++ b/data/sisu/v6/v/version.yml
@@ -1,5 +1,5 @@
---
:project: SiSU
-:version: 6.0.7
-:date_stamp: 2014w20/7
-:date: "2014-05-25"
+:version: 6.0.8
+:date_stamp: 2014w24/4
+:date: "2014-06-19"
diff --git a/lib/sisu/v5/ao.rb b/lib/sisu/v5/ao.rb
index 2a02ad63..c69e3be9 100644
--- a/lib/sisu/v5/ao.rb
+++ b/lib/sisu/v5/ao.rb
@@ -505,17 +505,26 @@ module SiSU_AO
end
def song
reset
- data=@data
- data=SiSU_AO_Insertions::Insertions.new(@md,data).expand_insertions? # ao_expand_insertions.rb
- data=SiSU_AO_MiscArrangeText::SI.new(@md,data).prepare_text # ao_misc_arrange.rb
- data,metadata=SiSU_AO_DocumentStructureExtract::Build.new(@md,data).identify_parts # ao_doc_str.rb
- data=SiSU_AO_Syntax::Markup.new(@md,data).songsheet # ao_syntax.rb
- data,endnote_array=SiSU_AO_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # ao_character_check.rb
- data=SiSU_AO_Images::Images.new(@md,data).images # ao_images.rb
- data,tags_map,ocn_html_seg_map=SiSU_AO_Numbering::Numbering.new(@md,data).numbering_song # ao_numbering.rb
- data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_AO_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # ao_idx.rb
- data=SiSU_AO_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # ao_endnotes.rb
- outputdata=data
+ data_txt=@data
+ data_txt=
+ SiSU_AO_Insertions::Insertions.new(@md,data_txt).expand_insertions? # ao_expand_insertions.rb
+ data_txt=
+ SiSU_AO_MiscArrangeText::SI.new(@md,data_txt).prepare_text # ao_misc_arrange.rb
+ data_obj,metadata=
+ SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt).identify_parts # ao_doc_str.rb
+ data_obj=
+ SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet # ao_syntax.rb
+ data_obj,endnote_array=
+ SiSU_AO_CharacterCheck::Check.new(data_obj).character_check_and_oldstyle_endnote_array # ao_character_check.rb
+ data_obj=
+ SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb
+ data_obj,tags_map,ocn_html_seg_map=
+ SiSU_AO_Numbering::Numbering.new(@md,data_obj).numbering_song # ao_numbering.rb
+ data_obj,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=
+ SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env).indexing_song if @md.book_idx # ao_idx.rb
+ data_obj=
+ SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array).endnotes # ao_endnotes.rb
+ outputdata=data_obj
if (@md.opt.act[:ao][:set]==:on \
|| @md.opt.act[:maintenance][:set]==:on)
SiSU_AO::Output.new(@fn,@md,outputdata).hard_output
diff --git a/lib/sisu/v5/ao_doc_objects.rb b/lib/sisu/v5/ao_doc_objects.rb
index 216349c1..c53c60d6 100644
--- a/lib/sisu/v5/ao_doc_objects.rb
+++ b/lib/sisu/v5/ao_doc_objects.rb
@@ -74,8 +74,8 @@ module SiSU_AO_DocumentStructure
@of=:meta
end
def metadata(tags)
- of= @of #String, classification - group
- is= :meta #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :meta #Symbol, classification - specific type
tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
obj= nil
@of,@is,@tags,@obj=of,is,tags,obj
@@ -89,8 +89,8 @@ module SiSU_AO_DocumentStructure
@of=:meta
end
def metadata(h,o=nil)
- of= @of #String, classification - group
- is= :meta #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :meta #Symbol, classification - specific type
tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@@ -142,8 +142,8 @@ module SiSU_AO_DocumentStructure
and (h[:ln] and h[:ln].to_s=~/[0-9]/)
h[:lv]=heading_lv(h[:ln])
end
- of= @of #String, classification - group
- is= :heading #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :heading #Symbol, classification - specific type
name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
@@ -191,8 +191,8 @@ module SiSU_AO_DocumentStructure
@tags=[]
end
def paragraph(h,o=nil)
- of= @of #String, classification - group
- is= :para #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :para #Symbol, classification - specific type
name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
@@ -247,8 +247,8 @@ module SiSU_AO_DocumentStructure
@tags=[]
end
def code(h,o=nil)
- of= @of #String, classification - group #alt 'code'
- is= :code #String, classification - specific type
+ of= @of #Symbol, classification - group #alt 'code'
+ is= :code #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -268,8 +268,8 @@ module SiSU_AO_DocumentStructure
self
end
def block(h,o=nil)
- of= @of #String, classification - group
- is= :block #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :block #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -288,8 +288,8 @@ module SiSU_AO_DocumentStructure
self
end
def group(h,o=nil)
- of= @of #String, classification - group
- is= :group #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :group #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -308,8 +308,8 @@ module SiSU_AO_DocumentStructure
self
end
def alt(h,o=nil) #see block
- of= @of #String, classification - group
- is= :alt #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :alt #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -328,8 +328,8 @@ module SiSU_AO_DocumentStructure
self
end
def verse(h,o=nil) #part of poem decide how you deal with this
- of= @of #String, classification - group
- is= :verse #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :verse #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -349,15 +349,15 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectTable
- attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
+ attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:num,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
def initialize
@of=:block
- @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
+ @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@num,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
@tags=[]
end
def table(h,o=nil)
- of= @of #String, classification - group
- is= :table #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :table #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
cols= h[:cols] || ((defined? o.cols) ? o.cols : nil)
widths= h[:widths] || ((defined? o.widths) ? o.widths : nil)
@@ -370,9 +370,9 @@ module SiSU_AO_DocumentStructure
head_= h[:head_] || ((defined? o.head_) ? o.head_ : false)
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
+ else h[:ocn_]
end
- num= h[:num] || ((defined? o.num) ? o.num : nil)
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,num,digest,tmp
@@ -387,8 +387,8 @@ module SiSU_AO_DocumentStructure
@tags=[]
end
def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider
- of= @of #String, classification - group
- is= :image #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :image #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
size= h[:size] || ((defined? o.size) ? o.size : nil)
@@ -414,34 +414,19 @@ module SiSU_AO_DocumentStructure
@is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil
end
def xml_dom(h,o=nil)
- of= @of #String, classification - group
- is= :xml_dom #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :xml_dom #Symbol, classification - specific type
obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
+ status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status Symbol :open or :close
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp
self
end
end
- class ObjectComment
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @of=:comment
- @is=@obj=@tmp=nil
- end
- def comment(h,o=nil)
- of= @of #String, classification - group
- is= :comment #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- end
class ObjectFlag
attr_accessor :obj,:is,:of,:flag,:mod,:tmp
def initialize
@@ -449,8 +434,8 @@ module SiSU_AO_DocumentStructure
@is=@obj=@flag=@mod=@tmp=nil
end
def flag(h,o=nil)
- of= @of #String, classification - group
- is= :flag #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :flag #Symbol, classification - specific type
obj= nil #String, text content
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content
@@ -459,8 +444,8 @@ module SiSU_AO_DocumentStructure
self
end
def flag_ocn(h,o=nil)
- of= @of #String, classification - group
- is= :flag_ocn #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :flag_ocn #Symbol, classification - specific type
obj= nil #String, text content
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content
@@ -476,8 +461,8 @@ module SiSU_AO_DocumentStructure
@is=@obj=@from=@tmp=nil
end
def break(h,f=nil) #decide how to deal with
- of= @of #String, classification - group
- is= :break #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :break #Symbol, classification - specific type
obj= h[:obj] #String, text content
from= f
tmp= h[:tmp] #available for processing, empty after use
@@ -485,8 +470,23 @@ module SiSU_AO_DocumentStructure
self
end
def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
- of= @of #String, classification - group
- is= :insert #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :insert #Symbol, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@obj,@tmp=of,is,obj,tmp
+ self
+ end
+ end
+ class ObjectComment
+ attr_accessor :obj,:is,:of,:tmp
+ def initialize
+ @of=:comment
+ @is=@obj=@tmp=nil
+ end
+ def comment(h,o=nil)
+ of= @of #Symbol, classification - group
+ is= :comment #Symbol, classification - specific type
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@tmp=of,is,obj,tmp
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index b66f01d1..43fa8e5e 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -63,14 +63,14 @@
module SiSU_AO_DocumentStructureExtract
class Instantiate < SiSU_Param::Parameters::Instructions
@@flag={
- ocn: :on,
- code: :off,
- poem: :off,
- block: :off,
- group: :off,
- alt: :off,
- table: :off,
- table_to: :off,
+ ocn: :on,
+ code: :off,
+ poem: :off,
+ block: :off,
+ group: :off,
+ alt: :off,
+ table: :off,
+ table_to: :off,
}
def initialize
@@counter=@@column=@@columns=0
@@ -79,14 +79,14 @@ module SiSU_AO_DocumentStructureExtract
end
class Build
@@flag={
- ocn: :on,
- code: :off,
- poem: :off,
- block: :off,
- group: :off,
- alt: :off,
- table: :off,
- table_to: :off,
+ ocn: :on,
+ code: :off,
+ poem: :off,
+ block: :off,
+ group: :off,
+ alt: :off,
+ table: :off,
+ table_to: :off,
}
def initialize(md,data)
@md,@data=md,data
@@ -225,7 +225,14 @@ module SiSU_AO_DocumentStructureExtract
def identify_parts
tuned_file=[]
@tuned_block,@tuned_code=[],[]
- @@counter,@verse_count,@num_code_block,@num_poem,@num_group,@num_block,@num_alt,@num_table=0,0,0,0,0,0,0,0
+ @@counter,@verse_count=0,0
+ @num_id={
+ code_block: 0,
+ poem: 0,
+ group: 0,
+ alt: 0,
+ table: 0,
+ }
@metadata={}
@data.each do |t_o|
if t_o =~/^--([+~-])[#]$/
@@ -248,7 +255,7 @@ module SiSU_AO_DocumentStructureExtract
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block|table)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
+ and t_o !~/^```[ ]+(?:code|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
and @@flag[:code]==:off \
and @@flag[:poem]==:off \
and @@flag[:group]==:off \
@@ -409,60 +416,60 @@ module SiSU_AO_DocumentStructureExtract
end
end
elsif @@flag[:code]==:off
- if t_o =~/^(?:code\{|[`]{3}\s+code)/
+ if t_o =~/^(?:code\{|```[ ]+code)/
@@flag[:code]=case t_o
when /^code\{/ then :curls
- when /^[`]{3}\s+code/ then :tics
+ when /^```[ ]+code/ then :tics
else @@flag[:code] #error
end
@@counter=1
- @codeblock_numbered=(t_o =~/^(?:code\{#|[`]{3}\s+code\s[#])/) ? true : false
- @num_code_block +=1
- h={ obj: "code block start #{@num_code_block}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
- elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/
+ @codeblock_numbered=(t_o =~/^(?:code\{#|```[ ]+code\s[#])/) ? true : false
+ @num_id[:code_block] +=1
+ h={ obj: '', sym: :code_block_open, num: @num_id[:code_block] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif t_o =~/^(?:poem\{|```[ ]+poem)/
@@flag[:poem]=case t_o
- when /^poem\{/ then :curls
- when /^[`]{3}\s+poem/ then :tics
- else @@flag[:poem] #error
+ when /^poem\{/ then :curls
+ when /^```[ ]+poem/ then :tics
+ else @@flag[:poem] #error
end
- @num_poem +=1
- h={ obj: "poem start #{@num_poem}" }
+ @num_id[:poem] +=1
+ h={ obj: "poem start #{@num_id[:poem]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:group\{|[`]{3}\s+group)/
+ elsif t_o =~/^(?:group\{|```[ ]+group)/
@@flag[:group]=case t_o
- when /^group\{/ then :curls
- when /^[`]{3}\s+group/ then :tics
- else @@flag[:group] #error
+ when /^group\{/ then :curls
+ when /^```[ ]+group/ then :tics
+ else @@flag[:group] #error
end
- @num_group +=1
- h={ obj: "group text start #{@num_group}" }
+ @num_id[:group] +=1
+ h={ obj: "group text start #{@num_id[:group]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:block\{|[`]{3}\s+block)/
+ elsif t_o =~/^(?:block\{|```[ ]+block)/
@@flag[:block]=case t_o
- when /^block\{/ then :curls
- when /^[`]{3}\s+block/ then :tics
- else @@flag[:block] #error
+ when /^block\{/ then :curls
+ when /^```[ ]+block/ then :tics
+ else @@flag[:block] #error
end
- @num_block +=1
- h={ obj: "block text start #{@num_block}" }
+ @num_id[:block] +=1
+ h={ obj: "block text start #{@num_id[:block]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/
+ elsif t_o =~/^(?:alt\{|```[ ]+alt)/
@@flag[:alt]=case t_o
when /^alt\{/ then :curls
- when /^[`]{3}\s+alt/ then :tics
+ when /^```[ ]+alt/ then :tics
else @@flag[:alt] #error
end
- @num_alt +=1
- h={ obj: "alt text start #{@num_alt}" }
+ @num_id[:alt] +=1
+ h={ obj: "alt text start #{@num_id[:alt]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:table\{|[`]{3}\s+table|\{table)[ ~]/
- @num_table +=1
- h={ obj: "table start #{@num_table}" }
+ elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/
+ @num_id[:table] +=1
+ h={ obj: "table start #{@num_id[:table]}" }
ins=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << ins
if t_o=~/^table\{(?:~h)?\s+/
@@ -479,15 +486,15 @@ module SiSU_AO_DocumentStructureExtract
heading=false
end
@h={ head_: heading, cols: cols, widths: col, idx: idx }
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+c\d+/
+ elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/
@@flag[:table]=:tics
@rows=''
case t_o
- when /^[`]{3}\s+table~h\s+c(\d+);\s+(.+)/
+ when /^```[ ]+table~h\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=true
- when /^[`]{3}\s+table\s+c(\d+);\s+(.+)/
+ when /^```[ ]+table\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=false
@@ -516,18 +523,18 @@ module SiSU_AO_DocumentStructureExtract
width=100.00/cols
cols.times { col << width }
end
- h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
+ h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
+ elsif t_o=~/^```[ ]+table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
h=case t_o
- when /^[`]{3}\s+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
m1,tbl,hd=$1,$2,true
- when /^[`]{3}\s+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
m1,tbl,hd=$1,$2,false
else nil
end
@@ -539,10 +546,10 @@ module SiSU_AO_DocumentStructureExtract
r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
- h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
elsif t_o=~/^\{table(?:~h)?\s+/
@@ -562,10 +569,10 @@ module SiSU_AO_DocumentStructureExtract
r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
- h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
end
@@ -576,19 +583,19 @@ module SiSU_AO_DocumentStructureExtract
if (@@flag[:table]==:curls \
and t_o =~/^\}table/) \
or (@@flag[:table]==:tics \
- and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:table]=:off
headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
@h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h)
tuned_file << t_o
@h,@rows=nil,''
- h={ obj: "table end #{@num_table}" }
+ h={ obj: "table end #{@num_id[:table]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
t_o
else
if t_o.is_a?(String) \
- and t_o !~/^(?:table\{|[`]{3}\s+table)/
+ and t_o !~/^(?:table\{|```[ ]+table)/
t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2)
gsub(/\n+/m,"#{Mx[:tc_p]}")
@rows += t_o + Mx[:tc_c]
@@ -598,15 +605,16 @@ module SiSU_AO_DocumentStructureExtract
end
if @@flag[:code]==:curls or @@flag[:code]==:tics
if (@@flag[:code]==:curls and t_o =~/^\}code/) \
- or (@@flag[:code]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:code]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:code]=:off
+ @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
obj=@tuned_code.join("\n")
tags=[]
- h={ obj: obj, tags: tags, num: @num_code_block, number_: @codeblock_numbered }
+ h={ obj: obj, tags: tags, num: @num_id[:code_block], number_: @codeblock_numbered }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
@tuned_code=[]
tuned_file << t_o
- h={ obj: "code block end #{@num_code_block}" }
+ h={ obj: "code block end #{@num_id[:code_block]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
@@ -623,39 +631,39 @@ module SiSU_AO_DocumentStructureExtract
or (@@flag[:block]==:curls or @@flag[:block]==:tics) \
or (@@flag[:alt]==:curls or @@flag[:alt]==:tics)
if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
- or (@@flag[:poem]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
- h={ obj: "poem end #{@num_poem}" }
+ h={ obj: "poem end #{@num_id[:poem]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
- or (@@flag[:group]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:group]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_group }
+ h={ obj: obj, tags: tags, num: @num_id[:group] }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h)
tuned_file << t_o
- h={ obj: "group text end #{@num_group}" }
+ h={ obj: "group text end #{@num_id[:group]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
- or (@@flag[:block]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:block]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_block }
+ h={ obj: obj, tags: tags, num: @num_id[:block] }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h)
tuned_file << t_o
- h={ obj: "block text end #{@num_block}" }
+ h={ obj: "block text end #{@num_id[:block]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
- or (@@flag[:alt]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:alt]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_alt }
+ h={ obj: obj, tags: tags, num: @num_id[:alt] }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h)
@tuned_block=[]
tuned_file << t_o
- h={ obj: "alt text end #{@num_alt}" }
+ h={ obj: "alt text end #{@num_id[:alt]}" }
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
end
if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
@@ -663,7 +671,7 @@ module SiSU_AO_DocumentStructureExtract
or @@flag[:alt]==:curls or @@flag[:alt]==:tics) \
and t_o =~/\S/ \
and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
+ and t_o !~/^```[ ]+(?:code|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
sub_array=t_o.dup
@line_mode=sub_array.scan(/.+/)
type=if @@flag[:poem]==:curls or @@flag[:poem]==:tics
@@ -672,7 +680,7 @@ module SiSU_AO_DocumentStructureExtract
poem.each do |v|
v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
obj,tags=extract_tags(v)
- h={ obj: obj, tags: tags, num: @num_poem }
+ h={ obj: obj, tags: tags, num: @num_id[:poem] }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h)
tuned_file << t_o
end
@@ -751,7 +759,7 @@ module SiSU_AO_DocumentStructureExtract
lines.each do |line|
line=if line =~/\S/ \
and line !~/^(?:code\{|\}code)/ \
- and line !~/^(?:[`]{3}\s+code|[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
+ and line !~/^(?:```[ ]+code|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
and not line.is_a?(Hash) #watch
@@counter+=1 if @@flag[:code]==:curls or @@flag[:code]==:tics
line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}").
@@ -1231,7 +1239,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
|| dob.is==:alt \
|| dob.is==:group \
|| dob.is==:block
- dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out
+ dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out
end
@o_array << dob
end
@@ -1255,24 +1263,18 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
@data,@md=data,md
end
def dom
- @s=[
- 'A',
- 'B',
- 'C',
- 'D',
- '1',
- '2',
- '3'
- ]
- @sp=' '
+ @s=[ 'A', 'B', 'C', 'D', '1', '2', '3' ]
tuned_file=structure_build
tuned_file
end
+ def spaces
+ Ax[:spaces]
+ end
def structure_build
data=@data
tuned_file=[]
hs=[0,false,false,false]
- t={ lv: @s[0], status: 'open' }
+ t={ lv: @s[0], status: :open }
tuned_file << tags(t)
if @md.opt.act[:verbose_plus][:set]==:on
puts "\nXML sisu structure outline --->\n"
@@ -1349,7 +1351,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
tuned_file=tuned_file.flatten
end
def tags(o)
- tag=(o[:status]=='open') \
+ tag=(o[:status]==:open) \
? %{<#{o[:lv]} id="#{o[:node]}">}
: "</#{o[:lv]}>"
ln=case o[:lv]
@@ -1368,7 +1370,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
end
def tag_open(o,tag)
- t={ lv: tag[o.ln], node: o.node, status: 'open' }
+ t={ lv: tag[o.ln], node: o.node, status: :open }
t_o=tags(t)
t_o
end
@@ -1377,166 +1379,166 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
case hs[0]
when 0
if (lev <= 0) and hs[0]
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 1
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 2
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 3
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 4
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 5
if (lev <= 5)
- t={ lv: @s[5], status: 'close' }
+ t={ lv: @s[5], status: :close }
ary << tags(t)
end
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 6
if (lev <= 6)
- t={ lv: @s[6], status: 'close' }
+ t={ lv: @s[6], status: :close }
ary << tags(t)
end
if (lev <= 5)
- t={ lv: @s[5], status: 'close' }
+ t={ lv: @s[5], status: :close }
ary << tags(t)
end
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
end
ary
end
def puts_tag_open(o,tag)
- puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">}
+ puts %{#{spaces*o.ln}<#{tag[o.ln]} id="#{o.node}">}
end
def puts_tag_close(lev,hs)
case hs[0]
when 0
- #puts "#{@sp*0}</#{@s[0]}>" if (lev <= 0) and hs[0]
+ #puts "#{spaces*0}</#{@s[0]}>" if (lev <= 0) and hs[0]
puts "</#{@s[0]}>" if (lev==0)
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
end
end
diff --git a/lib/sisu/v5/ao_expand_insertions.rb b/lib/sisu/v5/ao_expand_insertions.rb
index 60117e1d..ea499119 100644
--- a/lib/sisu/v5/ao_expand_insertions.rb
+++ b/lib/sisu/v5/ao_expand_insertions.rb
@@ -333,9 +333,9 @@ module SiSU_AO_Insertions
tuned_file,tuned_file_tmp=[],[]
codeblock_=false
data.each do |para|
- codeblock_=if para =~/^(?:code\{|[`]{3}\s+code)/
+ codeblock_=if para =~/^(?:code\{|```[ ]+code)/
true
- elsif para =~/^(?:\}code|[`]{3}(?:\s|$))/m
+ elsif para =~/^(?:\}code|```(?:\s|$))/m
false
else codeblock_
end
diff --git a/lib/sisu/v5/ao_misc_arrange.rb b/lib/sisu/v5/ao_misc_arrange.rb
index caf3326c..419241e1 100644
--- a/lib/sisu/v5/ao_misc_arrange.rb
+++ b/lib/sisu/v5/ao_misc_arrange.rb
@@ -74,25 +74,29 @@ module SiSU_AO_MiscArrangeText
end
para
end
- def code_blocks(para)
+ def markup_blocks(para)
def ticks(para)
block_open,block_close,text=nil,nil,nil
- if para =~/\A[`]{3}\s+.+?\n.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- block_open,text,block_close=/\A([`]{3}\s+.+?)\n(.+?)\n([`]{3}(\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
- ((para=~/^[`]{3}\s+table(?:~h)?\s+/) \
- and (para !~/^[`]{3}\s+table(?:~h)?\s+c\d+/)) \
+ if para =~/\A```[ ]+(?:code|poem|alt|group|block|table).*?\n.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
+ @flag=:close
+ block_open,text,block_close=/\A(```[ ]+(?:code|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
+ ((para=~/^```[ ]+table(?:~h)?\s+/) \
+ and (para !~/^```[ ]+table(?:~h)?\s+c\d+/)) \
? para
: (para=[]; para << block_open << text << block_close)
- elsif para =~/\A[`]{3}\s+.+?\n.*?\Z/m #look at, study
- block_open,text=/\A([`]{3}(?:\s+.+?))\n(.*?)\Z/m.match(para)[1,2]
+ elsif para =~/\A```[ ]+(?:code|poem|alt|group|block|table).*?\n.*?\Z/m #look at, study
+ @flag=:open
+ block_open,text=/\A(```(?:[ ]+.+?))\n(.*?)\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << block_open << text
else
para << block_open
end
- elsif para =~/\A.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- text,block_close=/\A(.+?)\n([`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
+ elsif para =~/\A.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m \
+ and @flag==:open
+ @flag=:close
+ text,block_close=/\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << text.to_s << block_close
@@ -103,6 +107,14 @@ module SiSU_AO_MiscArrangeText
end
para
end
+ def ticks_remove(para)
+ unless @md.opt.act[:quiet][:set] ==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("ticks not recognized, ticks removed from pargraph\n#{para}")
+ end
+ para=para.gsub(/```[ ]+\S+[ ]*/m,'').
+ gsub(/```\s*/m,'').
+ strip
+ end
def curly_braces(para)
block_open,block_close,text=nil,nil,nil
para=if para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
@@ -129,9 +141,14 @@ module SiSU_AO_MiscArrangeText
end
para
end
- para=para =~/^```/m \
- ? ticks(para)
- : para
+ para=if para =~/\A```[ ]+(?:code|poem|alt|group|block|table).*?\n.*?\Z/m \
+ or @flag==:open
+ ticks(para)
+ elsif para =~/```/m
+ ticks_remove(para)
+ else
+ para
+ end
para=(para =~/^(?:code|poem|alt|group|block|table)\{|^\}(?:code|poem|alt|group|block|table)/m) \
? curly_braces(para)
: para
@@ -149,7 +166,7 @@ module SiSU_AO_MiscArrangeText
end
data.each do |para|
para=conditional_headings(para)
- data_new << code_blocks(para)
+ data_new << markup_blocks(para)
end
data_new=data_new.flatten
end
diff --git a/lib/sisu/v5/ao_numbering.rb b/lib/sisu/v5/ao_numbering.rb
index 7affbe93..a143abeb 100644
--- a/lib/sisu/v5/ao_numbering.rb
+++ b/lib/sisu/v5/ao_numbering.rb
@@ -286,7 +286,7 @@ module SiSU_AO_Numbering
# numeric only (a number), if
# all segments have been named,
# the numbers used are over 1000 or
- # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
+ # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
# [for now a warning is printed for such documents on use of maintenance or very-verbose flag]
# auto-naming takes the form of giving numbers to segments
# the rules for which are as follows
@@ -381,13 +381,11 @@ module SiSU_AO_Numbering
: @segname
tags["#{dob.ocn}"]={ segname: @segname }
ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
- if dob.ln =~/[0-3]/
- { seg: nil, level: dob.ln }
- else #elsif dob.ln =~/[4-6]/
- { seg: @seg, level: dob.ln }
+ if dob.ln =~/[0-3]/ then { seg: nil, level: dob.ln }
+ #elsif dob.ln =~/[4-6]/
+ else { seg: @seg, level: dob.ln }
end
- else
- { seg: @seg, level: nil }
+ else { seg: @seg, level: nil }
end
end
dob.tags=dob.tags.uniq if defined? dob.tags
@@ -406,7 +404,8 @@ module SiSU_AO_Numbering
if ocn \
and ocn[:level].to_s=~/[1-3]/
(1..4).each do |x|
- if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4
+ if ocn_html_seg[i+x] \
+ and ocn_html_seg[i+x][:level]==4
ocn[:seg]=ocn_html_seg[i+x][:seg]
end
end
diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb
index 748051b6..42ab53a3 100644
--- a/lib/sisu/v5/constants.rb
+++ b/lib/sisu/v5/constants.rb
@@ -92,9 +92,12 @@ Sfx={
}
Ax={
tab: "\t",
+ comment: '%',
+ spaces: ' ',
}
Xx={
protect: '☞',
+ split: '✠',
segment: 'Ф',
relative_path: '☼',
html_relative2: '※※',
@@ -348,7 +351,7 @@ check:
·
¤
- #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ㈣
+ #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ✠ ㈣
Ѳ ѳ Ф
♩ ♭  ✠  ▭ ▬ ▪
【】〖〗◢ ◣ ◀ ▶ ◘ ◙
diff --git a/lib/sisu/v5/digests.rb b/lib/sisu/v5/digests.rb
index 6cea7c3e..06851739 100644
--- a/lib/sisu/v5/digests.rb
+++ b/lib/sisu/v5/digests.rb
@@ -134,6 +134,9 @@ module SiSU_DigestView
supplementary
output
end
+ def spaces
+ Ax[:spaces]
+ end
def description(f,e='')
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
@@description << f << e
@@ -234,19 +237,19 @@ module SiSU_DigestView
if t_o.is==:heading
x=case t_o.ln
when 0 then l[0] +=1
- ' '*0 << ':A'
+ spaces*0 << ':A'
when 1 then l[1] +=1
- ' '*1 << ':B'
+ spaces*1 << ':B'
when 2 then l[2] +=1
- ' '*2 << ':C'
+ spaces*2 << ':C'
when 3 then l[3] +=1
- ' '*3 << ':D'
+ spaces*3 << ':D'
when 4 then l[4] +=1
- ' '*4 << '1'
+ spaces*4 << '1'
when 5 then l[5] +=1
- ' '*5 << '2'
+ spaces*5 << '2'
when 6 then l[6] +=1
- ' '*6 << '3'
+ spaces*6 << '3'
else nil
end
end
diff --git a/lib/sisu/v5/harvest_topics.rb b/lib/sisu/v5/harvest_topics.rb
index aeca5246..09739200 100644
--- a/lib/sisu/v5/harvest_topics.rb
+++ b/lib/sisu/v5/harvest_topics.rb
@@ -97,6 +97,11 @@ module SiSU_HarvestTopics
SiSU_HarvestTopics::OutputIndex.new(@opt,the_hash).html_print.html_songsheet
end
end
+ class Mix
+ def spaces
+ Ax[:spaces]
+ end
+ end
class Harvest
def initialize(opt,env,data,filename,name,idx_array,lang)
@opt,@env,@data,@filename,@name,@idx_array,@lang=opt,env,data,filename,name,idx_array,lang
@@ -160,7 +165,7 @@ module SiSU_HarvestTopics
idx_array
end
end
- class Index
+ class Index < Mix
def initialize(opt,env,idx_array,the_idx)
@opt,@env,@idx_array,@the_idx=opt,env,idx_array,the_idx
@@the_idx_topics=@the_idx
@@ -313,7 +318,7 @@ module SiSU_HarvestTopics
else
@the_h[x0] ||={}
end
- #puts ' '*0 + x0
+ #puts spaces*0 + x0
if extract >= 1
y0.each_pair do |x1,y1|
if extract == 1
@@ -322,7 +327,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1] ||={}
end
- #puts ' '*1 + x1
+ #puts spaces*1 + x1
if extract >= 2
y1.each_pair do |x2,y2|
if extract == 2
@@ -331,7 +336,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2] ||={}
end
- #puts ' '*2 + x2
+ #puts spaces*2 + x2
if extract >= 3
y2.each_pair do |x3,y3|
if extract == 3
@@ -340,7 +345,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3] ||={}
end
- #puts ' '*3 + x3
+ #puts spaces*3 + x3
if extract == 4
y3.each_pair do |x4,y4|
if extract == 4
@@ -349,14 +354,14 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3][x4] ||={}
end
- #puts ' '*4 + x4
+ #puts spaces*4 + x4
if extract == 5
y4.each_pair do |x5,y5|
if extract == 5
@the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] }
@the_h[x0][x1][x2][x3][x4][x5][:md] << y5
end
- #puts ' '*5 + x5
+ #puts spaces*5 + x5
end
end
end
@@ -375,22 +380,22 @@ module SiSU_HarvestTopics
end
def traverse_base
@the_h.each_pair do |x0,y0|
- puts ' '*0 + x0 if x0.is_a?(String)
+ puts spaces*0 + x0 if x0.is_a?(String)
if y0.is_a?(Hash)
y0.each_pair do |x1,y1|
- puts ' '*1 + x1 if x1.is_a?(String)
+ puts spaces*1 + x1 if x1.is_a?(String)
if y1.is_a?(Hash)
y1.each_pair do |x2,y2|
- puts ' '*2 + x2 if x2.is_a?(String)
+ puts spaces*2 + x2 if x2.is_a?(String)
if y2.is_a?(Hash)
y2.each_pair do |x3,y3|
- puts ' '*3 + x3 if x3.is_a?(String)
+ puts spaces*3 + x3 if x3.is_a?(String)
if y3.is_a?(Hash)
y3.each_pair do |x4,y4|
- puts ' '*4 + x4 if x4.is_a?(String)
+ puts spaces*4 + x4 if x4.is_a?(String)
if y4.is_a?(Hash)
y4.each_pair do |x5,y5|
- puts ' '*5 + x5 if x5.is_a?(String)
+ puts spaces*5 + x5 if x5.is_a?(String)
end
end
end
@@ -405,37 +410,37 @@ module SiSU_HarvestTopics
end
def traverse
@the_h.each_pair do |x0,y0|
- puts ' '*0 + x0 if x0.is_a?(String)
+ puts spaces*0 + x0 if x0.is_a?(String)
if y0.is_a?(Hash)
if y0.has_key?(:md)
- y0[:md].each { |x| puts ' '*5 + x[:title] }
+ y0[:md].each { |x| puts spaces*5 + x[:title] }
end
y0.each_pair do |x1,y1|
- puts ' '*1 + x1 if x1.is_a?(String)
+ puts spaces*1 + x1 if x1.is_a?(String)
if y1.is_a?(Hash)
if y1.has_key?(:md)
- y1[:md].each { |x| puts ' '*5 + x[:title] }
+ y1[:md].each { |x| puts spaces*5 + x[:title] }
end
y1.each_pair do |x2,y2|
- puts ' '*2 + x2 if x2.is_a?(String)
+ puts spaces*2 + x2 if x2.is_a?(String)
if y2.is_a?(Hash)
if y2.has_key?(:md)
- y2[:md].each { |x| puts ' '*5 + x[:title] }
+ y2[:md].each { |x| puts spaces*5 + x[:title] }
end
y2.each_pair do |x3,y3|
- puts ' '*3 + x3 if x3.is_a?(String)
+ puts spaces*3 + x3 if x3.is_a?(String)
if y3.is_a?(Hash)
if y3.has_key?(:md)
- y3[:md].each { |x| puts ' '*5 + x[:title] }
+ y3[:md].each { |x| puts spaces*5 + x[:title] }
end
y3.each_pair do |x4,y4|
- puts ' '*4 + x4 if x4.is_a?(String)
+ puts spaces*4 + x4 if x4.is_a?(String)
if y4.is_a?(Hash)
if y4.has_key?(:md)
- y4[:md].each { |x| puts ' '*5 + x[:title] }
+ y4[:md].each { |x| puts spaces*5 + x[:title] }
end
y4.each_pair do |x5,y5|
- puts ' '*5 + x4 if x4.is_a?(String)
+ puts spaces*5 + x4 if x4.is_a?(String)
end
end
end
@@ -449,7 +454,7 @@ module SiSU_HarvestTopics
end
end
end
- class OutputIndex
+ class OutputIndex < Mix
require_relative 'i18n' # i18n.rb
def initialize(opt,the_idx)
@opt,@the_idx=opt,the_idx
@@ -509,67 +514,67 @@ module SiSU_HarvestTopics
lng=x0
if x0.is_a?(String)
#do_string_name(lng,'lev0',x0)
- #puts ' '*0 + x0
+ #puts spaces*0 + x0
end
if y0.is_a?(Hash)
if y0.has_key?(:md)
y0[:md].each do |x|
#do_hash(lng,attrib,x) #lv==0 ?
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y0.each_pair do |x1,y1|
if x1.is_a?(String)
do_string_name(lng,'lev0',x1)
- #puts ' '*1 + x1
+ #puts spaces*1 + x1
end
if y1.is_a?(Hash)
if y1.has_key?(:md)
y1[:md].each do |x|
do_hash(lng,0,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y1.each_pair do |x2,y2|
if x2.is_a?(String)
do_string(lng,'lev1',x2)
- #puts ' '*2 + x2
+ #puts spaces*2 + x2
end
if y2.is_a?(Hash)
if y2.has_key?(:md)
y2[:md].each do |x|
do_hash(lng,1,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y2.each_pair do |x3,y3|
if x3.is_a?(String)
do_string(lng,'lev2',x3)
- #puts ' '*3 + x3
+ #puts spaces*3 + x3
end
if y3.is_a?(Hash)
if y3.has_key?(:md)
y3[:md].each do |x|
do_hash(lng,2,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y3.each_pair do |x4,y4|
if x4.is_a?(String)
do_string(lng,'lev3',x4)
- #puts ' '*4 + x4
+ #puts spaces*4 + x4
end
if y4.is_a?(Hash)
if y4.has_key?(:md)
y4[:md].each do |x|
do_hash(lng,3,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y4.each_pair do |x5,y5|
if x5.is_a?(String)
do_string(lng,'lev4',x5)
- #puts ' '*5 + x5
+ #puts spaces*5 + x5
end
end
end
diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb
index 66584198..e17b1d86 100644
--- a/lib/sisu/v5/qrcode.rb
+++ b/lib/sisu/v5/qrcode.rb
@@ -124,6 +124,9 @@ module SiSU_QRcode
@brace_url=SiSU_Viz::Defaults.new.url_decoration
@f.make_path(@f.output_path.qrcode.dir)
end
+ def spaces
+ Ax[:spaces]
+ end
def output_metadata
fn=@f.base_filename.manifest_txt
mn=''
@@ -666,14 +669,13 @@ WOK
if defined? @md.topic_register_array \
and @md.topic_register_array.length > 0
@manifest[:txt] << %{#{@translate.topic_register}:\n}
-@sp=' '
@md.topic_register_array.each do |t|
t.each_with_index do |st,i|
if st.is_a?(Array)
st.each do |v|
- @manifest[:txt] << %{#{@sp*i}#{v}\n}
+ @manifest[:txt] << %{#{spaces*i}#{v}\n}
end
- else @manifest[:txt] << %{#{@sp*i}#{st}\n}
+ else @manifest[:txt] << %{#{spaces*i}#{st}\n}
end
end
end
diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb
index 45e6f0cf..98450520 100644
--- a/lib/sisu/v5/xml_docbook5.rb
+++ b/lib/sisu/v5/xml_docbook5.rb
@@ -127,8 +127,8 @@ module SiSU_XML_Docbook_Book
structure_build_collapsed(data)
#tail
end
- def space
- ' '
+ def spaces
+ Ax[:spaces]
end
def tags
# collapsed -->
@@ -176,7 +176,7 @@ module SiSU_XML_Docbook_Book
end
def output(o,comment='')
puts o.lc == (0..6) \
- ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
+ ? "#{spaces*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
: "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
end
def structure_collapsed(data)
@@ -213,21 +213,21 @@ module SiSU_XML_Docbook_Book
@splv=o.lc
tag_id=o.tags[0] ? %{ id="#{o.tags[0]}" } : ''
if doc_position ==:head
- filename_docbook.puts %{#{space*o.lc}<title#{id}>}
+ filename_docbook.puts %{#{spaces*o.lc}<title#{id}>}
doc_position=:body_and_tail
else
filename_docbook.puts structure_build_tag_close(o.lc,h)
- filename_docbook.puts %{#{space*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}>
-#{space*o.lc}<title#{id}>
+ filename_docbook.puts %{#{spaces*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}>
+#{spaces*o.lc}<title#{id}>
}
end
filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
- filename_docbook.puts %{#{space*o.lc}</title>}
+ filename_docbook.puts %{#{spaces*o.lc}</title>}
h=o.lc
elsif (o.of ==:para or o.of ==:block)
- filename_docbook.puts "#{space*(@splv)}<para#{id}>"
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
- filename_docbook.puts "#{space*(@splv)}</para>"
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
end
end
filename_docbook.puts structure_build_tag_close(0,h)
@@ -237,40 +237,40 @@ module SiSU_XML_Docbook_Book
x=[]
case h
when 0
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
when 1
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
when 2
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
when 3
- x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
when 4
- x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
- x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
when 5
- x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5)
- x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
- x << "#{space*5}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*5}</#{tags.docbook(5)}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
+ x << "#{spaces*5}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
when 6
- x << "#{space*6}</#{tags.docbook(6)}>" if (lc <= 6)
- x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5)
- x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
- x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*6}</#{tags.docbook(6)}>" if (lc <= 6)
+ x << "#{spaces*5}</#{tags.docbook(5)}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook(0)}>" if (lc <= 0)
end
x.join("\n")
end
diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb
index 32a7bc76..f890b329 100644
--- a/lib/sisu/v5/xml_fictionbook2.rb
+++ b/lib/sisu/v5/xml_fictionbook2.rb
@@ -126,8 +126,8 @@ module SiSU_XML_Fictionbook
data=markup_text(data)
structure_build_collapsed(data,endnotes,images_base64)
end
- def space
- ' '
+ def spaces
+ Ax[:spaces]
end
def tags
# collapsed -->
@@ -278,7 +278,7 @@ module SiSU_XML_Fictionbook
end
def output(o,comment='')
puts o.lc == (0..6) \
- ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
+ ? "#{spaces*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
: "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
end
def structure_collapsed(data)
@@ -315,11 +315,11 @@ module SiSU_XML_Fictionbook
filename_fictionbook.puts structure_build_tag_close(o.lc,h)
end
doc_position=:body_and_tail
- filename_fictionbook.puts %{#{space*o.lc}<#{tags.fictionbook[o.lc]}>
-#{space*o.lc}<title>
+ filename_fictionbook.puts %{#{spaces*o.lc}<#{tags.fictionbook[o.lc]}>
+#{spaces*o.lc}<title>
}
filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,(o.lc*2+2)).line_wrap
- filename_fictionbook.puts %{#{space*o.lc}</title>}
+ filename_fictionbook.puts %{#{spaces*o.lc}</title>}
h=o.lc
elsif o.is ==:heading_insert \
and o.obj =~/Endnotes/ \
@@ -338,40 +338,40 @@ module SiSU_XML_Fictionbook
x=[]
case h
when 0
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 1
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 2
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 3
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 4
- x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 5
- x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
- x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 6
- x << "#{space*6}</#{tags.fictionbook[6]}>" if (lc <= 6)
- x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
- x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*6}</#{tags.fictionbook[6]}>" if (lc <= 6)
+ x << "#{spaces*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
end
x.join("\n")
end
diff --git a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
index b6430159..0395d090 100644
--- a/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
+++ b/lib/sisu/v5/xml_scaffold_structure_collapsed.rb
@@ -70,7 +70,9 @@ module SiSU_XML_Scaffold_Structure_Collapse
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- @sp=' '
+ end
+ def spaces
+ Ax[:spaces]
end
def read
begin
@@ -87,7 +89,6 @@ module SiSU_XML_Scaffold_Structure_Collapse
class Scroll <Source
def initialize(data='',md='')
@data,@md=data,md
- @sp=' '
end
def songsheet
@t='sisu'
@@ -116,8 +117,8 @@ module SiSU_XML_Scaffold_Structure_Collapse
self
end
def output(o,lev=nil,comment='')
- puts lev == 0..6 \
- ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ puts lev == (0..6) \
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
: "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
end
def structure_collapsed(data)
@@ -137,7 +138,7 @@ module SiSU_XML_Scaffold_Structure_Collapse
if (o.is ==:heading || o.is ==:heading_insert)
lev=o.lc
structure_build_tag_close(lev,h)
- puts "#{@sp*lev}<#{@s[lev]}>\n#{@sp*lev} [#{o.ocn}] #{lev} {#{o.node}}"
+ puts "#{spaces*lev}<#{@s[lev]}>\n#{spaces*lev} [#{o.ocn}] #{lev} {#{o.node}}"
h[0]=lev
end
end
@@ -146,37 +147,37 @@ module SiSU_XML_Scaffold_Structure_Collapse
def structure_build_tag_close(lev,h)
case h[0]
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
end
end
diff --git a/lib/sisu/v5/xml_scaffold_structure_sisu.rb b/lib/sisu/v5/xml_scaffold_structure_sisu.rb
index 5e2afa4d..39ca1e6a 100644
--- a/lib/sisu/v5/xml_scaffold_structure_sisu.rb
+++ b/lib/sisu/v5/xml_scaffold_structure_sisu.rb
@@ -70,7 +70,9 @@ module SiSU_XML_Scaffold_Structure_Sisu
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- @sp=' '
+ end
+ def spaces
+ Ax[:spaces]
end
def read
begin
@@ -87,7 +89,6 @@ module SiSU_XML_Scaffold_Structure_Sisu
class Scroll <Source
def initialize(data='',md='')
@data,@md=data,md
- @sp=' '
end
def songsheet
@t='sisu'
@@ -114,13 +115,13 @@ module SiSU_XML_Scaffold_Structure_Sisu
puts "\nsisu structure, heading outline --->\n\n"
data.each_with_index do |o,i|
if (o.is ==:heading || o.is ==:heading_insert)
- puts "#{@sp*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>"
+ puts "#{spaces*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>"
end
end
end
def output(o,lev=nil,comment='')
- puts lev == 0..6 \
- ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ puts lev == (0..6) \
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
: "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
end
def structure_build_sisu(data)
@@ -131,7 +132,7 @@ module SiSU_XML_Scaffold_Structure_Sisu
data.each_with_index do |o,i|
if (o.is ==:heading || o.is ==:heading_insert)
structure_build_tag_close(o.ln,h)
- puts "#{@sp*o.ln}<#{@s[o.ln]}>\n#{@sp*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}"
+ puts "#{spaces*o.ln}<#{@s[o.ln]}>\n#{spaces*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}"
case o.ln
when 1
h=[o.ln,true,false,false]
@@ -149,37 +150,37 @@ module SiSU_XML_Scaffold_Structure_Sisu
def structure_build_tag_close(lev,h)
case h[0]
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
end
end
diff --git a/lib/sisu/v6/ao.rb b/lib/sisu/v6/ao.rb
index 6f7b1ac8..064436ae 100644
--- a/lib/sisu/v6/ao.rb
+++ b/lib/sisu/v6/ao.rb
@@ -505,17 +505,26 @@ module SiSU_AO
end
def song
reset
- data=@data
- data=SiSU_AO_Insertions::Insertions.new(@md,data).expand_insertions? # ao_expand_insertions.rb
- data=SiSU_AO_MiscArrangeText::SI.new(@md,data).prepare_text # ao_misc_arrange.rb
- data,metadata=SiSU_AO_DocumentStructureExtract::Build.new(@md,data).identify_parts # ao_doc_str.rb
- data=SiSU_AO_Syntax::Markup.new(@md,data).songsheet # ao_syntax.rb
- data,endnote_array=SiSU_AO_CharacterCheck::Check.new(data).character_check_and_oldstyle_endnote_array # ao_character_check.rb
- data=SiSU_AO_Images::Images.new(@md,data).images # ao_images.rb
- data,tags_map,ocn_html_seg_map=SiSU_AO_Numbering::Numbering.new(@md,data).numbering_song # ao_numbering.rb
- data,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=SiSU_AO_BookIndex::BookIndex.new(@md,data,@env).indexing_song if @md.book_idx # ao_idx.rb
- data=SiSU_AO_Endnotes::Endnotes.new(@md,data,endnote_array).endnotes # ao_endnotes.rb
- outputdata=data
+ data_txt=@data
+ data_txt=
+ SiSU_AO_Insertions::Insertions.new(@md,data_txt).expand_insertions? # ao_expand_insertions.rb
+ data_txt=
+ SiSU_AO_MiscArrangeText::SI.new(@md,data_txt).prepare_text # ao_misc_arrange.rb
+ data_obj,metadata=
+ SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt).identify_parts # ao_doc_str.rb
+ data_obj=
+ SiSU_AO_Syntax::Markup.new(@md,data_obj).songsheet # ao_syntax.rb
+ data_obj,endnote_array=
+ SiSU_AO_CharacterCheck::Check.new(data_obj).character_check_and_oldstyle_endnote_array # ao_character_check.rb
+ data_obj=
+ SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb
+ data_obj,tags_map,ocn_html_seg_map=
+ SiSU_AO_Numbering::Numbering.new(@md,data_obj).numbering_song # ao_numbering.rb
+ data_obj,book_index_rel,book_index_rel_html_seg,html_idx,xhtml_idx=
+ SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env).indexing_song if @md.book_idx # ao_idx.rb
+ data_obj=
+ SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array).endnotes # ao_endnotes.rb
+ outputdata=data_obj
if (@md.opt.act[:ao][:set]==:on \
|| @md.opt.act[:maintenance][:set]==:on)
SiSU_AO::Output.new(@fn,@md,outputdata).hard_output
diff --git a/lib/sisu/v6/ao_doc_objects.rb b/lib/sisu/v6/ao_doc_objects.rb
index 9555ab5e..ee229200 100644
--- a/lib/sisu/v6/ao_doc_objects.rb
+++ b/lib/sisu/v6/ao_doc_objects.rb
@@ -74,8 +74,8 @@ module SiSU_AO_DocumentStructure
@of=:meta
end
def metadata(tags)
- of= @of #String, classification - group
- is= :meta #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :meta #Symbol, classification - specific type
tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag
obj= nil
@of,@is,@tags,@obj=of,is,tags,obj
@@ -89,8 +89,8 @@ module SiSU_AO_DocumentStructure
@of=:meta
end
def metadata(h,o=nil)
- of= @of #String, classification - group
- is= :meta #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :meta #Symbol, classification - specific type
tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@@ -142,8 +142,8 @@ module SiSU_AO_DocumentStructure
and (h[:ln] and h[:ln].to_s=~/[0-9]/)
h[:lv]=heading_lv(h[:ln])
end
- of= @of #String, classification - group
- is= :heading #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :heading #Symbol, classification - specific type
name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
@@ -184,15 +184,15 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectPara
- attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
+ attr_accessor :obj,:is,:tags,:of,:name,:idx,:quote_,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp
def initialize
@of=:para
- @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
+ @is=@obj=@name=@idx=@quote_=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil
@tags=[]
end
def paragraph(h,o=nil)
- of= @of #String, classification - group
- is= :para #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :para #Symbol, classification - specific type
name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object?
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
@@ -204,6 +204,7 @@ module SiSU_AO_DocumentStructure
indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level
hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level
bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted?
+ quote_= h[:quote_] || ((defined? o.quote_) ? o.quote_ : false) #Bool, quote (blockquote)?
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization)
ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
@@ -211,7 +212,7 @@ module SiSU_AO_DocumentStructure
end
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
+ @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@quote_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,quote_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp
self
end
def docinfo(h,o=nil)
@@ -240,17 +241,18 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectBlockTxt
- attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
+ attr_accessor :obj,:is,:of,:tags,:lngsyn,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp
def initialize
@of=:block
- @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
+ @is=@obj=@lngsyn=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil
@tags=[]
end
def code(h,o=nil)
- of= @of #String, classification - group #alt 'code'
- is= :code #String, classification - specific type
+ of= @of #Symbol, classification - group #alt 'code'
+ is= :code #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ lngsyn= h[:lngsyn] || ((defined? o.lngsyn) ? o.lngsyn : :txt) #symbol, code lngsyn
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
@@ -264,12 +266,32 @@ module SiSU_AO_DocumentStructure
num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp
+ @of,@is,@tags,@obj,@lngsyn,@idx,@ocn,@odv,@osp,@parent,@number_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,lngsyn,idx,ocn,odv,osp,parent,number_,note_,ocn_,num,digest,tmp
+ self
+ end
+ def box(h,o=nil)
+ of= @of #Symbol, classification - group
+ is= :box #Symbol, classification - specific type
+ tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
+ ocn= h[:ocn] || ((defined? o.ocn) ? o.ocn : nil) #Integer, sequential on substantive-content objects
+ odv= h[:odv] || ((defined? o.odv) ? o.odv : nil)
+ osp= h[:osp] || ((defined? o.osp) ? o.osp : nil)
+ parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent]
+ note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
+ ocn_= if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
+ else h[:ocn_]
+ end
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
+ digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@tags,@obj,@idx,@ocn,@odv,@osp,@parent,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,obj,idx,ocn,odv,osp,parent,note_,ocn_,num,digest,tmp
self
end
def block(h,o=nil)
- of= @of #String, classification - group
- is= :block #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :block #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -288,8 +310,8 @@ module SiSU_AO_DocumentStructure
self
end
def group(h,o=nil)
- of= @of #String, classification - group
- is= :group #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :group #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -308,8 +330,8 @@ module SiSU_AO_DocumentStructure
self
end
def alt(h,o=nil) #see block
- of= @of #String, classification - group
- is= :alt #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :alt #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -328,8 +350,8 @@ module SiSU_AO_DocumentStructure
self
end
def verse(h,o=nil) #part of poem decide how you deal with this
- of= @of #String, classification - group
- is= :verse #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :verse #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided?
@@ -349,15 +371,15 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectTable
- attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
+ attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:num,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp
def initialize
@of=:block
- @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
+ @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@num,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@num=@digest=@tmp=nil
@tags=[]
end
def table(h,o=nil)
- of= @of #String, classification - group
- is= :table #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :table #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
cols= h[:cols] || ((defined? o.cols) ? o.cols : nil)
widths= h[:widths] || ((defined? o.widths) ? o.widths : nil)
@@ -370,9 +392,9 @@ module SiSU_AO_DocumentStructure
head_= h[:head_] || ((defined? o.head_) ? o.head_ : false)
note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization)
ocn_=if h[:ocn_].nil? then ((defined? o.ocn_) ? o.ocn_ : true) #Bool? no ocn, non-substantive content, do not include in toc #consider
- else h[:ocn_]
+ else h[:ocn_]
end
- num= h[:num] || ((defined? o.num) ? o.num : nil)
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, sha512, sha256 or md5
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@tags,@cols,@widths,@obj,@idx,@ocn,@odv,@osp,@parent,@head_,@note_,@ocn_,@num,@digest,@tmp=of,is,tags,cols,widths,obj,idx,ocn,odv,osp,parent,head_,note_,ocn_,num,digest,tmp
@@ -387,8 +409,8 @@ module SiSU_AO_DocumentStructure
@tags=[]
end
def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider
- of= @of #String, classification - group
- is= :image #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :image #Symbol, classification - specific type
tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
size= h[:size] || ((defined? o.size) ? o.size : nil)
@@ -414,34 +436,19 @@ module SiSU_AO_DocumentStructure
@is=@obj=@node=@lv=@ln=@lc=@status=@tmp=nil
end
def xml_dom(h,o=nil)
- of= @of #String, classification - group
- is= :xml_dom #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :xml_dom #Symbol, classification - specific type
obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content
lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-D then 1-6
ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9
lc= h[:lc] || ((defined? o.lc) ? o.lc : nil) #Integer, document structure collapsed level, convenience (collapse sisu's dual level document structure for markup with simple linear structure)
node= h[:node] || ((defined? o.node) ? o.node : nil) #[Node relationship doc structure info]
- status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status open or close
+ status= h[:status] || ((defined? o.status) ? o.status : nil) #tag status Symbol :open or :close
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@status,@node,@lv,@ln,@lc,@tmp=of,is,obj,status,node,lv,ln,lc,tmp
self
end
end
- class ObjectComment
- attr_accessor :obj,:is,:of,:tmp
- def initialize
- @of=:comment
- @is=@obj=@tmp=nil
- end
- def comment(h,o=nil)
- of= @of #String, classification - group
- is= :comment #String, classification - specific type
- obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
- tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
- @of,@is,@obj,@tmp=of,is,obj,tmp
- self
- end
- end
class ObjectFlag
attr_accessor :obj,:is,:of,:flag,:mod,:tmp
def initialize
@@ -449,8 +456,8 @@ module SiSU_AO_DocumentStructure
@is=@obj=@flag=@mod=@tmp=nil
end
def flag(h,o=nil)
- of= @of #String, classification - group
- is= :flag #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :flag #Symbol, classification - specific type
obj= nil #String, text content
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content
@@ -459,8 +466,8 @@ module SiSU_AO_DocumentStructure
self
end
def flag_ocn(h,o=nil)
- of= @of #String, classification - group
- is= :flag_ocn #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :flag_ocn #Symbol, classification - specific type
obj= nil #String, text content
flag= h[:flag] || ((defined? o.flag) ? o.flag : nil) #String, text content
mod= h[:mod] || ((defined? o.mod) ? o.mod : nil) #String, text content
@@ -470,14 +477,14 @@ module SiSU_AO_DocumentStructure
end
end
class ObjectLayout
- attr_accessor :obj,:is,:of,:from,:tmp
+ attr_accessor :obj,:sym,:attr,:is,:of,:from,:tmp,:num
def initialize
@of=:layout
- @is=@obj=@from=@tmp=nil
+ @is=@obj=@from=@tmp=@num=nil
end
def break(h,f=nil) #decide how to deal with
- of= @of #String, classification - group
- is= :break #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :break #Symbol, classification - specific type
obj= h[:obj] #String, text content
from= f
tmp= h[:tmp] #available for processing, empty after use
@@ -485,8 +492,34 @@ module SiSU_AO_DocumentStructure
self
end
def insert(h,o=nil) #decide how to deal with, could mimic paragraph?
- of= @of #String, classification - group
- is= :insert #String, classification - specific type
+ of= @of #Symbol, classification - group
+ is= :insert #Symbol, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ @of,@is,@obj,@tmp=of,is,obj,tmp
+ self
+ end
+ def open_close(h,o=nil) #useful for poem & quote
+ of= @of #Symbol, classification - group
+ is= :open_close_tags #Symbol, classification - specific type
+ obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
+ sym= h[:sym] || ((defined? o.sym) ? o.sym : nil) #Symbol tag_open, tag_close
+ attr= h[:attr] || ((defined? o.attr) ? o.attr : nil) #String, text content
+ tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
+ num= h[:num] || ((defined? o.num) ? o.num : nil)
+ @of,@is,@obj,@sym,@attr,@tmp,@num=of,is,obj,sym,attr,tmp,num
+ self
+ end
+ end
+ class ObjectComment
+ attr_accessor :obj,:is,:of,:tmp
+ def initialize
+ @of=:comment
+ @is=@obj=@tmp=nil
+ end
+ def comment(h,o=nil)
+ of= @of #Symbol, classification - group
+ is= :comment #Symbol, classification - specific type
obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content
tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use
@of,@is,@obj,@tmp=of,is,obj,tmp
diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb
index d060d89c..7f2815d8 100644
--- a/lib/sisu/v6/ao_doc_str.rb
+++ b/lib/sisu/v6/ao_doc_str.rb
@@ -63,14 +63,17 @@
module SiSU_AO_DocumentStructureExtract
class Instantiate < SiSU_Param::Parameters::Instructions
@@flag={
- ocn: :on,
- code: :off,
- poem: :off,
- block: :off,
- group: :off,
- alt: :off,
- table: :off,
- table_to: :off,
+ ocn: :on,
+ code: :off,
+ lngsyn: :txt,
+ poem: :off,
+ block: :off,
+ box: :off,
+ group: :off,
+ alt: :off,
+ quote: :off,
+ table: :off,
+ table_to: :off,
}
def initialize
@@counter=@@column=@@columns=0
@@ -79,14 +82,17 @@ module SiSU_AO_DocumentStructureExtract
end
class Build
@@flag={
- ocn: :on,
- code: :off,
- poem: :off,
- block: :off,
- group: :off,
- alt: :off,
- table: :off,
- table_to: :off,
+ ocn: :on,
+ code: :off,
+ lngsyn: :txt,
+ poem: :off,
+ block: :off,
+ box: :off,
+ group: :off,
+ alt: :off,
+ quote: :off,
+ table: :off,
+ table_to: :off,
}
def initialize(md,data)
@md,@data=md,data
@@ -119,6 +125,11 @@ module SiSU_AO_DocumentStructureExtract
? true
: false
end
+ def quotes?
+ @@flag[:quote]==:open \
+ ? true
+ : false
+ end
def hang_and_indent_test(str)
hang_indent=if str=~/^_([1-9])[^_]/
[$1,$1]
@@ -225,7 +236,16 @@ module SiSU_AO_DocumentStructureExtract
def identify_parts
tuned_file=[]
@tuned_block,@tuned_code=[],[]
- @@counter,@verse_count,@num_code_block,@num_poem,@num_group,@num_block,@num_alt,@num_table=0,0,0,0,0,0,0,0
+ @@counter,@verse_count=0,0
+ @num_id={
+ code_block: 0,
+ poem: 0,
+ box: 0,
+ group: 0,
+ alt: 0,
+ quote: 0,
+ table: 0,
+ }
@metadata={}
@data.each do |t_o|
if t_o =~/^--([+~-])[#]$/
@@ -247,13 +267,14 @@ module SiSU_AO_DocumentStructureExtract
next
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
- if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block|table)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
+ if t_o !~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
+ and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$|^`:quote_(?:open|close)`/ \
and @@flag[:code]==:off \
and @@flag[:poem]==:off \
and @@flag[:group]==:off \
and @@flag[:block]==:off \
and @@flag[:alt]==:off \
+ and @@flag[:box]==:off \
and @@flag[:table]==:off
unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
@@ -357,7 +378,7 @@ module SiSU_AO_DocumentStructureExtract
obj << ' ~#'
end
end
- h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? }
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
else nil
@@ -380,7 +401,7 @@ module SiSU_AO_DocumentStructureExtract
obj << ' ~#'
end
end
- h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? }
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
else nil
@@ -404,67 +425,93 @@ module SiSU_AO_DocumentStructureExtract
end
end
unless obj=~/\A\s*\Z/m
- h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags }
+ h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? }
SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
end
elsif @@flag[:code]==:off
- if t_o =~/^(?:code\{|[`]{3}\s+code)/
+ if t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
@@flag[:code]=case t_o
- when /^code\{/ then :curls
- when /^[`]{3}\s+code/ then :tics
- else @@flag[:code] #error
+ when /^code(?:\.[a-z][0-9a-z_]+)?\{/ then :curls
+ when /^```[ ]+code/ then :tics
+ else @@flag[:code] #error
+ end
+ @@flag[:lngsyn]=if t_o =~/^(?:code\.[a-z][0-9a-z_]+\{|```[ ]+code\.[a-z_]+)/
+ case t_o
+ when /^code\.([a-z][0-9a-z_]+)\{/
+ :"#{$1}"
+ when /^```[ ]+code\.([a-z][0-9a-z_]+)/
+ :"#{$1}"
+ else :txt
+ end
+ else :txt
end
@@counter=1
- @codeblock_numbered=(t_o =~/^(?:code\{#|[`]{3}\s+code\s[#])/) ? true : false
- @num_code_block +=1
- h={ obj: "code block start #{@num_code_block}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
- elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/
+ @codeblock_numbered=(t_o =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{#|```[ ]+code(?:\.[a-z][0-9a-z_]+)?\s[#])/) ? true : false
+ @num_id[:code_block] +=1
+ h={ obj: '', sym: :code_block_open, num: @num_id[:code_block], syntax: @@flag[:lngsyn] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif t_o =~/^(?:poem\{|```[ ]+poem)/
@@flag[:poem]=case t_o
- when /^poem\{/ then :curls
- when /^[`]{3}\s+poem/ then :tics
- else @@flag[:poem] #error
+ when /^poem\{/ then :curls
+ when /^```[ ]+poem/ then :tics
+ else @@flag[:poem] #error
end
- @num_poem +=1
- h={ obj: "poem start #{@num_poem}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ @num_id[:poem] +=1
+ h={ obj: '', sym: :poem_open, num: @num_id[:poem] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
- elsif t_o =~/^(?:group\{|[`]{3}\s+group)/
+ elsif t_o =~/^(?:box(?:\.[a-z_]+)?\{|```[ ]+box(?:\.[a-z_]+)?)/
+ @@flag[:box]=case t_o
+ when /^box\{/ then :curls
+ when /^```[ ]+box/ then :tics
+ else @@flag[:box] #error
+ end
+ @num_id[:box] +=1
+ h={ obj: '', sym: :box_open, num: @num_id[:box] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ tuned_file << t_o
+ elsif t_o =~/^(?:group\{|```[ ]+group)/
@@flag[:group]=case t_o
- when /^group\{/ then :curls
- when /^[`]{3}\s+group/ then :tics
- else @@flag[:group] #error
+ when /^group\{/ then :curls
+ when /^```[ ]+group/ then :tics
+ else @@flag[:group] #error
end
- @num_group +=1
- h={ obj: "group text start #{@num_group}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ @num_id[:group] +=1
+ h={ obj: '', sym: :group_open, num: @num_id[:group] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
- elsif t_o =~/^(?:block\{|[`]{3}\s+block)/
+ elsif t_o =~/^(?:block\{|```[ ]+block)/
@@flag[:block]=case t_o
- when /^block\{/ then :curls
- when /^[`]{3}\s+block/ then :tics
- else @@flag[:block] #error
+ when /^block\{/ then :curls
+ when /^```[ ]+block/ then :tics
+ else @@flag[:block] #error
end
- @num_block +=1
- h={ obj: "block text start #{@num_block}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ @num_id[:block] +=1
+ h={ obj: '', sym: :block_open, num: @num_id[:block] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
- elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/
+ elsif t_o =~/^(?:alt\{|```[ ]+alt)/
@@flag[:alt]=case t_o
when /^alt\{/ then :curls
- when /^[`]{3}\s+alt/ then :tics
+ when /^```[ ]+alt/ then :tics
else @@flag[:alt] #error
end
- @num_alt +=1
- h={ obj: "alt text start #{@num_alt}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ @num_id[:alt] +=1
+ h={ obj: '', sym: :alt_open, num: @num_id[:alt] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
tuned_file << t_o
- elsif t_o =~/^(?:table\{|[`]{3}\s+table|\{table)[ ~]/
- @num_table +=1
- h={ obj: "table start #{@num_table}" }
- ins=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
- tuned_file << ins
+ elsif t_o =~/^`:quote_open`/
+ @@flag[:quote]=:open
+ @num_id[:quote] +=1
+ h={ obj: '', sym: :quote_open, num: @num_id[:quote] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ #tuned_file << t_o #% find second source, entered twice, should be once so closed off here
+ elsif t_o =~/^(?:table\{|```[ ]+table|\{table)[ ~]/
+ @num_id[:table] +=1
+ h={ obj: '', sym: :table_open, num: @num_id[:table] }
+ ins_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ tuned_file << ins_o
if t_o=~/^table\{(?:~h)?\s+/
@@flag[:table]=:curls
@rows=''
@@ -479,15 +526,15 @@ module SiSU_AO_DocumentStructureExtract
heading=false
end
@h={ head_: heading, cols: cols, widths: col, idx: idx }
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+c\d+/
+ elsif t_o=~/^```[ ]+table(?:~h)?\s+c\d+/
@@flag[:table]=:tics
@rows=''
case t_o
- when /^[`]{3}\s+table~h\s+c(\d+);\s+(.+)/
+ when /^```[ ]+table~h\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=true
- when /^[`]{3}\s+table\s+c(\d+);\s+(.+)/
+ when /^```[ ]+table\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=false
@@ -516,18 +563,18 @@ module SiSU_AO_DocumentStructureExtract
width=100.00/cols
cols.times { col << width }
end
- h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
+ h={ head_: hd, cols: cols, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :table_close, num: @num_id[:table] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
+ elsif t_o=~/^```[ ]+table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
h=case t_o
- when /^[`]{3}\s+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ when /^```[ ]+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
m1,tbl,hd=$1,$2,true
- when /^[`]{3}\s+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ when /^```[ ]+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
m1,tbl,hd=$1,$2,false
else nil
end
@@ -539,11 +586,11 @@ module SiSU_AO_DocumentStructureExtract
r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
- h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :table_close, num: @num_id[:table] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
elsif t_o=~/^\{table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
@@ -562,11 +609,11 @@ module SiSU_AO_DocumentStructureExtract
r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
rows += r + Mx[:tc_c]
end
- h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_table }
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags, num: @num_id[:table] }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
tuned_file << t_o
- h={ obj: "table end #{@num_table}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :table_close, num: @num_id[:table] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
end
end
@@ -576,20 +623,20 @@ module SiSU_AO_DocumentStructureExtract
if (@@flag[:table]==:curls \
and t_o =~/^\}table/) \
or (@@flag[:table]==:tics \
- and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:table]=:off
headings,columns,widths,idx=@h[:head_],@h[:cols],@h[:widths],@h[:idx]
@h={ head_: headings, cols: columns, widths: widths, idx: idx, obj: @rows }
t_o=SiSU_AO_DocumentStructure::ObjectTable.new.table(@h)
tuned_file << t_o
@h,@rows=nil,''
- h={ obj: "table end #{@num_table}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :table_close, num: @num_id[:table] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
t_o
else
if t_o.is_a?(String) \
- and t_o !~/^(?:table\{|[`]{3}\s+table)/
- t_o=t_o.gsub(/^\n+/m,''). #check added for ruby 1.9.2 not needed in 1.8 series (tested in v2)
+ and t_o !~/^(?:table\{|```[ ]+table)/
+ t_o=t_o.gsub(/^\n+/m,'').
gsub(/\n+/m,"#{Mx[:tc_p]}")
@rows += t_o + Mx[:tc_c]
end
@@ -598,16 +645,18 @@ module SiSU_AO_DocumentStructureExtract
end
if @@flag[:code]==:curls or @@flag[:code]==:tics
if (@@flag[:code]==:curls and t_o =~/^\}code/) \
- or (@@flag[:code]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:code]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:code]=:off
+ @tuned_code[-1].gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*\Z/m,'')
obj=@tuned_code.join("\n")
tags=[]
- h={ obj: obj, tags: tags, num: @num_code_block, number_: @codeblock_numbered }
+ h={ obj: obj, syntax: @@flag[:lngsyn], tags: tags, num: @num_id[:code_block], number_: @codeblock_numbered }
+ @@flag[:lngsyn]=:txt
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.code(h)
@tuned_code=[]
tuned_file << t_o
- h={ obj: "code block end #{@num_code_block}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :code_close, num: @num_id[:code_block] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
end
if (@@flag[:code]==:curls or @@flag[:code]==:tics) \
and t_o.is_a?(String)
@@ -619,51 +668,71 @@ module SiSU_AO_DocumentStructureExtract
t_o=nil
end
elsif (@@flag[:poem]==:curls or @@flag[:poem]==:tics) \
+ or (@@flag[:box]==:curls or @@flag[:box]==:tics) \
or (@@flag[:group]==:curls or @@flag[:group]==:tics) \
or (@@flag[:block]==:curls or @@flag[:block]==:tics) \
- or (@@flag[:alt]==:curls or @@flag[:alt]==:tics)
+ or (@@flag[:alt]==:curls or @@flag[:alt]==:tics) \
+ or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m) #not
if (@@flag[:poem]==:curls and t_o =~/^\}poem/) \
- or (@@flag[:poem]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:poem]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:poem]=:off
- h={ obj: "poem end #{@num_poem}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :poem_close, num: @num_id[:poem] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif (@@flag[:box]==:curls and t_o =~/^\}box/) \
+ or (@@flag[:box]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ @@flag[:box]=:off
+ obj,tags=extract_tags(@tuned_block.join("\n"))
+ h={ obj: obj, tags: tags, num: @num_id[:box] }
+ @tuned_block=[]
+ t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.box(h)
+ tuned_file << t_o
+ h={ obj: '', sym: :box_close, num: @num_id[:box] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif (@@flag[:group]==:curls and t_o =~/^\}group/) \
- or (@@flag[:group]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:group]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:group]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_group }
+ h={ obj: obj, tags: tags, num: @num_id[:group] }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.group(h)
tuned_file << t_o
- h={ obj: "group text end #{@num_group}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :group_close, num: @num_id[:group] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif (@@flag[:block]==:curls and t_o =~/^\}block/) \
- or (@@flag[:block]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:block]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:block]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_block }
+ h={ obj: obj, tags: tags, num: @num_id[:block] }
@tuned_block=[]
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.block(h)
tuned_file << t_o
- h={ obj: "block text end #{@num_block}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :block_close, num: @num_id[:block] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
elsif (@@flag[:alt]==:curls and t_o =~/^\}alt/) \
- or (@@flag[:alt]==:tics and t_o =~/^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
+ or (@@flag[:alt]==:tics and t_o =~/^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/)
@@flag[:alt]=:off
obj,tags=extract_tags(@tuned_block.join("\n"))
- h={ obj: obj, tags: tags, num: @num_alt }
+ h={ obj: obj, tags: tags, num: @num_id[:alt] }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.alt(h)
@tuned_block=[]
tuned_file << t_o
- h={ obj: "alt text end #{@num_alt}" }
- t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
+ h={ obj: '', sym: :alt_close, num: @num_id[:alt] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif @@flag[:quote]==:open and t_o =~/`:quote_close`/m
+ @@flag[:quote]=:off
+ h={ obj: '', sym: :quote_close, num: @num_id[:quote] }
+ t_o=SiSU_AO_DocumentStructure::ObjectLayout.new.open_close(h)
+ elsif @@flag[:quote]==:open
+ t_o,tags=extract_tags(t_o)
+ h={ indent: 1, obj: t_o, idx: idx, note_: note, image_: image, tags: tags, quote: quotes? }
+ SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
if (@@flag[:poem]==:curls or @@flag[:poem]==:tics \
or @@flag[:group]==:curls or @@flag[:group]==:tics \
or @@flag[:alt]==:curls or @@flag[:alt]==:tics) \
and t_o =~/\S/ \
- and t_o !~/^(?:\}(?:verse|code|alt|group|block)|(?:verse|code|alt|group|block)\{)/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
+ and t_o !~/^(?:\}(?:verse|code|box|alt|group|block)|(?:verse|code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|alt|group|block)\{)/ \
+ and t_o !~/^```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block)|^```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ # fix logic
sub_array=t_o.dup
@line_mode=sub_array.scan(/.+/)
type=if @@flag[:poem]==:curls or @@flag[:poem]==:tics
@@ -672,7 +741,7 @@ module SiSU_AO_DocumentStructureExtract
poem.each do |v|
v=v.gsub(/\n/m,"#{Mx[:br_nl]}\n")
obj,tags=extract_tags(v)
- h={ obj: obj, tags: tags, num: @num_poem }
+ h={ obj: obj, tags: tags, num: @num_id[:poem] }
t_o=SiSU_AO_DocumentStructure::ObjectBlockTxt.new.verse(h)
tuned_file << t_o
end
@@ -684,8 +753,10 @@ module SiSU_AO_DocumentStructureExtract
end
if @@flag[:code]==:off
if @@flag[:poem]==:curls or @@flag[:poem]==:tics \
+ or @@flag[:box]==:curls or @@flag[:box]==:tics \
or @@flag[:group]==:curls or @@flag[:group]==:tics \
- or @@flag[:alt]==:curls or @@flag[:alt]==:tics
+ or @@flag[:alt]==:curls or @@flag[:alt]==:tics \
+ or (@@flag[:quote]==:open and t_o =~/`:quote_close`/m)
if t_o.is_a?(String)
t_o=t_o.gsub(/\n/m,"#{Mx[:br_nl]}").
gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
@@ -694,6 +765,7 @@ module SiSU_AO_DocumentStructureExtract
elsif t_o.is==:group \
|| t_o.is==:block \
|| t_o.is==:alt \
+ || t_o.is==:box \
|| t_o.is==:verse
t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}").
gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}").
@@ -750,8 +822,8 @@ module SiSU_AO_DocumentStructureExtract
lines,lines_new=@data,[]
lines.each do |line|
line=if line =~/\S/ \
- and line !~/^(?:code\{|\}code)/ \
- and line !~/^(?:[`]{3}\s+code|[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
+ and line !~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|\}code)/ \
+ and line !~/^(?:```[ ]+code(?:\.[a-z][0-9a-z_]+)?|```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$)/ \
and not line.is_a?(Hash) #watch
@@counter+=1 if @@flag[:code]==:curls or @@flag[:code]==:tics
line=line.gsub(/\s\s/,"#{Mx[:nbsp]*2}").
@@ -1182,6 +1254,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
ocnc+=1
ocn_sp,parent="c#{ocnc}",node
elsif dob.is==:group \
+ || dob.is==:box \
|| dob.is==:block \
|| dob.is==:alt \
|| dob.is==:verse
@@ -1229,9 +1302,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
if dob.is==:code \
|| dob.is==:verse \
|| dob.is==:alt \
+ || dob.is==:box \
|| dob.is==:group \
|| dob.is==:block
- dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out
+ dob.obj=dob.obj.gsub(/\n+/,"\n") #newlines taken out
end
@o_array << dob
end
@@ -1255,24 +1329,18 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
@data,@md=data,md
end
def dom
- @s=[
- 'A',
- 'B',
- 'C',
- 'D',
- '1',
- '2',
- '3'
- ]
- @sp=' '
+ @s=[ 'A', 'B', 'C', 'D', '1', '2', '3' ]
tuned_file=structure_build
tuned_file
end
+ def spaces
+ Ax[:spaces]
+ end
def structure_build
data=@data
tuned_file=[]
hs=[0,false,false,false]
- t={ lv: @s[0], status: 'open' }
+ t={ lv: @s[0], status: :open }
tuned_file << tags(t)
if @md.opt.act[:verbose_plus][:set]==:on
puts "\nXML sisu structure outline --->\n"
@@ -1349,7 +1417,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
tuned_file=tuned_file.flatten
end
def tags(o)
- tag=(o[:status]=='open') \
+ tag=(o[:status]==:open) \
? %{<#{o[:lv]} id="#{o[:node]}">}
: "</#{o[:lv]}>"
ln=case o[:lv]
@@ -1368,7 +1436,7 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments
end
def tag_open(o,tag)
- t={ lv: tag[o.ln], node: o.node, status: 'open' }
+ t={ lv: tag[o.ln], node: o.node, status: :open }
t_o=tags(t)
t_o
end
@@ -1377,166 +1445,166 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"}
case hs[0]
when 0
if (lev <= 0) and hs[0]
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 1
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 2
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 3
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 4
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 5
if (lev <= 5)
- t={ lv: @s[5], status: 'close' }
+ t={ lv: @s[5], status: :close }
ary << tags(t)
end
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
when 6
if (lev <= 6)
- t={ lv: @s[6], status: 'close' }
+ t={ lv: @s[6], status: :close }
ary << tags(t)
end
if (lev <= 5)
- t={ lv: @s[5], status: 'close' }
+ t={ lv: @s[5], status: :close }
ary << tags(t)
end
if (lev <= 4)
- t={ lv: @s[4], status: 'close' }
+ t={ lv: @s[4], status: :close }
ary << tags(t)
end
if (lev <= 3) and hs[3]
- t={ lv: @s[3], status: 'close' }
+ t={ lv: @s[3], status: :close }
ary << tags(t)
end
if (lev <= 2) and hs[2]
- t={ lv: @s[2], status: 'close' }
+ t={ lv: @s[2], status: :close }
ary << tags(t)
end
if (lev <= 1) and hs[1]
- t={ lv: @s[1], status: 'close' }
+ t={ lv: @s[1], status: :close }
ary << tags(t)
end
if (lev==0)
- t={ lv: @s[0], status: 'close' }
+ t={ lv: @s[0], status: :close }
ary << tags(t)
end
end
ary
end
def puts_tag_open(o,tag)
- puts %{#{@sp*o.ln}<#{tag[o.ln]} id="#{o.node}">}
+ puts %{#{spaces*o.ln}<#{tag[o.ln]} id="#{o.node}">}
end
def puts_tag_close(lev,hs)
case hs[0]
when 0
- #puts "#{@sp*0}</#{@s[0]}>" if (lev <= 0) and hs[0]
+ #puts "#{spaces*0}</#{@s[0]}>" if (lev <= 0) and hs[0]
puts "</#{@s[0]}>" if (lev==0)
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) and hs[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) and hs[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) and hs[1]
puts "</#{@s[0]}>" if (lev==0)
end
end
diff --git a/lib/sisu/v6/ao_expand_insertions.rb b/lib/sisu/v6/ao_expand_insertions.rb
index 65386c48..22e3b1ea 100644
--- a/lib/sisu/v6/ao_expand_insertions.rb
+++ b/lib/sisu/v6/ao_expand_insertions.rb
@@ -333,9 +333,9 @@ module SiSU_AO_Insertions
tuned_file,tuned_file_tmp=[],[]
codeblock_=false
data.each do |para|
- codeblock_=if para =~/^(?:code\{|[`]{3}\s+code)/
+ codeblock_=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?\{|```[ ]+code(?:\.[a-z][0-9a-z_]+)?)/
true
- elsif para =~/^(?:\}code|[`]{3}(?:\s|$))/m
+ elsif para =~/^(?:\}code|```(?:\s|$))/m
false
else codeblock_
end
diff --git a/lib/sisu/v6/ao_misc_arrange.rb b/lib/sisu/v6/ao_misc_arrange.rb
index a2cbb6c1..de32f560 100644
--- a/lib/sisu/v6/ao_misc_arrange.rb
+++ b/lib/sisu/v6/ao_misc_arrange.rb
@@ -74,25 +74,29 @@ module SiSU_AO_MiscArrangeText
end
para
end
- def code_blocks(para)
+ def markup_blocks(para)
def ticks(para)
block_open,block_close,text=nil,nil,nil
- if para =~/\A[`]{3}\s+.+?\n.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- block_open,text,block_close=/\A([`]{3}\s+.+?)\n(.+?)\n([`]{3}(\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
- ((para=~/^[`]{3}\s+table(?:~h)?\s+/) \
- and (para !~/^[`]{3}\s+table(?:~h)?\s+c\d+/)) \
+ if para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
+ @flag=:close
+ block_open,text,block_close=/\A(```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?)\n(.+?)\n(```([ ]+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
+ ((para=~/^```[ ]+table(?:~h)?\s+/) \
+ and (para !~/^```[ ]+table(?:~h)?\s+c\d+/)) \
? para
: (para=[]; para << block_open << text << block_close)
- elsif para =~/\A[`]{3}\s+.+?\n.*?\Z/m #look at, study
- block_open,text=/\A([`]{3}(?:\s+.+?))\n(.*?)\Z/m.match(para)[1,2]
+ elsif para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.*?\Z/m #look at, study
+ @flag=:open
+ block_open,text=/\A(```(?:[ ]+.+?))\n(.*?)\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << block_open << text
else
para << block_open
end
- elsif para =~/\A.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
- text,block_close=/\A(.+?)\n([`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
+ elsif para =~/\A.+?\n```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m \
+ and @flag==:open
+ @flag=:close
+ text,block_close=/\A(.+?)\n(```(?:\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << text.to_s << block_close
@@ -103,22 +107,46 @@ module SiSU_AO_MiscArrangeText
end
para
end
+ def ticks_remove(para)
+ unless @md.opt.act[:quiet][:set] ==:on
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).mark("ticks not recognized, ticks removed from pargraph\n#{para}")
+ end
+ para=para.gsub(/```[ ]+\S+[ ]*/m,'').
+ gsub(/```\s*/m,'').
+ strip
+ end
+ def ticks_quote(para)
+ @flag=:quote_open
+ text=para
+ para=[]
+ if text =~ /```[ ]+quote/m
+ para << '`:quote_open`'
+ text=text.gsub(/```[ ]+quote/m,'')
+ end
+ text=text.gsub(/(?:\n|\A)([^`=\n]+)/m,'_1 \1') #not a perfect match for book index \n={
+ para << text.gsub(/```/m,'')
+ if text =~/```/m
+ @flag=:quote_close
+ para << '`:quote_close`'
+ end
+ para
+ end
def curly_braces(para)
block_open,block_close,text=nil,nil,nil
- para=if para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
- block_open,text,block_close=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3]
+ para=if para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
+ block_open,text,block_close=/\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1..3]
para=[]
para << block_open << text << block_close
- elsif para =~/\A(?:code|poem|alt|group|block|table)\{ .+?\n.+?\Z/m
- block_open,text=/\A((?:code|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2]
+ elsif para =~/\A(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?\n.+?\Z/m
+ block_open,text=/\A((?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{ .+?)\n(.+?)\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << block_open << text
else
para << block_open
end
- elsif para =~/\A.+?\n\}(?:code|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
- text,block_close=/\A(.+?)\n(\}(?:code|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2]
+ elsif para =~/\A.+?\n\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?\s*\Z/m
+ text,block_close=/\A(.+?)\n(\}(?:code|box|poem|alt|group|block|table)(?: [~-][#])?)\s*\Z/m.match(para)[1,2]
para=[]
if not text.to_s.empty?
para << text.to_s << block_close
@@ -129,12 +157,23 @@ module SiSU_AO_MiscArrangeText
end
para
end
- para=para =~/^```/m \
- ? ticks(para)
- : para
- para=(para =~/^(?:code|poem|alt|group|block|table)\{|^\}(?:code|poem|alt|group|block|table)/m) \
- ? curly_braces(para)
- : para
+ para=if (para =~/\A```[ ]+quote/m \
+ and @flag !=:open) \
+ or @flag==:quote_open
+ ticks_quote(para)
+ elsif para =~/\A```[ ]+(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table).*?\n.*?\Z/m \
+ or @flag==:open
+ ticks(para)
+ elsif para =~/```/m
+ ticks_remove(para)
+ else
+ para
+ end
+ para=if para =~/^(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|poem|alt|group|block|table)\{|^\}(?:code|box|poem|alt|group|block|table)/m
+ curly_braces(para)
+ else
+ para
+ end
end
def prepare_text
data=@data
@@ -149,7 +188,7 @@ module SiSU_AO_MiscArrangeText
end
data.each do |para|
para=conditional_headings(para)
- data_new << code_blocks(para)
+ data_new << markup_blocks(para)
end
data_new=data_new.flatten
end
diff --git a/lib/sisu/v6/ao_numbering.rb b/lib/sisu/v6/ao_numbering.rb
index e04befb0..0dbb1a71 100644
--- a/lib/sisu/v6/ao_numbering.rb
+++ b/lib/sisu/v6/ao_numbering.rb
@@ -286,7 +286,7 @@ module SiSU_AO_Numbering
# numeric only (a number), if
# all segments have been named,
# the numbers used are over 1000 or
- # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
+ # it is not minded that auto-numbering uses a funny scheme for naming segments (not yet implemented)
# [for now a warning is printed for such documents on use of maintenance or very-verbose flag]
# auto-naming takes the form of giving numbers to segments
# the rules for which are as follows
@@ -381,13 +381,11 @@ module SiSU_AO_Numbering
: @segname
tags["#{dob.ocn}"]={ segname: @segname }
ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert)
- if dob.ln =~/[0-3]/
- { seg: nil, level: dob.ln }
- else #elsif dob.ln =~/[4-6]/
- { seg: @seg, level: dob.ln }
+ if dob.ln =~/[0-3]/ then { seg: nil, level: dob.ln }
+ #elsif dob.ln =~/[4-6]/
+ else { seg: @seg, level: dob.ln }
end
- else
- { seg: @seg, level: nil }
+ else { seg: @seg, level: nil }
end
end
dob.tags=dob.tags.uniq if defined? dob.tags
@@ -406,7 +404,8 @@ module SiSU_AO_Numbering
if ocn \
and ocn[:level].to_s=~/[1-3]/
(1..4).each do |x|
- if ocn_html_seg[i+x] and ocn_html_seg[i+x][:level]==4
+ if ocn_html_seg[i+x] \
+ and ocn_html_seg[i+x][:level]==4
ocn[:seg]=ocn_html_seg[i+x][:seg]
end
end
diff --git a/lib/sisu/v6/ao_syntax.rb b/lib/sisu/v6/ao_syntax.rb
index 8a13e406..68720aca 100644
--- a/lib/sisu/v6/ao_syntax.rb
+++ b/lib/sisu/v6/ao_syntax.rb
@@ -91,7 +91,7 @@ module SiSU_AO_Syntax
{ o: Mx[:fa_underscore_o], c: Mx[:fa_underscore_c] }
else p __LINE__.to_s + '::' + __FILE__
end
- @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
+ @http_m=%r{\{.+?\}https?://\S+|https?:\S+|:\S+|\.\.\/\S+|#\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code(?:\.[a-z][0-9a-z_]+)?|box(?:\.[a-z_]+)?|block|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}}
@manmkp_ital=emph_italics \
? '[i/*]\\{.+?\\}[i/*]'
: '[i/]\\{.+?\\}[i/]'
@@ -163,6 +163,7 @@ module SiSU_AO_Syntax
&& dob.is !=:heading \
&& dob.is !=:heading_insert \
&& dob.is !=:code \
+ && dob.is !=:layout \
&& dob.is !=:comment
word=dob.obj.scan(@line_scan_ital)
word=word.flatten.compact
diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb
index be60431e..43fff554 100644
--- a/lib/sisu/v6/constants.rb
+++ b/lib/sisu/v6/constants.rb
@@ -92,9 +92,12 @@ Sfx={
}
Ax={
tab: "\t",
+ comment: '%',
+ spaces: ' ',
}
Xx={
protect: '☞',
+ split: '✠',
segment: 'Ф',
relative_path: '☼',
html_relative2: '※※',
@@ -348,7 +351,7 @@ check:
·
¤
- #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ㈣
+ #˝ " λ Ω β α π Ѫ Ж Я Ѳ ѳ Ф ✠ ㈣
Ѳ ѳ Ф
♩ ♭  ✠  ▭ ▬ ▪
【】〖〗◢ ◣ ◀ ▶ ◘ ◙
diff --git a/lib/sisu/v6/digests.rb b/lib/sisu/v6/digests.rb
index 24ddc32e..7e5e42ab 100644
--- a/lib/sisu/v6/digests.rb
+++ b/lib/sisu/v6/digests.rb
@@ -134,6 +134,9 @@ module SiSU_DigestView
supplementary
output
end
+ def spaces
+ Ax[:spaces]
+ end
def description(f,e='')
puts f + e.to_s if @md.opt.act[:verbose_plus][:set]==:on
@@description << f << e
@@ -234,19 +237,19 @@ module SiSU_DigestView
if t_o.is==:heading
x=case t_o.ln
when 0 then l[0] +=1
- ' '*0 << ':A'
+ spaces*0 << ':A'
when 1 then l[1] +=1
- ' '*1 << ':B'
+ spaces*1 << ':B'
when 2 then l[2] +=1
- ' '*2 << ':C'
+ spaces*2 << ':C'
when 3 then l[3] +=1
- ' '*3 << ':D'
+ spaces*3 << ':D'
when 4 then l[4] +=1
- ' '*4 << '1'
+ spaces*4 << '1'
when 5 then l[5] +=1
- ' '*5 << '2'
+ spaces*5 << '2'
when 6 then l[6] +=1
- ' '*6 << '3'
+ spaces*6 << '3'
else nil
end
end
diff --git a/lib/sisu/v6/harvest_topics.rb b/lib/sisu/v6/harvest_topics.rb
index ce6e13c2..c682bd37 100644
--- a/lib/sisu/v6/harvest_topics.rb
+++ b/lib/sisu/v6/harvest_topics.rb
@@ -97,6 +97,11 @@ module SiSU_HarvestTopics
SiSU_HarvestTopics::OutputIndex.new(@opt,the_hash).html_print.html_songsheet
end
end
+ class Mix
+ def spaces
+ Ax[:spaces]
+ end
+ end
class Harvest
def initialize(opt,env,data,filename,name,idx_array,lang)
@opt,@env,@data,@filename,@name,@idx_array,@lang=opt,env,data,filename,name,idx_array,lang
@@ -160,7 +165,7 @@ module SiSU_HarvestTopics
idx_array
end
end
- class Index
+ class Index < Mix
def initialize(opt,env,idx_array,the_idx)
@opt,@env,@idx_array,@the_idx=opt,env,idx_array,the_idx
@@the_idx_topics=@the_idx
@@ -313,7 +318,7 @@ module SiSU_HarvestTopics
else
@the_h[x0] ||={}
end
- #puts ' '*0 + x0
+ #puts spaces*0 + x0
if extract >= 1
y0.each_pair do |x1,y1|
if extract == 1
@@ -322,7 +327,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1] ||={}
end
- #puts ' '*1 + x1
+ #puts spaces*1 + x1
if extract >= 2
y1.each_pair do |x2,y2|
if extract == 2
@@ -331,7 +336,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2] ||={}
end
- #puts ' '*2 + x2
+ #puts spaces*2 + x2
if extract >= 3
y2.each_pair do |x3,y3|
if extract == 3
@@ -340,7 +345,7 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3] ||={}
end
- #puts ' '*3 + x3
+ #puts spaces*3 + x3
if extract == 4
y3.each_pair do |x4,y4|
if extract == 4
@@ -349,14 +354,14 @@ module SiSU_HarvestTopics
else
@the_h[x0][x1][x2][x3][x4] ||={}
end
- #puts ' '*4 + x4
+ #puts spaces*4 + x4
if extract == 5
y4.each_pair do |x5,y5|
if extract == 5
@the_h[x0][x1][x2][x3][x4][x5] ||={ md: [] }
@the_h[x0][x1][x2][x3][x4][x5][:md] << y5
end
- #puts ' '*5 + x5
+ #puts spaces*5 + x5
end
end
end
@@ -375,22 +380,22 @@ module SiSU_HarvestTopics
end
def traverse_base
@the_h.each_pair do |x0,y0|
- puts ' '*0 + x0 if x0.is_a?(String)
+ puts spaces*0 + x0 if x0.is_a?(String)
if y0.is_a?(Hash)
y0.each_pair do |x1,y1|
- puts ' '*1 + x1 if x1.is_a?(String)
+ puts spaces*1 + x1 if x1.is_a?(String)
if y1.is_a?(Hash)
y1.each_pair do |x2,y2|
- puts ' '*2 + x2 if x2.is_a?(String)
+ puts spaces*2 + x2 if x2.is_a?(String)
if y2.is_a?(Hash)
y2.each_pair do |x3,y3|
- puts ' '*3 + x3 if x3.is_a?(String)
+ puts spaces*3 + x3 if x3.is_a?(String)
if y3.is_a?(Hash)
y3.each_pair do |x4,y4|
- puts ' '*4 + x4 if x4.is_a?(String)
+ puts spaces*4 + x4 if x4.is_a?(String)
if y4.is_a?(Hash)
y4.each_pair do |x5,y5|
- puts ' '*5 + x5 if x5.is_a?(String)
+ puts spaces*5 + x5 if x5.is_a?(String)
end
end
end
@@ -405,37 +410,37 @@ module SiSU_HarvestTopics
end
def traverse
@the_h.each_pair do |x0,y0|
- puts ' '*0 + x0 if x0.is_a?(String)
+ puts spaces*0 + x0 if x0.is_a?(String)
if y0.is_a?(Hash)
if y0.has_key?(:md)
- y0[:md].each { |x| puts ' '*5 + x[:title] }
+ y0[:md].each { |x| puts spaces*5 + x[:title] }
end
y0.each_pair do |x1,y1|
- puts ' '*1 + x1 if x1.is_a?(String)
+ puts spaces*1 + x1 if x1.is_a?(String)
if y1.is_a?(Hash)
if y1.has_key?(:md)
- y1[:md].each { |x| puts ' '*5 + x[:title] }
+ y1[:md].each { |x| puts spaces*5 + x[:title] }
end
y1.each_pair do |x2,y2|
- puts ' '*2 + x2 if x2.is_a?(String)
+ puts spaces*2 + x2 if x2.is_a?(String)
if y2.is_a?(Hash)
if y2.has_key?(:md)
- y2[:md].each { |x| puts ' '*5 + x[:title] }
+ y2[:md].each { |x| puts spaces*5 + x[:title] }
end
y2.each_pair do |x3,y3|
- puts ' '*3 + x3 if x3.is_a?(String)
+ puts spaces*3 + x3 if x3.is_a?(String)
if y3.is_a?(Hash)
if y3.has_key?(:md)
- y3[:md].each { |x| puts ' '*5 + x[:title] }
+ y3[:md].each { |x| puts spaces*5 + x[:title] }
end
y3.each_pair do |x4,y4|
- puts ' '*4 + x4 if x4.is_a?(String)
+ puts spaces*4 + x4 if x4.is_a?(String)
if y4.is_a?(Hash)
if y4.has_key?(:md)
- y4[:md].each { |x| puts ' '*5 + x[:title] }
+ y4[:md].each { |x| puts spaces*5 + x[:title] }
end
y4.each_pair do |x5,y5|
- puts ' '*5 + x4 if x4.is_a?(String)
+ puts spaces*5 + x4 if x4.is_a?(String)
end
end
end
@@ -449,7 +454,7 @@ module SiSU_HarvestTopics
end
end
end
- class OutputIndex
+ class OutputIndex < Mix
require_relative 'i18n' # i18n.rb
def initialize(opt,the_idx)
@opt,@the_idx=opt,the_idx
@@ -509,67 +514,67 @@ module SiSU_HarvestTopics
lng=x0
if x0.is_a?(String)
#do_string_name(lng,'lev0',x0)
- #puts ' '*0 + x0
+ #puts spaces*0 + x0
end
if y0.is_a?(Hash)
if y0.has_key?(:md)
y0[:md].each do |x|
#do_hash(lng,attrib,x) #lv==0 ?
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y0.each_pair do |x1,y1|
if x1.is_a?(String)
do_string_name(lng,'lev0',x1)
- #puts ' '*1 + x1
+ #puts spaces*1 + x1
end
if y1.is_a?(Hash)
if y1.has_key?(:md)
y1[:md].each do |x|
do_hash(lng,0,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y1.each_pair do |x2,y2|
if x2.is_a?(String)
do_string(lng,'lev1',x2)
- #puts ' '*2 + x2
+ #puts spaces*2 + x2
end
if y2.is_a?(Hash)
if y2.has_key?(:md)
y2[:md].each do |x|
do_hash(lng,1,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y2.each_pair do |x3,y3|
if x3.is_a?(String)
do_string(lng,'lev2',x3)
- #puts ' '*3 + x3
+ #puts spaces*3 + x3
end
if y3.is_a?(Hash)
if y3.has_key?(:md)
y3[:md].each do |x|
do_hash(lng,2,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y3.each_pair do |x4,y4|
if x4.is_a?(String)
do_string(lng,'lev3',x4)
- #puts ' '*4 + x4
+ #puts spaces*4 + x4
end
if y4.is_a?(Hash)
if y4.has_key?(:md)
y4[:md].each do |x|
do_hash(lng,3,x)
- #puts ' '*5 + x[:title]
+ #puts spaces*5 + x[:title]
end
end
y4.each_pair do |x5,y5|
if x5.is_a?(String)
do_string(lng,'lev4',x5)
- #puts ' '*5 + x5
+ #puts spaces*5 + x5
end
end
end
diff --git a/lib/sisu/v6/qrcode.rb b/lib/sisu/v6/qrcode.rb
index 73feaf3f..a8d27ad2 100644
--- a/lib/sisu/v6/qrcode.rb
+++ b/lib/sisu/v6/qrcode.rb
@@ -124,6 +124,9 @@ module SiSU_QRcode
@brace_url=SiSU_Viz::Defaults.new.url_decoration
@f.make_path(@f.output_path.qrcode.dir)
end
+ def spaces
+ Ax[:spaces]
+ end
def output_metadata
fn=@f.base_filename.manifest_txt
mn=''
@@ -666,14 +669,13 @@ WOK
if defined? @md.topic_register_array \
and @md.topic_register_array.length > 0
@manifest[:txt] << %{#{@translate.topic_register}:\n}
-@sp=' '
@md.topic_register_array.each do |t|
t.each_with_index do |st,i|
if st.is_a?(Array)
st.each do |v|
- @manifest[:txt] << %{#{@sp*i}#{v}\n}
+ @manifest[:txt] << %{#{spaces*i}#{v}\n}
end
- else @manifest[:txt] << %{#{@sp*i}#{st}\n}
+ else @manifest[:txt] << %{#{spaces*i}#{st}\n}
end
end
end
diff --git a/lib/sisu/v6/shared_metadata.rb b/lib/sisu/v6/shared_metadata.rb
index 1fa57fa7..dae28c6c 100644
--- a/lib/sisu/v6/shared_metadata.rb
+++ b/lib/sisu/v6/shared_metadata.rb
@@ -297,6 +297,57 @@ module SiSU_Metadata
end
meta
end
+ def metadata_alt
+ meta=[]
+ if @display_heading
+ @tag,@inf=%{<b><u>Document Metadata</u></b>},''
+ meta << self.meta_para
+ end
+ if defined? @md.title.main \
+ and @md.title.main=~/\S+/
+ @tag='title'
+ @inf=@md.title.main
+ meta << self.meta_para
+ end
+ if defined? @md.title.sub \
+ and @md.title.sub=~/\S+/
+ @tag='subtitle'
+ @inf=@md.title.sub
+ meta << self.meta_para
+ end
+ if defined? @md.creator.author \
+ and @md.creator.author=~/\S+/
+ @tag='author'
+ @inf=@md.creator.author
+ meta << self.meta_para
+ end
+ if defined? @md.creator.translator \
+ and @md.creator.translator=~/\S+/
+ @tag='translator'
+ @inf=@md.creator.translator
+ meta << self.meta_para
+ end
+ if defined? @md.creator.illustrator \
+ and @md.creator.illustrator=~/\S+/
+ @tag='illustrator'
+ @inf=@md.creator.illustrator
+ meta << self.meta_para
+ end
+ if defined? @md.rights.copyright.text \
+ and @md.rights.copyright.text=~/\S+/
+ @tag='copyright'
+ @inf=@md.rights.copyright.text # year & holder
+ @inf=@inf.gsub(/(?:Copyright|\(C\))+\s*/,'')
+ meta << self.meta_para
+ end
+ if defined? @md.rights.license \
+ and @md.rights.license=~/\S+/
+ @tag='license'
+ @inf=@md.rights.license
+ meta << self.meta_para
+ end
+ meta
+ end
def processing_tags
def make
def language
@@ -756,6 +807,21 @@ module SiSU_Metadata
end
self
end
+ def xml_docbook
+ def meta_para
+ inf_xml=char_enc(@inf).utf8
+ inf_xml=char_enc(inf_xml).br
+ <<WOK
+#{Ax[:tab]}<#{@tag}>
+#{Ax[:tab]*2}#{inf_xml}
+#{Ax[:tab]}</#{@tag}>
+WOK
+ end
+ def metadata
+ SiSU_Metadata::Summary.new(@md).metadata_alt
+ end
+ self
+ end
def xml_sax
def meta_para
inf_xml=char_enc(@inf).utf8
diff --git a/lib/sisu/v6/txt_shared.rb b/lib/sisu/v6/txt_shared.rb
index 8d2a09b7..3159844f 100644
--- a/lib/sisu/v6/txt_shared.rb
+++ b/lib/sisu/v6/txt_shared.rb
@@ -62,8 +62,8 @@
=end
module SiSU_TextUtils
class Wrap
- def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil)
- @para,@n_char_max,@n_indent=para,n_char_max,n_indent
+ def initialize(para='',n_char_max=76,n_indent=0,n_hang=nil,post='')
+ @para,@n_char_max,@n_indent,@post,=para,n_char_max,n_indent,post
@n_char_max_extend = n_char_max
@n_hang=n_hang ? n_hang : @n_indent
end
@@ -110,7 +110,10 @@ module SiSU_TextUtils
end
@oldword=word if word =~/\S+/
end
- spaces_hang + out.join(spaces_indent)
+ post=(@post.empty?) \
+ ? ''
+ : "\n" + (' '*@n_indent) +@post
+ spaces_hang + out.join(spaces_indent) + post
end
def line_wrap_indent1
@n_indent,@n_hang=2,2
diff --git a/lib/sisu/v6/xml_docbook5.rb b/lib/sisu/v6/xml_docbook5.rb
index f5dba87a..b3e9e035 100644
--- a/lib/sisu/v6/xml_docbook5.rb
+++ b/lib/sisu/v6/xml_docbook5.rb
@@ -70,6 +70,7 @@ module SiSU_XML_Docbook_Book
include SiSU_TextUtils
require_relative 'xml_shared' # xml_shared.rb
include SiSU_XML_Munge
+ require_relative 'shared_metadata' # shared_metadata.rb
class Source
def initialize(opt)
@opt=opt
@@ -127,15 +128,15 @@ module SiSU_XML_Docbook_Book
structure_build_collapsed(data)
#tail
end
- def space
- ' '
+ def spaces
+ Ax[:spaces]
end
def tags
# collapsed -->
def collapsed
%w[ 0 1 2 3 4 5 ]
end
- def docbook(lc,chlv='')
+ def docbook_tag(lc,chlv='')
case lc
when 0 then 'book'
when 1 then lc==chlv ? 'chapter' : 'section'
@@ -162,7 +163,7 @@ module SiSU_XML_Docbook_Book
end
def markup_text(data)
data.each_with_index do |o,i|
- if o.is ==:heading || o.is ==:para
+ if o.is ==:heading || o.is ==:para || o.is ==:open_close_tags
o=@trans.markup_docbook(o) #unless o.obj==nil
end
end
@@ -176,7 +177,7 @@ module SiSU_XML_Docbook_Book
end
def output(o,comment='')
puts o.lc == (0..6) \
- ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
+ ? "#{spaces*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
: "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
end
def structure_collapsed(data)
@@ -189,6 +190,38 @@ module SiSU_XML_Docbook_Book
end
#def chapterlevel
#end
+ def xml_head
+ [
+ '<docinfo>',
+ SiSU_Metadata::Summary.new(@md).xml_docbook.metadata,
+ '</docinfo>'
+ ].flatten
+ end
+ def code_output(o,ocn,filename_docbook)
+ filename_docbook.puts o.obj.gsub(/\n?(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\n?/m,"\n")
+ end
+ def adjust_output(o,ocn,filename_docbook,splv)
+ if o.obj =~/#{Xx[:split]}/
+ outs=o.obj.split(/#{Xx[:split]}/)
+ outs.each do |out|
+ if out =~/<figure id=/m
+ out=out.gsub(/:spaces0:/m,
+ %{#{spaces*(splv)}#{spaces}}).
+ gsub(/:spaces1:/m,
+ %{#{spaces*(splv)}#{spaces*2}})
+ filename_docbook.puts out
+ filename_docbook.puts "#{spaces*3}#{ocn}"
+ else
+ unless out.empty?
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(out,80,(splv*2+2),nil).line_wrap
+ filename_docbook.puts "#{spaces*3}#{ocn}"
+ end
+ end
+ end
+ else
+ filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj,80,(splv*2+2),nil,ocn).line_wrap
+ end
+ end
def structure_build_collapsed(data)
#output_file=@md.file.output_path.xml_docbook_book.dir + '/' + @md.file.base_filename.xml_docbook_book
file=SiSU_Env::FileOp.new(@md)
@@ -197,10 +230,11 @@ module SiSU_XML_Docbook_Book
@chlv=chlv=0
doc_position=:head
filename_docbook.puts head
+ filename_docbook.puts xml_head
data.each_with_index do |o,i|
if (defined? o.ocn and not o.ocn.nil?)
ocn=(@make.build.ocn?) \
- ? "\n#{Dx[:ocn_o]}#{o.ocn}#{Dx[:ocn_c]}"
+ ? "<!-- o#{o.ocn} -->"
: ''
id=%{ id="o#{o.ocn}" }
else
@@ -213,21 +247,45 @@ module SiSU_XML_Docbook_Book
@splv=o.lc
tag_id=o.tags[0] ? %{ id="#{o.tags[0]}" } : ''
if doc_position ==:head
- filename_docbook.puts %{#{space*o.lc}<title#{id}>}
+ filename_docbook.puts %{#{spaces*o.lc}<title#{id}>}
doc_position=:body_and_tail
else
filename_docbook.puts structure_build_tag_close(o.lc,h)
- filename_docbook.puts %{#{space*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}>
-#{space*o.lc}<title#{id}>
+ filename_docbook.puts %{#{spaces*(o.lc)}<#{tags.docbook_tag(o.lc,chlv)}#{tag_id}>
+#{spaces*o.lc}<title#{id}>
}
end
- filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
- filename_docbook.puts %{#{space*o.lc}</title>}
+ adjust_output(o,ocn,filename_docbook,@splv)
+ filename_docbook.puts %{#{spaces*o.lc}</title>}
h=o.lc
- elsif (o.of ==:para or o.of ==:block)
- filename_docbook.puts "#{space*(@splv)}<para#{id}>"
- filename_docbook.puts SiSU_TextUtils::Wrap.new(o.obj + ocn,80,(@splv*2+2)).line_wrap
- filename_docbook.puts "#{space*(@splv)}</para>"
+ elsif o.of ==:layout \
+ and o.is ==:open_close_tags
+ xml_tag=case o.sym
+ when :quote_open then '<blockquote>'
+ when :quote_close then '</blockquote>'
+ else ''
+ end
+ unless xml_tag.empty?
+ filename_docbook.puts "#{spaces*(@splv)}#{xml_tag}"
+ end
+ elsif o.of ==:block
+ if o.is ==:table
+ filename_docbook.puts SiSU_Tables::TableXMLdocbook.new(o,id).table.obj
+ elsif o.is ==:code
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
+ filename_docbook.puts "#{spaces*(@splv+1)}<programlisting>"
+ code_output(o,ocn,filename_docbook)
+ filename_docbook.puts "#{spaces*(@splv+1)}</programlisting>"
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
+ else
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
+ adjust_output(o,ocn,filename_docbook,@splv)
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
+ end
+ elsif o.of ==:para
+ filename_docbook.puts "#{spaces*(@splv)}<para#{id}>"
+ adjust_output(o,ocn,filename_docbook,@splv)
+ filename_docbook.puts "#{spaces*(@splv)}</para>"
end
end
filename_docbook.puts structure_build_tag_close(0,h)
@@ -237,40 +295,40 @@ module SiSU_XML_Docbook_Book
x=[]
case h
when 0
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
when 1
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
when 2
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
when 3
- x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
when 4
- x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
- x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
when 5
- x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5)
- x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
- x << "#{space*5}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*5}</#{tags.docbook_tag(5)}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4)
+ x << "#{spaces*5}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
when 6
- x << "#{space*6}</#{tags.docbook(6)}>" if (lc <= 6)
- x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5)
- x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4)
- x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3)
- x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2)
- x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1)
- x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0)
+ x << "#{spaces*6}</#{tags.docbook_tag(6)}>" if (lc <= 6)
+ x << "#{spaces*5}</#{tags.docbook_tag(5)}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.docbook_tag(4,@chlv)}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.docbook_tag(3,@chlv)}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.docbook_tag(2,@chlv)}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.docbook_tag(1,@chlv)}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.docbook_tag(0)}>" if (lc <= 0)
end
x.join("\n")
end
diff --git a/lib/sisu/v6/xml_fictionbook2.rb b/lib/sisu/v6/xml_fictionbook2.rb
index d0ad4a7f..4e580b84 100644
--- a/lib/sisu/v6/xml_fictionbook2.rb
+++ b/lib/sisu/v6/xml_fictionbook2.rb
@@ -126,8 +126,8 @@ module SiSU_XML_Fictionbook
data=markup_text(data)
structure_build_collapsed(data,endnotes,images_base64)
end
- def space
- ' '
+ def spaces
+ Ax[:spaces]
end
def tags
# collapsed -->
@@ -278,7 +278,7 @@ module SiSU_XML_Fictionbook
end
def output(o,comment='')
puts o.lc == (0..6) \
- ? "#{space*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
+ ? "#{spaces*o.lc}<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
: "<#{o.lc}>[#{o.ocn}] #{o.ln} #{o.obj}</#{o.lc}>#{comment}"
end
def structure_collapsed(data)
@@ -315,11 +315,11 @@ module SiSU_XML_Fictionbook
filename_fictionbook.puts structure_build_tag_close(o.lc,h)
end
doc_position=:body_and_tail
- filename_fictionbook.puts %{#{space*o.lc}<#{tags.fictionbook[o.lc]}>
-#{space*o.lc}<title>
+ filename_fictionbook.puts %{#{spaces*o.lc}<#{tags.fictionbook[o.lc]}>
+#{spaces*o.lc}<title>
}
filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,(o.lc*2+2)).line_wrap
- filename_fictionbook.puts %{#{space*o.lc}</title>}
+ filename_fictionbook.puts %{#{spaces*o.lc}</title>}
h=o.lc
elsif o.is ==:heading_insert \
and o.obj =~/Endnotes/ \
@@ -338,40 +338,40 @@ module SiSU_XML_Fictionbook
x=[]
case h
when 0
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 1
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 2
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 3
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 4
- x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 5
- x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
- x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
when 6
- x << "#{space*6}</#{tags.fictionbook[6]}>" if (lc <= 6)
- x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
- x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
- x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
- x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
- x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
- x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
+ x << "#{spaces*6}</#{tags.fictionbook[6]}>" if (lc <= 6)
+ x << "#{spaces*5}</#{tags.fictionbook[5]}>" if (lc <= 5)
+ x << "#{spaces*4}</#{tags.fictionbook[4]}>" if (lc <= 4)
+ x << "#{spaces*3}</#{tags.fictionbook[3]}>" if (lc <= 3)
+ x << "#{spaces*2}</#{tags.fictionbook[2]}>" if (lc <= 2)
+ x << "#{spaces*1}</#{tags.fictionbook[1]}>" if (lc <= 1)
+ x << "#{spaces*0}</#{tags.fictionbook[0]}>" if (lc <= 0)
end
x.join("\n")
end
diff --git a/lib/sisu/v6/xml_scaffold_structure_collapsed.rb b/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
index 23bc4f4c..9fece3bf 100644
--- a/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
+++ b/lib/sisu/v6/xml_scaffold_structure_collapsed.rb
@@ -70,7 +70,9 @@ module SiSU_XML_Scaffold_Structure_Collapse
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- @sp=' '
+ end
+ def spaces
+ Ax[:spaces]
end
def read
begin
@@ -87,7 +89,6 @@ module SiSU_XML_Scaffold_Structure_Collapse
class Scroll <Source
def initialize(data='',md='')
@data,@md=data,md
- @sp=' '
end
def songsheet
@t='sisu'
@@ -116,8 +117,8 @@ module SiSU_XML_Scaffold_Structure_Collapse
self
end
def output(o,lev=nil,comment='')
- puts lev == 0..6 \
- ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ puts lev == (0..6) \
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
: "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
end
def structure_collapsed(data)
@@ -137,7 +138,7 @@ module SiSU_XML_Scaffold_Structure_Collapse
if (o.is ==:heading || o.is ==:heading_insert)
lev=o.lc
structure_build_tag_close(lev,h)
- puts "#{@sp*lev}<#{@s[lev]}>\n#{@sp*lev} [#{o.ocn}] #{lev} {#{o.node}}"
+ puts "#{spaces*lev}<#{@s[lev]}>\n#{spaces*lev} [#{o.ocn}] #{lev} {#{o.node}}"
h[0]=lev
end
end
@@ -146,37 +147,37 @@ module SiSU_XML_Scaffold_Structure_Collapse
def structure_build_tag_close(lev,h)
case h[0]
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3)
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2)
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1)
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3)
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2)
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1)
puts "</#{@s[0]}>" if (lev==0)
end
end
diff --git a/lib/sisu/v6/xml_scaffold_structure_sisu.rb b/lib/sisu/v6/xml_scaffold_structure_sisu.rb
index 075a00ee..a21f8347 100644
--- a/lib/sisu/v6/xml_scaffold_structure_sisu.rb
+++ b/lib/sisu/v6/xml_scaffold_structure_sisu.rb
@@ -70,7 +70,9 @@ module SiSU_XML_Scaffold_Structure_Sisu
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::CombinedSingleton.instance.get_all(opt)
- @sp=' '
+ end
+ def spaces
+ Ax[:spaces]
end
def read
begin
@@ -87,7 +89,6 @@ module SiSU_XML_Scaffold_Structure_Sisu
class Scroll <Source
def initialize(data='',md='')
@data,@md=data,md
- @sp=' '
end
def songsheet
@t='sisu'
@@ -114,13 +115,13 @@ module SiSU_XML_Scaffold_Structure_Sisu
puts "\nsisu structure, heading outline --->\n\n"
data.each_with_index do |o,i|
if (o.is ==:heading || o.is ==:heading_insert)
- puts "#{@sp*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>"
+ puts "#{spaces*o.ln}<#{tags.sisu[o.ln]}>[#{o.ocn}] #{o.ln} #{o.obj}</#{tags.sisu[o.ln]}>"
end
end
end
def output(o,lev=nil,comment='')
- puts lev == 0..6 \
- ? "#{@sp*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
+ puts lev == (0..6) \
+ ? "#{spaces*lev}<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
: "<#{lev}>[#{o.ocn}] #{o.ln} #{o.obj}</#{lev}>#{comment}"
end
def structure_build_sisu(data)
@@ -131,7 +132,7 @@ module SiSU_XML_Scaffold_Structure_Sisu
data.each_with_index do |o,i|
if (o.is ==:heading || o.is ==:heading_insert)
structure_build_tag_close(o.ln,h)
- puts "#{@sp*o.ln}<#{@s[o.ln]}>\n#{@sp*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}"
+ puts "#{spaces*o.ln}<#{@s[o.ln]}>\n#{spaces*o.ln} [#{o.ocn}] #{o.ln} {#{o.node}}"
case o.ln
when 1
h=[o.ln,true,false,false]
@@ -149,37 +150,37 @@ module SiSU_XML_Scaffold_Structure_Sisu
def structure_build_tag_close(lev,h)
case h[0]
when 1
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 2
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 3
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 4
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 5
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
when 6
- puts "#{@sp*6}</#{@s[6]}>" if (lev <= 6)
- puts "#{@sp*5}</#{@s[5]}>" if (lev <= 5)
- puts "#{@sp*4}</#{@s[4]}>" if (lev <= 4)
- puts "#{@sp*3}</#{@s[3]}>" if (lev <= 3) && h[3]
- puts "#{@sp*2}</#{@s[2]}>" if (lev <= 2) && h[2]
- puts "#{@sp*1}</#{@s[1]}>" if (lev <= 1) && h[1]
+ puts "#{spaces*6}</#{@s[6]}>" if (lev <= 6)
+ puts "#{spaces*5}</#{@s[5]}>" if (lev <= 5)
+ puts "#{spaces*4}</#{@s[4]}>" if (lev <= 4)
+ puts "#{spaces*3}</#{@s[3]}>" if (lev <= 3) && h[3]
+ puts "#{spaces*2}</#{@s[2]}>" if (lev <= 2) && h[2]
+ puts "#{spaces*1}</#{@s[1]}>" if (lev <= 1) && h[1]
puts "</#{@s[0]}>" if (lev==0)
end
end
diff --git a/lib/sisu/v6/xml_shared.rb b/lib/sisu/v6/xml_shared.rb
index 033659f0..3e8ddf50 100644
--- a/lib/sisu/v6/xml_shared.rb
+++ b/lib/sisu/v6/xml_shared.rb
@@ -460,28 +460,33 @@ module SiSU_XML_Munge
clean(str)
end
def markup_docbook(dob='') # work on, initially a copy of fictionbook!
- dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,'<footnote>\1</footnote>').
- gsub(/&/,'&amp;'). #sort
- gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
- gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
- gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
- dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
- gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
- gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
- gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
- gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
- gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
- gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
- gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
- gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
- gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,'<image xl:href="../../_sisu/image/\1" />'). #taken unmodified except path from fictionbook
- gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}").
- gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
- gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
- gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
- gsub(/<(p|br)>/,'<\1 />')
- dob.obj=clean(dob.obj)
+ if dob.is !=:code
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}(\d+)\s*(.+?)#{Mx[:en_a_c]}/m,'<footnote><para><!-- fn\1 -->\2</para></footnote>').
+ gsub(/\\\\/,'</para><para>').
+ gsub(/&/,'&amp;'). #sort
+ gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
+ gsub(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1&amp; '). #sort
+ gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>').
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>').
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>').
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>').
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>').
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'<ins>\1</ins>').
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'<cite>\1</cite>').
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>').
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). # tt, kbd
+ gsub(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)).+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/m,
+ %{#{Xx[:split]}:spaces0:<figure id="\\1">\n:spaces1:<title></title>\n:spaces1:<graphic fileref="images/\\1" align="center" width="50%"></graphic>\n:spaces0:</figure>#{Xx[:split]}}).
+ gsub(/#{Mx[:url_o]}(.+?)#{Mx[:url_c]}/,"#{Dx[:url_o]}\\1#{Dx[:url_c]}").
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'<a name="\1"></a>').
+ gsub(/#{Mx[:gl_bullet]}/m,'● '). #&nbsp; not available
+ gsub(/#{Mx[:nbsp]}/,' '). #&nbsp; not available
+ gsub(/<(p|br)>/,'<\1 />')
+ dob.obj=clean(dob.obj)
+ else # codeblock
+ end
dob
end
def markup_group(dob='')
diff --git a/lib/sisu/v6/xml_tables.rb b/lib/sisu/v6/xml_tables.rb
index a994e402..6967bb86 100644
--- a/lib/sisu/v6/xml_tables.rb
+++ b/lib/sisu/v6/xml_tables.rb
@@ -122,6 +122,64 @@ module SiSU_Tables
@parablock
end
end
+ class TableXMLdocbook
+ @@tablehead=0
+ @@tablefoot=[] #watch
+ def initialize(table,id='')
+ @table_obj,@id=table,id
+ @vz=SiSU_Viz::Defaults.new
+ end
+ def spaces
+ Ax[:spaces]
+ end
+ def table
+ table_obj=@table_obj
+ if table_obj.obj !~/^<table\s/m
+ table_obj=table_rows_and_columns_array(table_obj)
+ else p __LINE__; p caller
+ end
+ table_obj
+ end
+ def table_rows_and_columns_array(table_obj) # provides basic (x)html table
+ table_rows,nr=[],0
+ table_obj.obj.split(Mx[:tc_c]).each do |table_row|
+ table_row_with_columns=table_row.split(Mx[:tc_p])
+ trc,nc=[],0
+ table_row_with_columns.each do |c|
+ c=c.gsub(/^(?:~|&nbsp;)$/,''). # tilde / empty cell
+ gsub(/&nbsp;/,' ').
+ gsub(/<:br>/,'<br />')
+ trc <<= if table_obj.head_ and nr==0
+ %{#{spaces*6}<entry>#{c}</entry>\n}
+ else %{#{spaces*6}<entry>#{c}</entry>\n}
+ end
+ nc+=1
+ end
+ trc=(trc.is_a?(Array)) ? trc.flatten.join : trc
+ trc = if table_obj.head_ and nr==0
+ "#{spaces*4}<thead>\n#{spaces*5}<row>\n#{trc}#{spaces*5}</row>\n#{spaces*4}</thead>\n#{spaces*4}<tbody>\n"
+ else
+ "#{spaces*5}<row>\n#{trc}#{spaces*5}</row>\n"
+ end
+ nr+=1
+ table_rows << trc
+ end
+ tbody_close=if table_obj.head_
+ "#{spaces*4}</tbody>"
+ else ''
+ end
+ table_rows=table_rows.flatten.join
+ # include table_id <table id=''>
+ table_obj.obj=%{#{spaces*3}<para #{@id}>
+#{spaces*4}<table>
+#{spaces*4}<tgroup cols="#{table_obj.cols}" align="char">
+#{table_rows}#{tbody_close}
+#{spaces*4}</tgroup>
+#{spaces*4}</table>
+#{spaces*3}</para>}
+ table_obj
+ end
+ end
class TableXMLexp <Table
@@tablehead=0
@@tablefoot=[]
diff --git a/rbuild b/rbuild
index 9ee18775..a5beb760 100644
--- a/rbuild
+++ b/rbuild
@@ -37,8 +37,8 @@
#require 'mkmf'
#create_makefile("sisu")
#% manual settings, edit/update as required (note current default settings are obtained from sisu version yml file)
-SiSU_version_next_stable = '5.4.0'
-SiSU_version_next_unstable = '6.0.7'
+SiSU_version_next_stable = '5.4.1'
+SiSU_version_next_unstable = '6.0.8'
#% rake file
SiSU_version_generic_next_stable = '5.4.x'
SiSU_version_generic_next_unstable = '6.0.x'