From c9ab55b699ba9b2257f9ee3837093fd1f1e4cf57 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 22 Jul 2008 20:09:54 -0400 Subject: sisu-0.68.0 + sha256 --- CHANGELOG | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 03f069fc..c0682802 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -11,9 +11,9 @@ Reverse Chronological: %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz - sisu_0.68.0.orig.tar.gz - sisu_0.68.0-1.dsc - sisu_0.68.0-1.diff.gz + cecae8b828aa187b22354f2ee9e8a8b5244dd9f4 1509605 sisu_0.68.0.orig.tar.gz + f7dc610a710d9818901909d8c4dc110019f39417 1159 sisu_0.68.0-1.dsc + fc5f2f8e22e02c165f92adcb31a9c328feb487e9 146736 sisu_0.68.0-1.diff.gz Should simplify maintenance; numerous small fixes Not without risk but should be easier to maintain. -- cgit v1.2.3 From d43865fb6a093625a77e8605d6fb00158546e1e4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 12 Aug 2008 23:37:42 -0400 Subject: html increased use of css; dal, middle layer, url representation, interim commit --- CHANGELOG | 10 ++ lib/sisu/v0/constants.rb | 8 +- lib/sisu/v0/css.rb | 264 +++++++++++++++++++++------------ lib/sisu/v0/dal.rb | 14 +- lib/sisu/v0/dal_doc_str.rb | 10 +- lib/sisu/v0/dal_syntax.rb | 11 +- lib/sisu/v0/db_import.rb | 6 +- lib/sisu/v0/defaults.rb | 8 +- lib/sisu/v0/digests.rb | 4 +- lib/sisu/v0/html.rb | 31 +++- lib/sisu/v0/html_format.rb | 130 +++++----------- lib/sisu/v0/html_format_css.rb | 133 +++++++---------- lib/sisu/v0/html_segments.rb | 26 ++-- lib/sisu/v0/html_table.rb | 18 +-- lib/sisu/v0/html_tune.rb | 18 +-- lib/sisu/v0/hub.rb | 5 +- lib/sisu/v0/manpage.rb | 6 +- lib/sisu/v0/odf.rb | 16 +- lib/sisu/v0/plaintext.rb | 4 +- lib/sisu/v0/shared_html_lite.rb | 18 +-- lib/sisu/v0/shared_structure.rb | 3 +- lib/sisu/v0/shared_xml.rb | 16 +- lib/sisu/v0/sst_do_inline_footnotes.rb | 1 + lib/sisu/v0/sst_to_s_xml_dom.rb | 2 + lib/sisu/v0/texinfo_format.rb | 6 +- lib/sisu/v0/texpdf.rb | 6 +- lib/sisu/v0/texpdf_format.rb | 86 ++++++----- lib/sisu/v0/wikispeak.rb | 6 +- 28 files changed, 467 insertions(+), 399 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c0682802..84867947 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,16 @@ Reverse Chronological: %% STABLE MANIFEST +%% sisu_0.68.1.orig.tar.gz (2008-08-12:32/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.1.orig.tar.gz + sisu_0.68.1.orig.tar.gz + sisu_0.68.1-1.dsc + sisu_0.68.1-1.diff.gz + + * middle layer, url representation + + * html increased use of css, includes segmented html minitoc + %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz cecae8b828aa187b22354f2ee9e8a8b5244dd9f4 1509605 sisu_0.68.0.orig.tar.gz diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index 68093673..2c08bdfa 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -97,7 +97,8 @@ Mx[:br_page]= "#{Mx[:mk_o]}pb#{Mx[:mk_c]}" Mx[:br_page_new]= "#{Mx[:mk_o]}pn#{Mx[:mk_c]}" Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}" Mx[:br_eof]= "#{Mx[:mk_o]}EOF#{Mx[:mk_c]}" -Mx[:lnk_o]='「'; Mx[:lnk_c]='」' +Mx[:lnk_o]='◁'; Mx[:lnk_c]='▷' + #‹ › Mx[:sm_set_o]='《'; Mx[:sm_set_c]='》' Mx[:sm_subset_o]='《 '; Mx[:sm_subset_c]='》' #Mx[:sm_set_o]='∈ '; Mx[:sm_set_c]='∋ ' @@ -166,4 +167,9 @@ check: ‹ › ∗  '〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕' '〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕' +◁▷ + +▶this is text or an image◀http:// + +◀this is text or an image▶ http:// diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index cdd05528..52de3351 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -106,7 +106,7 @@ WOK /* SiSU css default stylesheet */ body { color: black; - background: #{@vz.color_white}; + background: "#ffffff"; } /* table { @@ -121,25 +121,25 @@ WOK } */ a:link { - color: #{@vz.color_blue_ink}; + color: #003399; text-decoration: none; } a:visited { - color: #{@vz.color_blue_ink}; + color: #003399; text-decoration: none; } /* a:hover { - color: #{@vz.color_black}; + color: #000000; border-bottom: 2px solid #777777; - background-color: #{@vz.color_yellow_light}; + background-color: #fff3b6; } */ a:hover img { - background-color: #{@vz.color_white}; + background-color: "#ffffff"; } a:active { - color: #{@vz.color_blue_ink}; + color: #003399; text-decoration: underline; } div { @@ -197,24 +197,35 @@ WOK margin-left: 75%; width: 20%; } - p { + ul, li, p { display: block; - font-family: #{fonts}; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 100%; font-weight: normal; line-height: 150%; - text-align: left; - margin-left: 10mm; + text-align: justify; + margin-left: 1em; text-indent: 0mm; margin-top: 3px; margin-bottom: 3px; - margin-right: 5mm; + /* margin-bottom:0; */ + margin-right: 2em; + /* width: 90%; */ } p.norm { - text-align: justify; } + p.i1 {margin-left: 2em;} + p.i2 {margin-left: 3em;} + p.i3 {margin-left: 4em;} + p.i4 {margin-left: 5em;} + p.i5 {margin-left: 6em;} + p.i6 {margin-left: 7em;} + p.i7 {margin-left: 8em;} + p.i8 {margin-left: 9em;} + p.i9 {margin-left: 10em;} p.code { - font-family: monospace; + font-family: inconsolata, andale mono, courier new, courier, monospace; + font-size: 90%; text-align: left; } p.caption { @@ -223,24 +234,24 @@ WOK display: inline; } p.endnote { - font-family: #{fonts}; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 96%; font-weight: normal; line-height: 120%; text-align: left; - margin-left: 10mm; + margin-left: 1em; text-indent: 0mm; margin-top: 3px; margin-bottom: 3px; margin-right: 15mm; } p.endnote_indent { - font-family: #{fonts}; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 96%; font-weight: normal; line-height: 120%; text-align: left; - margin-left: 15mm; + margin-left: 2em; text-indent: 0mm; margin-top: 3px; margin-bottom: 3px; @@ -264,6 +275,8 @@ WOK p.ocn, p.paranum { font-size: 10px; margin-top: 0px; + float: right; + width: 5%; margin-bottom: 5px; color: #777777; margin-right: 5px; @@ -384,7 +397,7 @@ WOK margin-top: 1px; margin-bottom: 3px; } - p.quickref{ + p.quickref { font-size: 10px; font-style: italic; margin-top: 0px; @@ -393,7 +406,7 @@ WOK margin-right: 5px; text-align: left; } - p.bigref{ + p.bigref { font-size: 11px; font-weight: bold; margin-top: 0px; @@ -402,19 +415,11 @@ WOK margin-right: 5px; text-align: center; } - p.i1 {margin-left: 15mm;} - p.i2 {margin-left: 20mm;} - p.i3 {margin-left: 25mm;} - p.i4 {margin-left: 30mm;} - p.i5 {margin-left: 35mm;} - p.i6 {margin-left: 40mm;} - p.i7 {margin-left: 45mm;} - p.i8 {margin-left: 50mm;} - p.i9 {margin-left: 55mm;} table { } tr { } th, td { } + p.left, th.left, td.left { text-align: left; } @@ -428,11 +433,11 @@ WOK h0, h1, h2, h3, h4, h5, h6 { display: block; - font-family: #{fonts}; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-weight: bold; line-height: 120%; - margin-left: 10mm; - margin-right: 10mm; + margin-left: 5mm; + margin-right: 5mm; text-align: left; margin-top: 20px; margin-bottom: 10px; @@ -440,6 +445,7 @@ WOK h1.center, h2.center, h3.center, h4.center, h5.center, h6.center { text-align: center; } + ul { list-style: none; } @@ -449,52 +455,52 @@ WOK ul.vertical { list-style: none; } + li { background: url(../image/bullet_09.png) no-repeat 0px 6px; - /* list-style-type: disc; */ padding-left: 20px; display: block; - font-family: #{fonts}; - /* font-size: 100%; */ + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-weight: normal; line-height: 150%; text-align: left; - margin-left: 10mm; + margin-left: 1em; text-indent: 0mm; margin-top: 3px; margin-bottom: 3px; - margin-right: 0mm; + margin-right: 10mm; } li.bullet { - margin-left: 10mm; + margin-left: 1em; } li.i1 { - margin-left: 15mm; + margin-left: 2em; } li.i2 { - margin-left: 20mm; + margin-left: 3em; } li.i3 { - margin-left: 25mm; + margin-left: 4em; } li.i4 { - margin-left: 30mm; + margin-left: 5em; } li.i5 { - margin-left: 35mm; + margin-left: 6em; } li.i6 { - margin-left: 40mm; + margin-left: 7em; } li.i7 { - margin-left: 45mm; + margin-left: 8em; } li.i8 { - margin-left: 50mm; + margin-left: 9em; } li.i9 { - margin-left: 55mm; + margin-left: 10em; } + #horizontal_links { background: #eeeeee; margin-left: 5%; @@ -515,8 +521,6 @@ WOK background: none; } #horizontal a { - /* font-weight: normal; */ - /* float: left; */ line-height: 12px; margin: 0 0 0 0; text-decoration: none; @@ -525,7 +529,6 @@ WOK #horizontal a.active, #horizontal a:hover { border-bottom: 2px solid #777777; padding-bottom: 2px; - /* font-weight: bold; */ color: #000077; } #horizontal a:hover { @@ -536,7 +539,6 @@ WOK top: 10mm; right: 2%; width: 12%; - /* background: #ffffff; */ float: right; } #vertical_links { @@ -569,7 +571,6 @@ WOK list-style-type: none; } #vertical a { - /* font-weight: normal; */ line-height: 12px; text-decoration: none; color: #000077; @@ -577,13 +578,11 @@ WOK #vertical a.active, #vertical a:hover { border-bottom: 2px solid #777777; padding-bottom: 2px; - /* font-weight: bold; */ color: #000077; } + li.doc { background: url(../image/bullet_09.png) no-repeat 0px 6px; - /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ - /* background: url(../../_sisu/image/bullet_09.png) no-repeat 0px 6px; */ padding-left: 16px; margin-left: 10px; margin-top: 0px; @@ -606,7 +605,6 @@ WOK } li.refcenter { background: url(../image/bullet_09.png) no-repeat 0px 6px; - /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ background: none; padding-left: 20px; margin-left: 10%; @@ -618,8 +616,6 @@ WOK } li.refbold { background: url(../image/bullet_09.png) no-repeat 0px 6px; - /* background: url(../image/bullet_doc.png) no-repeat 0 0; */ - /* padding-left: 0px; */ padding-left: 16px; margin-left: 0; margin-top: 0px; @@ -629,6 +625,7 @@ WOK font-weight: bold; text-align: left; } + h1 { font-size: 120%; margin-top: 20px; @@ -655,7 +652,7 @@ WOK } h1.norm, h2.norm, h3.norm { font-size: 110%; - margin-left: 10mm; + margin-left: 1em; margin-right: 15mm; text-align: left; margin-top: 20px; @@ -682,6 +679,7 @@ WOK margin-right: 0px; text-align: left; } + p.top_band { display: inline; text-align: left; @@ -709,6 +707,7 @@ WOK text-indent: 0mm; margin-right: 1mm; } + h4.norm, h5.norm, h6.norm { font-size: 100%; margin-left: 10mm; @@ -717,6 +716,7 @@ WOK margin-top: 10px; margin-bottom: 0px; } + h1.i {margin-left: 10mm;} h2.i {margin-left: 15mm;} h3.i {margin-left: 20mm;} @@ -726,6 +726,7 @@ WOK h7.i {margin-left: 40mm;} h8.i {margin-left: 45mm;} h9.i {margin-left: 50mm;} + h1.banner { font-weight: bold; text-align: center; @@ -779,6 +780,7 @@ WOK h6.banner { font-weight: bold; } + h1.toc { margin-left: 10mm; font-size: 115%; @@ -824,7 +826,7 @@ WOK margin-bottom: 6px; line-height: 110%; } -/* microtoc (for later) --> */ + h1.microtoc { margin-left: 0mm; font-size: 115%; @@ -864,9 +866,8 @@ WOK margin-top: 2px; margin-bottom: 2px; } -/* subtoc --> */ h5.subtoc { - margin-left: 20mm; + margin-left: 2em; margin-right: 34%; font-weight: normal; font-size: 80%; @@ -874,13 +875,121 @@ WOK margin-bottom: 2px; } h6.subtoc { - margin-left: 25mm; + margin-left: 3em; margin-right: 34%; font-weight: normal; font-size: 75%; margin-top: 0px; margin-bottom: 0px; } + +div.substance { + width: 100%; + background-color: #ffffff; +} +div.ocn { + width: 5%; + float: right; + top: 0; + background-color: #ffffff; +} +div.endnote { + width: 95%; + background-color: #fffffff; +} +/* +body { + font-size: 90%; + font-family: verdana, arial, sans-serif; +} +*/ +div.toc { + position: absolute; + float: left; + margin: 0; + padding: 0; + padding-top: 0.5em; + border: 0; + width: 13em; + background-color: #eeeeee; + margin-right:1em; +} +div.content { + margin: 0; + padding: 0; + border-left: 13em solid #ffffff; + padding-left: 1em; +} +div.content:after { + content:' '; + clear:both; + display:block; + height:0; + overflow:hidden +} +div.footer { + clear:left; + padding: 0.5em; + font-size: 80%; + margin: 0; +} +div.toc ul { + list-style: none; + padding: 0; + margin: 0; +} +div.toc li ul a, li ul span.currentlink +{ + font-weight: normal; + font-size: 90%; + padding-left: 2em; + background-color: #eeeeee; +} +div.toc a, span.currentlink{ + display:block; + text-decoration: none; + padding-left: 0.5em; + color: #0000aa; +} +span.currentlink { + text-decoration: none; + background-color: #aaaaf9; +} +div.toc a:visited { + color: #0000aa; +} +div.toc a:hover { + background-color: #f9f9aa; +} + h1.minitoc, h2.minitoc, h3.minitoc { + margin-left: 0mm; + font-weight: bold; + text-align: left; + font-size: 90%; + margin-top: 4px; + margin-bottom: 4px; + } + h4.minitoc { + margin-left: 0mm; + font-weight: normal; + font-size: 90%; + margin-top: 2px; + margin-bottom: 2px; + } + h5.minitoc { + margin-left: 2mm; + font-weight: normal; + font-size: 85%; + margin-top: 2px; + margin-bottom: 2px; + } + h6.minitoc { + margin-left: 4mm; + font-weight: normal; + font-size: 85%; + margin-top: 2px; + margin-bottom: 2px; + } h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c { text-align: center } @@ -902,35 +1011,6 @@ WOK margin-bottom: 20px; margin-right: 15mm; } -/* - table.hidden { - color: #ffffff; - text-decoration: none; - } - td.hidden { - color: #ffffff; - background-color: #000000; - } - td.hidden a.active, div.hidden a:hover { - color: #ffffff; - background-color: #000000; - } - td.hidden a:hover { - text-decoration: none; - } - div.hidden a { - line-height: 12px; - margin: 0 0 0 0; - text-decoration: none; - color: #000077; - } - div.hidden a.active, div.hidden a:hover { - text-decoration: none; - } - div.hidden a:hover { - text-decoration: none; - } -*/ WOK end def homepage #stylesheet for index, home page diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index cb6d70f8..cf6d8e09 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -257,7 +257,7 @@ module SiSU_DAL when /\^~/ # endnotes #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_para=para.dup - @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/, %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip + @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip endnote_no+=1 para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion end @@ -275,9 +275,9 @@ module SiSU_DAL end data.each do |para| para.strip! - if para =~/\{\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?\}(?:(?:https?|file|ftp):\S+|image)/ - if para !~/\{\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/ - m=/\{\s*(\S+\.(?:png|jpg|gif))/ + if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ + if para !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/ + m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/ if @rmgk imgs=para.scan(m).flatten images=imgs.each do |image| @@ -306,7 +306,7 @@ module SiSU_DAL end end para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}") - else para.gsub!(/\{\s*(\S+)\.(png|jpg|gif).+?\}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]') + else para.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]') end end else @@ -317,7 +317,7 @@ module SiSU_DAL end end end - para.gsub!(/\{\s+(\S+\.(?:png|jpg|gif))\s+/i,'{\1 ') if para =~/\{\s+\S+\.(?:png|jpg|gif).+?\}(?:(?:https?|file|ftp):\S+|image)/ + para.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ tuned_file << para unless para.nil? end tuned_file @@ -1147,7 +1147,7 @@ module SiSU_DAL #s=s.gsub(/¡¡\d+¡/,' ') # tables #s=s.gsub(/¡/,' ') # tables tidy later #s=s.gsub(/<.+?>/,'') - s=s.gsub(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search + s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search s=s.gsub(/\s\s+/,' ') s=s.strip end diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index 37e9be3c..d34bf01e 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -216,15 +216,15 @@ module SiSU_document_structure end else ocno+=1 - if para=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; ocnt+=1 #table + if para=~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; ocnt+=1 #table ocn_dv,ocn_sp="o#{ocno}","t#{ocnt}" - elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; ocnc+=1 #code block + elsif para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; ocnc+=1 #code block ocn_dv,ocn_sp="o#{ocno}","c#{ocnc}" - elsif para=~/^#{Mx[:gr_o]}(?:group|alt|verse)#{Mx[:gr_c]}/; ocng+=1 #group, poem + elsif para=~/^#{Mx[:gr_o]}(?:group|alt|verse)#{Mx[:gr_c]}/; ocng+=1 #group, poem ocn_dv,ocn_sp="o#{ocno}","g#{ocng}" - elsif para=~/\{\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image + elsif para=~/#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m; ocni+=1 #image ocn_dv,ocn_sp="o#{ocno}","i#{ocni}" - else ocnp+=1 #paragraph + else ocnp+=1 #paragraph ocn_dv,ocn_sp="o#{ocno}","p#{ocnp}" end end diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index c3bd8a7d..35f0582a 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -273,10 +273,12 @@ module SiSU_Syntax line.gsub!(/^(#{Mx[:lv_o]}[56]:(\S+?)#{Mx[:lv_c]})\s*(.+)/,"\\1 \\3 #{Mx[:mk_o]}:name#\\2#{Mx[:mk_c]}") #html name marker , however at present takes you to correct position within sub-toc, will nneed to clean from sub-toc leaving in main body only line.gsub!(/(?:<:?br>|
)/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
|
)\s*_([12])\s+/,'
<:i\1> ') if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m - line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m,"\\1{ \\2 }\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch + line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch end if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m - line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m,"\\1{ \\2 }\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ") + line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m, + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ") #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url #{Mx[:en_a_o]} http://url #{Mx[:en_a_c]} [plus adjustment for commas] #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde.. end @@ -326,8 +328,9 @@ module SiSU_Syntax #line.gsub!(/<:\/hi>/,'') line.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") line.gsub!(/[ ]+($)/,'\1') - #line.gsub!(/\{(.+?)\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image) - #line.gsub!(/\{(.+?)\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image + line.gsub!(/\{\s*(.+?)\s*\}(https?:\S+)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked (text or image) + line.gsub!(/\{\s*(.+?)\s*\}(image)/,"#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image + #line.gsub!(/(#{Mx[:lnk_c]})\s*((?:https?|file|ftp):\S+?)/m,'\1\2') ##semantic #line.gsub!(/([a-z](?:[a-z_:.]+?[a-z])?)+(?::\{(.+?)\}:\1)/m,"\\1#{Mx[:sm_set_o]}\\2#{Mx[:sm_set_c]}\\1") #line.gsub!(/;\{\s*(.+?)\s*\};([a-z]+(?:[_:.][a-z]+)*)/,"#{Mx[:sm_subset_o]}\\1#{Mx[:sm_subset_c]}\\2") diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 1e788f8e..addd1ae1 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -141,8 +141,8 @@ module SiSU_DB_import string.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"
\n") string.gsub!(/#{Mx[:gr_o]}(?:code|alt|group|verse)(?:-end)?#{Mx[:gr_c]}/,'') string.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') - string.gsub!(/\{\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)\}\S+/,'[image: \1] \2') - string.gsub!(/\{\s*(.+?)\s*\}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') + string.gsub!(/#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg))(?:\s+\d+x\d+)?(.+?)#{Mx[:lnk_c]}\S+/,'[image: \1] \2') + string.gsub!(/#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?([.,!?]?(?:\s|$))/,'\1\2') end def strip_markup(string) #define rules, make same as in dal clean string.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') @@ -153,7 +153,7 @@ module SiSU_DB_import string.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables string.gsub!(/#{Mx[:tc_p]}/u,' ') #tables tidy later string.gsub!(/<.+?>/,'') - string.gsub!(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search + string.gsub!(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search string.gsub!(/\s\s+/,' ') string.strip! end diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 4129893a..821893fc 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -936,7 +936,7 @@ module SiSU_Viz } end - def margin_css + def margin_css #unused, check '
' end @@ -1627,11 +1627,13 @@ WOK #{table_close*4}} end def credits_sisu - %{#{widgets_open} + %{
+

+
#{widget_sisu} #{widget_way_better} -
} +

} end def credits_splash end diff --git a/lib/sisu/v0/digests.rb b/lib/sisu/v0/digests.rb index 9510a12a..42fa6962 100644 --- a/lib/sisu/v0/digests.rb +++ b/lib/sisu/v0/digests.rb @@ -161,8 +161,8 @@ module SiSU_Digest_view end ima=[] if para !~/^%+\s/ \ - and para =~/(?:^|[^_\\])\{(\S+\.(png|jpg|gif))\s.+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/ - images=para.scan(/(?:^|[^_\\])\{(\S+\.(?:png|jpg|gif))\s.+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/).flatten + and para =~/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/ + images=para.scan(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/).flatten else image=nil end x=case para diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 5b9639dd..5f0d0de9 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -106,7 +106,7 @@ module SiSU_HTML toc=SiSU_HTML::Source::Toc.new(data,@md).songsheet links_guide=SiSU_HTML::Source::Links_guide.new(data,@md).toc data=@tuned_file_array - scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(data,@md,toc,links_guide).in_common #watch + scr_toc=SiSU_HTML::Source::Scroll_head_and_segtoc.new(@md,toc,links_guide).in_common #watch SiSU_HTML::Source::Seg.new(data,@md).songsheet data=@tuned_file_array scr=SiSU_HTML::Source::Scroll.new(data,@md).songsheet @@ -246,7 +246,7 @@ module SiSU_HTML end end class Toc [],:scr=>[] } + @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] } @@seg_url='' @@dp,@@firstseg=nil,nil def initialize(data='',md=nil) @@ -255,12 +255,13 @@ module SiSU_HTML @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern @pat_heading=/^(?:#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*)?(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @pat_strip_heading_name=/(.+?)<\/a>/ - @tell=SiSU_Screen::Ansi.new(@md.cmd) + @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md end def songsheet #extracts toc for scroll & seg SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ toc=nil @@firstseg=nil + @@toc={ :seg=>[],:seg_mini=>[],:scr=>[] } @data.each do |para| if para =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/ para_toc=para.dup @@ -282,6 +283,7 @@ module SiSU_HTML if toc begin @@toc[:seg] << toc[:seg] if toc[:seg] + @@toc[:seg_mini] << toc[:seg_mini] if toc[:seg_mini] @@toc[:scr] << toc[:scr] if toc[:scr] rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error end @@ -291,6 +293,10 @@ module SiSU_HTML @md.firstseg=@@firstseg @@toc end + def minitoc + minitoc=@@toc[:seg_mini].to_s + '
' + minitoc + '
' + end protected def rss #sort all wrong, disabled but kept @@toc[:seg] <<< \\2
}) + if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m + m=/#{$1}/m + seg_link.gsub!(m,'') + end @@seg_url=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1] elsif para =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ seg_link=para.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, @@ -443,6 +461,7 @@ WOK format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,seg_link) toc={} toc[:seg]=format_toc.lev4 + toc[:seg_mini]=format_toc.mini_lev4 if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ m=/#{$1}/ para.gsub!(m,'') @@ -476,6 +495,7 @@ WOK } format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt) toc[:seg]=format_toc.lev5 + toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) @@ -504,6 +524,7 @@ WOK } format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt) toc[:seg]=format_toc.lev6 + toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) @@ -535,8 +556,8 @@ WOK end end class Scroll_head_and_segtoc < Toc - def initialize(data,md='',toc='',links_guide_toc='') - @data,@md,@toc,@links_guide_toc=data,md,toc,links_guide_toc + def initialize(md='',toc='',links_guide_toc='') + @md,@toc,@links_guide_toc=md,toc,links_guide_toc @vz=SiSU_Env::Get_init.instance.skin end def in_common diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 03d97a8d..5e261649 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -85,7 +85,7 @@ module SiSU_HTML_Format ocn_class='ocn' @paranum.gsub(/^(\d+|)$/, %{

-   \\1 + \\1

}) end end @@ -638,53 +638,8 @@ WOK %{
#{@vz.paragraph_txt}} - end - def toc_endnote - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - - Endnotes - -#{@vz.table_close}} end def title_endnote - %{#{@vz.margin_txt_0} - #{@vz.paragraph_txt} - -#{@vz.margin_num} -   -#{@vz.table_close}} - end - def tail - %{
-#{@vz.margin_txt_0} - - - -
-#{@vz.banner_band} - -
#@tocband_scroll
-
-
-#{@vz.paragraph_txt} -
- #{@vz.credits_splash} - #{@vz.credits_sisu} -
-#{@vz.margin_num} -#{@vz.table_close} - - - - - - - - #{@md.title*10} - - -} end end class Head_seg < Head_information @@ -860,25 +815,8 @@ WOK #{@vz.png_nav_toc} #{@vz.table_close}} - end - def toc_endnote end def title_endnote(title,subtitle,creator,table_top_control) - %{#{@vz.banner_instrument_cover_band_seg} -

- #{title} -

-

- #{subtitle} -

-

- #{creator} -

- -#{@vz.table_close} -

Endnotes

} end def navigation_table %{ @@ -934,18 +872,17 @@ WOK } end def credit - %{
-#{@vz.credits_splash} + %{#{@vz.credits_splash} #{@vz.credits_sisu} -} +} end - def navigation_band(segtocband,seg_table_top_control) - %{
+ def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner + %{
@@ -957,10 +894,23 @@ WOK
#{@vz.banner_band}
#{seg_table_top_control}} + end + def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless + %{
+

+ + + +
+ #{doc_types} + + #{segtocband} +
+#{seg_table_top_control} +

} end def endnote_mark %{

-


} #revisit end end @@ -998,51 +948,51 @@ WOK end @vz=SiSU_Env::Get_init.instance.skin end - def para_form(tag,attrib) # regular paragraphs shaped here + def para_form_css(tag,attrib) # regular paragraphs shaped here ul=ulc='' ul,ulc="
    \n ","\n
" if @tag =~/li/ - %{#{@vz.margin_css} - #{ul}<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} + %{
+ #{@p_num.ocn_display} +#{ul}<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #@parablock #{ulc} -#{@vz.margin_num_css} - #{@p_num.ocn_display} -#{@vz.table_close} +
} end def para - para_form('p','norm') + para_form_css('p','norm') end def code - para_form('p','code') + para_form_css('p','code') end def center - para_form('p','center') + para_form_css('p','center') end def bold - para_form('p','bold') + para_form_css('p','bold') end def bullet - para_form('li','bullet') + para_form_css('li','bullet') end def format(tag,atrib) - para_form(tag,atrib) + para_form_css(tag,atrib) end def dl "
#@one #@two
" end - def table_end # - %{
- #{@vz.margin_num_css.strip} - #{@p_num.ocn_display} - #{@vz.table_close}} + def table_css_end # + ' +

+ ' end def no_paranum - %{#{@vz.margin_css} -#{@vz.paragraph_txt} + %{
+

 

+

#@one #@two -#{@vz.margin_num} -#{@vz.table_close}} +

+
+} end def gsub_body case @one diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index ace6983b..106157ba 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -155,53 +155,29 @@ module SiSU_HTML_Format_type def initialize(md='') super(md) end - def toc_endnote - %{#{@vz.margin_css} -

- - Endnotes - -

-#{@vz.table_close}} - end end class Format_scroll < SiSU_HTML_Format::Format_text_object def initialize(md='',*txt) super(md,*txt) @vz=SiSU_Env::Get_init.instance.skin end - def indent_one_no_paranum - %{#{@vz.margin_txt_1} -#{@paragraph.txt} - #@one -#{@vz.margin_num} -#{@vz.table_close}} - end - def indent_two_no_paranum - %{#{@vz.margin_txt_1} -#{@paragraph.txt} - #@one -#{@vz.margin_num} -#{@vz.table_close}} - end def endnote_body - %{#{@vz.margin_css} -

- #@one + %{

+

 

+

+ #@one

-#{@vz.margin_num_css} -   -#{@vz.table_close}} +
+} end def header_normal - %{#{@vz.margin_css} + %{
+ #{@p_num.ocn_display} <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #@headname #@parablock -#{@vz.margin_num_css} - #{@p_num.ocn_display} -#{@vz.table_close}} +
} end def heading_body @tag,@class='p','norm' @@ -236,13 +212,6 @@ module SiSU_HTML_Format_type def initialize(md='',*txt) super(md,*txt) end - def navigation_para - %{#{@vz.margin_css} -#{@paragraph.txt} - #@one -

-#{@vz.table_close}} - end def navigation_toc_lev1_advert %{#{@banner.home_button}\n
@@ -291,39 +260,36 @@ module SiSU_HTML_Format_type end def navigation_toc_lev6 end - def endnote_body_seg_tail - %{#{@vz.margin_css} + def endnote_body_seg_tail #FIX + %{

#@one

-#{@vz.margin_num_css}  -#{@vz.table_close}} +
} end def endnote_body_seg_tail_indent - %{#{@vz.margin_css} + %{

#@one

-#{@vz.margin_num_css}  -#{@vz.table_close}} +
} end - def endnote_seg_body(fn='') #url construction keep within single line... BUG WATCH 200408 + def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info - %{#{@vz.margin_css} + %{

#@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three

-#{@vz.margin_num_css}  -#{@vz.table_close}} +
} end def title_header - %{#{@vz.margin_css} - <#@tag class="#@class"> + %{
+ #@two +<#@tag class="#@class"> #@one -#{@vz.margin_num_css}  -#@two -#{@vz.table_close}} +
+} end def title_header1 @tag,@class='h1','banner' @@ -338,12 +304,12 @@ module SiSU_HTML_Format_type title_header end def title_header4 - %{#{@vz.margin_css} + %{
+

 

-#{@vz.margin_num_css}  -#{@vz.table_close}} +
} end def subtoc_lev one=if @one \ @@ -374,25 +340,22 @@ module SiSU_HTML_Format_type end #% para sisu def header4 - %{#@format #{@vz.margin_css} + %{
+#{@p_num.ocn_display}

#{@p_num.name} #@format #@parablock

-#{@vz.margin_num_css} -#{@p_num.ocn_display} -#{@vz.table_close}} +
} end def header_sub @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') - %{#{@vz.margin_css} -#{@headname} - <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} + %{
+ #{@p_num.ocn_display} + <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname} #{@parablock} -#{@vz.margin_num_css} -#{@p_num.ocn_display} -#{@vz.table_close}} +
} end def header5 @tag,@class='p','bold' @@ -419,17 +382,6 @@ module SiSU_HTML_Format_type %{

#@parablock

} - end - def navigation_indent1 - %{#{@vz.margin_txt_00_1} -#{@paragraph.txt_00} - #@parablock - -

-#{@vz.margin_num_css}  -#{@vz.table_close}} - end - def navigation_indent2 end def navigation_center "
#@parablock
" @@ -475,6 +427,27 @@ module SiSU_HTML_Format_type def lev0 #docinfo lev('h0','toc') end + def mini_lev1 + lev('h1','minitoc') + end + def mini_lev2 + lev('h2','minitoc') + end + def mini_lev3 + lev('h3','minitoc') + end + def mini_lev4 + lev('h4','minitoc') + end + def mini_lev5 + lev('h5','minitoc') + end + def mini_lev6 + lev('h6','minitoc') + end + def mini_lev0 #docinfo + lev('h0','minitoc') + end end end __END__ diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index a15c302e..e632c835 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -69,7 +69,7 @@ module SiSU_HTML_seg @@loop_count=@@seg_total=@@tracker=0 @@is4=@@is3=@@is2=@@is1=0 @@header1=@@header2=@@header3=@@header4=0 - @@seg[:tocband],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(9){[]} + @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(10){[]} @@seg[:header_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@flag_alt=false @@ -85,6 +85,7 @@ module SiSU_HTML_seg end def songsheet begin + @@minitoc=SiSU_HTML::Source::Toc.new(@data,@md).minitoc data=get_subtoc_endnotes(@data) data=articles(data) Seg.new.cleanup # (((( added )))) @@ -192,6 +193,8 @@ module SiSU_HTML_seg end end end + @@seg[:main] << '' + data end def header_art(para) format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) @@ -215,7 +218,8 @@ module SiSU_HTML_seg @p_num ||= '' if @@is1 == 1 @dc_creator=%{#{@md.dc_creator}\n} if @md.dc_creator.to_s =~/\S/ - @@seg[:tocband] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format_type::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 @@ -320,14 +324,16 @@ module SiSU_HTML_seg elsif para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \ and para =~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ format_txt_obj.gsub_body - @sto.seg_lev_para_ocn.table_end + @sto.seg_lev_para_ocn.table_css_end else para end else para end elsif para =~/#{Mx[:tc_p]}|#{Mx[:gr_o]}T[hZ]?/u + @sto=nil table=SiSU_HTML_shared::Table.new(para) para=table.table + else @sto=nil end if @md.flag_separate_endnotes para.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{@md.sfx}#_\\1">}) #endnote- twice #removed file type @@ -345,8 +351,9 @@ module SiSU_HTML_seg para=format_seg.no_paranum end end - if @sto.format=~/4:\S+/ + if @sto and @sto.format=~/4:\S+/ para.gsub!(/^\s*4:\S+\s*|<:[-_\w\d]?(-.+?-)?>|4~!.+/m,'') #sort seg headers + @@seg[:main] << '
' @@seg[:main] << para @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc else @@ -361,20 +368,19 @@ module SiSU_HTML_seg @@seg[:tail] << format_head_seg.endnote_mark @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| end - @@seg[:tail] << '
 
' ads=SiSU_HTML_promo::Ad.new(@md) @@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close end def output(type='') if @@seg[:title] =~/\S/ #kludge (for exception file better.ways, how ironic) get a real ruby test, e.g. test that not array or... filename_seg=[] - filename_seg << @@seg[:title] << @@seg[:tocband] + filename_seg << @@seg[:title] << @@seg[:tocband_banner] if type !~/endnote/ - filename_seg << @@seg[:headers] << @@seg[:main] + filename_seg << @@minitoc << @@seg[:main] else - filename_seg << @@seg[:header_endnotes] << @@seg[:endnote_all] + filename_seg << @@seg[:header_endnotes] << @@minitoc << '
' << @@seg[:endnote_all] end - filename_seg << @@seg[:tail] << @@seg[:tocband] << @@seg[:credits] + filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits] filename_seg.flatten!.compact! filename_seg.each do |para| unless para =~/\A\s*\Z/ @@ -386,7 +392,7 @@ module SiSU_HTML_seg end end def reinitialise - @@seg[:title],@@seg[:dot_nav],@@seg[:tocband],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(7){[]} + @@seg[:title],@@seg[:dot_nav],@@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]} @@segtocband=nil end def cleanup diff --git a/lib/sisu/v0/html_table.rb b/lib/sisu/v0/html_table.rb index 1aed4f5d..ffba4b0b 100644 --- a/lib/sisu/v0/html_table.rb +++ b/lib/sisu/v0/html_table.rb @@ -67,17 +67,17 @@ module SiSU_HTML_table @one,@parablock,@vz=one,one,SiSU_Env::Get_init.instance.skin end def table_head(inf) - %{ - - -
-

-
+ %{
+

+ #{inf} +

+

} end def table_end(tablefoot='') - %{
#{@vz.margin_num}#{@vz.margin_num} #{@vz.table_close} -#{tablefoot}} + %{

+#{tablefoot} +
} end def table_row(inf,h=false) bold=if h; '' @@ -109,7 +109,7 @@ module SiSU_HTML_table tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end + if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock="

\n
" #table_end end end if @@tablehead == 1 diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 11976af9..9cc50b23 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -254,10 +254,10 @@ module SiSU_Tune def urls(data) @words=[] data.each do |word| - @words << if word=~/\{(.+?)\}((?:https?|file|ftp)\S+|image)/ - if word =~/\{.+?\}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/ - m,u,d=/\{(.+?)\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures - else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures + @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/ + m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures + else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures d='' end case m @@ -276,13 +276,13 @@ module SiSU_Tune %{#{caption}} else %{#{caption}} end - word.gsub!(/\{.+?\}((?:https?|file|ftp)\S+|image)/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/,ins) else link=m[/(.+)/m] png=m.scan(/\S+/)[0].strip link=link.strip ins=%{#{link}#{d}} - word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins) end word else word @@ -313,8 +313,8 @@ module SiSU_Tune para.gsub!(/<:image\s+(\S+)\s+>/, %{}) end - if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ - @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u) + if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + @word_mode=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u) words=urls(@word_mode) para.gsub!(/.+/m,words) end @@ -336,7 +336,7 @@ module SiSU_Tune para.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') end para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url + para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration if para =~/..\/\S+/ \ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ diff --git a/lib/sisu/v0/hub.rb b/lib/sisu/v0/hub.rb index b3815828..58ea4c4f 100644 --- a/lib/sisu/v0/hub.rb +++ b/lib/sisu/v0/hub.rb @@ -134,6 +134,7 @@ module SiSU #when /^air$/; SiSU_Air::Source.new(@opt).read # -A when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -a when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g + #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o when /^xml_md_oai_pmh_dc$/; SiSU_XML_metadata::OAI_PMH.new(@opt).read # -O when /^texpdf$/; SiSU_TeX::Source.new(@opt).read # -p @@ -278,7 +279,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ if @opt.mod.inspect =~/--convert|--to|--from/ require "#{SiSU_lib}/sst_convert_markup" end - if @opt.cmd =~/([AabCcDdFfgGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \ + if @opt.cmd =~/([AabCcDdFfGHhIiJjLMmNnOopQqrRSsTtUuVvwWXxYyZ_0-9])/ \ and @opt.cmd =~/^-/ \ and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \ or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ #and @@ -425,6 +426,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ end if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki end + #if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki + #end if @opt.cmd =~/o/; op('odf','OpenDocument') #% -o opendocument end if @opt.cmd =~/x/; op('xml','xml sax') #% -x xml sax type diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 06878094..edbb55f9 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -277,7 +277,7 @@ WOK para.gsub!(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,"#{Mx[:br_line]}.B \\1#{Mx[:br_line]}") para.gsub!(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") unless para =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ - para.gsub!(/(?:^|\s)\{(.+?)\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1 #{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") + para.gsub!(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1 #{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") @manpage[:endnotes]=extract_endnotes(para) para.gsub!(/#{Mx[:en_a_o]}([\d*+]+)\s*(?:.+?)#{Mx[:en_a_c]}/m,'[^\1]') # endnote marker marked up @@ -332,8 +332,8 @@ WOK para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links para.gsub!(/ /,' ') # decide on para.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape - para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") - para.gsub!(/^(?:^|[^_\\])\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") + para.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') wordlist=para.scan(/\S+/) if para =~/^#{Rx[:meta]}\s*(.+?)\Z/m # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 09c67ff6..f3e3385f 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -222,13 +222,13 @@ module SiSU_ODF end def image(para) para.gsub!(@serial,'') - m=para.scan(/(\{\s*(.+?)\}((?:https?|file|ftp)\S+|image))/) + m=para.scan(/(#{Mx[:lnk_o]}\s*(.+?)\s*#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image))/) if m; m.each do |i| cont,url=i[1],i[2] cont.gsub!(/([)(\]\[])/,"\\\\\\1") cont.gsub!(/([+?])/,"\\\\\\1") # incorrect handling of + url.gsub!(/([+?])/,"\\\\\\1") - para.sub!(/\{\s*#{cont}\}#{url}/m,image_odf(i)) #watch + para.sub!(/#{Mx[:lnk_o]}\s*#{cont}\s*#{Mx[:lnk_c]}#{url}/m,image_odf(i)) #watch para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix end m=nil @@ -242,12 +242,12 @@ module SiSU_ODF end def text_link(para) para.gsub!(@serial,'') - m=para.scan(/(\{([^}]+?)\}((?:https?|file|ftp)\S+?))([;.,]?(?=\s|$))/) #sort + m=para.scan(/(#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+?))([;.,]?(?=\s|$))/) #sort if m m.each do |i| txt,url,trail=i[1],i[2] txt.gsub!(/([)(\]\[])/,"\\\\\\1") - txt.gsub!(/([+?])/,"\\\\\\1") # problems with + + txt.gsub!(/([+?*])/,"\\\\\\1") # problems with + url.gsub!(/([+?])/,"\\\\\\1") # problems with + para.gsub!(/\{\s*#{txt}\}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix @@ -260,7 +260,7 @@ module SiSU_ODF para.gsub!(@serial,'') para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, '\1\2') #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, '\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration @@ -368,8 +368,8 @@ module SiSU_ODF n3=lv + 2 lv=nil if lv == 0 para=unless para=~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ - para=if para =~/\{\s*\S+?\.(?:png|jpg|gif)\s.+?\}(?:(?:https?|file|ftp):\S+|image)/; image(para) - elsif para =~/\{.+?\}(?:(?:https?|file|ftp):\S+|image)/; text_link(para) + para=if para =~/#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/; image(para) + elsif para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/; text_link(para) else para end else para @@ -485,7 +485,7 @@ module SiSU_ODF para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/,'') # remove empty lines para.gsub!(/(.+?)<\/a>/,'\1') para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links -# para.gsub!(/(.+?)<\/a>/im,'\1') + #para.gsub!(/(.+?)<\/a>/im,'\1') #para.gsub!(/ /,' ') # decide on #para.gsub!(/\{(\S+?\.(?:png|jpg)) .+?\}(?:http:\/\/\S+|image)/," [ \\1 ]") #"[ #{@env.url.images_local}\/\\1 ]") #para.gsub!(/<\s]+?)([.,]?(?:\s|$))/,"\\1#{@url_brace.txt_open}\\2#{@url_brace.txt_close}\\3") para.gsub!(/_((?:https?|file|ftp):\/\/\S+)/,'\1') extract_endnotes(para) @@ -322,7 +322,7 @@ WOK para.gsub!(/(.+?)<\/a>/m,'\1') para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links para.gsub!(/ /,' ') # decide on - para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') wordlist=para.scan(/\S+/) diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index a930821e..a4e40685 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -92,10 +92,10 @@ module SiSU_Format_Shared def urls(data) @words=[] data.each do |word| - @words << if word=~/\{(.+?)\}((?:https?|file|ftp)\S+|image)/ - if word =~/\{(.+?)\}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/ - m,u,d=/\{(.+?)\}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/.match(word).captures - else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures + @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + if word =~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/ + m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/.match(word).captures + else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures d='' end word=case m @@ -114,14 +114,14 @@ module SiSU_Format_Shared %{[#{png}]#{caption}} else %{[#{png}] #{caption}} end - word.gsub!(/\{.+?\}((?:https?|file|ftp)\S+|image)/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/,ins) else link=m[/(.+)/m] png=m.scan(/\S+/)[0].strip link=link.strip ins=%{#{link}#{d}} #ins=%{#{link} [link]#{d}} - word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins) end else word end @@ -131,14 +131,14 @@ module SiSU_Format_Shared end def markup(para) if para !~/^#{Mx[:gr_o]}:code#{Mx[:gr_c]}/ - if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ - wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) + if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + wm=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|\S+/) words=urls(wm) para.gsub!(/.+/m,words) end para.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/m,'') para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url + para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration else para.gsub!(/(^|[^}])_/m,'\1>') #code-block: angle brackets special characters diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index f7b78e0e..506b5097 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -9,8 +9,7 @@ * Author: Ralph Amissah * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, - 2008 Ralph Amissah All Rights Reserved. + 2007, 2008 Ralph Amissah All Rights Reserved. * License: GPL 3 or later: diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 3c34e67f..9203f0df 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -377,16 +377,16 @@ module SiSU_XML_munge para.gsub!(/#{Mx[:br_page]}\s*/,'') para.gsub!(/#{Mx[:br_page_new]}\s*/,'') para.gsub!(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''); para.gsub!(/<[-~]#>/,'') - para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/, - %{[\\1] \\4}) - para.gsub!(/(?:^|[^_\\])\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/, - %{\\1}) - para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/, + %{[\\1] \\4}) + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/, + %{\\1}) + para.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, '\1\2\4') #watch, compare html_tune para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - '\1\2') #escaped urls not linked, deal with later + '\1\2') #escaped urls not linked, deal with later para.gsub!(/ /,' ') #para.gsub!(/ /,' ') #clean else @@ -406,7 +406,7 @@ module SiSU_XML_munge para.gsub!(/<[-~]#>/,'') para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax - para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{@dir.url.images_local}\/\\1") para.gsub!(/ /,' ') #para.gsub!(/ /,' ') #clean @@ -429,7 +429,7 @@ module SiSU_XML_munge para.gsub!(/<[-~]#>/,'') para.gsub!(/(^|#{Mx[:gl_c]}|\s)&\s+/,'\1& ') #sort para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax - para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{@dir.url.images_local}\/\\1") para.gsub!(/ /,' ') #para.gsub!(/ /,' ') #clean diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb index 5cfd38da..ba1f6379 100644 --- a/lib/sisu/v0/sst_do_inline_footnotes.rb +++ b/lib/sisu/v0/sst_do_inline_footnotes.rb @@ -475,6 +475,7 @@ module SiSU_Convert_footnotes s=s.gsub(/(\d+)<\/sup>/,'[\1]') s=s.gsub(/(?: \\;)+/,' ') s=s.gsub(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search + s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search s=s.gsub(/\s\s+/,' ') s=s.strip end diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 23143ed8..5976d82b 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -365,6 +365,8 @@ WOK para.gsub!(/<:pb>\s*/,'') para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{dir.url.images_local}/\\1") + para.gsub!(/#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, + "#{dir.url.images_local}/\\1") para.gsub!(/ /,' ') para=SiSU_document_structure::Structure.new(@md,para).structure @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index 42d62960..b627b616 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -482,7 +482,7 @@ WOK end def http # very messy clean up ! - work area, testing - z=@para[/\\\{(.+?)\}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile ! + z=@para[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile ! url=@para[/((?:https?|file|ftp):\S+)/im,1] if @para =~/\.(png|jpg|gif)/ image,w,x,y=z.scan(/\S+/) @@ -496,11 +496,11 @@ WOK end if image dir=SiSU_Env::Info_env.new(@md.fns) - @para.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile ! + @para.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile ! "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}") else link=z[/(.+?)\\/im,1] - @para.gsub!(/\{.+?\}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile ! + @para.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile ! end end end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 8d951dfb..e4bd9c00 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -435,7 +435,7 @@ module SiSU_TeX end elsif x =~/code/; @@flag_alt,@@flag_code=true,true elsif @@flag_alt - if para =~ /\}(?:https?|file|ftp)/m + if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/m para=SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http end @group_collect << para #<< "\n\n" @@ -485,7 +485,7 @@ module SiSU_TeX when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/; mono.indent($1) when /<:=/; mono.symbol_graphic #watch when /^\s*<:image\s+/; mono.image - when /\}image/; mono.png + when /#{Mx[:lnk_c]}image/; mono.png else para.strip! para=enclose(para) unless para =~/^$/ @@ -499,7 +499,7 @@ module SiSU_TeX end para end - if para =~ /\}(?:https?|file|ftp)/ + if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/ para=if para !~/\.(?:png|jpg|gif)/ SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http else diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 0fa439f0..a3f2f7d2 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -375,12 +375,12 @@ para else tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}") tell.error2 unless @md.cmd =~/q/ - @string.gsub!(/\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile ! + @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile ! end end def image dir=SiSU_Env::Info_env.new(@md.fns) - image,m=/<:image\s+(\S+)\s+.+?width=``(\d+)''.+?>/m.match(@string).captures + image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@string).captures width=m[1] || '100' width=width.to_i*0.4 image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ @@ -397,17 +397,17 @@ para nil end if image_source - @string.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/, + @string.gsub!(/#{Mx[:lnk_o]}\s*((?:https?|file|ftp):\/\/\S+)\s+(\S+).+?#{Mx[:lnk_c]}/, @center_begin + "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{image_source}/\\2}}" + @center_end ) - @string.gsub!(/<:image\s+(\S+)\s+.+\s+?>/, + @string.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/, @center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end ) - else @string.gsub!(/<:image\s+(\S+)\s+.+\s+?>/,'\1}') + else @string.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}') end end def png #fc missing image check dir=SiSU_Env::Info_env.new(@md.fns) # messy clean up - z=@string[/\\\{(\S.+?)\}(?:image|png)/,1].strip if @string =~ /\\\{\S.+?\}(?:image|png)/ # match operator for z \\ fragile ! + z=@string[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @string =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile ! if z #debug 2004w14 image=z[/(\S+?\.(?:png|jpg|gif)\b)/m] image.gsub!(/\\/,'') @@ -438,29 +438,28 @@ para nil end if image_source - @string.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/, # fragile match operator\\ fragile ! + @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile ! "#@center_begin\n\\includegraphics*[width=#{width}pt]{#{image_source}/#{image}}#{caption}#@center_end") - else - @string.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,'') # fragile match operator\\ fragile ! + else @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'') end end def http_word_mode #(orientation='') # clean up ! - work area, testing dir=SiSU_Env::Info_env.new(@md.fns) @words=[] - @url_generic_rgx=/\\\{.+?\\?\}(?:https?|file|ftp):\S+/ + @url_generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/ @string.each do |word| @words << if word=~@url_generic_rgx - if word =~/\\\{(?:.+?)\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ - regx_url=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ - punctuate=/\\\{.+?\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join + if word =~/#{Mx[:lnk_o]}(?:.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ + regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ + punctuate=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join else - regx_url=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+)/ + regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\S+)/ punctuate='' end z,url=regx_url.match(word).captures if word =~regx_url url=url.strip - if word =~/\{\s*\S+\.?(?:png|jpg|gif)/ \ + if word =~/#{Mx[:lnk_o]}\s*\S+\.?(?:png|jpg|gif)/ \ and word=~/\s+\d+x\d+\s+/ image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') @@ -486,37 +485,37 @@ para "{\\\\\ \n\\begin{scriptsize}#{hsp*3}#{c}\\end{scriptsize}&}" else '' end - elsif word =~/\{\s*(\S+\.?\.(?:png|jpg|gif))/ + elsif word =~/#{Mx[:lnk_o]}\s*(\S+\.?\.(?:png|jpg|gif))/ tell=SiSU_Screen::Ansi.new(@md.cmd,%{document built without image: "#{$1}" as image dimensions not provided (& librmagick-ruby is not installed)?\n}) tell.print_grey #unless @opt.cmd =~/q/ end word=if image #most images fc etc. #% clean up ! word=if @md.fns =~/\.(?:ssm\.)?sst$/ \ and FileTest.file?("#{dir.path.image_source_local_tex}/#{image}") - word=if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + word=if word =~ /(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/ "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_local_tex}/#{image}}}#{caption} #@center_end" end word elsif @md.fns =~/\.-ss[tm]$/ \ and FileTest.file?("#{dir.path.image_source_remote_tex}/#{image}") - word=if word =~ /(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + word=if word =~ /(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/ "#@center_begin\\\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_remote_tex}/#{image}}}#{caption}#@center_end" end word elsif FileTest.file?("#{dir.path.image_source_tex}/#{image}") - word=if word =~/(\{[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+)/ + word=if word =~/(#{Mx[:lnk_o]}[a-zA-Z0-9_\\]+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+)/ "#@center_begin\\\n\\href{#{url}}\n{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}#@center_end" end word else tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search locations: #{dir.path.image_source_local_tex},#{dir.path.image_source_remote_tex} and #{dir.path.image_source_tex}") tell.error2 unless @md.cmd =~/q/ - word='' if word =~ /\{\S+\.(png|jpg|gif).+?\}(?:https?|file|ftp):\/\/\S+/ + word='' if word =~ /#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/ word end else link=z.strip #[/(.+?)\\/m,1] - word="\\href{#{url}}{#{link}}#{punctuate}" if word =~/\\\{.+?\\\}(?:https?|file|ftp):\/\/\S+/ + word="\\href{#{url}}{#{link}}#{punctuate}" if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/ word end else word @@ -526,7 +525,7 @@ para @words end def http - wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) + wm=@string.dup.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) @string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm,@ps).http_word_mode #GET PAPER SIZE AND USE IT end def title @@ -993,7 +992,7 @@ WOK string.gsub!(/\#/,'\#') string.gsub!(/\%/,'\%') string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes - if string !~/^\s*<:image|\}:image\s/ + if string !~/^\s*#{Mx[:lnk_o]}|#{Mx[:lnk_c]}image\s/ string.gsub!(/_/,'\_') end string.gsub!(/\{/,'\{') @@ -1013,11 +1012,15 @@ WOK string.gsub!(/&\S+?;/,' ') string.gsub!(//,' ') string.gsub!(/<\/a>/,' ') - string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case - string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url - string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration + string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + '\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, + ' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + '\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration unless @@flag_code - string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start + string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start else #code-block: angle brackets special characters, note _ already escaped string.gsub!(/\\_/,'{\UseTextSymbol{OML}{>}}') @@ -1025,7 +1028,8 @@ WOK string.gsub!(/<:ee>/,'') string.gsub!(//,' ') #proposed change, insert, but may be redundant - string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~||<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}') #string.gsub!(/(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') @@ -1049,7 +1053,8 @@ WOK string.gsub!(/\s+'/,' `') # open ' string.gsub!(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*'/,'\1`') # open ' end - string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/,'\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_ + string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})?\s*#{Mx[:gl_bullet]}\s*/, + '\1 \begin{math} \bullet \end{math}~~') #bullets - added 2004w17 watch \\_ string.gsub!(/(|<\/font>)/,'') string.gsub!(/\s*#{Mx[:fa_superscript_o]}(\S+?)#{Mx[:fa_superscript_c]}/,'^\1') #string.gsub!(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_paragraph]}|\n)\*/,' \\\\ ') @@ -1084,7 +1089,8 @@ WOK #string.gsub!(/<=asterisk>/,'{\ast}') #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' - string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic + string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/, + '^\copyright \textnormal{\1} \2') # watch likely to be problematic string end def xetex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list @@ -1153,7 +1159,7 @@ WOK string.gsub!(/\#/,'\#') string.gsub!(/\%/,'\%') string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes - if string !~/^\s*<:image|\}:image\s/ + if string !~/^\s*#{Mx[:lnk_o]}|#{Mx[:lnk_c]}image\s/ string.gsub!(/_/,'\_') end string.gsub!(/\{/,'\{') @@ -1173,11 +1179,15 @@ WOK string.gsub!(/&\S+?;/,' ') string.gsub!(//,' ') string.gsub!(/<\/a>/,' ') - string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/,' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case - string.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url - string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration + string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + '\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, + ' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + '\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration unless @@flag_code - string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,"\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start + string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start else #code-block: angle brackets special characters, note _ already escaped string.gsub!(/\\_/,'{\UseTextSymbol{OML}{>}}') @@ -1185,7 +1195,8 @@ WOK string.gsub!(/<:ee>/,'') string.gsub!(//,' ') #proposed change, insert, but may be redundant - string.gsub!(/ \/>#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~|#{Mx[:pa_o]}:i[12]#{Mx[:pa_c]}(.+?)(?:\}~||<\/\s*(br|p)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") # Work Area string.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}') #string.gsub!(/(.+?)<\/em>/,'\begin{bfseries}\1 \end{bfseries}') @@ -1249,7 +1260,8 @@ WOK #string.gsub!(/<=asterisk>/,'{\ast}') #string.gsub!(/<=copymark>/,"^{\\copyright} ") # watch has been problematic #copymark='{\\begin{small}\\raisebox{1ex}{\\copyright}\\end{small}} ' - string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/,"^\\copyright \\textnormal{\\1} \\2") # watch likely to be problematic + string.gsub!(/<=copymark>\s*(.+)?\s+(#{Mx[:id_o]}\\~\d+;\w(?:[0-6]:)?\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})/, + '^\copyright \textnormal{\1} \2') # watch likely to be problematic string end def special_characters_curly(string) diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index 967387d9..2b0ba560 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -253,7 +253,7 @@ WOK para.gsub!(/(.+?)<\/i>/,"''\\1''") para.gsub!(/(.+?)<\/b>/,"'''\\1'''") para.gsub!(/(.+?)<\/u>/,'_\1_') - para.gsub!(/\{(.+?)\}(https?:\/\/\S+)/,'[\2 \1]') + para.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/\S+)/,'[\2 \1]') para.gsub!(/(https?:\/\/\S+)/,'[\1]') para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})?/,'') para.gsub!(/<:p[bn]>/,'') # remove page breaks @@ -261,8 +261,8 @@ WOK para.gsub!(/(.+?)<\/a>/m,'\1') para.gsub!(/<:name#\S+?>/,'') # remove name links para.gsub!(/ /,' ') # decide on - para.gsub!(/(?:^|[^_\\])\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") - para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') wordlist=para.scan(/\S+/) if para =~/^0~(\S+)\s+(.+?)\Z/m # for headers -- cgit v1.2.3 From d2121e12b11ee54b0287e58101538c5c48fc1252 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 12 Aug 2008 23:45:27 -0400 Subject: interim version info --- conf/sisu/version.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index ac7dd106..26045409 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- -:version: 0.68.0 -:date_stamp: 2008w29/2 -:date: "2008-07-22" +:version: 0.68.1-beta +:date_stamp: 2008w32/2 +:date: "2008-08-12" :project: SiSU -- cgit v1.2.3 From e25335596d5c77fd9edb8f806373a41cfdf90622 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Aug 2008 01:30:04 -0400 Subject: html, css and related markup --- lib/sisu/v0/css.rb | 516 ++++++++++++++-------------------------- lib/sisu/v0/html_format.rb | 67 +++--- lib/sisu/v0/html_format_css.rb | 54 +++-- lib/sisu/v0/html_segments.rb | 7 +- lib/sisu/v0/html_table.rb | 11 +- lib/sisu/v0/shared_html_lite.rb | 2 +- 6 files changed, 267 insertions(+), 390 deletions(-) diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index 52de3351..f4dfc15f 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -107,6 +107,7 @@ WOK body { color: black; background: "#ffffff"; + background-color: "#ffffff"; } /* table { @@ -128,9 +129,12 @@ WOK color: #003399; text-decoration: none; } -/* a:hover { color: #000000; + background-color: #f9f9aa; + } +/* + a:hover { border-bottom: 2px solid #777777; background-color: #fff3b6; } @@ -150,6 +154,7 @@ WOK margin-left: 5%; margin-right: 1%; } + #top_band { position: absolute; top: 0; @@ -197,7 +202,16 @@ WOK margin-left: 75%; width: 20%; } - ul, li, p { + + .norm, .bold { + line-height: 150%; + margin-left: 1em; + margin-right: 2em; + margin-top: 10px; + margin-bottom: 0px; + text-indent: 0mm; + } + p, h0, h1, h2, h3, h4, h5, h6 { display: block; font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 100%; @@ -205,15 +219,12 @@ WOK line-height: 150%; text-align: justify; margin-left: 1em; + margin-right: 2em; text-indent: 0mm; margin-top: 3px; margin-bottom: 3px; - /* margin-bottom:0; */ - margin-right: 2em; - /* width: 90%; */ - } - p.norm { } + p.norm { } p.i1 {margin-left: 2em;} p.i2 {margin-left: 3em;} p.i3 {margin-left: 4em;} @@ -223,40 +234,33 @@ WOK p.i7 {margin-left: 8em;} p.i8 {margin-left: 9em;} p.i9 {margin-left: 10em;} + p.code { font-family: inconsolata, andale mono, courier new, courier, monospace; font-size: 90%; text-align: left; } + p.caption { text-align: left; font-size: 80%; display: inline; } + p.endnote { - font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 96%; - font-weight: normal; line-height: 120%; text-align: left; - margin-left: 1em; - text-indent: 0mm; - margin-top: 3px; - margin-bottom: 3px; margin-right: 15mm; } p.endnote_indent { - font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; font-size: 96%; - font-weight: normal; line-height: 120%; text-align: left; margin-left: 2em; - text-indent: 0mm; - margin-top: 3px; - margin-bottom: 3px; margin-right: 15mm; } + p.center { text-align: center; } @@ -272,25 +276,7 @@ WOK font-style: normal; background: #fff3b6; } - p.ocn, p.paranum { - font-size: 10px; - margin-top: 0px; - float: right; - width: 5%; - margin-bottom: 5px; - color: #777777; - margin-right: 5px; - text-align: right; - } - p.ocn_off, p.no_paranum { - display: none; - font-size: 10px; - margin-top: 0px; - margin-bottom: 5px; - color: #777777; - margin-right: 5px; - text-align: right; - } + p.small { font-size: 80%; margin-top: 0px; @@ -298,7 +284,8 @@ WOK margin-right: 6px; text-align: left; } - p.tiny { + + p.tiny, p.tiny_left, p.tiny_right, p.tiny_center { font-size: 10px; margin-top: 0px; margin-bottom: 0px; @@ -306,33 +293,23 @@ WOK margin-right: 6px; text-align: left; } + p.tiny { } p.tiny_left { - font-size: 10px; - margin-top: 0px; - margin-bottom: 0px; - color: #777777; margin-left: 0px; margin-right: 0px; text-align: left; } p.tiny_right { - font-size: 10px; - margin-top: 0px; - margin-bottom: 0px; - color: #777777; - margin-right: 5mm; + margin-right: 1em; text-align: right; } p.tiny_center { - font-size: 10px; - margin-top: 0px; - margin-bottom: 0px; - color: #777777; margin-left: 0px; margin-right: 0px; text-align: center; } - p.pane { + + p.pane, p.pane_title, p.pane_blurb, p.pane_link, p.pane_indent { font-size: 80%; margin-top: 0px; margin-bottom: 0px; @@ -340,39 +317,26 @@ WOK margin-right: 4px; text-align: left; } + p.pane { } p.pane_title { font-weight: bold; - font-size: 80%; - margin-top: 0px; margin-bottom: 0px; - margin-left: 2mm; - margin-right: 4px; - text-align: left; } p.pane_blurb { font-size: 10px; - margin-top: 0px; margin-bottom: 0px; - margin-left: 2mm; - margin-right: 4px; - text-align: left; } p.pane_link { font-size: 10px; - margin-top: 0px; margin-bottom: 0px; margin-left: 4mm; - margin-right: 4px; - text-align: left; } p.pane_indent { font-size: 10px; - margin-top: 0px; margin-bottom: 0px; margin-left: 4mm; - margin-right: 4px; - text-align: left; } + p.concordance_word { line-height: 150%; font-weight: bold; @@ -384,19 +348,17 @@ WOK font-size: 80%; color: #777777; display: inline; - margin-left: 0mm; - text-indent: 0mm; + margin-left: 0em; } p.concordance_object { font-size: 80%; - font-weight: normal; line-height: 120%; text-align: left; - margin-left: 15mm; - text-indent: 0mm; + margin-left: 3em; margin-top: 1px; margin-bottom: 3px; } + p.quickref { font-size: 10px; font-style: italic; @@ -416,6 +378,19 @@ WOK text-align: center; } + label.ocn { + width: 2%; + float: right; + top: 0; + font-size: 10px; + margin-top: 0px; + margin-bottom: 5px; + color: #777777; + margin-right: 5px; + text-align: right; + background-color: #ffffff; + } + table { } tr { } th, td { } @@ -431,76 +406,6 @@ WOK text-align: right; } - h0, h1, h2, h3, h4, h5, h6 { - display: block; - font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; - font-weight: bold; - line-height: 120%; - margin-left: 5mm; - margin-right: 5mm; - text-align: left; - margin-top: 20px; - margin-bottom: 10px; - } - h1.center, h2.center, h3.center, h4.center, h5.center, h6.center { - text-align: center; - } - - ul { - list-style: none; - } - ul.horizontal { - list-style: none; - } - ul.vertical { - list-style: none; - } - - li { - background: url(../image/bullet_09.png) no-repeat 0px 6px; - padding-left: 20px; - display: block; - font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; - font-weight: normal; - line-height: 150%; - text-align: left; - margin-left: 1em; - text-indent: 0mm; - margin-top: 3px; - margin-bottom: 3px; - margin-right: 10mm; - } - li.bullet { - margin-left: 1em; - } - li.i1 { - margin-left: 2em; - } - li.i2 { - margin-left: 3em; - } - li.i3 { - margin-left: 4em; - } - li.i4 { - margin-left: 5em; - } - li.i5 { - margin-left: 6em; - } - li.i6 { - margin-left: 7em; - } - li.i7 { - margin-left: 8em; - } - li.i8 { - margin-left: 9em; - } - li.i9 { - margin-left: 10em; - } - #horizontal_links { background: #eeeeee; margin-left: 5%; @@ -534,6 +439,7 @@ WOK #horizontal a:hover { color: #000077; } + #document_versions { position: absolute; top: 10mm; @@ -541,6 +447,7 @@ WOK width: 12%; float: right; } + #vertical_links { position: absolute; top: 10mm; @@ -550,22 +457,10 @@ WOK float: right; } #vertical { - /* background: none; */ padding: 0 12px 0px 0px; - /* border-top: 2px solid #000077; */ - /* border-bottom: 2px solid #000077; */ - /* margin-left: 33%; */ margin-left: 2%; margin-right: 2%; } -/* - #vertical { - padding: 0 12px 0px 0px; - border-top: 2px solid #000077; - border-bottom: 2px solid #000077; - margin-left: 33%; - margin-right: 33%; - } */ #vertical li { display: block; list-style-type: none; @@ -581,10 +476,40 @@ WOK color: #000077; } - li.doc { + ul, li { + list-style-type: none; + list-style: none; + padding-left: 20px; + display: block; + font-family: verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman; + font-weight: normal; + line-height: 150%; + text-align: left; + text-indent: 0mm; + margin-left: 1em; + margin-right: 2em; + margin-top: 3px; + margin-bottom: 3px; + } + + li { background: url(../image/bullet_09.png) no-repeat 0px 6px; - padding-left: 16px; - margin-left: 10px; + } + + ul { + } + li.bullet { margin-left: 1em; } + li.i1 { margin-left: 2em; } + li.i2 { margin-left: 3em; } + li.i3 { margin-left: 4em; } + li.i4 { margin-left: 5em; } + li.i5 { margin-left: 6em; } + li.i6 { margin-left: 7em; } + li.i7 { margin-left: 8em; } + li.i8 { margin-left: 9em; } + li.i9 { margin-left: 10em; } + + li.doc, li.ref, li.refcenter { margin-top: 0px; margin-bottom: 0px; margin-right: 0px; @@ -592,72 +517,65 @@ WOK font-style: normal; text-align: left; } + li.doc { + background: url(../image/bullet_09.png) no-repeat 0px 6px; + padding-left: 16px; + margin-left: 10px; + margin-right: 0px; + } li.ref { background: none; padding-left: 0; margin-left: 0; - margin-top: 0px; - margin-bottom: 0px; color: #777777; - font-size: 8px; - font-style: normal; - text-align: left; } li.refcenter { background: url(../image/bullet_09.png) no-repeat 0px 6px; - background: none; padding-left: 20px; margin-left: 10%; font-size: 9px; - margin-top: 0px; - margin-bottom: 0px; color: #777777; text-align: center; } li.refbold { - background: url(../image/bullet_09.png) no-repeat 0px 6px; + list-style-type: none; padding-left: 16px; margin-left: 0; - margin-top: 0px; - margin-bottom: 0px; margin-right: 10mm; - font-size: 8px; font-weight: bold; - text-align: left; } - h1 { - font-size: 120%; - margin-top: 20px; - } - h2 { - font-size: 115%; - margin-top: 20px; - } - h3 { - font-size: 110%; - margin-top: 20px; - } - h4 { - font-size: 105%; - } - h5 { - font-size: 100%; - } - h6 { - font-size: 100%; - } - h0 { - font-size: 80%; - } - h1.norm, h2.norm, h3.norm { - font-size: 110%; - margin-left: 1em; - margin-right: 15mm; + h0, h1, h2, h3, h4, h5, h6 { + font-weight: bold; + line-height: 120%; text-align: left; margin-top: 20px; margin-bottom: 10px; } + h4.norm, h5.norm, h6.norm { + margin-top: 10px; + margin-bottom: 0px; + } + h1.center, h2.center, h3.center, h4.center, h5.center, h6.center { + text-align: center; + } + h1 { font-size: 120%; } + h2 { font-size: 115%; } + h3 { font-size: 110%; } + h4 { font-size: 105%; } + h5 { font-size: 100%; } + h6 { font-size: 100%; } + h0 { font-size: 80%; } + + h1.i {margin-left: 2em;} + h2.i {margin-left: 3em;} + h3.i {margin-left: 4em;} + h4.i {margin-left: 5em;} + h5.i {margin-left: 6em;} + h6.i {margin-left: 7em;} + h7.i {margin-left: 8em;} + h8.i {margin-left: 9em;} + h9.i {margin-left: 10em;} h1.top_band { display: inline; text-align: left; @@ -708,202 +626,137 @@ WOK margin-right: 1mm; } - h4.norm, h5.norm, h6.norm { - font-size: 100%; - margin-left: 10mm; - margin-right: 15mm; - text-align: left; - margin-top: 10px; - margin-bottom: 0px; - } - - h1.i {margin-left: 10mm;} - h2.i {margin-left: 15mm;} - h3.i {margin-left: 20mm;} - h4.i {margin-left: 25mm;} - h5.i {margin-left: 30mm;} - h6.i {margin-left: 35mm;} - h7.i {margin-left: 40mm;} - h8.i {margin-left: 45mm;} - h9.i {margin-left: 50mm;} - - h1.banner { + .banner, .subbanner { font-weight: bold; text-align: center; - font-size: 120%; margin-left: 10mm; margin-right: 15mm; margin-top: 20px; margin-bottom: 10px; } + h1.banner { + font-size: 120%; + } h1.subbanner { - font-weight: bold; - text-align: center; font-size: 115%; - margin-left: 10mm; - margin-right: 15mm; - margin-top: 20px; - margin-bottom: 10px; } h2.banner { - font-weight: bold; - text-align: center; font-size: 110%; - margin-left: 10mm; - margin-right: 15mm; - margin-top: 20px; - margin-bottom: 10px; } h3.banner { - font-weight: bold; - text-align: center; color: #990000; font-size: 105%; - margin-left: 10mm; - margin-right: 15mm; - margin-top: 20px; - margin-bottom: 10px; } h4.banner { - font-weight: bold; - text-align: center; color: #ff0000; font-size: 100%; - margin-left: 10mm; - margin-right: 15mm; - margin-top: 20px; - margin-bottom: 10px; } h5.banner { - font-weight: bold; } h6.banner { - font-weight: bold; } - h1.toc { - margin-left: 10mm; - font-size: 115%; + .toc { + font-weight: normal; margin-top: 6px; margin-bottom: 6px; + } + h1.toc { + margin-left: 1em; + font-size: 115%; line-height: 150%; } h2.toc { - margin-left: 15mm; + margin-left: 2em; font-size: 110%; - margin-top: 6px; - margin-bottom: 6px; line-height: 140%; } h3.toc { - margin-left: 20mm; + margin-left: 3em; font-size: 105%; - margin-top: 6px; - margin-bottom: 6px; line-height: 120%; } h4.toc { - margin-left: 25mm; - font-weight: normal; + margin-left: 4em; font-size: 100%; - margin-top: 6px; - margin-bottom: 6px; line-height: 120%; } h5.toc { - margin-left: 30mm; - font-weight: normal; + margin-left: 5em; font-size: 95%; - margin-top: 6px; - margin-bottom: 6px; line-height: 110%; } h6.toc { - margin-left: 35mm; - font-weight: normal; + margin-left: 6em; font-size: 90%; - margin-top: 6px; - margin-bottom: 6px; line-height: 110%; } + .microtoc { + margin-top: 2px; + margin-bottom: 2px; + } + h1.microtoc { margin-left: 0mm; font-size: 115%; - margin-top: 2px; - margin-bottom: 2px; } h2.microtoc { margin-left: 5mm; font-size: 110%; - margin-top: 2px; - margin-bottom: 2px; } h3.microtoc { margin-left: 10mm; font-size: 105%; - margin-top: 2px; - margin-bottom: 2px; } h4.microtoc { margin-left: 15mm; font-weight: normal; font-size: 100%; - margin-top: 2px; - margin-bottom: 2px; } h5.microtoc { margin-left: 20mm; font-weight: normal; font-size: 95%; - margin-top: 2px; - margin-bottom: 2px; } h6.microtoc { margin-left: 25mm; font-weight: normal; font-size: 90%; - margin-top: 2px; - margin-bottom: 2px; } - h5.subtoc { - margin-left: 2em; + + .subtoc { margin-right: 34%; font-weight: normal; + } + h5.subtoc { + margin-left: 2em; font-size: 80%; margin-top: 2px; margin-bottom: 2px; } h6.subtoc { margin-left: 3em; - margin-right: 34%; - font-weight: normal; font-size: 75%; margin-top: 0px; margin-bottom: 0px; } -div.substance { + div.substance { width: 100%; background-color: #ffffff; -} -div.ocn { + } + div.ocn { width: 5%; float: right; top: 0; background-color: #ffffff; -} -div.endnote { + } + div.endnote { width: 95%; background-color: #fffffff; -} -/* -body { - font-size: 90%; - font-family: verdana, arial, sans-serif; -} -*/ -div.toc { + } + div.toc { position: absolute; float: left; margin: 0; @@ -913,56 +766,65 @@ div.toc { width: 13em; background-color: #eeeeee; margin-right:1em; -} -div.content { + } + div.content { margin: 0; padding: 0; border-left: 13em solid #ffffff; padding-left: 1em; -} -div.content:after { + } + div.content:after { content:' '; clear:both; display:block; height:0; overflow:hidden -} -div.footer { + } + div.footer { clear:left; padding: 0.5em; font-size: 80%; margin: 0; -} -div.toc ul { + } + div.toc ul { list-style: none; padding: 0; margin: 0; -} -div.toc li ul a, li ul span.currentlink -{ + } + div.toc li ul a, li ul span.currentlink + { font-weight: normal; font-size: 90%; padding-left: 2em; background-color: #eeeeee; -} -div.toc a, span.currentlink{ + } + div.toc a, span.currentlink{ display:block; text-decoration: none; padding-left: 0.5em; color: #0000aa; -} -span.currentlink { + } + + span.currentlink { text-decoration: none; background-color: #aaaaf9; -} -div.toc a:visited { + } + + div.toc a:visited { color: #0000aa; -} -div.toc a:hover { + } + div.toc a:hover { + color: #000000; background-color: #f9f9aa; -} + } + + .minitoc { + font-weight: normal; + margin-top: 2px; + margin-bottom: 2px; + } h1.minitoc, h2.minitoc, h3.minitoc { - margin-left: 0mm; + margin-left: 0em; font-weight: bold; text-align: left; font-size: 90%; @@ -970,26 +832,18 @@ div.toc a:hover { margin-bottom: 4px; } h4.minitoc { - margin-left: 0mm; - font-weight: normal; + margin-left: 0em; font-size: 90%; - margin-top: 2px; - margin-bottom: 2px; } h5.minitoc { - margin-left: 2mm; - font-weight: normal; + margin-left: 1em; font-size: 85%; - margin-top: 2px; - margin-bottom: 2px; } h6.minitoc { - margin-left: 4mm; - font-weight: normal; + margin-left: 2em; font-size: 85%; - margin-top: 2px; - margin-bottom: 2px; } + h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c { text-align: center } @@ -1147,8 +1001,7 @@ WOK margin-top: 2px; margin-bottom: 0px; } - p.norm { - } + p.norm { } p.h1 { font-family: #{fonts}; font-size: 120%; @@ -2095,8 +1948,7 @@ WOK margin-bottom: 0px; margin-right: 5mm } - p.norm { - } + p.norm { } p.endnote { font-size: 100%; margin-left: 20%; diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 5e261649..8b6fc28a 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -78,19 +78,15 @@ module SiSU_HTML_Format or @skin_no_ocn ocn_class='ocn_off' @paranum.gsub(/^(\d+|)$/, - %{

-   -

}) + %{}) else ocn_class='ocn' @paranum.gsub(/^(\d+|)$/, - %{

- \\1 -

}) + %{
\\1}) end end def name - %{} + %{} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying %{id="o#@paranum"} @@ -414,7 +410,8 @@ WOK end def links_guide_vertical_open #??? url=(defined? @vz.url_hp) && @vz.url_hp =~/^http:\/\/\S+$/ ? @vz.url_hp : @vz.url_home - %{} end def seg_navigation_tail #this is a bug area, look up and "tidy" #nav=scroll_head_navigation_band @@ -879,7 +879,9 @@ WOK -} + + +} end def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner %{ @@ -896,18 +898,21 @@ WOK #{seg_table_top_control}} end def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{
+ %{ +

-

- - -
- #{doc_types} - - #{segtocband} -
-#{seg_table_top_control} -

} + + + +
+ #{doc_types} + + #{segtocband} +
+ #{seg_table_top_control} +

+ +} end def endnote_mark %{

@@ -951,9 +956,10 @@ WOK def para_form_css(tag,attrib) # regular paragraphs shaped here ul=ulc='' ul,ulc="

    \n ","\n
" if @tag =~/li/ - %{
+ %{ +
#{@p_num.ocn_display} -#{ul}<#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} + #{ul}<#{tag} class="#{attrib}" #{@p_num.id}> #@parablock #{ulc}
@@ -986,10 +992,11 @@ WOK
' end def no_paranum - %{
-

 

-

- #@one #@two + %{ +

+ +

+ #@one #@two

} diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb index 106157ba..1573d107 100644 --- a/lib/sisu/v0/html_format_css.rb +++ b/lib/sisu/v0/html_format_css.rb @@ -162,22 +162,25 @@ module SiSU_HTML_Format_type @vz=SiSU_Env::Get_init.instance.skin end def endnote_body - %{
-

 

-

+ %{ +

+ +

#@one

} end def header_normal - %{
+ %{ +
#{@p_num.ocn_display} <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #@headname #@parablock -
} +
+} end def heading_body @tag,@class='p','norm' @@ -261,29 +264,36 @@ module SiSU_HTML_Format_type def navigation_toc_lev6 end def endnote_body_seg_tail #FIX - %{
+ %{ +

#@one

-
} +
+} end def endnote_body_seg_tail_indent - %{
+ %{ +

#@one

-
} +
+} end def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info - %{
+ %{ +

#@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three

-
} +
+} end def title_header - %{
+ %{ +
#@two <#@tag class="#@class"> #@one @@ -304,12 +314,14 @@ module SiSU_HTML_Format_type title_header end def title_header4 - %{
-

 

+ %{ +
+ -
} +
+} end def subtoc_lev one=if @one \ @@ -340,22 +352,26 @@ module SiSU_HTML_Format_type end #% para sisu def header4 - %{
+ %{ +
#{@p_num.ocn_display}

#{@p_num.name} #@format #@parablock

-
} +
+} end def header_sub @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') - %{
+ %{ +
#{@p_num.ocn_display} <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname} #{@parablock} -
} +
+} end def header5 @tag,@class='p','bold' diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index e632c835..5b7ede63 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -193,7 +193,7 @@ module SiSU_HTML_seg end end end - @@seg[:main] << '
' + @@seg[:main] << "\n
\n" data end def header_art(para) @@ -353,7 +353,7 @@ module SiSU_HTML_seg end if @sto and @sto.format=~/4:\S+/ para.gsub!(/^\s*4:\S+\s*|<:[-_\w\d]?(-.+?-)?>|4~!.+/m,'') #sort seg headers - @@seg[:main] << '
' + @@seg[:main] << %{\n
\n} @@seg[:main] << para @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc else @@ -368,6 +368,7 @@ module SiSU_HTML_seg @@seg[:tail] << format_head_seg.endnote_mark @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| end + #@@seg[:tail] << '
 
' ads=SiSU_HTML_promo::Ad.new(@md) @@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close end @@ -378,7 +379,7 @@ module SiSU_HTML_seg if type !~/endnote/ filename_seg << @@minitoc << @@seg[:main] else - filename_seg << @@seg[:header_endnotes] << @@minitoc << '
' << @@seg[:endnote_all] + filename_seg << @@seg[:header_endnotes] << @@minitoc << %{\n
\n} << @@seg[:endnote_all] end filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits] filename_seg.flatten!.compact! diff --git a/lib/sisu/v0/html_table.rb b/lib/sisu/v0/html_table.rb index ffba4b0b..24721835 100644 --- a/lib/sisu/v0/html_table.rb +++ b/lib/sisu/v0/html_table.rb @@ -67,17 +67,18 @@ module SiSU_HTML_table @one,@parablock,@vz=one,one,SiSU_Env::Get_init.instance.skin end def table_head(inf) - %{
-

- #{inf} -

+ %{ +
+

} end def table_end(tablefoot='') %{

#{tablefoot} -
} +
+
+} end def table_row(inf,h=false) bold=if h; '' diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index a4e40685..21315d0f 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -184,7 +184,7 @@ GSUB %{

} end def ocn - %{#{@tab*1}

#@ocn

} << "\n" + %{#{@tab*1}#@ocn} << "\n" end def html_table # get rid of use html_table @new_content=[] -- cgit v1.2.3 From f42c740cbdff498cbc4e586a72086fc4cd4e794e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Aug 2008 01:31:25 -0400 Subject: html, css and related markup, touch --- lib/sisu/v0/shared_html_lite.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 21315d0f..7be46abb 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -184,7 +184,7 @@ GSUB %{

} end def ocn - %{#{@tab*1}#@ocn} << "\n" + %{#{@tab*1}} << "\n" end def html_table # get rid of use html_table @new_content=[] -- cgit v1.2.3 From 6759751b4a94ee4866c6f150b0245a3da7e98370 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Aug 2008 19:55:27 -0400 Subject: html format, consolidate html_format file, prune later; version number bumped version number bump: is necessary to re-initialize using new css for html presentation sisu -CC --- CHANGELOG | 13 +- conf/sisu/version.yml | 6 +- lib/sisu/v0/concordance.rb | 6 +- lib/sisu/v0/html.rb | 74 +++--- lib/sisu/v0/html_format.rb | 555 +++++++++++++++++++++++++++++++++++----- lib/sisu/v0/html_format_css.rb | 469 --------------------------------- lib/sisu/v0/html_scroll.rb | 16 +- lib/sisu/v0/html_segments.rb | 44 ++-- lib/sisu/v0/shared_structure.rb | 6 +- 9 files changed, 576 insertions(+), 613 deletions(-) delete mode 100644 lib/sisu/v0/html_format_css.rb diff --git a/CHANGELOG b/CHANGELOG index 84867947..0b081f64 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,15 +9,18 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.68.1.orig.tar.gz (2008-08-12:32/2) -http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.1.orig.tar.gz - sisu_0.68.1.orig.tar.gz - sisu_0.68.1-1.dsc - sisu_0.68.1-1.diff.gz +%% sisu_0.69.0.orig.tar.gz (2008-08-14:32/4) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz + sisu_0.69.0.orig.tar.gz + sisu_0.69.0-1.dsc + sisu_0.69.0-1.diff.gz * middle layer, url representation * html increased use of css, includes segmented html minitoc + necessary to re-initialise sisu output directory with new css files + [version number bump] + sisu -CC %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index 26045409..7e7b8d10 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- -:version: 0.68.1-beta -:date_stamp: 2008w32/2 -:date: "2008-08-12" +:version: 0.69.0-beta +:date_stamp: 2008w32/4 +:date: "2008-08-14" :project: SiSU diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index f62b20ac..3e073900 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -66,7 +66,7 @@ module SiSU_Concordance include SiSU_Env require "#{SiSU_lib}/defaults" include SiSU_Viz - require "#{SiSU_lib}/html_format_css" + require "#{SiSU_lib}/html_format" include SiSU_HTML_Format class Source def initialize(opt) @@ -120,7 +120,7 @@ module SiSU_Concordance WOK end def create - head_banner=SiSU_HTML_Format_type::Head_toc.new(@md) + head_banner=SiSU_HTML_Format::Head_toc.new(@md) < @@ -171,7 +171,7 @@ WOK class Words require "#{SiSU_lib}/defaults" include SiSU_Viz - require "#{SiSU_lib}/html_format_css" + require "#{SiSU_lib}/html_format" include SiSU_HTML_Format require "#{SiSU_lib}/sysenv" include SiSU_Screen diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 5f0d0de9..e882627c 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -65,8 +65,8 @@ module SiSU_HTML require "#{SiSU_lib}/defaults" include SiSU_Viz require "#{SiSU_lib}/html_table" - require "#{SiSU_lib}/html_format_css" - include SiSU_HTML_Format_type + require "#{SiSU_lib}/html_format" + include SiSU_HTML_Format require "#{SiSU_lib}/html_segments" require "#{SiSU_lib}/html_scroll" include SiSU_HTML_seg @@ -190,7 +190,7 @@ module SiSU_HTML end def toc @links_guide_toc=[] - format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) guide_type='horzontal' #values: horizontal or vertical @links_guide_toc << format_head_toc.links_guide_open(guide_type) if defined? @md.lnk \ @@ -201,24 +201,24 @@ module SiSU_HTML else '_top' end s_lnk_url,s_lnk_lnk=l[:url],l[:say] - lev_para_ocn=SiSU_HTML_Format_type::Format_toc.new(@md,s_lnk_url,s_lnk_lnk,target) + lev_para_ocn=SiSU_HTML_Format::Format_toc.new(@md,s_lnk_url,s_lnk_lnk,target) @links_guide_toc << lev_para_ocn.links_guide if s_lnk_lnk end end end - format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) @links_guide_toc << format_head_toc.links_guide_close #(guide_type) @links_guide_toc end end class Endnotes - include SiSU_HTML_Format_type + include SiSU_HTML_Format def initialize(data,md) @data,@md=data,md end def scroll @scr_endnotes=[] - format_head_scroll=SiSU_HTML_Format_type::Head_scroll.new(@md) + format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) @scr_endnotes << format_head_scroll.title_endnote @data.each do |para| pg=para.dup @@ -236,7 +236,7 @@ module SiSU_HTML endnote_array << pg.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m) end endnote_array.flatten.each do |note| - format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,note) + format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,note) @scr_endnotes << format_scroll.endnote_body end end @@ -314,24 +314,24 @@ WOK end def level_doc_owner_details if @md.stmp =~/\w\w/ - format_head_scroll=SiSU_HTML_Format_type::Head_scroll.new(@md) + format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) @@toc[:scr] << format_head_scroll.toc_owner_details end end def level_endnotes if @md.flag_endnotes - format_head_scroll=SiSU_HTML_Format_type::Head_scroll.new(@md) + format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) @@toc[:scr] << format_head_scroll.toc_endnote end end def level_metadata - format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) @@toc[:scr] << format_head_toc.metadata @@toc[:seg] << format_head_toc.seg_metadata @@toc[:seg_mini] << format_head_toc.mini_seg_metadata end def level_word_index - format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@d0c) + format_head_toc=SiSU_HTML_Format::Head_toc.new(@d0c) @@toc[:scr] << format_head_toc.concordance @@toc[:seg] << format_head_toc.concordance @@toc[:seg_mini] << format_head_toc.mini_concordance @@ -345,7 +345,7 @@ WOK linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ #% keep eye on link - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) end title=unless para =~/Document Information/; linkname else @@ -353,7 +353,7 @@ WOK %{#{linkname}} end toc={} - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:seg]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 @@ -376,7 +376,7 @@ WOK end %{#{linkname}} end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:scr]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 @@ -392,9 +392,9 @@ WOK linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev2 toc[:seg_mini]=format_toc.mini_lev2 @@ -404,7 +404,7 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:scr]=format_toc.lev2 toc end @@ -416,9 +416,9 @@ WOK linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,linkname) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,linkname) toc={} toc[:seg]=format_toc.lev3 toc[:seg_mini]=format_toc.mini_lev3 @@ -428,7 +428,7 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:scr]=format_toc.lev3 toc end @@ -439,7 +439,7 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') para[@pat_heading] linkname,link=$1.strip,$2 if $& - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) if link end para.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') if para =~/^#{Mx[:lv_o]}4:/ @@ -457,8 +457,8 @@ WOK %{\\1 \\2 \\3 }) end - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) if link - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,seg_link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) if link + format_toc=SiSU_HTML_Format::Format_toc.new(@md,seg_link) toc={} toc[:seg]=format_toc.lev4 toc[:seg_mini]=format_toc.mini_lev4 @@ -468,7 +468,7 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}} if p_num end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:scr]=format_toc.lev4 toc end @@ -482,7 +482,7 @@ WOK linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) end toc={} if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -493,12 +493,12 @@ WOK lnk_n_txt=%{ #{linkname} } - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,lnk_n_txt) toc[:seg]=format_toc.lev5 toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:scr]=format_toc.lev5 toc end @@ -511,7 +511,7 @@ WOK linkname,link=$1.strip,$2 if $& if link \ and link !~/#/ - p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) end toc={} if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -522,12 +522,12 @@ WOK lnk_n_txt=%{ #{linkname} } - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,lnk_n_txt) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,lnk_n_txt) toc[:seg]=format_toc.lev6 toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) + format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) toc[:scr]=format_toc.lev6 toc end @@ -564,14 +564,14 @@ WOK toc_shared=[] @segtoc=[] SiSU_Screen::Ansi.new(@md.cmd,'Scroll & Segtoc').txt_grey unless @md.cmd =~/q/ - format_head_toc=SiSU_HTML_Format_type::Head_toc.new(@md) + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) dochead=format_head_toc.head dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge ads=SiSU_HTML_promo::Ad.new(@md) toc_shared << dochead << ads.div.major @segtoc << format_head_toc.head << ads.div.major - toc_shared << format_head_toc.toc_head_escript if SiSU_HTML_Format_type::Head_toc.method_defined? :toc_head_escript - @segtoc << format_head_toc.toc_head_escript if SiSU_HTML_Format_type::Head_toc.method_defined? :toc_head_escript + toc_shared << format_head_toc.toc_head_escript if SiSU_HTML_Format::Head_toc.method_defined? :toc_head_escript + @segtoc << format_head_toc.toc_head_escript if SiSU_HTML_Format::Head_toc.method_defined? :toc_head_escript toc_shared << format_head_toc.scroll_head_navigation_band if @md.dc_rights rights=format_head_toc.rights @@ -588,20 +588,20 @@ WOK tmp_head=nil doc_title_endnote=@md.title.gsub(/(\*+)/,'\1') tmp_head=doc_title_endnote + "\n" - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold if not @md.subtitle.nil? \ and not @md.subtitle.empty? tmp_head=@md.subtitle + "\n" - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end if @md.dc_creator creator_endnote=@md.dc_creator.gsub(/(\*+)/,%{ \\1}) tmp_head=creator_endnote + "\n" - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,tmp_head) + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 8b6fc28a..87988ec1 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -55,7 +55,7 @@ - ** Description: base formatting template for html generation + ** Description: html formating, css template =end module SiSU_HTML_Format @@ -98,7 +98,8 @@ module SiSU_HTML_Format class Paragraph_id_ocn #used by table version #work area 2003w48 attr_accessor :paranum,:font,:p_num def initialize(md,paranum) - @paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,SiSU_HTML_Format::Paragraph_number.new(md,paranum) #font + @paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,Paragraph_number.new(md,paranum) #font + #@paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,SiSU_HTML_Format::Paragraph_number.new(md,paranum) #font end def txt %{

#{@p_num.name} @@ -140,7 +141,6 @@ module SiSU_HTML_Format end class Head_information include SiSU_Viz - include SiSU_HTML_Format attr_reader :md,:sfx,:pdf,:rdf,:vz def initialize(md='') @md=md @@ -184,6 +184,10 @@ module SiSU_HTML_Format #{@vz.txt_home} } end + def html_close #moved + %{ +} + end end class Widget < Head_information def initialize(md) @@ -268,6 +272,8 @@ module SiSU_HTML_Format end end end + class XML + end class Head_toc < Head_information def initialize(md) super(md) @@ -397,16 +403,30 @@ WOK #{@md.html_title} - - #{@rdf.rdftoc} - #{@rdf.metatag_html} - #{@vz.font_css_table_file} + +#{@rdf.rdftoc} +#{@rdf.metatag_html} +#{@css.html} #{@vz.color_body} - - - - #{@vz.js_top}} + + + +#{@vz.js_top}} + end + def concordance + if @md.concord_make + %{#{@vz.margin_css} +

+ + Concordance + +

+#{@vz.table_close}} + else + %{#{@vz.margin_css} +#{@vz.table_close}} + end end def links_guide_vertical_open #??? url=(defined? @vz.url_hp) && @vz.url_hp =~/^http:\/\/\S+$/ ? @vz.url_hp : @vz.url_home @@ -539,15 +559,12 @@ WOK #{@vz.table_close}} end def metadata - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - - MetaData - -     - - - + %{#{@vz.margin_css} +

+ + MetaData + +

#{@vz.table_close}} end def seg_metadata @@ -602,48 +619,8 @@ WOK } end end - def html_close - %{ -} - end - class Head_scroll < Head_toc - def initialize(md) - super(md) - end - def toc_owner_details - %{#{@vz.margin_txt_3} -#{@vz.paragraph_font_small} - - Owner Details - -     - - -
-#{@vz.table_close}} - end - def table - %{
- -
- -#{@vz.paragraph_txt}} - end - def table1 - %{ -
-#{@vz.paragraph_txt}} - end - def table2 - %{ -
-#{@vz.paragraph_txt}} - end - def title_endnote - end - end class Head_seg < Head_information - def initialize(md) + def initialize(md) #(md='') super(md) end def head @@ -817,6 +794,21 @@ WOK #{@vz.table_close}} end def title_endnote(title,subtitle,creator,table_top_control) +# %{#{@vz.banner_instrument_cover_band_seg} +#

+# #{title} +#

+#

+# #{subtitle} +#

+#

+# #{creator} +#

+# +##{@vz.table_close} +#

Endnotes

} end def navigation_table %{ @@ -918,6 +910,135 @@ WOK %{

} #revisit end + def head + %{#{doc_type} + + + #{@seg_name_html[@seg_name_html_tracker]} - + #{@md.html_title} + + +#{@rdf.rdfseg} +#{@rdf.metatag_html} +#{@css.html} + +#{@vz.color_body} + + + +#{@vz.js_top}} + end + def toc_metadata + @metalink=%{./#{@md.fn[:meatadata]}} + toc_metadata + end + def title_banner(title,subtitle,creator) + %{

+ #{title} +

+

+ #{subtitle} +

+

+ #{creator} +

+

+ copy @ + + #{@vz.txt_home} + +

} + end + end + class Head_scroll < Head_toc + def initialize(md) #(md='') + super(md) + end + def toc_owner_details + %{#{@vz.margin_txt_3} +#{@vz.paragraph_font_small} + + Owner Details + +     + + + +#{@vz.table_close}} + end + def table + %{
+ +
+ +#{@vz.paragraph_txt}} + end + def table1 + %{ +
+#{@vz.paragraph_txt}} + end + def table2 + %{ +
+#{@vz.paragraph_txt}} + end +## def toc_endnote +## %{#{@vz.margin_txt_3} +## #{@vz.paragraph_font_small} +## +## Endnotes +## +## #{@vz.table_close}} +## end +# def toc_endnote +# %{#{@vz.margin_css} +#

+# +# Endnotes +# +#

+##{@vz.table_close}} +# end + def title_endnote +# %{#{@vz.margin_txt_0} +# #{@vz.paragraph_txt} +# +##{@vz.margin_num} +#   +##{@vz.table_close}} + end +# def tail +# %{
+##{@vz.margin_txt_0} +# +# +# +#
+##{@vz.banner_band} +# +#
#@tocband_scroll
+#
+#
+##{@vz.paragraph_txt} +#
+# #{@vz.credits_splash} +# #{@vz.credits_sisu} +#
+##{@vz.margin_num} +##{@vz.table_close} +# +# +# +# +# +# +# +# #{@md.title*10} +# +# +#} +# end end class Format_text_object @vz=SiSU_Env::Get_init.instance.skin @@ -941,7 +1062,8 @@ WOK #end if txt[2]=~/\d+/ @paranum=txt[2][/(\d+)/m,1] # unless paranum =~/#/ - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,@paranum) + @p_num=Paragraph_number.new(@md,@paranum) + #@p_num=SiSU_HTML_Format::Paragraph_number.new(@md,@paranum) @para_id=Paragraph_id_ocn.new(@md,@paranum) #used by table version end @headname='' @@ -1048,7 +1170,314 @@ WOK %{

#@one

\n} end end - class XML + class Format_scroll < Format_text_object + def initialize(md='',*txt) + super(md,*txt) + @vz=SiSU_Env::Get_init.instance.skin + end + def endnote_body + %{ +
+ +

+ #@one +

+
+} + end + def header_normal + %{ +
+ #{@p_num.ocn_display} + <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} + #@headname + #@parablock + +
+} + end + def heading_body + @tag,@class='p','norm' + header_normal + end + def heading_body1 + @tag,@class='h1','norm' + header_normal + end + def heading_body2 + @tag,@class='h2','norm' + header_normal + end + def heading_body3 + @tag,@class='h3','norm' + header_normal + end + def heading_body4 + @tag,@class='h4','norm' + header_normal + end + def heading_body5 + @tag,@class='h5','norm' + header_normal + end + def heading_body6 + @tag,@class='h6','norm' + header_normal + end + end + class Format_seg < Format_text_object + def initialize(md='',*txt) + super(md,*txt) + end + def navigation_toc_lev1_advert + %{#{@banner.home_button}\n +
+#@one +#@two +

} + end + def navigation_toc_lev1 + %{#{@banner.nav_toc}} + end + def navigation_toc_lev2 #change bold use css + %{

+ + +
+ + + #@one + +

+#{@vz.table_close}} + end + def navigation_toc_lev3 #change bold use css + %{

+ + +
+ + + #@one + +

+#{@vz.table_close}} + end + def navigation_toc_lev4 + %{ + +
+ +

+ #@one +

+#{@vz.table_close}} + end + def navigation_toc_lev5 + end + def navigation_toc_lev6 + end + def endnote_body_seg_tail #FIX + %{ +
+

+ #@one +

+
+} + end + def endnote_body_seg_tail_indent + %{ +
+

+ #@one +

+
+} + end + def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 + fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info + %{ +
+

+ #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three +

+
+} + end + def title_header + %{ +
+ #@two +<#@tag class="#@class"> + #@one + +
+} + end + def title_header1 + @tag,@class='h1','banner' + title_header + end + def title_header2 + @tag,@class='h2','banner' + title_header + end + def title_header3 + @tag,@class='h3','banner' + title_header + end + def title_header4 + %{ +
+ + +
+} + end + def subtoc_lev + one=if @one \ + and @one =~/<\/?i>|/mi + @one.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text + else @one + end + note='' + if one =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream + note=$1 + note.gsub!(/[\n\s]+/m,' ') + one.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') + one.gsub!(/ \d+<\/sup> /m,'') + end + %{<#@tag class="#@class"> + + #{one} + #{note} + } + end + def subtoc_lev5 + @tag,@class='h5','subtoc' + subtoc_lev if @one + end + def subtoc_lev6 + @tag,@class='h6','subtoc' + subtoc_lev if @one + end + #% para sisu + def header4 + %{ +
+#{@p_num.ocn_display} +

#{@p_num.name} + #@format + #@parablock +

+
+} + end + def header_sub + @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') + %{ +
+ #{@p_num.ocn_display} + <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname} + #{@parablock} + +
+} + end + def header5 + @tag,@class='p','bold' + header_sub + end + def header6 + @tag,@class='p','bold' + header_sub + end + def navigation_header4 + %{ +
+

+ #@parablock +

+#{@vz.table_close}} + end + def navigation_header5 + %{

+ #@parablock +

} + end + def navigation_header6 + %{

+ #@parablock +

} + end + def navigation_center + "
#@parablock
" + end + end + class Format_toc < Format_text_object + def initialize(md='',*txt) + super(md,*txt) + end + def links_guide + #@three distinguishes between _top and external, can be used e.g. for different colour scheme + %{
  • + + #@linkname + +
  • +} + end + def lev(tag,attrib) + %{<#{tag} class="#{attrib}"> + #@one + +} + end + def lev1 + lev('h1','toc') + end + def lev2 + lev('h2','toc') + end + def lev3 + lev('h3','toc') + end + def lev4 + lev('h4','toc') + end + def lev5 + lev('h5','toc') + end + def lev6 + lev('h6','toc') + end + def lev0 #docinfo + lev('h0','toc') + end + def mini_lev1 + lev('h1','minitoc') + end + def mini_lev2 + lev('h2','minitoc') + end + def mini_lev3 + lev('h3','minitoc') + end + def mini_lev4 + lev('h4','minitoc') + end + def mini_lev5 + lev('h5','minitoc') + end + def mini_lev6 + lev('h6','minitoc') + end + def mini_lev0 #docinfo + lev('h0','minitoc') + end end end __END__ diff --git a/lib/sisu/v0/html_format_css.rb b/lib/sisu/v0/html_format_css.rb deleted file mode 100644 index 1573d107..00000000 --- a/lib/sisu/v0/html_format_css.rb +++ /dev/null @@ -1,469 +0,0 @@ -# coding: utf-8 -=begin - - * Name: SiSU - - * Description: a framework for document structuring, publishing and search - - * Author: Ralph Amissah - - * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008 Ralph Amissah All Rights Reserved. - - * License: GPL 3 or later: - - SiSU, a framework for document structuring, publishing and search - - Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008 Ralph Amissah - - This program is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. - - You should have received a copy of the GNU General Public License along with - this program. If not, see . - - If you have Internet connection, the latest version of the GPL should be - available at these locations: - - - - - - - - * SiSU uses: - * Standard SiSU markup syntax, - * Standard SiSU meta-markup syntax, and the - * Standard SiSU object citation numbering and system - - * Hompages: - - - - * Download: - - - * Ralph Amissah - - - - ** Description: html formating, css template - -=end -module SiSU_HTML_Format_type - require "#{SiSU_lib}/html_format" - include SiSU_Viz - include SiSU_HTML_Format - class Head_toc < SiSU_HTML_Format::Head_toc - def initialize(md='') - super(md) - end - def head - %{#{doc_type} - - - #{@md.html_title} - - -#{@rdf.rdftoc} -#{@rdf.metatag_html} -#{@css.html} - -#{@vz.color_body} - - - -#{@vz.js_top}} - end - def concordance - if @md.concord_make - %{#{@vz.margin_css} -

    - - Concordance - -

    -#{@vz.table_close}} - else - %{#{@vz.margin_css} -#{@vz.table_close}} - end - end - def metadata - %{#{@vz.margin_css} -

    - - MetaData - -

    -#{@vz.table_close}} - end - end - class Head_seg < SiSU_HTML_Format::Head_seg - def initialize(md='') - super(md) - end - def head - %{#{doc_type} - - - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - - -#{@rdf.rdfseg} -#{@rdf.metatag_html} -#{@css.html} - -#{@vz.color_body} - - - -#{@vz.js_top}} - end - def toc_metadata - @metalink=%{./#{@md.fn[:meatadata]}} - toc_metadata - end - def title_banner(title,subtitle,creator) - %{

    - #{title} -

    -

    - #{subtitle} -

    -

    - #{creator} -

    -

    - copy @ - - #{@vz.txt_home} - -

    } - end - end - class Head_scroll < SiSU_HTML_Format::Head_scroll - def initialize(md='') - super(md) - end - end - class Format_scroll < SiSU_HTML_Format::Format_text_object - def initialize(md='',*txt) - super(md,*txt) - @vz=SiSU_Env::Get_init.instance.skin - end - def endnote_body - %{ -
    - -

    - #@one -

    -
    -} - end - def header_normal - %{ -
    - #{@p_num.ocn_display} - <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} - #@headname - #@parablock - -
    -} - end - def heading_body - @tag,@class='p','norm' - header_normal - end - def heading_body1 - @tag,@class='h1','norm' - header_normal - end - def heading_body2 - @tag,@class='h2','norm' - header_normal - end - def heading_body3 - @tag,@class='h3','norm' - header_normal - end - def heading_body4 - @tag,@class='h4','norm' - header_normal - end - def heading_body5 - @tag,@class='h5','norm' - header_normal - end - def heading_body6 - @tag,@class='h6','norm' - header_normal - end - end - class Format_seg < SiSU_HTML_Format::Format_text_object - def initialize(md='',*txt) - super(md,*txt) - end - def navigation_toc_lev1_advert - %{#{@banner.home_button}\n -
    -#@one -#@two -

    } - end - def navigation_toc_lev1 - %{#{@banner.nav_toc}} - end - def navigation_toc_lev2 #change bold use css - %{

    - - -
    - - - #@one - -

    -#{@vz.table_close}} - end - def navigation_toc_lev3 #change bold use css - %{

    - - -
    - - - #@one - -

    -#{@vz.table_close}} - end - def navigation_toc_lev4 - %{ - -
    - -

    - #@one -

    -#{@vz.table_close}} - end - def navigation_toc_lev5 - end - def navigation_toc_lev6 - end - def endnote_body_seg_tail #FIX - %{ -
    -

    - #@one -

    -
    -} - end - def endnote_body_seg_tail_indent - %{ -
    -

    - #@one -

    -
    -} - end - def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 - fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info - %{ -
    -

    - #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three -

    -
    -} - end - def title_header - %{ -
    - #@two -<#@tag class="#@class"> - #@one - -
    -} - end - def title_header1 - @tag,@class='h1','banner' - title_header - end - def title_header2 - @tag,@class='h2','banner' - title_header - end - def title_header3 - @tag,@class='h3','banner' - title_header - end - def title_header4 - %{ -
    - - -
    -} - end - def subtoc_lev - one=if @one \ - and @one =~/<\/?i>|/mi - @one.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text - else @one - end - note='' - if one =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream - note=$1 - note.gsub!(/[\n\s]+/m,' ') - one.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') - one.gsub!(/ \d+<\/sup> /m,'') - end - %{<#@tag class="#@class"> - - #{one} - #{note} - } - end - def subtoc_lev5 - @tag,@class='h5','subtoc' - subtoc_lev if @one - end - def subtoc_lev6 - @tag,@class='h6','subtoc' - subtoc_lev if @one - end - #% para sisu - def header4 - %{ -
    -#{@p_num.ocn_display} -

    #{@p_num.name} - #@format - #@parablock -

    -
    -} - end - def header_sub - @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') - %{ -
    - #{@p_num.ocn_display} - <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname} - #{@parablock} - -
    -} - end - def header5 - @tag,@class='p','bold' - header_sub - end - def header6 - @tag,@class='p','bold' - header_sub - end - def navigation_header4 - %{ - +

    #{@translate.suggested_links}:

    +
    -

    - #@parablock -

    -#{@vz.table_close}} - end - def navigation_header5 - %{

    - #@parablock -

    } - end - def navigation_header6 - %{

    - #@parablock -

    } - end - def navigation_center - "
    #@parablock
    " - end - end - class Format_toc < SiSU_HTML_Format::Format_text_object - def initialize(md='',*txt) - super(md,*txt) - end - def links_guide - #@three distinguishes between _top and external, can be used e.g. for different colour scheme - %{
  • - - #@linkname - -
  • -} - end - def lev(tag,attrib) - %{<#{tag} class="#{attrib}"> - #@one - -} - end - def lev1 - lev('h1','toc') - end - def lev2 - lev('h2','toc') - end - def lev3 - lev('h3','toc') - end - def lev4 - lev('h4','toc') - end - def lev5 - lev('h5','toc') - end - def lev6 - lev('h6','toc') - end - def lev0 #docinfo - lev('h0','toc') - end - def mini_lev1 - lev('h1','minitoc') - end - def mini_lev2 - lev('h2','minitoc') - end - def mini_lev3 - lev('h3','minitoc') - end - def mini_lev4 - lev('h4','minitoc') - end - def mini_lev5 - lev('h5','minitoc') - end - def mini_lev6 - lev('h6','minitoc') - end - def mini_lev0 #docinfo - lev('h0','minitoc') - end - end -end -__END__ diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 0bbac4fa..8b1e041c 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -102,12 +102,12 @@ module SiSU_HTML_scroll end if para =~/.+?#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ paranum=para[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1] - @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) end @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_scroll m=/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch case @sto.format when /^1:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body1 when /^2:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body2 @@ -138,20 +138,20 @@ module SiSU_HTML_scroll end elsif para =~/^#{Mx[:lv_o]}[1-9]:/ \ and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]}$/ - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,para) + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,para) para=format_txt_obj.bold_header elsif para =~/Endnotes?/ \ and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
    Note') + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,'
    Note') para=format_txt_obj.bold_para elsif para =~/Owner Details/ \ and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,'
    Owner Details') + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,'
    Owner Details') @scr[:owner_details]=format_txt_obj.bold_para para='' elsif para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ #watch one,two=$1,$2 - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) para=format_seg.no_paranum end if para =~// \ @@ -160,7 +160,7 @@ module SiSU_HTML_scroll end if para =~/<:center>/ #rules changed now a

    (.*)/.match(para).captures - format_scroll=SiSU_HTML_Format_type::Format_scroll.new(@md,one,two) + format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,one,two) end para.gsub!(/^#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/^<:\S?>/,'') para.gsub!(/#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/<:\S?>/,' '); para.gsub!(//,' ') @@ -174,7 +174,7 @@ module SiSU_HTML_scroll end def tails scr_tail=[] - format_head_scroll=SiSU_HTML_Format_type::Head_toc.new(@md) + format_head_scroll=SiSU_HTML_Format::Head_toc.new(@md) ads=SiSU_HTML_promo::Ad.new(@md) scr_tail << format_head_scroll.scroll_tail << ads.div.close << ads.display << format_head_scroll.html_close scr_tail diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 5b7ede63..c3617b24 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -197,7 +197,7 @@ module SiSU_HTML_seg data end def header_art(para) - format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) + format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if para =~/^#{Mx[:lv_o]}[1-6]:/ #2004w27/5 if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next else @@seg[:dot_nav]=format_head_seg.dot_control_pre @@ -208,7 +208,7 @@ module SiSU_HTML_seg end def head(para) clean=/|#{Mx[:gr_o]}:.*?#{Mx[:gr_c]}|<:.*?>|#{Mx[:id_o]}~\d+;(?:[ohum]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) + format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if @@tracker < @@seg_total-1 if @@tracker == 0; @@segtocband=format_head_seg.toc_next2 #if format_head_seg.toc_next2 else @@segtocband=format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2 @@ -220,13 +220,13 @@ module SiSU_HTML_seg @dc_creator=%{#{@md.dc_creator}\n} if @md.dc_creator.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) - @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format_type::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug + @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,@@header1,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,@@header1,@p_num.ocn_display) @@seg[:headers] << format_seg.title_header1.gsub(clean,'') @@header1.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') end @@ -235,8 +235,8 @@ module SiSU_HTML_seg paranum=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,header2,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,header2,@p_num.ocn_display) @@seg[:headers] << format_seg.title_header2.gsub(clean,'') @@header2.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') end @@ -245,8 +245,8 @@ module SiSU_HTML_seg paranum=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,header3,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,header3,@p_num.ocn_display) @@seg[:headers] << format_seg.title_header3.gsub(clean,'') @@header3.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') end @@ -255,8 +255,8 @@ module SiSU_HTML_seg paranum=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,header4,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,header4,@p_num.ocn_display) @@seg[:headers] << format_seg.title_header4.gsub(clean,'') end @@seg[:header_endnotes]=format_head_seg.title_endnote(@md.title,@md.subtitle,@dc_creator,@@seg[:dot_nav]) @@ -264,12 +264,12 @@ module SiSU_HTML_seg end def markup(para) @debug=[] - format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) + format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if para !~/^#{Rx[:meta]}/ m=para[/.+?#{Mx[:id_o]}~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] if m paranum=m[1].to_s - @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) end if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m \ or @@flag_alt==true @@ -293,13 +293,13 @@ module SiSU_HTML_seg if para !~/^#{Mx[:lv_o]}[1-9]:|#{Rx[:meta]}/ if para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ one,two=$1,$2 - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) para=format_seg.no_paranum end end if para[/#{Mx[:id_o]}~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp)#{Mx[:id_c]}$/] @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_seg - format_txt_obj=SiSU_HTML_Format_type::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn| when /^4:/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object when /^5:/; @sto.seg_lev_para_ocn.header5 @@ -341,13 +341,13 @@ module SiSU_HTML_seg if para !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m? one,two=$1,$2 - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) #FIX --> not that undefined, rather is not needed, should not be visited, and remove #para=format_seg.seg_no_paranum #% undefined end para.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint if para =~/ / #endnote- note- - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,para) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,para) para=format_seg.no_paranum end end @@ -363,7 +363,7 @@ module SiSU_HTML_seg end end def tail - format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) + format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if @md.flag_auto_endnotes @@seg[:tail] << format_head_seg.endnote_mark @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| @@ -437,11 +437,11 @@ module SiSU_HTML_seg case para # series changed 2002w42 when /^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #remove [u]? req by pg texts, revist one,two=$1,$2 - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) para=format_seg.subtoc_lev5 when /^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ one,two=$1,$2 - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) para=format_seg.subtoc_lev6 end @@seg_subtoc_array << para @@ -466,7 +466,7 @@ module SiSU_HTML_seg e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1] try=e_n.split(/
    /) try.each do |e| - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,e) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,e) note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ format_seg.endnote_body_seg_tail_indent else format_seg.endnote_body_seg_tail @@ -478,7 +478,7 @@ module SiSU_HTML_seg m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi one=note_match_seg[m,1] #note~ [a name] two=note_match_seg[m,2] #note- - format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) + format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg end diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index 506b5097..5a3993c6 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -62,7 +62,7 @@ module SiSU_Structure class Split_text_object include SiSU_Viz - #include SiSU_HTML_Format_type + #include SiSU_HTML_Format @@dp=nil attr_reader :format,:text,:ocn,:scroll_lev_para_ocn,:seg_lev_para_ocn,:lev_para_ocn def initialize(md,para) @@ -104,14 +104,14 @@ module SiSU_Structure def html_seg lev_segname_para_ocn @seg_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] - SiSU_HTML_Format_type::Format_seg.new(@md,@format,@text,@ocn) + SiSU_HTML_Format::Format_seg.new(@md,@format,@text,@ocn) end self end def html_scroll lev_segname_para_ocn @scroll_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] - SiSU_HTML_Format_type::Format_scroll.new(@md,@format,@text,@ocn) + SiSU_HTML_Format::Format_scroll.new(@md,@format,@text,@ocn) end self end -- cgit v1.2.3 From e2fb7c3734fd1b7ad789a5cae42a87fb16704a9a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Aug 2008 20:18:57 -0400 Subject: texpdf, fix: image dimension match (for post 0.68.0 changed middle layer representation) --- lib/sisu/v0/texpdf_format.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index a3f2f7d2..f776dd5a 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -460,7 +460,7 @@ para z,url=regx_url.match(word).captures if word =~regx_url url=url.strip if word =~/#{Mx[:lnk_o]}\s*\S+\.?(?:png|jpg|gif)/ \ - and word=~/\s+\d+x\d+\s+/ + and word=~/\s+\d+x\d+(\s+|\s*#{Mx[:lnk_c]})/ image,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') width=if z =~/(\d+)x\d*/ -- cgit v1.2.3 From afb83150d0b9876006bc100517b60be9e2fd0f56 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 16 Aug 2008 00:21:01 -0400 Subject: html css and div related --- lib/sisu/v0/css.rb | 9 ++++- lib/sisu/v0/html.rb | 7 ++-- lib/sisu/v0/html_format.rb | 78 +++++++++++++++++++++++++++++++------------- lib/sisu/v0/html_scroll.rb | 1 + lib/sisu/v0/html_segments.rb | 19 ++++++++--- lib/sisu/v0/html_tune.rb | 1 - 6 files changed, 82 insertions(+), 33 deletions(-) diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index f4dfc15f..1eef5023 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -742,7 +742,7 @@ WOK margin-bottom: 0px; } - div.substance { + div.substance, div.main_column { width: 100%; background-color: #ffffff; } @@ -804,6 +804,9 @@ WOK padding-left: 0.5em; color: #0000aa; } + hr { + width: 90%; + } span.currentlink { text-decoration: none; @@ -843,6 +846,10 @@ WOK margin-left: 2em; font-size: 85%; } + h0.minitoc { + margin-left: 0em; + font-size: 90%; + } h1.c, h2.c, h3.c, h4.c, h5.c, h6.c, p.c { text-align: center diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index e882627c..e57b5add 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -358,8 +358,8 @@ WOK format_toc.lev0 else format_toc.lev1 end - toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ - format_toc.lev0 + toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ + format_toc.mini_lev0 else format_toc.mini_lev1 end title=if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ @@ -582,6 +582,7 @@ WOK prefix_b=SiSU_Tune::Clean_html.new(prefix_b).clean end @seg_toc_band=format_head_toc.seg_head_navigation_band('pdf') #bug, vary depending on type of doc !! examine + @seg_toc_band_bottom=format_head_toc.seg_head_navigation_band_bottom('pdf') #bug, vary depending on type of doc !! examine @segtoc << @seg_toc_band toc_shared << format_head_toc.scroll_head_title_banner_open @segtoc << format_head_toc.seg_head_title_banner_open @@ -627,7 +628,7 @@ WOK @segtoc << prefix_b if @md.prefix_b #Segtoc tail added here @segtoc << "

    \n" #bugfix sort later DEBUGNOW - @segtoc << @seg_toc_band + @segtoc << @seg_toc_band_bottom ads=SiSU_HTML_promo::Ad.new(@md) @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close @segtoc.flatten!.compact! diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 87988ec1..1ee409ab 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -333,6 +333,25 @@ WOK
     #{firstseg}  #{@vz.table_close} +

    } + end + def seg_head_navigation_band_bottom(type='') + if type=~/pdf/ + @tocband_segtoc=make_scroll_seg_pdf + end + firstseg=%{ + #{@vz.png_nav_nxt} + } if @md.firstseg =~/\S+/ + %{ + + +
    +   + + #@tocband_segtoc + +  #{firstseg}  +#{@vz.table_close}

    } end def manifest_link(text) @@ -572,7 +591,9 @@ WOK metadata end def seg_tail - %{

     

    + %{ +

    +

     

    #{@vz.banner_band} @@ -591,11 +612,15 @@ WOK -} + + +} end def scroll_tail #debug nav=scroll_head_navigation_band - %{#{nav} + %{ +
    +#{nav} #{@vz.credits_splash} #{@vz.credits_sisu} @@ -604,11 +629,13 @@ WOK -
    } +} end def seg_navigation_tail #this is a bug area, look up and "tidy" #nav=scroll_head_navigation_band - %{

     

    + %{ +
    +

     

    #{@vz.credits_splash} #{@vz.credits_sisu} @@ -616,7 +643,9 @@ WOK -} + +
    +} end end class Head_seg < Head_information @@ -864,7 +893,9 @@ WOK } end def credit - %{#{@vz.credits_splash} + %{ +
    +#{@vz.credits_splash} #{@vz.credits_sisu} @@ -891,8 +922,7 @@ WOK end def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless %{ -
    -

    +

    #{doc_types} @@ -902,13 +932,24 @@ WOK
    #{seg_table_top_control} -

    } end def endnote_mark -%{

    -

    } #revisit +%{ +

    +


    +

    } + end + def endnote_section_open +%{ +
    +} + end + def endnote_section_close +%{ +
    +} #revisit end def head %{#{doc_type} @@ -1177,12 +1218,9 @@ WOK end def endnote_body %{ -
    - -

    +

    #@one -

    -
    +

    } end def header_normal @@ -1279,30 +1317,24 @@ WOK end def endnote_body_seg_tail #FIX %{ -

    #@one

    -
    } end def endnote_body_seg_tail_indent %{ -

    #@one

    -
    } end def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{ -

    #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three

    -
    } end def title_header diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 8b1e041c..93e30494 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -97,6 +97,7 @@ module SiSU_HTML_scroll and (para =~/^#{Mx[:lv_o]}:metadata#{Mx[:lv_c]}/ or para =~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}\s*Document Information/) @rcdc=true end + para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'


    ') if para !~/(^#{Rx[:meta]}|#{Mx[:br_endnotes]}|#{Mx[:br_eof]})/ unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') end diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index c3617b24..c4d136b7 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -141,7 +141,9 @@ module SiSU_HTML_seg end end if @@is4 == 1 \ - or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ + or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ \ + or para =~/^#{Mx[:mk_o]}4:metadata#{Mx[:mk_c]}/ + m=para[/^#{Mx[:lv_o]}4:(metadata)#{Mx[:lv_c]}/]; @@get_hash_fn=$1 if m if newfile == 1 \ or para =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 @@ -219,7 +221,11 @@ module SiSU_HTML_seg if @@is1 == 1 @dc_creator=%{#{@md.dc_creator}\n} if @md.dc_creator.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) - @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + endnote_section_close=unless @@get_hash_fn =~/metadata/ + format_head_seg.endnote_section_close + else '' + end + @@seg[:tocband_bannerless] << endnote_section_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 @@ -364,9 +370,12 @@ module SiSU_HTML_seg end def tail format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) - if @md.flag_auto_endnotes - @@seg[:tail] << format_head_seg.endnote_mark - @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| + if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] + @@seg[:tail] << format_head_seg.endnote_section_open + if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 + @@seg[:tail] << format_head_seg.endnote_mark + @@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| + end end #@@seg[:tail] << '
     
    ' ads=SiSU_HTML_promo::Ad.new(@md) diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 9cc50b23..f06b8764 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -236,7 +236,6 @@ module SiSU_Tune para.gsub!(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;') para.gsub!(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
    ') - para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'


    ') # else clean '' para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') -- cgit v1.2.3 From 89d5ace0572e2ec228ef9ba6702e590309f1f086 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 16 Aug 2008 11:09:06 -0400 Subject: html segments, links to concordance file only if made, fix --- lib/sisu/v0/html.rb | 2 +- lib/sisu/v0/html_format.rb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index e57b5add..28098f6c 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -359,7 +359,7 @@ WOK else format_toc.lev1 end toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ - format_toc.mini_lev0 + format_toc.mini_tail else format_toc.mini_lev1 end title=if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 1ee409ab..0bfe580e 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -764,6 +764,7 @@ WOK scroll=seg='' wgt=Widget.new(@md) #dir=SiSU_Env::Info_env.new(@md.fns) + x=if @md.concord_make %{ @@ -776,6 +777,19 @@ WOK #{wgt.search} #{wgt.home}
    } + else + %{ + + + #{wgt.seg(@vz.nav_txt_toc_link)} + #{wgt.scroll(@vz.nav_txt_doc_link)} + #{wgt.pdf}#{wgt.odf} +
    + #{wgt.manifest} + #{wgt.search} + #{wgt.home} +
    } + end end def toc_pre_next3 #used with seg_doc_types in seg_nav_band #with pdf & other doc types #knxjs %{ @@ -1510,6 +1524,27 @@ WOK def mini_lev0 #docinfo lev('h0','minitoc') end + def mini_tail +# +# Document Information (metadata) +# + x=if @md.concord_make + %{ +

    + Concordance (wordlist) +

    +

    + Manifest (alternative outputs) +

    +} + else + %{ +

    + Manifest (alternative outputs) +

    +} + end + end end end __END__ -- cgit v1.2.3 From 0ec2677657a7199d5210d9e013fe62334c83f71a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 17 Aug 2008 01:18:19 -0400 Subject: html segments structure and info provided (a bit verbose), and css --- lib/sisu/v0/css.rb | 260 ++---------------------------------- lib/sisu/v0/html.rb | 5 +- lib/sisu/v0/html_format.rb | 304 ++++++++++++++++++------------------------- lib/sisu/v0/html_segments.rb | 15 ++- 4 files changed, 149 insertions(+), 435 deletions(-) diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index 1eef5023..449f51d8 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -285,7 +285,7 @@ WOK text-align: left; } - p.tiny, p.tiny_left, p.tiny_right, p.tiny_center { + .tiny, .tiny_left, .tiny_right, .tiny_center { font-size: 10px; margin-top: 0px; margin-bottom: 0px; @@ -634,6 +634,7 @@ WOK margin-top: 20px; margin-bottom: 10px; } + h1.banner { font-size: 120%; } @@ -767,6 +768,13 @@ WOK background-color: #eeeeee; margin-right:1em; } + div.summary { + margin: 0; + padding: 0; + border-left: 13em solid #eeeeee; + padding-left: 1em; + background-color: #eeeeee; + } div.content { margin: 0; padding: 0; @@ -913,256 +921,6 @@ WOK } #column_right p { font-size:12px} #banner h1 { margin:0px; padding:10px} -WOK - end - def html_bk #stylesheet for html... check use -< */ -/* - -*/ -/* subtoc --> */ - p.subtoc4 { - font-size: x-small; - text-align: left; - line-height: 100%; - margin-left: 10%; - margin-right: 10%; - margin-top: 5px; - margin-bottom: 5px; - } - p.subtoc5 { - font-size: x-small; - text-align: left; - line-height: 100%; - margin-left: 15%; - margin-right: 10%; - margin-top: 5px; - margin-bottom: 5px; - } - p.subtoc6 { - font-size: x-small; - text-align: left; - line-height: 100%; - margin-left: 20%; - margin-right: 10%; - margin-top: 5px; - margin-bottom: 5px; - } - p.ocn { - display: block; - text-align: right; - vertical-align: super; - color: #999999; - font-size: xx-small; - margin-right: 0mm; - margin-top: 0px; - margin-bottom: 0px; - } - p.note { - display: block; - font-size: small; - font-family: #{fonts}; - font-weight: normal; - line-height: 150%; - text-align: justify; - margin-left: 10%; - margin-right: 5%; - margin-top: 4px; - margin-bottom: 0px; - } - en { - font-size: xx-small; - vertical-align: super; - } - i { font-style: italic; } - b { font-style: bold; } - u { text-decoration: underline; } - br { display: block; } WOK end def xhtml #stylesheet for xhtml diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 28098f6c..fd2294ba 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -359,7 +359,10 @@ WOK else format_toc.lev1 end toc[:seg_mini]=if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ - format_toc.mini_tail + x=if @md.concord_make + format_toc.mini_concord_tail + else format_toc.mini_tail + end else format_toc.mini_lev1 end title=if para =~/(#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/ diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 0bfe580e..4992dc6d 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -765,7 +765,7 @@ WOK wgt=Widget.new(@md) #dir=SiSU_Env::Info_env.new(@md.fns) x=if @md.concord_make - %{ + %{
    #{wgt.seg(@vz.nav_txt_toc_link)} @@ -988,7 +988,9 @@ WOK toc_metadata end def title_banner(title,subtitle,creator) - %{

    + %{ +

    +

    #{title}

    @@ -1002,7 +1004,9 @@ WOK #{@vz.txt_home} -

    } +

    +
    +} end end class Head_scroll < Head_toc @@ -1055,7 +1059,7 @@ WOK # ##{@vz.table_close}} # end - def title_endnote + def title_endnote #revisit # %{#{@vz.margin_txt_0} # #{@vz.paragraph_txt} # @@ -1063,37 +1067,6 @@ WOK #   ##{@vz.table_close}} end -# def tail -# %{
    -##{@vz.margin_txt_0} -#
    -# -# -#
    -##{@vz.banner_band} -# -#
    #@tocband_scroll
    -#
    -#
    -##{@vz.paragraph_txt} -#
    -# #{@vz.credits_splash} -# #{@vz.credits_sisu} -#
    -##{@vz.margin_num} -##{@vz.table_close} -# -# -# -# -# -# -# -# #{@md.title*10} -# -# -#} -# end end class Format_text_object @vz=SiSU_Env::Get_init.instance.skin @@ -1130,6 +1103,30 @@ WOK end @vz=SiSU_Env::Get_init.instance.skin end + def endnote_body + %{ +

    + #@one +

    +} + end + def endnote_body_indent + %{ +

    + #@one +

    +} + end + def no_paranum + %{ +
    + +

    + #@one #@two +

    +
    +} + end def para_form_css(tag,attrib) # regular paragraphs shaped here ul=ulc='' ul,ulc="
      \n ","\n
    " if @tag =~/li/ @@ -1157,26 +1154,80 @@ WOK def bullet para_form_css('li','bullet') end - def format(tag,atrib) - para_form_css(tag,atrib) + def format(tag,attrib) + para_form_css(tag,attrib) end - def dl - "
    #@one #@two
    " + + def header_normal(tag,attrib) + %{ +
    + #{@p_num.ocn_display} + <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} + #@headname + #@parablock + +
    +} end - def table_css_end # - '
    -

    -
    ' + def heading_body + header_normal('p','norm') end - def no_paranum + def heading_body1 + header_normal('h1','norm') + end + def heading_body2 + header_normal('h2','norm') + end + def heading_body3 + header_normal('h3','norm') + end + def heading_body4 + header_normal('h4','norm') + end + def heading_body5 + header_normal('h5','norm') + end + def heading_body6 + header_normal('h6','norm') + end + def title_header(tag,attrib) + %{ +
    +<#{tag} class="#{attrib}"> + #@one + +
    +} + end + def title_header1 + title_header('h1','tiny') + end + def title_header2 + title_header('h2','tiny') + end + def title_header3 + title_header('h3','tiny') + end + def title_header4 + '' + end + def title_header4_old %{
    -

    - #@one #@two -

    +
    } + end + def dl + "
    #@one #@two
    " + end + def table_css_end # + '
    +

    + ' end def gsub_body case @one @@ -1230,52 +1281,6 @@ WOK super(md,*txt) @vz=SiSU_Env::Get_init.instance.skin end - def endnote_body - %{ -

    - #@one -

    -} - end - def header_normal - %{ -
    - #{@p_num.ocn_display} - <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} - #@headname - #@parablock - -
    -} - end - def heading_body - @tag,@class='p','norm' - header_normal - end - def heading_body1 - @tag,@class='h1','norm' - header_normal - end - def heading_body2 - @tag,@class='h2','norm' - header_normal - end - def heading_body3 - @tag,@class='h3','norm' - header_normal - end - def heading_body4 - @tag,@class='h4','norm' - header_normal - end - def heading_body5 - @tag,@class='h5','norm' - header_normal - end - def heading_body6 - @tag,@class='h6','norm' - header_normal - end end class Format_seg < Format_text_object def initialize(md='',*txt) @@ -1328,20 +1333,6 @@ WOK def navigation_toc_lev5 end def navigation_toc_lev6 - end - def endnote_body_seg_tail #FIX - %{ -

    - #@one -

    -} - end - def endnote_body_seg_tail_indent - %{ -

    - #@one -

    -} end def endnote_seg_body(fn='') #FIX #url construction keep within single line... BUG WATCH 200408 fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info @@ -1351,39 +1342,7 @@ WOK

    } end - def title_header - %{ -
    - #@two -<#@tag class="#@class"> - #@one - -
    -} - end - def title_header1 - @tag,@class='h1','banner' - title_header - end - def title_header2 - @tag,@class='h2','banner' - title_header - end - def title_header3 - @tag,@class='h3','banner' - title_header - end - def title_header4 - %{ -
    - - -
    -} - end - def subtoc_lev + def subtoc_lev(tag,attrib) one=if @one \ and @one =~/<\/?i>|/mi @one.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text @@ -1396,50 +1355,44 @@ WOK one.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') one.gsub!(/ \d+<\/sup> /m,'') end - %{<#@tag class="#@class"> - - #{one} - #{note} - } + %{<#{tag} class="#{attrib}"> + #{one} #{note} + } end def subtoc_lev5 - @tag,@class='h5','subtoc' - subtoc_lev if @one + subtoc_lev('h5','subtoc') if @one end def subtoc_lev6 - @tag,@class='h6','subtoc' - subtoc_lev if @one + subtoc_lev('h6','subtoc') if @one end #% para sisu - def header4 - %{ -
    -#{@p_num.ocn_display} -

    #{@p_num.name} - #@format - #@parablock -

    -
    -} - end - def header_sub + def header_sub(tag,attrib) @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') %{
    - #{@p_num.ocn_display} - <#@tag class="#@class" #{@p_num.id}>#{@p_num.name} #{@headname} + #{@p_num.ocn_display} + <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #{@headname} #{@parablock} - +
    } end def header5 - @tag,@class='p','bold' - header_sub + header_sub('p','bold') end def header6 - @tag,@class='p','bold' - header_sub + header_sub('p','bold') + end + def header4 + %{ +
    + #{@p_num.ocn_display} +

    #{@p_num.name} + #@format + #@parablock +

    +
    +} end def navigation_header4 %{ @@ -1528,22 +1481,21 @@ WOK # # Document Information (metadata) # - x=if @md.concord_make - %{ -

    - Concordance (wordlist) -

    + %{

    Manifest (alternative outputs)

    } - else - %{ + end + def mini_concord_tail + %{ +

    + Concordance (wordlist) +

    Manifest (alternative outputs)

    } - end end end end diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index c4d136b7..db387105 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -221,11 +221,11 @@ module SiSU_HTML_seg if @@is1 == 1 @dc_creator=%{#{@md.dc_creator}\n} if @md.dc_creator.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) - endnote_section_close=unless @@get_hash_fn =~/metadata/ - format_head_seg.endnote_section_close + conditional_div_close=unless @@get_hash_fn =~/metadata/ #watch + '' else '' end - @@seg[:tocband_bannerless] << endnote_section_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 @@ -270,6 +270,7 @@ module SiSU_HTML_seg end def markup(para) @debug=[] + para.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'') format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if para !~/^#{Rx[:meta]}/ m=para[/.+?#{Mx[:id_o]}~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] @@ -386,9 +387,9 @@ module SiSU_HTML_seg filename_seg=[] filename_seg << @@seg[:title] << @@seg[:tocband_banner] if type !~/endnote/ - filename_seg << @@minitoc << @@seg[:main] + filename_seg << @@minitoc << @@seg[:headers] << @@seg[:main] else - filename_seg << @@seg[:header_endnotes] << @@minitoc << %{\n
    \n} << @@seg[:endnote_all] + filename_seg << @@seg[:header_endnotes] << @@minitoc << @@seg[:headers] << %{\n
    \n} << @@seg[:endnote_all] #<< '
    ' end filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits] filename_seg.flatten!.compact! @@ -477,8 +478,8 @@ module SiSU_HTML_seg try.each do |e| format_seg=SiSU_HTML_Format::Format_seg.new(@md,e) note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ - format_seg.endnote_body_seg_tail_indent - else format_seg.endnote_body_seg_tail + format_seg.endnote_body_indent + else format_seg.endnote_body end @@seg_endnotes_array << note_match end -- cgit v1.2.3 From 0c15db877ebd266b5f25af1aa1b185eb9ec392f6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 17 Aug 2008 18:17:30 -0400 Subject: html document structure, div markers, watch --- lib/sisu/v0/html_format.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 4992dc6d..8fcd1e25 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -614,6 +614,8 @@ WOK
    + + } end def scroll_tail #debug @@ -629,7 +631,10 @@ WOK -} + + + +} end def seg_navigation_tail #this is a bug area, look up and "tidy" #nav=scroll_head_navigation_band @@ -645,6 +650,8 @@ WOK + + } end end @@ -918,6 +925,8 @@ WOK + + } end def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner -- cgit v1.2.3 From d74651a9c0102cc55a6b495eb4e2f12d3fca7795 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 17 Aug 2008 23:17:25 -0400 Subject: rsync, replace --delete-after with --delete apparently not all versions of rsync accept more specific option --- lib/sisu/v0/sysenv.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index a259d991..ed0012e2 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -712,6 +712,7 @@ module SiSU_Env end def scp program='scp' + puts "scp -Cr #@input #@output" if @cmd =~/[vVM]/ if program_found?(program); system("scp -Cr #@input #@output") else puts "\tWARN: #{program} not found" end @@ -725,6 +726,7 @@ module SiSU_Env end msg='' msg=" && echo 'OK: #@input -> #@output'" unless @cmd =~/q/ + puts "rsync -az#{vb} #{action} #@input #@output" if @cmd =~/[vVM]/ system("rsync -az#{vb} #{action} #@input #@output #{msg}") else puts "\tWARN: #{program} not found" end @@ -2469,7 +2471,8 @@ WOK and remote_gen !~/\/\//) \ and @@flag_remote==true \ and @opt.cmd !~/U/ - System_call.new(local_gen,remote_gen,@opt.cmd).rsync('--delete-after') + delete_extra_files='--delete' # '--delete-after' + System_call.new(local_gen,remote_gen,@opt.cmd).rsync(delete_extra_files) if FileTest.file?("#{local_src}/#{src_txt}") System_call.new("#{local_src}/#{src_txt}",remote_src,@opt.cmd).rsync if defined? @md.ec[:image] and not @md.ec[:image].empty? @@ -2569,10 +2572,11 @@ WOK and @rc['permission_set']['remote_base_site'] \ and @@flag_remote==true \ and @opt.cmd !~/U/ + delete_extra_files='--delete' # '--delete-after' puts "begin rsync_base_sync: #{local} -> #{remote}" - System_call.new("#{local}/_sisu/image_sys/",remote).rsync('--delete-after') - System_call.new("#{local}/_sisu/image/",remote).rsync('--delete-after') - System_call.new("#{local}/#{@env.path.style}/",remote).rsync('--delete-after') + System_call.new("#{local}/_sisu/image_sys/",remote).rsync(delete_extra_files) + System_call.new("#{local}/_sisu/image/",remote).rsync(delete_extra_files) + System_call.new("#{local}/#{@env.path.style}/",remote).rsync(delete_extra_files) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_base_sync: #{local} -> #{remote}" @@ -2589,7 +2593,8 @@ WOK remote="#{remote_conn[:name]}/#{@env.path.stub_pwd}/." if @@flag_remote #if defined? @rc['permission_set']['remote_base_site'] and @rc['permission_set']['remote_base_site'] #and @@flag_remote==true and @opt.cmd !~/U/ - System_call.new(local,remote).rsync('--delete-after') + delete_extra_files='--delete' # '--delete-after' + System_call.new(local,remote).rsync(delete_extra_files) elsif @opt.cmd =~/U/ puts "#{__FILE__} #{__LINE__}" if @opt.cmd =~/M/ puts "rsync_sitemaps: #{local} -> #{remote}" -- cgit v1.2.3 From 5787bd8ec03e93e90dd90d5fbcb66bdb49a07a84 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 18 Aug 2008 23:41:37 -0400 Subject: a bit of a cleanup, and change reference to null to ordinary --- lib/sisu/v0/html_format.rb | 67 +++++++--------------------------------- lib/sisu/v0/html_scroll.rb | 4 +-- lib/sisu/v0/html_segments.rb | 6 ++-- lib/sisu/v0/manpage.rb | 19 ------------ lib/sisu/v0/odf.rb | 20 ------------ lib/sisu/v0/plaintext.rb | 19 ------------ lib/sisu/v0/shared_structure.rb | 2 +- lib/sisu/v0/shared_txt.rb | 3 +- lib/sisu/v0/sst_to_s_xml_dom.rb | 21 +------------ lib/sisu/v0/sst_to_s_xml_node.rb | 50 +----------------------------- lib/sisu/v0/sst_to_s_xml_sax.rb | 21 +------------ lib/sisu/v0/wikispeak.rb | 2 +- lib/sisu/v0/xhtml.rb | 2 +- lib/sisu/v0/xml.rb | 2 +- lib/sisu/v0/xml_dom.rb | 2 +- 15 files changed, 24 insertions(+), 216 deletions(-) diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 8fcd1e25..af36dc30 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -79,6 +79,9 @@ module SiSU_HTML_Format ocn_class='ocn_off' @paranum.gsub(/^(\d+|)$/, %{}) + elsif @paranum.to_i == 0 + @paranum.gsub(/^(\d+|)$/, + %{}) else ocn_class='ocn' @paranum.gsub(/^(\d+|)$/, @@ -798,51 +801,6 @@ WOK
    } end end - def toc_pre_next3 #used with seg_doc_types in seg_nav_band #with pdf & other doc types #knxjs - %{ - - -\n} + @manifest[:html] << %{\n} end def output_tests if FileTest.file?("#@base_path/#{@md.fn[:toc]}")==true @@ -568,16 +569,26 @@ SiSU manifest: #{@md.title} #{minitoc.to_s}
    -

    #{@md.dc_title}

    +

    #{@translate.manifest_description}

    +

    #{@md.dc_title}

    #{@md.dc_creator}

    +

    +  Document, Available Filetypes +

    +

    +  Document Metadata +

    +

    +      (metadata suggested links (if any) +

    - - #{@vz.png_nav_previous} - - - - #{@vz.png_nav_toc} - - - - #{@vz.png_nav_next} - -#{@vz.table_close}} - end - def toc_next3 #used with seg_doc_types in seg_nav_band #with pdf & other doc types #knxjs - %{ - - -
    - - #{@vz.png_nav_toc} - - - - #{@vz.png_nav_next} - -#{@vz.table_close}} - end - def toc_pre3 #used with seg_doc_types in seg_nav_band #with pdf and other doc types #knxjs - # note endnotes is now two back, with insertion between end of text and metadata, but what happens where no endnote? - %{ - -
    - - #{@vz.png_nav_previous} - - - #{@vz.png_nav_toc} - -#{@vz.table_close}} - end def title_endnote(title,subtitle,creator,table_top_control) # %{#{@vz.banner_instrument_cover_band_seg} #

    @@ -1088,19 +1046,12 @@ WOK @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern rgx=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ #problem introduced @one_stripped=@one.gsub(rgx,'\1') if @one =~rgx #problem introduced - @link,@linkname=txt[0],txt[1] - @format,parablock=txt[0],txt[1] - @parablock=parablock - ##performance hit does not justify action: - #@parablock=if parablock=~/\S+/ and parablock !~/ + if @one + %{<#{tag} class="#{attrib}"> #@one } + else '' + end end def lev1 lev('h1','toc') diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 93e30494..01720862 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -108,7 +108,7 @@ module SiSU_HTML_scroll @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_scroll m=/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ #watch case @sto.format when /^1:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body1 when /^2:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body2 @@ -127,7 +127,7 @@ module SiSU_HTML_scroll when /^(?:b|bold)$/; para=@sto.scroll_lev_para_ocn.bold when /^(?:verse|group|alt)$/; para=@sto.scroll_lev_para_ocn.para when /^code$/; para=@sto.scroll_lev_para_ocn.code - when /null/ # see whether u can improve + when /ordinary/ # see whether u can improve if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ format_txt_obj.gsub_body para=@sto.scroll_lev_para_ocn.para diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index db387105..7a4a4fb6 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -306,7 +306,7 @@ module SiSU_HTML_seg end if para[/#{Mx[:id_o]}~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp)#{Mx[:id_c]}$/] @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_seg - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ #watch + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ #watch para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn| when /^4:/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object when /^5:/; @sto.seg_lev_para_ocn.header5 @@ -323,7 +323,7 @@ module SiSU_HTML_seg @sto.seg_lev_para_ocn.para when /^code$/ @sto.seg_lev_para_ocn.code - when /null/ + when /ordinary/ if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ \ and para !~/^#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ format_txt_obj.gsub_body @@ -349,8 +349,6 @@ module SiSU_HTML_seg if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m? one,two=$1,$2 format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) -#FIX --> not that undefined, rather is not needed, should not be visited, and remove - #para=format_seg.seg_no_paranum #% undefined end para.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint if para =~/ / #endnote- note- diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index edbb55f9..fb6f6b2e 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -369,25 +369,6 @@ WOK when /^(6):(\S*)/ manpage_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body6 - #when /^(i1)$/ - # #formatMono.gsubBody - # #para=@sto[:lev_para_ocn].scrIndent1 - #when /^(i2)$/ - # formatMono.gsubBody - # para=@sto[:lev_para_ocn].scrIndent2 - #when /^(center)$/ - # para.gsub!(/(.+)/, - # %{
    (\\1)
    }) - # para=@sto[:lev_para_ocn].scrPara - #when /^(b|bold)$/ - # para.gsub!(/(.+)/, - # %{(\\1)}) - # para=@sto[:lev_para_ocn].scrPara - #when /null/ # see whether u can improve - # if (para !~/#{@margin.txt_0}|#{@margin.txt_1}|#{@margin.txt_2}/) - # #formatMono.gsubBody - # #para=@sto[:lev_para_ocn].scrPara - # end else manpage_structure(para,nil,nil,nil) #watch may be problematic para diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index f3e3385f..9fb6b51e 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -533,26 +533,6 @@ module SiSU_ODF when /^(6):(\S*)/ odf_structure(para,$1,@sto.ocn,$2) para - #@sto.lev_para_ocn.heading_body6 - #when /^(i1)$/ - # #formatMono.gsubBody - # #para=@sto[:lev_para_ocn].scrIndent1 - #when /^(i2)$/ - # formatMono.gsubBody - # para=@sto[:lev_para_ocn].scrIndent2 - #when /^(center)$/ - # para.gsub!(/(.+)/, - # %{
    (\\1)
    }) - # para=@sto[:lev_para_ocn].scrPara - #when /^(b|bold)$/ - # para.gsub!(/(.+)/, - # %{(\\1)}) - # para=@sto[:lev_para_ocn].scrPara - #when /null/ # see whether u can improve - # if (para !~/#{@margin.txt_0}|#{@margin.txt_1}|#{@margin.txt_2}/) - # #formatMono.gsubBody - # #para=@sto[:lev_para_ocn].scrPara - # end else odf_structure(para,nil,nil,nil) #watch may be problematic para end diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 6378c2d5..9a246e49 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -360,25 +360,6 @@ WOK when /^(6):(\S*?)/ plaintext_structure(para,$1,@sto.ocn,$2) @sto.lev_para_ocn.heading_body6 - #when /^(i1)$/ - # #formatMono.gsubBody - # #para=@sto[:lev_para_ocn].scrIndent1 - #when /^(i2)$/ - # formatMono.gsubBody - # para=@sto[:lev_para_ocn].scrIndent2 - #when /^(center)$/ - # para.gsub!(/(.+)/, - # %{
    (\\1)
    }) - # para=@sto[:lev_para_ocn].scrPara - #when /^(b|bold)$/ - # para.gsub!(/(.+)/, - # %{(\\1)}) - # para=@sto[:lev_para_ocn].scrPara - #when /null/ # see whether u can improve - # if (para !~/#{@margin.txt_0}|#{@margin.txt_1}|#{@margin.txt_2}/) - # #formatMono.gsubBody - # #para=@sto[:lev_para_ocn].scrPara - # end else plaintext_structure(para,nil,nil,nil) #watch may be problematic para diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index 5a3993c6..cdfe9bf3 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -67,7 +67,7 @@ module SiSU_Structure attr_reader :format,:text,:ocn,:scroll_lev_para_ocn,:seg_lev_para_ocn,:lev_para_ocn def initialize(md,para) @md,@para=md,para - @format,@ocn='null','null' + @format,@ocn='ordinary','ordinary' #@format,@ocn=nil,nil @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern end diff --git a/lib/sisu/v0/shared_txt.rb b/lib/sisu/v0/shared_txt.rb index 484a5f05..41d6d815 100644 --- a/lib/sisu/v0/shared_txt.rb +++ b/lib/sisu/v0/shared_txt.rb @@ -228,8 +228,7 @@ module SiSU_text_parts_flatfile attr_reader :format,:text,:ocn,:lev_para_ocn def initialize(md,para) @md,@para=md,para - @format,@ocn='null','null' - #@format,@ocn=nil,nil + @format,@ocn='ordinary','ordinary' @@dl ||=SiSU_Env::Info_env.new.digest.length end def lev_segname_para_ocn diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 5976d82b..efb60a88 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -386,7 +386,7 @@ WOK @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc if para !~/^(?:%\s|0~|@\S+?:)/ - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_clean(para) @@ -412,25 +412,6 @@ WOK xml_clean(para) xml_structure($1,para,$2) para=@sto.lev_para_ocn.heading_body6 - #when /^(i1)$/i - # #format_scroll.gsubBody - # #para=@sto.lev_para_ocn.scrIndent1 - #when /^(i2)$/i - # format_scroll.gsubBody - # para=@sto.lev_para_ocn.scrIndent2 - #when /^(center)$/i - # para.gsub!(/(.+)/, - # %{
    (\\1)
    }) - # para=@sto.lev_para_ocn.scrPara - #when /^(b|bold)$/i - # para.gsub!(/(.+)/, - # %{(\\1)}) - # para=@sto.lev_para_ocn.scrPara - #when /null/ # see whether u can improve - # if (para !~/#{@margin.txt_0}|#{@margin.txt_1}|#{@margin.txt_2}/) - # #format_scroll.gsubBody - # #para=@sto.lev_para_ocn.scrPara - # end else if para =~ /<:verse>/ para=poem_structure(para) diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index ed7f4b10..d9451149 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -440,54 +440,6 @@ WOK end end end - #obj.each do |o| - # para=o.txt unless o.txt =~/^%% / #comments are lost, consider - # if para - # para.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\1') - # para.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\1') - # para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') - # para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') - # para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_paragraph]}/,'
    ') - # if @rcdc==false \ - # and (para =~/~metadata/ or para =~/^1~meta\s+Document Information/) - # if para !~/(^0~|^@\S+?:|^\s*$||)/ - # @rcdc=true - # end - # @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para - # unless @rcdc - # format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ - # case @sto.format - # when /^(1):(\S*)/ - # node_structure(o,para,$1,$2) - # when /^(2):(\S*)/ - # node_structure(o,para,$1,$2) - # when /^(3):(\S*)/ - # node_structure(o,para,$1,$2) - # when /^(4):(\S*)/ # work on see Split_text_object - # node_structure(o,para,$1,$2) - # when /^(5):(\S*)/ - # node_structure(o,para,$1,$2) - # when /^(6):(\S*)/ - # node_structure(o,para,$1,$2) - # else - # if para =~ /<:verse>/ - # node_structure(o,para) - # elsif para =~ /<:group>/ - # node_structure(o,para) - # elsif para =~ /<:code>/ - # node_structure(o,para) - # elsif para =~/|)/ @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[12]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_clean(para) diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index 4b3ca7c8..e6864405 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -293,7 +293,7 @@ WOK if para !~/(^0~|^@\S+?:|^\s*$||)/ @sto=SiSU_text_parts::Split_text_object.new(@md,para).lev_segname_para unless @rcdc - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_clean(para) @@ -319,25 +319,6 @@ WOK xml_clean(para) xml_structure(para,$1,$2) para=@sto.lev_para_ocn.heading_body6 - #when /^(i1)$/i - # #format_scroll.gsubBody - # #para=@sto[:lev_para_ocn].scrIndent1 - #when /^(i2)$/i - # format_scroll.gsubBody - # para=@sto[:lev_para_ocn].scrIndent2 - #when /^(center)$/i - # para.gsub!(/(.+)/, - # %{
    (\\1)
    }) - # para=@sto[:lev_para_ocn].scrPara - #when /^(b|bold)$/i - # para.gsub!(/(.+)/, - # %{(\\1)}) - # para=@sto[:lev_para_ocn].scrPara - #when /null/ # see whether u can improve - # if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/) - # #format_scroll.gsubBody - # #para=@sto[:lev_para_ocn].scrPara - # end else if para =~ /<:verse>/ para=poem_structure(para) diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index 2b0ba560..0e8d3989 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -105,7 +105,7 @@ module SiSU_Wikispeak attr_reader :format,:lev,:text,:ocn,:lev_para_ocn def initialize(para) @para=para - @format,@ocn='null','null' + @format,@ocn='ordinary','ordinary' @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern end def lev_segname_para_ocn diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 067ed8a8..593d26c4 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -289,7 +289,7 @@ WOK unless @rcdc m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 9f897266..2531a962 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -313,7 +313,7 @@ WOK unless @rcdc m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index 9bcb15ec..38ba0a87 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -371,7 +371,7 @@ WOK unless @rcdc m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|null/ + format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_markup(para) -- cgit v1.2.3 From 08c69d074001507d64cd5960c8679ec91a5a8353 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 23 Aug 2008 12:01:59 -0400 Subject: pass Hash to Format classes; some match tuning in dal --- lib/sisu/v0/concordance.rb | 4 +- lib/sisu/v0/dal.rb | 2 +- lib/sisu/v0/dal_syntax.rb | 32 ++-- lib/sisu/v0/db_import.rb | 30 ++-- lib/sisu/v0/html.rb | 99 +++++++----- lib/sisu/v0/html_format.rb | 242 +++++++++++++---------------- lib/sisu/v0/html_scroll.rb | 30 ++-- lib/sisu/v0/html_segments.rb | 67 ++++---- lib/sisu/v0/manpage.rb | 18 +-- lib/sisu/v0/manpage_format.rb | 25 ++- lib/sisu/v0/odf.rb | 61 +++++--- lib/sisu/v0/odf_format.rb | 100 +++++++----- lib/sisu/v0/plaintext.rb | 3 +- lib/sisu/v0/plaintext_format.rb | 26 +++- lib/sisu/v0/shared_html_lite.rb | 85 ++++++----- lib/sisu/v0/shared_structure.rb | 43 ++++-- lib/sisu/v0/shared_txt.rb | 46 ------ lib/sisu/v0/texinfo.rb | 40 +++-- lib/sisu/v0/texinfo_format.rb | 330 +++++++++++++++++++++------------------- lib/sisu/v0/texpdf.rb | 32 ++-- lib/sisu/v0/texpdf_format.rb | 318 +++++++++++++++++++++----------------- lib/sisu/v0/xhtml.rb | 33 ++-- lib/sisu/v0/xml.rb | 26 ++-- lib/sisu/v0/xml_dom.rb | 25 ++- lib/sisu/v0/xml_format.rb | 57 ++++--- 25 files changed, 961 insertions(+), 813 deletions(-) diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 3e073900..8fe8c4ed 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -240,6 +240,7 @@ WOK and toy !~/^0$/ for word in line.scan(@rgx_scanlist) #%take in word or other match #word.gsub!(@rxp_clean,'') + word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}(?:http)?/,'') word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') word.gsub!(/#{Mx[:gl_o]}#[a-z]+#{Mx[:gl_c]}/,'') @@ -274,7 +275,8 @@ WOK word.gsub!(/^\(?[a-zA-Z]\)$/,'') word.gsub!(/^\d+(st|nd|rd|th)$/,'') word.gsub!(/^(\d+\.?)+$/, '') - word.gsub(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') + word.gsub!(/#{Mx[:mk_o]}|#{Mx[:mk_c]}/,'') + word.gsub!(/:name#\S+/,'') word.gsub!(/^\S$/,'') word=nil if word =~/^\S$/ word=nil if word =~/^\s*$/ #watch diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index cf6d8e09..3187a538 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -614,7 +614,7 @@ module SiSU_DAL @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/ end if para =~/^#{Mx[:lv_o]}[1-6]:[\w-]*#{Mx[:lv_c]}/ \ - and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s+[\d.]+)\s/ \ + and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s*[\d.]+)\s/ \ and para !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ if para =~/^#{Mx[:lv_o]}#{no1}:/ t_no1+=1; t_no2=0; t_no3=0 diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 35f0582a..98c8cf51 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -240,7 +240,19 @@ module SiSU_Syntax end line.gsub!(/~\{(.+?)\}~/m,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") line.gsub!(/~\[(.+?)\]~/m,"#{Mx[:en_b_o]}\\1#{Mx[:en_b_c]}") - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 #{@md.title} - #{@md.subtitle},
    \\2#{@md.dc_creator}") + if @md.subtitle and not @md.subtitle.empty? + if line =~/(?:by\s+)?(?:@creator|@author)/ + line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title} - #{@md.subtitle},
    \\2#{@md.dc_creator}") + else + line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") + end + else + if line =~/(?:by\s+)?(?:@creator|@author)/ + line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title},
    \\2#{@md.dc_creator}") + else + line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title}") + end + end line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") # line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") # line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup @@ -285,16 +297,16 @@ module SiSU_Syntax #line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch line.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <:i\1> ') # depreciated -->#{Mx[:fa_c]} - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics # depreciated ^ - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |\(|\>|\S)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index addd1ae1..52bb3ad2 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -402,7 +402,8 @@ module SiSU_DB_import end txt=endnotes(txt).clean_text end - @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_minus + txt_obj={:txt =>txt,:col =>@col} + @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_minus special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup strip_markup(@col[:plaintext]) @@ -443,7 +444,8 @@ module SiSU_DB_import end txt=endnotes(txt).clean_text(@base_url) end - @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus + txt_obj={:txt =>txt,:col =>@col} + @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup strip_markup(@col[:plaintext]) @@ -482,7 +484,8 @@ module SiSU_DB_import end txt=endnotes(txt).clean_text(@base_url) end - @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus + txt_obj={:txt =>txt,:col =>@col} + @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup strip_markup(@col[:plaintext]) @@ -521,7 +524,8 @@ module SiSU_DB_import end txt=endnotes(txt).clean_text(@base_url) end - @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).lev4_plus + txt_obj={:txt =>txt,:col =>@col} + @col[:body]=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).lev4_plus special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup strip_markup(@col[:plaintext]) @@ -570,11 +574,14 @@ module SiSU_DB_import if @en_pls[0]; @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last end @col[:body]=if txt=~/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/ #watch - SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).html_table + txt_obj={:txt =>txt,:col =>@col} + SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).html_table elsif txt=~/^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/ - SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).indent($1) + txt_obj={:txt =>txt,:col =>@col} + SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).indent($1) else - SiSU_Format_Shared::CSS_Format.new(@md,txt,@col).norm + txt_obj={:txt =>txt,:col =>@col} + SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).norm end special_character_escape(@col[:body]) @col[:plaintext]=@col[:body].dup @@ -593,7 +600,8 @@ module SiSU_DB_import nr,txt,digest_clean=$1,$2,$3 end @id_n+=1 - body=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col,nr).endnote + txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr} + body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote special_character_escape(body) special_character_escape(txt) strip_markup(txt) @@ -633,7 +641,8 @@ module SiSU_DB_import nr,txt,digest_clean=$1,$2,$3 end @id_n+=1 - body=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col,nr).endnote + txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr} + body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote special_character_escape(body) special_character_escape(txt) strip_markup(txt) @@ -674,7 +683,8 @@ module SiSU_DB_import nr,txt,digest_clean=$1,$2,$3 end @id_n+=1 - body=SiSU_Format_Shared::CSS_Format.new(@md,txt,@col,nr).endnote + txt_obj={:txt =>txt,:col =>@col,:endnote_nr =>nr} + body=SiSU_Format_Shared::CSS_Format.new(@md,txt_obj).endnote special_character_escape(body) special_character_escape(txt) strip_markup(txt) diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index fd2294ba..2dc75d60 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -201,7 +201,8 @@ module SiSU_HTML else '_top' end s_lnk_url,s_lnk_lnk=l[:url],l[:say] - lev_para_ocn=SiSU_HTML_Format::Format_toc.new(@md,s_lnk_url,s_lnk_lnk,target) + txt_obj={:lnk_url =>s_lnk_url,:lnk_txt =>s_lnk_lnk,:target =>target} + lev_para_ocn=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) @links_guide_toc << lev_para_ocn.links_guide if s_lnk_lnk end end @@ -236,7 +237,8 @@ module SiSU_HTML endnote_array << pg.scan(/#{Mx[:en_b_o]}[\d+]+(.+?)#{Mx[:en_b_c]}/m) end endnote_array.flatten.each do |note| - format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,note) + txt_obj={:txt =>note} + format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,txt_obj) @scr_endnotes << format_scroll.endnote_body end end @@ -318,12 +320,17 @@ WOK @@toc[:scr] << format_head_scroll.toc_owner_details end end +#not used --> def level_endnotes if @md.flag_endnotes format_head_scroll=SiSU_HTML_Format::Head_scroll.new(@md) @@toc[:scr] << format_head_scroll.toc_endnote end end + def level_concordance + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + @@toc[:seg_mini] << format_head_toc.mini_seg_concordance + end def level_metadata format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) @@toc[:scr] << format_head_toc.metadata @@ -336,6 +343,7 @@ WOK @@toc[:seg] << format_head_toc.concordance @@toc[:seg_mini] << format_head_toc.mini_concordance end +# <-- not used def level_1 para=@data unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -353,7 +361,8 @@ WOK %{
    #{linkname}} end toc={} - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:seg]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 @@ -379,7 +388,8 @@ WOK end %{#{linkname}} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=if para =~/^#{Mx[:lv_o]}\d:meta^#{Mx[:lv_c]}\s*Document Information/ format_toc.lev0 else format_toc.lev1 @@ -392,12 +402,13 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,linkname) + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev2 toc[:seg_mini]=format_toc.mini_lev2 @@ -407,7 +418,8 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev2 toc end @@ -416,12 +428,13 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') para.gsub(/(.*?)<\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,linkname) + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev3 toc[:seg_mini]=format_toc.mini_lev3 @@ -431,7 +444,8 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev3 toc end @@ -441,8 +455,8 @@ WOK unless para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ para.gsub!(@pat_strip_heading_name,'\1') para[@pat_heading] - linkname,link=$1.strip,$2 if $& - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) if link + linkname,ocn=$1.strip,$2 if $& + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn end para.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') if para =~/^#{Mx[:lv_o]}4:/ @@ -460,8 +474,9 @@ WOK %{\\1 \\2 \\3 }) end - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) if link - format_toc=SiSU_HTML_Format::Format_toc.new(@md,seg_link) + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) if ocn + txt_obj={:txt =>seg_link} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc={} toc[:seg]=format_toc.lev4 toc[:seg_mini]=format_toc.mini_lev4 @@ -471,7 +486,8 @@ WOK title=linkname else title=%{#{p_num.goto}#{linkname}} if p_num end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev4 toc end @@ -482,10 +498,10 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end toc={} if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -493,15 +509,17 @@ WOK para.gsub!(m,'') title=linkname else - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,lnk_n_txt) + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:seg]=format_toc.lev5 toc[:seg_mini]=format_toc.mini_lev5 title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev5 toc end @@ -511,10 +529,10 @@ WOK para.gsub!(@pat_strip_heading_name,'\1') end para[@pat_heading] - linkname,link=$1.strip,$2 if $& - if link \ - and link !~/#/ - p_num=SiSU_HTML_Format::Paragraph_number.new(@md,link) + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end toc={} if para =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -522,15 +540,17 @@ WOK para.gsub!(m,'') title=linkname else - lnk_n_txt=%{ + lnk_n_txt=%{ #{linkname} } - format_toc=SiSU_HTML_Format::Format_toc.new(@md,lnk_n_txt) + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:seg]=format_toc.lev6 toc[:seg_mini]=format_toc.mini_lev6 title=%{#{p_num.goto}#{linkname}} end - format_toc=SiSU_HTML_Format::Format_toc.new(@md,title) + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) toc[:scr]=format_toc.lev6 toc end @@ -592,20 +612,23 @@ WOK tmp_head=nil doc_title_endnote=@md.title.gsub(/(\*+)/,'\1') tmp_head=doc_title_endnote + "\n" - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold if not @md.subtitle.nil? \ and not @md.subtitle.empty? tmp_head=@md.subtitle + "\n" - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) + txt_obj={:txt=>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end if @md.dc_creator creator_endnote=@md.dc_creator.gsub(/(\*+)/,%{ \\1}) tmp_head=creator_endnote + "\n" - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,tmp_head) + txt_obj={:txt =>tmp_head} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) toc_shared << format_txt_obj.center_bold @segtoc << format_txt_obj.center_bold end diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index af36dc30..1d82ddfe 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -61,10 +61,9 @@ module SiSU_HTML_Format include SiSU_Viz class Paragraph_number - def initialize(md,paranum) - @md=md - @paranum=paranum[/(\d+)/m,1] - @paranum ||='' + def initialize(md,ocn) + @md,@ocn=md,ocn[/(\d+)/m,1] + @ocn ||='' vz=SiSU_Env::Get_init.instance.skin @skin_no_ocn=if defined? vz.ocn_display_off \ and vz.ocn_display_off == true @@ -77,75 +76,31 @@ module SiSU_HTML_Format or @md.mod.inspect =~/--no-ocn/ \ or @skin_no_ocn ocn_class='ocn_off' - @paranum.gsub(/^(\d+|)$/, + @ocn.gsub(/^(\d+|)$/, %{}) - elsif @paranum.to_i == 0 - @paranum.gsub(/^(\d+|)$/, - %{}) + elsif @ocn.to_i == 0 + @ocn.gsub(/^(\d+|)$/, + %{}) else ocn_class='ocn' - @paranum.gsub(/^(\d+|)$/, - %{}) + @ocn.gsub(/^(\d+|)$/, + %{}) end end def name - %{} + %{} end def id #w3c? "tidy" complains about numbers as identifiers ! annoying - %{id="o#@paranum"} + %{id="o#{@ocn}"} end def goto - %{} - end - end - class Paragraph_id_ocn #used by table version #work area 2003w48 - attr_accessor :paranum,:font,:p_num - def initialize(md,paranum) - @paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,Paragraph_number.new(md,paranum) #font - #@paranum,@vz,@p_num=paranum,SiSU_Env::Get_init.instance.skin,SiSU_HTML_Format::Paragraph_number.new(md,paranum) #font - end - def txt - %{

    #{@p_num.name} - } - end - def txt_00 - %{

    #{@p_num.name} - } - end - def font_citation - %{} - end - def endnote - %{

    #{@p_num.name} - } - end - def table - %{

    #{@p_num.name} - } - end - def tiny - %{

    #{@p_num.name} - } - end - def small - %{

    #{@p_num.name} - } # keep but not used? - end - def font_tiny - %{} - end - def font_small - %{} - end - def header_ - %{

    #{@p_num.name} - } + %{} end end class Head_information include SiSU_Viz attr_reader :md,:sfx,:pdf,:rdf,:vz - def initialize(md='') + def initialize(md) @md=md @sfx,@pdf=@md.sfx,@md.pdf @rdf=SiSU_XML_tags::RDF.new(md) @@ -1038,27 +993,39 @@ WOK class Format_text_object @vz=SiSU_Env::Get_init.instance.skin @@dp=nil - attr_accessor :md,:one,:two,:three,:parablock,:table,:link,:linkname,:format,:paranum,:p_num,:para_id,:headname,:margin,:paragraph,:table,:banner,:url,:icon,:font,:one_stripped - def initialize(md='',*txt) - @md,@one,@two,@three=md,txt[0],txt[1],txt[2] - rgx=/^#{Mx[:lv_o]}\d:\S*?#{Mx[:lv_c]}/ - @one_stripped=@one.gsub(rgx,'') if @one =~rgx - @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - rgx=/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/ #problem introduced - @one_stripped=@one.gsub(rgx,'\1') if @one =~rgx #problem introduced - @format,@parablock=txt[0],txt[1] - @one.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') if @one - @parablock.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') if @parablock - if txt[2]=~/\d+/ - @paranum=txt[2][/(\d+)/m,1] # unless paranum =~/#/ - @p_num=Paragraph_number.new(@md,@paranum) - @para_id=Paragraph_id_ocn.new(@md,@paranum) #used by table version + attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + @ocn =t_o[:ocn] || nil + @ocn_display =t_o[:ocn_display] || nil + @headname =t_o[:headname] || nil + @trailer =t_o[:trailer] || nil + @endnote_part_a =t_o[:endnote_part_a] || nil + @endnote_part_b =t_o[:endnote_part_b] || nil + @lnk_url =t_o[:lnk_url] || nil + @lnk_txt =t_o[:lnk_txt] || nil + @format =t_o[:format] || nil + @target =t_o[:target] || nil #occasionally passed but not used + else + if @md.cmd =~/M/ + p t_o.class + p caller + end + end + if @txt and not @txt.empty? + @txt.gsub!(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') + end + if @ocn and @ocn=~/\d+/ #WATCH FIX + @p_num=Paragraph_number.new(@md,@ocn) end - @headname='' - if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/ - headname=$1 #format[/\d~(\S+)/m,1] - @headname=if headname =~/^[a-zA-Z]/; %{} #consider: h_#{headname} - else %{} + if @format and not @format.empty? + if @format=~/^\d:(\S+)/ #need more reliable marker #if @format =~ /#{Rx[:lv]}/ + headname=$1 #format[/\d~(\S+)/m,1] + @headname=if headname =~/^[a-zA-Z]/; %{} #consider: h_#{headname} + else %{} + end end end @vz=SiSU_Env::Get_init.instance.skin @@ -1066,14 +1033,14 @@ WOK def endnote_body %{

    - #@one + #{@txt}

    } end def endnote_body_indent %{

    - #@one + #{@txt}

    } end @@ -1082,7 +1049,7 @@ WOK

    - #@one #@two + #{@txt}

    } @@ -1094,7 +1061,7 @@ WOK
    #{@p_num.ocn_display} #{ul}<#{tag} class="#{attrib}" #{@p_num.id}> - #@parablock + #{@txt} #{ulc}
    } @@ -1123,8 +1090,7 @@ WOK
    #{@p_num.ocn_display} <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} - #@headname - #@parablock + #{@headname}#{@txt}
    } @@ -1154,7 +1120,7 @@ WOK %{
    <#{tag} class="#{attrib}"> - #@one + #{@txt}
    } @@ -1176,13 +1142,13 @@ WOK
    } end - def dl - "
    #@one #@two
    " + def dl #check :trailer + "
    #{@txt} #{@trailer}
    " end def table_css_end # '

    @@ -1190,66 +1156,66 @@ WOK ' end def gsub_body - case @one + case @txt when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\((i+|iv|v|vi+|ix|x|xi+)\)/ - @one.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'(\1)') - @one.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)') + @txt.gsub!(/^\((i+|iv|v|vi+|ix|x|xi+)\)/,'(\1)') + @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((i+|iv|v|vi+|ix|x|xi+)\)/,'\1(\2)') when /^(?:#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}\s*)?\(?(\d|[a-z])+\)/ - @one.gsub!(/^\((\d+|[a-z])+\)/,'(\1)') - @one.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1(\2)') + @txt.gsub!(/^\((\d+|[a-z])+\)/,'(\1)') + @txt.gsub!(/^(#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]})\s*\((\d+|[a-z])+\)/,'\1(\2)') when /^\s*\d{1,3}\.\s/ - @one.gsub!(/^\s*(\d+\.)/,'\1') + @txt.gsub!(/^\s*(\d+\.)/,'\1') when /^\s*[A-Z]\.\s/ - @one.gsub!(/^\s*([A-Z]\.)/,'\1') + @txt.gsub!(/^\s*([A-Z]\.)/,'\1') end end def bold_para %{#{@vz.margin_txt_0}

    - #@one + #{@txt}

    #{@vz.margin_num_css}     #{@vz.table_close}} end def bold_header - @one.gsub!(/[1-9]~(\S+)/,'') - @one.gsub!(/[1-9]~/,'') - @one.gsub!(/#{Mx[:id_o]}~0;[um]\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}\s*$/i,'') #watch & do differently + @txt.gsub!(/[1-9]~(\S+)/,'') + @txt.gsub!(/[1-9]~/,'') + @txt.gsub!(/#{Mx[:id_o]}~0;[um]\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}\s*$/i,'') #watch & do differently %{

    - #@one + #{@txt}

    #{@vz.margin_num_css}     #{@vz.table_close}} end def toc_head_copy_at - %{

    #@one

    \n} + %{

    #{@txt}

    \n} end def center - %{

    #@one

    \n} + %{

    #{@txt}

    \n} end def bold - %{

    #@one

    \n} + %{

    #{@txt}

    \n} end def center_bold - %{

    #@one

    \n} + %{

    #{@txt}

    \n} end end class Format_scroll < Format_text_object - def initialize(md='',*txt) - super(md,*txt) + def initialize(md,txt) + super(md,txt) @vz=SiSU_Env::Get_init.instance.skin end end class Format_seg < Format_text_object - def initialize(md='',*txt) - super(md,*txt) + def initialize(md,txt) + super(md,txt) end def navigation_toc_lev1_advert %{#{@banner.home_button}\n
    -#@one +#{@txt} #@two

    } end @@ -1263,7 +1229,7 @@ WOK

    - #@one + #{@txt}

    #{@vz.table_close}} @@ -1275,7 +1241,7 @@ WOK
    - #@one + #{@txt}

    #{@vz.table_close}} @@ -1286,7 +1252,7 @@ WOK

    - #@one + #{@txt}

    #{@vz.table_close}} end @@ -1298,41 +1264,41 @@ WOK fn='doc' if fn.empty? #you may wish to reconsider, sends to 'doc' where no segment info %{

    - #@one#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#@two#@three + #{@endnote_part_a}#{@md.fnl[:pre]}#{fn}#{@md.fnl[:mid]}#{@md.sfx}#{@md.fnl[:post]}#{@endnote_part_b}

    } end def subtoc_lev(tag,attrib) - one=if @one \ - and @one =~/<\/?i>|/mi - @one.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text - else @one + txt=if @txt \ + and @txt =~/<\/?i>|/mi + @txt.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text + else @txt end note='' - if one =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream + if txt =~/((?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*)/m #this is a clumsy fix, revisit and address upstream note=$1 note.gsub!(/[\n\s]+/m,' ') - one.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') - one.gsub!(/ \d+<\/sup> /m,'') + txt.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') + txt.gsub!(/ \d+<\/sup> /m,'') end %{<#{tag} class="#{attrib}"> - #{one} #{note} + #{txt} #{note} } end def subtoc_lev5 - subtoc_lev('h5','subtoc') if @one + subtoc_lev('h5','subtoc') if @txt end def subtoc_lev6 - subtoc_lev('h6','subtoc') if @one + subtoc_lev('h6','subtoc') if @txt end #% para sisu def header_sub(tag,attrib) - @parablock.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') + @txt.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') %{
    #{@p_num.ocn_display} <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} #{@headname} - #{@parablock} + #{@txt}
    } @@ -1348,8 +1314,8 @@ WOK
    #{@p_num.ocn_display}

    #{@p_num.name} - #@format - #@parablock + #{@t_o[:format]} + #{@txt}

    } @@ -1358,42 +1324,40 @@ WOK %{

    - #@parablock + #{@txt}

    #{@vz.table_close}} end def navigation_header5 %{

    - #@parablock + #{@txt}

    } end def navigation_header6 %{

    - #@parablock + #{@txt}

    } end def navigation_center - "
    #@parablock
    " + "
    #{@txt}
    " end end class Format_toc < Format_text_object - def initialize(md='',*txt) - super(md,*txt) - @link,@linkname=@one,@two + def initialize(md,txt) + super(md,txt) end def links_guide - #@three distinguishes between _top and external, can be used e.g. for different colour scheme %{
  • - - #@linkname + + #{@lnk_txt}
  • } end def lev(tag,attrib) - if @one + if @txt %{<#{tag} class="#{attrib}"> - #@one + #{@txt} } else '' diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 01720862..9286df10 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -102,13 +102,16 @@ module SiSU_HTML_scroll unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/; para.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})\s*/m,' ') end if para =~/.+?#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - paranum=para[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1] - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + ocn=para[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,1] + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_scroll m=/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ #watch + if @sto.format =~/i[1-9]|ordinary/ #watch + txt_obj={:txt =>@sto.text} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + end case @sto.format when /^1:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body1 when /^2:\S*?/; para=@sto.scroll_lev_para_ocn.heading_body2 @@ -139,30 +142,33 @@ module SiSU_HTML_scroll end elsif para =~/^#{Mx[:lv_o]}[1-9]:/ \ and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_c]}#@dp:#@dp#{Mx[:id_c]}$/ - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,para) + txt_obj={:txt =>para} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) para=format_txt_obj.bold_header elsif para =~/Endnotes?/ \ and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,'
    Note') + txt_obj={:txt =>'
    Note'} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) para=format_txt_obj.bold_para elsif para =~/Owner Details/ \ and para !~/#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,'
    Owner Details') + txt_obj={:txt =>'
    Owner Details'} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) @scr[:owner_details]=format_txt_obj.bold_para para='' elsif para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ #watch - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + cont=if $2.empty? + $1 + else "#{$1} #{$2}" #watch, check desired where $2 is other than space + end + txt_obj={:txt =>cont} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.no_paranum end if para =~// \ and para =~/^(?:\^~\d+\s|)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though para='' end - if para =~/<:center>/ #rules changed now a

    (.*)/.match(para).captures - format_scroll=SiSU_HTML_Format::Format_scroll.new(@md,one,two) - end para.gsub!(/^#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/^<:\S?>/,'') para.gsub!(/#{Rx[:mx_fa_clean]}/,' '); para.gsub!(/<:\S?>/,' '); para.gsub!(//,' ') para.strip! diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 7a4a4fb6..b457fe5c 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -228,41 +228,45 @@ module SiSU_HTML_seg @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') - paranum=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,@@header1,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>@@header1,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header1.gsub(clean,'') @@header1.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is2 == 1 header2=@@header2 - paranum=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if header2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,header2,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>header2,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header2.gsub(clean,'') @@header2.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is3 == 1 header3=@@header3 - paranum=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if header3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,header3,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>header3,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header3.gsub(clean,'') @@header3.gsub!(/  [\d*+]+<\/sup> <\/a>/,'') end if @@is4 == 1 header4=@@header4 - paranum=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 + ocn=if header4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 else '' end - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) - format_seg=SiSU_HTML_Format::Format_seg.new(@md,header4,@p_num.ocn_display) + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + txt_obj={:txt =>header4,:ocn_display =>@p_num.ocn_display} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) @@seg[:headers] << format_seg.title_header4.gsub(clean,'') end @@seg[:header_endnotes]=format_head_seg.title_endnote(@md.title,@md.subtitle,@dc_creator,@@seg[:dot_nav]) @@ -275,8 +279,8 @@ module SiSU_HTML_seg if para !~/^#{Rx[:meta]}/ m=para[/.+?#{Mx[:id_o]}~(\d+);(?:[ohm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] if m - paranum=m[1].to_s - @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,paranum) + ocn=m[1].to_s + @p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) end if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/m \ or @@flag_alt==true @@ -299,14 +303,18 @@ module SiSU_HTML_seg end if para !~/^#{Mx[:lv_o]}[1-9]:|#{Rx[:meta]}/ if para =~/(.*)#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/ - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + cont="#{$1} #{$2}" #check where $2 is other than space + txt_obj={:txt =>cont} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.no_paranum end end if para[/#{Mx[:id_o]}~(\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp)#{Mx[:id_c]}$/] @sto=SiSU_HTML::Source::Split_text_object.new(@md,para).html_seg - format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ #watch + if @sto.format =~/i[1-9]|ordinary/ #watch + txt_obj={:txt =>@sto.text} + format_txt_obj=SiSU_HTML_Format::Format_text_object.new(@md,txt_obj) + end para=case @sto.format # work area 2003w29 ||@|def lev_segname_para_ocn| when /^4:/; @sto.seg_lev_para_ocn.header4 # work on see Split_text_object when /^5:/; @sto.seg_lev_para_ocn.header5 @@ -348,11 +356,13 @@ module SiSU_HTML_seg if para !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ if para[/(.*)#{Mx[:id_o]}~0;(?:u|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}(.*)/] #% watch u & m? one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + txt_obj={:txt =>$1.strip,:trailing =>$2.strip} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) end para.gsub!(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with #?? workpoint if para =~/ / #endnote- note- - format_seg=SiSU_HTML_Format::Format_seg.new(@md,para) + txt_obj={:txt =>para} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.no_paranum end end @@ -444,12 +454,12 @@ module SiSU_HTML_seg para.gsub!(/ <\/a>/,' ') case para # series changed 2002w42 when /^#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #remove [u]? req by pg texts, revist - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + txt_obj={:txt =>$1.strip,:ocn =>$2} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.subtoc_lev5 when /^#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.+)?#{Mx[:id_o]}~(\d+);(?:h|[56]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - one,two=$1,$2 - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + txt_obj={:txt =>$1.strip,:ocn =>$2} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) para=format_seg.subtoc_lev6 end @@seg_subtoc_array << para @@ -474,7 +484,8 @@ module SiSU_HTML_seg e_n=note_match_seg[/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,1] try=e_n.split(/
    /) try.each do |e| - format_seg=SiSU_HTML_Format::Format_seg.new(@md,e) + txt_obj={:txt =>e} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) note_match=if e =~/#{Mx[:pa_o]}i[1-9]#{Mx[:pa_c]}/ format_seg.endnote_body_indent else format_seg.endnote_body @@ -484,9 +495,11 @@ module SiSU_HTML_seg try.join('
    ') #% creation of separate end segment/page of all endnotes referenced back to reference segment m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi - one=note_match_seg[m,1] #note~ [a name] - two=note_match_seg[m,2] #note- - format_seg=SiSU_HTML_Format::Format_seg.new(@md,one,two) + endnote_part_a=note_match_seg[m,1] + endnote_part_b=note_match_seg[m,2] + txt_obj={:endnote_part_a =>endnote_part_a,:endnote_part_b =>endnote_part_b} + + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) note_match_all_seg=format_seg.endnote_seg_body(@@fn) #BUG WATCH 200408 @@seg[:endnote_all] << note_match_all_seg end diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index fb6f6b2e..77d6e408 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -66,7 +66,7 @@ module SiSU_manpage include SiSU_Param include SiSU_Viz require "#{SiSU_lib}/manpage_format" - include Format + include SiSU_Manpage_format require "#{SiSU_lib}/shared_txt" require "#{SiSU_lib}/shared_structure" pwd=Dir.pwd @@ -343,9 +343,9 @@ WOK if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] - @p_num=Format::Paragraph_number.new(paranum) + @p_num=SiSU_Manpage_format::Paragraph_number.new(paranum) end - @sto=SiSU_Structure::Split_text_object.new(@md,para).txt + @sto=SiSU_Structure::Split_text_object.new(@md,para).manpage ### problem in scroll, it appears tables are getting paragraph numbers m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m \ @@ -387,10 +387,6 @@ WOK #@@manpage[:owner_details]=formatMono.bold_para #para='' elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! - elsif para =~/(.*)(.*)/ - one,two=$1,$2 - format_text=Format_text_object.new(one,two) - para=format_text.seg_no_paranum end if (para =~/
    / \ and para =~/^(-\{{2}~\d+|)/) # -endnote @@ -399,18 +395,14 @@ WOK case para when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ if para =~/.*<:#>.*$/m - format_text=Format_text_object.new(para,'') + txt_obj={:txt =>para} + format_text=Format_text_object.new(txt_obj) para=format_text.scr_indent_one_no_paranum end end if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ # i don't get the condition for no paranum end - if para =~/<:center>/ - one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=Format_text_object.new(one,two) - para=format_text.center - end para.gsub!(/\s(\[)/m,' \ \1') if para #manpages use this para.gsub!(/(?:#{Mx[:br_line]}|#{Mx[:br_nl]})/,"\n\n") if para para.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~') if para #manpages use this diff --git a/lib/sisu/v0/manpage_format.rb b/lib/sisu/v0/manpage_format.rb index 02fbf216..28756455 100644 --- a/lib/sisu/v0/manpage_format.rb +++ b/lib/sisu/v0/manpage_format.rb @@ -58,7 +58,7 @@ ** Description: manpage formatting template =end -module Format +module SiSU_Manpage_format require "#{SiSU_lib}/param" include SiSU_Param include SiSU_Viz @@ -78,19 +78,28 @@ module Format end class Format_text_object @@dp=nil - def initialize(one,two,three) - one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ - @one,@two,@three=one,two,three + def initialize(md,t_o) + @md,@t_o=md,t_o + if @t_o.class == Hash + @txt =@t_o[:txt] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + p t_o.class + p caller + end + #@txt.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ rgx=/^#{Mx[:lv_o]}[1-6-]:/ - @one.gsub!(rgx,'') if @one =~rgx + @txt.gsub!(rgx,'') if @txt =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ - @one.gsub!(rgx,'\1') if @one =~rgx - @link,@linkname=one,two + @txt.gsub!(rgx,'\1') if @txt =~rgx @vz=SiSU_Env::Get_init.instance.skin end def scr_endnote_body - "#@one " + "#{@txt} " end def heading_body1 end diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 9fb6b51e..d21a8628 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -249,7 +249,7 @@ module SiSU_ODF txt.gsub!(/([)(\]\[])/,"\\\\\\1") txt.gsub!(/([+?*])/,"\\\\\\1") # problems with + url.gsub!(/([+?])/,"\\\\\\1") # problems with + - para.gsub!(/\{\s*#{txt}\}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url + para.gsub!(/#{Mx[:lnk_o]}\s*#{txt}#{Mx[:lnk_c]}#{url}/m,text_link_odf(txt,url,trail)) #make sure trailing ']' are not caught in url para.gsub!(/\\([)(\]\[?])/,'\1') #clumsy fix end m=nil @@ -358,11 +358,29 @@ module SiSU_ODF end def table(para) # if para =~/#{Mx[:gr_o]}Th?.+/ # tables come as single block - table=SiSU_ODF_format::Table.new(@md,para) + txt_obj={:table =>para} + table=SiSU_ODF_format::Table.new(@md,txt_obj) para=table.table_split end end - def odf_structure(para='',lv='',ocn='',hname='') #% Used to extract the structure of a document + def odf_structure(md,t_o) + @md,@t_o=md,t_o + @md,@t_o=md,t_o + if t_o.class == Hash + para =t_o[:txt] || nil + lv =t_o[:lv] || nil + ocn =t_o[:ocn] || nil + hname =t_o[:h_name] || nil + #@h_name =t_o[:h_name] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + #@one,@two,@three=one,two,three + p t_o.class + p caller + end lv=lv.to_i n=lv - 1 n3=lv + 2 @@ -515,31 +533,35 @@ module SiSU_ODF and para=~/\S+/ para=case @sto.format when /^(1):(\S*)/ - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) para when /^(2):(\S*)/ - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) para when /^(3):(\S*)/ - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) para when /^(4):(\S+)/ # work on see Split_text_object - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) # work on see SiSU_text_parts::Split_text_object para when /^(5):(\S*)/ - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) para when /^(6):(\S*)/ - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) para - else odf_structure(para,nil,nil,nil) #watch may be problematic + else + txt_obj={:txt =>para} + odf_structure(@md,txt_obj) #watch may be problematic para end - elsif para =~/(.*)(.*)/ - one,two=$1,$2 - format_text=SiSU_ODF_format::Format_text_object.new(one,two) - para=format_text.seg_no_paranum end if para =~// \ and para =~/^(-\{{2}~\d+|)/ # -endnote @@ -548,17 +570,14 @@ module SiSU_ODF if (para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/) # i don't get the condition for no paranum end - if para =~/<:center>/ - one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=SiSU_ODF_format::Format_text_object.new(one,two) - para=format_text.center - end else if para =~ /^(4)~(\S+)/ - odf_structure(para,$1,@sto.ocn,$2) + txt_obj={:txt =>para,:lv =>$1,:ocn =>@sto.ocn,:h_name=>$2} + odf_structure(@md,txt_obj) para elsif para =~/#{Mx[:id_o]}~(\d+);m\d+;[mdv]\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - odf_structure(para,nil,nil,nil) #watch may be problematic + txt_obj={:txt =>para} + odf_structure(@md,txt_obj) #watch may be problematic para end end diff --git a/lib/sisu/v0/odf_format.rb b/lib/sisu/v0/odf_format.rb index 05e4a918..fe94bf5b 100644 --- a/lib/sisu/v0/odf_format.rb +++ b/lib/sisu/v0/odf_format.rb @@ -78,19 +78,28 @@ module SiSU_ODF_format end class Format_text_object @@dp=nil - def initialize(one,two,three) - one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ - @one,@two,@three=one,two,three + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + #@one,@two,@three=one,two,three + p t_o.class + p caller + end rgx=/^#{Mx[:lv_o]}[1-6-]:/ - @one.gsub!(rgx,'') if @one =~rgx + @txt.gsub!(rgx,'') if @txt =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern rgx=/#{Mx[:en_a_o]}\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ - @one.gsub!(rgx,'\1') if @one =~rgx - @link,@linkname=one,two + @txt.gsub!(rgx,'\1') if @txt =~rgx @vz=SiSU_Env::Get_init.instance.skin end def scr_endnote_body - "#@one " + "#@txt " end def heading_body1 #%{#@two} @@ -116,8 +125,21 @@ module SiSU_ODF_format @@tablefoot=[] #watch @@fns='' @@dp=nil - def initialize(md,one) - @md,@one,@parablock,@vz=md,one,one,SiSU_Env::Get_init.instance.skin + def initialize(md,t_o) + @md,@t_o,@vz=md,t_o,SiSU_Env::Get_init.instance.skin + if t_o.class == Hash + @txt =t_o[:txt] || nil + @table =t_o[:table] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + if @md.cmd =~/M/ + p t_o.class + p caller + end + end if @md.fns != @@fns @@table_counter=0 @@fns=@md.fns @@ -177,58 +199,60 @@ module SiSU_ODF_format %{#@br} end def table - @parablock='' if @parablock =~/^/,1] + @txt='' if @txt =~/^/,1] @@tablefoot << m if m - @parablock.gsub!(//,'') - @@tablehead=1 if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u - @@table_counter+=1 if @parablock =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u - if @parablock =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head(@@table_counter,$1,true) - elsif @parablock =~/#{Mx[:gr_o]}T#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @parablock=table_head(@@table_counter,$1) + @txt.gsub!(//,'') + @@tablehead=1 if @txt =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}/u + @@table_counter+=1 if @txt =~/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}/u + if @txt =~/#{Mx[:gr_o]}Th#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @txt=table_head(@@table_counter,$1,true) + elsif @txt =~/#{Mx[:gr_o]}T#{Mx[:tc_p]}\s+c(\d+).+?#{Mx[:tc_p]}~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u; @txt=table_head(@@table_counter,$1) end - if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ tablefoot=[] @@tablefoot.each {|x| tablefoot << ''} @@tablefoot=[] - if @parablock =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @parablock=table_end + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/; @txt=table_end end end if @@tablehead == 1 - if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u - if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u - @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) + if @txt =~/#{Mx[:tc_p]}#{Mx[:tc_p]}/u + if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1,true)) end - if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u - @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) + if @txt =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @txt.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1,true)) end - if @parablock =~/#{Mx[:tc_c]}/ - @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) + if @txt =~/#{Mx[:tc_c]}/ + @txt.gsub!(/#{Mx[:tc_c]}/,table_row_close(true)) end @@tablehead=0 end - @parablock + @txt else - if @parablock =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u - @parablock.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) + if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_row($1)) end - if @parablock =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u - @parablock.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) + if @txt =~/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u + @txt.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}(\d+?)#{Mx[:tc_p]}/u,table_cell($1)) end - if @parablock =~/#{Mx[:tc_c]}/ - @parablock.gsub!(/#{Mx[:tc_c]}/,table_row_close) + if @txt =~/#{Mx[:tc_c]}/ + @txt.gsub!(/#{Mx[:tc_c]}/,table_row_close) end - @parablock + @txt end - @parablock + @txt end def table_split @new_content=[] - @one.split(/\s*#{Mx[:tc_o]}/).each do |parablock| + @table.split(/\s*#{Mx[:tc_o]}/).each do |parablock| table=if parablock =~/#{Mx[:gr_o]}/ - Table.new(@md,"#{parablock}") + txt_obj={:txt =>parablock} + Table.new(@md,txt_obj) else - Table.new(@md,"#{Mx[:tc_o]}#{parablock}") + txt_obj={:txt =>"#{Mx[:tc_o]}#{parablock}"} + Table.new(@md,txt_obj) end @new_content << table.table end diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 9a246e49..132f2997 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -388,7 +388,8 @@ WOK case para when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ if para =~/.*<:#>.*$/m - format_text=Format_text_object.new(para,'') + txt_obj={:txt =>para} + format_text=Format_text_object.new(@md,txt_obj) para=format_text.scr_indent_one_no_paranum end end diff --git a/lib/sisu/v0/plaintext_format.rb b/lib/sisu/v0/plaintext_format.rb index e957d3a3..ddac2e32 100644 --- a/lib/sisu/v0/plaintext_format.rb +++ b/lib/sisu/v0/plaintext_format.rb @@ -78,19 +78,30 @@ module Format end class Format_text_object @@dp=nil - def initialize(one,two,three) - one.gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ - @one,@two,@three=one,two,three + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + @lnk_url =t_o[:lnk_url] || nil + @lnk_txt =t_o[:lnk_txt] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + #@one,@two,@three=one,two,three + p t_o.class + p caller + end rgx=/^#{Rx[:lv]}/ - @one.gsub!(rgx,'') if @one =~rgx + @txt.gsub!(rgx,'') if @txt =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern rgx=/#{Mx[:en_a_o]}[\d*+]+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/ - @one.gsub!(rgx,'\1') if @one =~rgx - @link,@linkname=one,two + @txt.gsub!(rgx,'\1') if @txt =~rgx @vz=SiSU_Env::Get_init.instance.skin end def scr_endnote_body - "#@one " + "#{@txt} " end def heading_body1 end @@ -109,4 +120,3 @@ module Format end end __END__ - diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 7be46abb..7a23be0b 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -65,20 +65,34 @@ module SiSU_Format_Shared class CSS_Format require "#{SiSU_lib}/defaults" @@fns=nil - def initialize(md,content=nil,col=nil,en=nil) - content.gsub!(/<:i[12]>/,'') - @md,@content=md,content - @id=@ocn=col[:id] - @ocnd,@ocns=col[:ocnd],col[:ocns] - @notenumber=en - @lv=col[:lev].to_s + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] #|| nil #s/@content/@txt/ + @col =t_o[:col] #|| nil + @notenumber =t_o[:endnote_nr] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + #content.gsub!(/<:i[1-9]>/,'') + #@md,@content=md,content + p t_o.class + p caller + end + + @txt.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'') + @id=@ocn=@col[:id] + @ocnd,@ocns=@col[:ocnd],@col[:ocns] + @lv=@col[:lev].to_s @@hname=if @md.fns != @@fns @@fns=@md.fns '' end - @hname=if col[:seg] \ - and not col[:seg].to_s.empty? - @@hname=col[:seg].to_s + @hname=if @col[:seg] \ + and not @col[:seg].to_s.empty? + @@hname=@col[:seg].to_s else @@hname end @tab="\t" @@ -87,7 +101,7 @@ module SiSU_Format_Shared @@tablehead,@@tablefoot=[],[] @vz=SiSU_Env::Get_init.instance.skin @env=SiSU_Env::Info_env.new(@md.fns) - @base_url="#{@env.url.root}/#{@md.fnb}/#@hname.html" + @base_url="#{@env.url.root}/#{@md.fnb}/#{@hname}.html" end def urls(data) @words=[] @@ -147,48 +161,48 @@ module SiSU_Format_Shared para end def paragraph - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} << "\n" + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} << "\n" end def endnote #used only by db - @content=markup(@content) + @txt=markup(@txt) < -#{@tab*2}
    #@notenumber. #@content +#{@tab*1}

    +#{@tab*2}#{@notenumber}. #{@txt} #{@tab*1}

    GSUB end def lev_toc_hname - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} << "\n" + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} << "\n" end def lev_toc - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} << "\n" + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} << "\n" end def lev4_plus - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} << "\n" + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} << "\n" end def lev4_minus - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} << "\n" + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} << "\n" end def norm_comment - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} end def norm - @content=markup(@content) - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} + @txt=markup(@txt) + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} end def indent(t) - @content=markup(@content) - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} + @txt=markup(@txt) + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} end def para_table %{

    } end def ocn - %{#{@tab*1}} << "\n" + %{#{@tab*1}} << "\n" end def html_table # get rid of use html_table @new_content=[] - @content.split(/\n/).each do |parablock| + @txt.split(/\n/).each do |parablock| m=parablock[//,1] @@tablefoot</,'') @@ -233,27 +247,27 @@ GSUB @new_content.join end end - class CSS_Format_generic #does CSS_Format in one definition, needs to be told about class, despite brevity of generic, easier to see structure with CSS_Format - def initialize(css_class='',content='',id=nil,ocnd=nil,ocns=nil,lv='',hname=nil) + class CSS_Format_generic #does CSS_Format in one definition, needs to be told about attrib, despite brevity of generic, easier to see structure with CSS_Format + def initialize(attrib='',txt='',id=nil,ocnd=nil,ocns=nil,lv='',hname=nil) @tab="\t" - @class=css_class - @content=content + @attrib=attrib + @txt=txt @lv=@notenumber=lv.to_s - #@ocn=ocn.to_s + #{@ocn}=ocn.to_s @hname=hname.to_s @id=@ocn=id end def paragraph - css_class=%{class="#@class" } + attrib=%{class="#{@attrib}" } if @ocn - id=%{id="#@ocn" } + id=%{id="#{@ocn}" } type=%{type="substantive" } else id=%{id="none" } type=%{type="comment" } end - header=%{header="#@hname" } if @hname - %{#{@tab*1}

    \n#{@tab*2}#@content\n#{@tab*1}

    \n} << "\n" + header=%{header="#{@hname}" } if @hname + %{#{@tab*1}

    \n#{@tab*2}#{@txt}\n#{@tab*1}

    \n} << "\n" end def para paragraph @@ -261,4 +275,3 @@ GSUB end end __END__ - diff --git a/lib/sisu/v0/shared_structure.rb b/lib/sisu/v0/shared_structure.rb index cdfe9bf3..47b8ff0d 100644 --- a/lib/sisu/v0/shared_structure.rb +++ b/lib/sisu/v0/shared_structure.rb @@ -70,6 +70,7 @@ module SiSU_Structure @format,@ocn='ordinary','ordinary' #@format,@ocn=nil,nil @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + @id_block="#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" end def lev_segname_para_ocn if @para =~/^#{Mx[:lv_o]}\d:.+?#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ @@ -94,7 +95,7 @@ module SiSU_Structure if @para !~/#{Mx[:id_o]}~(\d+);(?:[ohu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$|^$/ #added 2002w06 @text=@para[/(.+?)/m,1] end - if @para[/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s+(.+)/m] + if @para[/^#{Mx[:lv_o]}(\d):\S*?#{Mx[:lv_c]}\s*(.+)/m] @format,@text=$1,$2 end end @@ -104,14 +105,16 @@ module SiSU_Structure def html_seg lev_segname_para_ocn @seg_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] - SiSU_HTML_Format::Format_seg.new(@md,@format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_HTML_Format::Format_seg.new(@md,txt_obj) end self end def html_scroll lev_segname_para_ocn @scroll_lev_para_ocn=if @para[/.+#{Mx[:id_o]}~\d+;(?:[ohmu]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] - SiSU_HTML_Format::Format_scroll.new(@md,@format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_HTML_Format::Format_scroll.new(@md,txt_obj) end self end @@ -119,18 +122,24 @@ module SiSU_Structure require "#{SiSU_lib}/shared_xml" lev_segname_para_ocn @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - SiSU_XML_format::Format_scroll.new(@md,@format,@text,"x#@ocn") + txt_obj={:txt =>@text,:format =>@format,:ocn =>"x#@ocn"} + SiSU_XML_format::Format_scroll.new(@md,txt_obj) else - SiSU_XML_format::Format_scroll.new(@md,@format,@text,"#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + id_block="#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_XML_format::Format_scroll.new(@md,txt_obj) end self end def odt lev_segname_para_ocn @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - SiSU_ODF_format::Format_text_object.new(format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_ODF_format::Format_text_object.new(@md,txt_obj) else - SiSU_ODF_format::Format_text_object.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + id_block="#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_ODF_format::Format_text_object.new(@md,txt_obj) end self @@ -139,9 +148,25 @@ module SiSU_Structure lev_segname_para_ocn #format=@format.dup @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - Format::Format_text_object.new(@format,@text,@ocn) + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_Plaintext_format::Format_text_object.new(@md,txt_obj) else - Format::Format_text_object.new(@format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}") + id_block="#{Mx[:id_o]}~\d+;[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_Plaintext_format::Format_text_object.new(@md,txt_obj) + end + self + end + def manpage #check + lev_segname_para_ocn + #format=@format.dup + @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt_obj={:txt =>@text,:format =>@format,:ocn =>@ocn} + SiSU_Manpage_format::Format_text_object.new(@md,txt_obj) + else + id_block="#{Mx[:id_o]}~\d+;[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}" + txt_obj={:txt =>@text,:format =>@format,:id_block =>id_block} + SiSU_Manpage_format::Format_text_object.new(@md,txt_obj) end self end diff --git a/lib/sisu/v0/shared_txt.rb b/lib/sisu/v0/shared_txt.rb index 41d6d815..198b8ce8 100644 --- a/lib/sisu/v0/shared_txt.rb +++ b/lib/sisu/v0/shared_txt.rb @@ -222,50 +222,4 @@ module SiSU_text_utils end end end -module SiSU_text_parts_flatfile - class Split_text_object - @@dl=nil - attr_reader :format,:text,:ocn,:lev_para_ocn - def initialize(md,para) - @md,@para=md,para - @format,@ocn='ordinary','ordinary' - @@dl ||=SiSU_Env::Info_env.new.digest.length - end - def lev_segname_para_ocn - if @para =~/^(?:#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}.*/ - if /^(#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) - @format,segname,@text,@ocn=$1,$2,$3,$4 - @format="#@format~#{segname}" # - elsif /^(#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) - @format,@text,@ocn=$1,$2,$3 - elsif /^(#{Mx[:lv_o]}([1-6]):(\S+?)#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(0);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) - @@alt_id_count+=1 - @format,segname,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" - @format="#@format~#{segname}" # - elsif /^(#{Mx[:lv_o]}([1-6]):#{Mx[:lv_c]})\s*(\S.+?)#{Mx[:id_o]}~(0);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) - @@alt_id_count+=1 - @format,@text,@ocn=$1,$2,"x#{@@alt_id_count}" - end - else - if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}/m.match(@para) - @text,@ocn=$1,$2 - end - if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}[0-9a-f]{#{@@dl}}:[0-9a-f]{#{@@dl}}#{Mx[:id_c]}|^$/ #added 2002w06 - @text=/(.+?)/m.match(@para)[1] - end - if /^(#{Mx[:lv_o]}([1-9]):\S*?#{Mx[:lv_c]})\s*(.+)/m.match(@para) - @format,@text=$1,$2 - end - end - @lev_para_ocn=if @para =~/.+<~\d+>/ #hmmm, watch - Format::ParaSiSU.new(@md,@format,@text,@ocn) - else Format::ParaSiSU.new(@md,@format,@text,'<~0>') - end - self - end - end -end __END__ - diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index adcba123..3edf67e4 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -65,7 +65,7 @@ module SiSU_TexInfo include SiSU_Viz #include Stamp ... needed removed arbitrarily 2005w05/1 (warnings about undefined flags) require "#{SiSU_lib}/texinfo_format" - include TexInfoFormat + include SiSU_Texinfo_format @tex_file=[] @@tex_backslash="\\\\" @@tabular="{tabular}" @@ -82,7 +82,6 @@ module SiSU_TexInfo @opt=opt @env=SiSU_Env::Info_env.new(@opt.fns) @st={ 'tex'=>{} } - @tex=TexInfoFormat::Texinfo.new @vz=SiSU_Env::Get_init.instance.skin end def directories @@ -129,7 +128,7 @@ module SiSU_TexInfo end class Texinfo_make include SiSU_Param - include TexInfoFormat + include SiSU_Texinfo_format @@tex_1='(?:.+?)+~' #?? debug @@tabular="{tabular}" @@tex_pattern_margin_number="\\\\marginpar.+?\s+" @@ -138,7 +137,7 @@ module SiSU_TexInfo @data,@md=data,md #fns @env=SiSU_Env::Info_env.new(@md.fns) @st={ 'tex'=>{} } - #@tex=TexInfoFormat::Texinfo.new + #@tex=SiSU_Texinfo_format::Texinfo.new @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern end @@ -165,7 +164,8 @@ module SiSU_TexInfo end para.gsub!(/<:p[bn]>/,'') para.gsub!(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') - do_mono=TexInfoFormat::Texinfo.new(para,@md) + txt_obj={:txt =>para} + do_mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) @tex_file << do_mono.spec_char end data=@tex_file.delete_if {|x| x =~ /^0(?:\\)+~/m} @@ -244,7 +244,8 @@ module SiSU_TexInfo @@tableheader=0 data.each do |para| if para =~ /#{Mx[:tc_p]}|#{Mx[:gr_o]}T/ui - do_mono=TexInfoFormat::Texinfo.new(para,@md) + txt_obj={:txt =>para} + do_mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) para=do_mono.longtable # using longtable latex package end @tex_file << para @@ -256,8 +257,10 @@ module SiSU_TexInfo @row_break='\\\\\\' @break_page="#@row_break\n#@row_break \n" md={} - @tex_file << TexInfoFormat::Texinfo.new('',@md).head - mono=TexInfoFormat::Texinfo.new(@md.title,@md) + txt_obj={:txt =>''} + @tex_file << SiSU_Texinfo_format::Texinfo.new(@md,txt_obj).head + txt_obj={:txt =>@md.title} + mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) @tex_file << mono.topnode texinfo_menu=[] n_menu,n_submenu=0,0 @@ -265,10 +268,12 @@ module SiSU_TexInfo data.each do |para| para.gsub!(/\s*<:name#example>\s*/,' ') if para =~ /^#{Mx[:lv_o]}[1-3]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ - toc=TexInfoFormat::Texinfo.new($1,@md) + txt_obj={:txt =>$1} + toc=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) texinfo_menu << toc.menu elsif para =~ /^#{Mx[:lv_o]}[4-6]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ - toc=TexInfoFormat::Texinfo.new($1,@md) + txt_obj={:txt =>$1} + toc=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) texinfo_menu << toc.menu case para when /^#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.+?)\s*$/ @@ -297,7 +302,8 @@ module SiSU_TexInfo n_menu,n_submenu=0,0 @@do_submenu,@@do_subsubmenu=1,1 data.each do |para| - mono=TexInfoFormat::Texinfo.new(para,@md) + txt_obj={:txt =>para} + mono=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) case para when /^#{Mx[:lv_o]}1:/; mono.level1 when /^#{Mx[:lv_o]}2:/; mono.level2 @@ -310,14 +316,16 @@ module SiSU_TexInfo n_submenu+=1 @@do_subsubmenu=1 if @@do_submenu==1 - menu=TexInfoFormat::Texinfo.new(@submenu[n_menu],@md) + txt_obj={:txt =>@submenu[n_menu]} + menu=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) para="#{menu.submenu}#{mono.level5}" @@do_submenu=0 else mono.level5 end when /^#{Mx[:lv_o]}6:/; if @@do_submenu==1 - menu=TexInfoFormat::Texinfo.new(@subsubmenu[n_menu],@md) + txt_obj={:txt =>@submenu[n_menu]} + menu=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) para="#{menu.subsubmenu}#{mono.level6}" @@do_subsubmenu=0 else @@ -391,7 +399,7 @@ module SiSU_TexInfo if para =~/#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/ \ and para !~ /#{Mx[:br_eof]}/ parablock,paranum=/(.+?)#{Mx[:id_o]}\\~(\d+);\w\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}/im.match(para)[1,2] - do_duo=TexInfoFormat::DuoTex.new(parablock,paranum) ###is BUG + do_duo=SiSU_Texinfo_format::DuoTex.new(parablock,paranum) ###is BUG para=do_duo.paraNum if parablock end @tex_file << para @@ -400,7 +408,8 @@ module SiSU_TexInfo end def tail data=@data - tex=TexInfoFormat::Texinfo.new('',@md) + txt_obj={:txt =>''} + tex=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) data << tex.dublincore data << tex.tail end @@ -428,4 +437,3 @@ module SiSU_TexInfo end end __END__ - diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index b627b616..cdfa6a75 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -58,7 +58,7 @@ ** Description: texinfo formatting template =end -module TexInfoFormat +module SiSU_Texinfo_format @@table_pg_break_counter=1 require "#{SiSU_lib}/param" include SiSU_Param @@ -69,9 +69,19 @@ module TexInfoFormat @@tabular="{tabular}" @@tex_pattern_margin_number="\\\\marginpar.+?\s+" @@dp=nil - def initialize(data=nil,md=nil,three=nil) - @para=@one=data - @md=md + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + #@h_name =t_o[:h_name] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + p t_o.class + p caller + end @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern end @@ -79,12 +89,12 @@ module TexInfoFormat t=Time.now year=t.year filename=%{#{@md.fns}}[/(.+?)\.\w\w\d\d$/,1] - title=Texinfo.new(@md.title).spec_char + title=spec_char_string(@md.title) title=title.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") title.gsub!(/\$/,"\\$") title.gsub!(/[,]\s*/,' - ') if @md.subtitle - subtitle=Texinfo.new(@md.subtitle).spec_char + subtitle=spec_char_string(@md.subtitle) subtitle=subtitle.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") subtitle.gsub!(/\$/,"\\$") subtitle.gsub!(/[,]\s*/,' - ') @@ -150,42 +160,42 @@ WOK "#{head}#{titlepage}" end def topnode - @one=Texinfo.new(@one).spec_char - @one=@one.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") - @one.gsub!(/\$/,"\\$") - @one.gsub!(/[,]\s*/,' - ') + txt=spec_char_string(@txt) + txt=txt.gsub(/<(br|p|i)>|<\/\s*(br|p|i)>|<(br|p)\s*\/>/," #{@@tex_backslash*2} ") + txt.gsub!(/\$/,"\\$") + txt.gsub!(/[,]\s*/,' - ') "@c %% 4\n" + "@ifnottex\n" + "@node Top\n" + - "@top #@one\n\n" + + "@top #{txt}\n\n" + "@insertcopying\n" + "@end ifnottex\n\n" + "@menu\n" end def dublincore - title=Texinfo.new(@md.title).spec_char if @md.title - subtitle=Texinfo.new(@md.subtitle).spec_char if @md.subtitle + title=spec_char_string(@md.title) if @md.title + subtitle=spec_char_string(@md.subtitle) if @md.subtitle dc_title="#{title} - #{subtitle}" - dc_creator=Texinfo.new(@md.dc_creator).spec_char if @md.dc_creator - dc_subject=Texinfo.new(@md.dc_subject).spec_char if @md.dc_subject - dc_description=Texinfo.new(@md.dc_description).spec_char if @md.dc_description - dc_publisher=Texinfo.new(@md.dc_publisher).spec_char if @md.dc_publisher - dc_contributor=Texinfo.new(@md.dc_contributor).spec_char if @md.dc_contributor - dc_date=Texinfo.new(@md.dc_date).spec_char if @md.dc_date - dc_date_created=Texinfo.new(@md.dc_date_created).spec_char if @md.dc_date_created - dc_date_issued=Texinfo.new(@md.dc_date_issued).spec_char if @md.dc_date_issued - dc_date_available=Texinfo.new(@md.dc_date_available).spec_char if @md.dc_date_available - dc_date_valid=Texinfo.new(@md.dc_date_valid).spec_char if @md.dc_date_valid - dc_date_modified=Texinfo.new(@md.dc_date_modified).spec_char if @md.dc_date_modified - dc_type=Texinfo.new(@md.dc_type).spec_char if @md.dc_type - dc_format=Texinfo.new(@md.dc_format).spec_char if @md.dc_format - dc_identifier=Texinfo.new(@md.dc_identifier).spec_char if @md.dc_identifier - dc_source=Texinfo.new(@md.dc_source).spec_char if @md.dc_source - dc_language=Texinfo.new(@md.dc_language[:name]).spec_char if @md.dc_language[:name] - #language_original=Texinfo.new(@md.language_original[:name]).spec_char if @md.language_original[:name] - dc_relation=Texinfo.new(@md.dc_relation).spec_char if @md.dc_relation - dc_coverage=Texinfo.new(@md.dc_coverage).spec_char if @md.dc_coverage - dc_rights=Texinfo.new(@md.dc_rights).spec_char if @md.dc_rights + dc_creator=spec_char_string(@md.dc_creator) if @md.dc_creator + dc_subject=spec_char_string(@md.dc_subject) if @md.dc_subject + dc_description=spec_char_string(@md.dc_description) if @md.dc_description + dc_publisher=spec_char_string(@md.dc_publisher) if @md.dc_publisher + dc_contributor=spec_char_string(@md.dc_contributor) if @md.dc_contributor + dc_date=spec_char_string(@md.dc_date) if @md.dc_date + dc_date_created=spec_char_string(@md.dc_date_created) if @md.dc_date_created + dc_date_issued=spec_char_string(@md.dc_date_issued) if @md.dc_date_issued + dc_date_available=spec_char_string(@md.dc_date_available) if @md.dc_date_available + dc_date_valid=spec_char_string(@md.dc_date_valid) if @md.dc_date_valid + dc_date_modified=spec_char_string(@md.dc_date_modified) if @md.dc_date_modified + dc_type=spec_char_string(@md.dc_type) if @md.dc_type + dc_format=spec_char_string(@md.dc_format) if @md.dc_format + dc_identifier=spec_char_string(@md.dc_identifier) if @md.dc_identifier + dc_source=spec_char_string(@md.dc_source) if @md.dc_source + dc_language=spec_char_string(@md.dc_language[:name]) if @md.dc_language[:name] + #language_original=spec_char_string(@md.language_original[:name]) if @md.language_original[:name] + dc_relation=spec_char_string(@md.dc_relation) if @md.dc_relation + dc_coverage=spec_char_string(@md.dc_coverage) if @md.dc_coverage + dc_rights=spec_char_string(@md.dc_rights) if @md.dc_rights dc_title="Title: #{dc_title}\n\n" if dc_title dc_creator="Creator: #{dc_creator}\n\n" if dc_creator dc_subject="Subject: #{dc_subject}\n\n" if dc_subject @@ -244,140 +254,144 @@ WOK para end def menu - para=clean(@para) + para=clean(@txt) para=para.gsub(/@footnote\{.+?\}\s+/,'') "* #{para}::" end def level1 - @para.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'') - para=clean(@para) + @txt.gsub!(/#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}\s*/,'') + para=clean(@txt) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" - @para.gsub!(/.+/,"#{para}") + @txt.gsub!(/.+/,"#{para}") end def level2 - @para.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'') - para=clean(@para) + @txt.gsub!(/#{Mx[:lv_o]}2:\S*?#{Mx[:lv_c]}\s*/,'') + para=clean(@txt) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" - @para.gsub!(/.+/,"#{para}") + @txt.gsub!(/.+/,"#{para}") end def level3 - @para.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'') - para=clean(@para) + @txt.gsub!(/#{Mx[:lv_o]}3:\S*?#{Mx[:lv_c]}\s*/,'') + para=clean(@txt) nd=para.gsub(/@footnote\{.+?\}\s+/,'') #para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,"\\1 \\3\n\\2") #para=para.gsub(/(.+?)\s*(@footnote\{.+?\})\s*(.+)$/,'\1 \3 \2') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" - @para.gsub!(/.+/,"#{para}") + @txt.gsub!(/.+/,"#{para}") end def level4 - @para.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'') - para=clean(@para) + @txt.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'') + para=clean(@txt) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" - @para.gsub!(/.+/,"#{para}") + @txt.gsub!(/.+/,"#{para}") end def level5 - @para.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'') - para=clean(@para) + @txt.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'') + para=clean(@txt) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" - @para.gsub!(/.+/,"#{para}") + @txt.gsub!(/.+/,"#{para}") end def level6 - @para.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'') - para=clean(@para) + @txt.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'') + para=clean(@txt) nd=para.gsub(/@footnote\{.+?\}\s+/,'') para="@node #{nd}\n@unnumbered #{para}\n@cindex chapter, #{nd}\n" - @para.gsub!(/.+/,"#{para}") + @txt.gsub!(/.+/,"#{para}") end def submenu - @para=@para.join("\n") - @para.gsub!(/[5]\\+~\S+/,'') - para=clean(@para) + @txt=@txt.join("\n") + @txt.gsub!(/[5]\\+~\S+/,'') + para=clean(@txt) para="@menu\n#{para}\n@end menu\n\n" - @para.gsub!(/.+/m,"#{para}") + @txt.gsub!(/.+/m,"#{para}") end def subsubmenu - @para=@para.join("\n") - @para.gsub!(/[6]\\+~\S+/,'') - para=clean(@para) + @txt=@txt.join("\n") + @txt.gsub!(/[6]\\+~\S+/,'') + para=clean(@txt) para="@menu\n#{para}\n@end menu\n\n" - @para.gsub!(/.+/m,"#{para}") + @txt.gsub!(/.+/m,"#{para}") end def indent1 - @para.gsub!(/<:i1>(.*)/,'\1') + @txt.gsub!(/<:i1>(.*)/,'\1') end def indent2 - @para.gsub!(/<:i2>(.*)/,'\1') + @txt.gsub!(/<:i2>(.*)/,'\1') + end + def spec_char_string(txt) # special characters + txt_obj={:txt =>txt} + SiSU_Texinfo_format::Texinfo.new(@md,txt_obj).spec_char end def spec_char # special characters - @para.gsub!(/#{Mx[:br_eof]}/i,'') - @para.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)') - @para.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); @para.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>') - @para.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); @para.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') - @para.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') - @para.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') - @para.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') - @para.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') - @para.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') - @para.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') - @para.gsub!(/&atild;<\/font><\/sup>/,' ') - @para.gsub!(/\\/,'\\backslash ') - @para.gsub!(/<:pb>/,'\\newpage') - @para.gsub!(/\\backslash copyright/,'\\copyright ') - @para.gsub!(/\^/,'\\wedge ') - @para.gsub!(/(\$)/,"\\$") - @para.gsub!(/\~/,'\\~') - @para.gsub!(/%/,"\\%") - #if @para !~ /^\s*<:image|\}:image\s/ - # @para.gsub!(/_/,'\_') + @txt.gsub!(/#{Mx[:br_eof]}/i,'') + @txt.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'(c)') + @txt.gsub!(/#{Mx[:gl_o]}#(?:lt|060)#{Mx[:gl_c]}/,'<'); @txt.gsub!(/#{Mx[:gl_o]}(gt|#062)#{Mx[:gl_c]}/,'>') + @txt.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'); @txt.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}') + @txt.gsub!(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') + @txt.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!') + @txt.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#') + @txt.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*') + @txt.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/') + @txt.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_') + @txt.gsub!(/&atild;<\/font><\/sup>/,' ') + @txt.gsub!(/\\/,'\\backslash ') + @txt.gsub!(/<:pb>/,'\\newpage') + @txt.gsub!(/\\backslash copyright/,'\\copyright ') + @txt.gsub!(/\^/,'\\wedge ') + @txt.gsub!(/(\$)/,"\\$") + @txt.gsub!(/\~/,'\\~') + @txt.gsub!(/%/,"\\%") + #if @txt !~ /^\s*<:image|\}:image\s/ + # @txt.gsub!(/_/,'\_') #end - @para.gsub!(/_(https?:\/\/)/,'\1') - @para.gsub!(/§/i,'\S') - @para.gsub!(/£/i,'\pounds') - @para.gsub!(/å/i,'\aa') - @para.gsub!(/æ/i,'\ae') - @para.gsub!(/ø/i,'\o') - @para.gsub!(/Å/i,'\AA') - @para.gsub!(/Æ/i,'\AE') - @para.gsub!(/Ø/i,'\O') - @para.gsub!(//i,' ') - @para.gsub!(/<\/a>/i,' ') - @para.gsub!(/<:ee>/i,'') - @para.gsub!(//i,' ') - @para.gsub!(/(.+?)<\/b>/,'\*\1\*') - @para.gsub!(/(.+?)<\/i>/,'\/\1\/') - @para.gsub!(/(.+?)<\/u>/,'\_\1\_') - @para.gsub!(/@/i,'@@') - @para.gsub!(/\{/,'@{'); @para.gsub!(/\}/,'@}') - #@para.gsub!(/(^|[\s*!\/#_-])\{/,'\1@{'); @para.gsub!(/\}([\s*!\/#_-]|$)/,'@}\1') - @para.gsub!(/  /,' ') # ~ character for hardspace - @para.gsub!(/ /,' ') # ~ character for hardspace - @para.gsub!(/&(\S+?);/,' ') - @para.gsub!(/&/,'<=and>') - @para.gsub!(/(\s+&\s+)/,' and ') - @para.gsub!(/(\&)/,"\\&") - @para.gsub!(/"(.+?)"/,"`\\1'") # open & close " - @para.gsub!(/\s+"/," `") # open " - @para.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open " - @para.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close " - @para.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close " - @para.gsub!(/"(\.|,)/,"'") # close " - @para.gsub!(/\s+'/," `") # open ' - @para.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open ' - @para.gsub!(/(|<\/font>)/,'') - @para.gsub!(/\s*(\S+?)<\/sup>/,'^\1') - @para.gsub!(/(|<\/sup>)/,'') - @para + @txt.gsub!(/_(https?:\/\/)/,'\1') + @txt.gsub!(/§/i,'\S') + @txt.gsub!(/£/i,'\pounds') + @txt.gsub!(/å/i,'\aa') + @txt.gsub!(/æ/i,'\ae') + @txt.gsub!(/ø/i,'\o') + @txt.gsub!(/Å/i,'\AA') + @txt.gsub!(/Æ/i,'\AE') + @txt.gsub!(/Ø/i,'\O') + @txt.gsub!(//i,' ') + @txt.gsub!(/<\/a>/i,' ') + @txt.gsub!(/<:ee>/i,'') + @txt.gsub!(//i,' ') + @txt.gsub!(/(.+?)<\/b>/,'\*\1\*') + @txt.gsub!(/(.+?)<\/i>/,'\/\1\/') + @txt.gsub!(/(.+?)<\/u>/,'\_\1\_') + @txt.gsub!(/@/i,'@@') + @txt.gsub!(/\{/,'@{'); @txt.gsub!(/\}/,'@}') + #@txt.gsub!(/(^|[\s*!\/#_-])\{/,'\1@{'); @txt.gsub!(/\}([\s*!\/#_-]|$)/,'@}\1') + @txt.gsub!(/  /,' ') # ~ character for hardspace + @txt.gsub!(/ /,' ') # ~ character for hardspace + @txt.gsub!(/&(\S+?);/,' ') + @txt.gsub!(/&/,'<=and>') + @txt.gsub!(/(\s+&\s+)/,' and ') + @txt.gsub!(/(\&)/,"\\&") + @txt.gsub!(/"(.+?)"/,"`\\1'") # open & close " + @txt.gsub!(/\s+"/," `") # open " + @txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*"/,'\1`') # open " + @txt.gsub!(/"(\s|\.|,|:|;)/,"'\\1") # close " + @txt.gsub!(/"([1-6-]\\+(?:~\S+)?|<.+?>)?\s*$/,"'\\1") # close " + @txt.gsub!(/"(\.|,)/,"'") # close " + @txt.gsub!(/\s+'/," `") # open ' + @txt.gsub!(/^([1-6-]\\+(?:~\S+)?|<.+?>)?\s*'/,'\1`') # open ' + @txt.gsub!(/(|<\/font>)/,'') + @txt.gsub!(/\s*(\S+?)<\/sup>/,'^\1') + @txt.gsub!(/(|<\/sup>)/,'') + @txt end def longtable @end_table="\\end{longtable}" @row_break='\\\\\\' - if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure + if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] #CHECK !> closure no_of_cols,cols_width=$1,$2 - @@tableheader=1 if @para =~ /#{Mx[:gr_o]}Th/i + @@tableheader=1 if @txt =~ /#{Mx[:gr_o]}Th/i @w=cols_width.split(/;\s+/) @@number_of_cols=no_of_cols @colW=[] @@ -390,31 +404,31 @@ WOK @colW=@colW.join @@start_table="\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{longtable}[hb]#@colW\n" - @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ - @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table") + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table") end - @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') if @@tableheader==1 - if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u tablefoot=para[/\/,1] - @para.gsub!(/\/,'') - @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u, + @txt.gsub!(/\/,'') + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u, "{\\begin{tiny} {\\bfseries \\1}\\end{tiny}}&") - @para.gsub!(/&>\s*$/, + @txt.gsub!(/&>\s*$/, " #@row_break \\hline\\endhead #@row_break") - @para="#@para \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot + @txt="#{@txt} \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader=0 @@number_of_cols=0 end else - if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u - @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") - @para.gsub!(/&>\s*$/," #@row_break") + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") + @txt.gsub!(/&>\s*$/," #@row_break") end end - @para + @txt end def scopedtable # some features related to headers have been incorporated in longtable @@ -423,7 +437,7 @@ WOK @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @para[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] + if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/ui] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s+/) @colW=[] @@ -432,59 +446,59 @@ WOK @colW << "p{#{col_w}cm}" if col_w end @@start_table="\\begin{tabular}{#@colW}\n" - @para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#{@@start_table}") end - if @para =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ - @para.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") @@table_pg_break_counter=1 end - if @para =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u + if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u if @@table_pg_break_counter==28 # taken from 34 ideal for portrait to 28 which suits landscape - @para = + @txt = "\n\n#@end_table \n" + "#@break_page" + "#{@@start_table}\n" @@table_pg_break_counter=1 else - @para.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') @@table_pg_break_counter+=1 - tablefoot=@para[/\/] - @para.gsub!(/\/,'') + tablefoot=@txt[/\/] + @txt.gsub!(/\/,'') end end - if @para =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u - @para.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") - @para.gsub!(/&>\s*$/,"#@row_break") + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,"\\begin{tiny}\\1\\end{tiny}&") + @txt.gsub!(/&>\s*$/,"#@row_break") end - @para + @txt end def graphics dir=SiSU_Env::Info_env.new(@md.fns) - @para.gsub!(/<::\s+(\S+?)\s+>/i, #watch + @txt.gsub!(/<::\s+(\S+?)\s+>/i, #watch "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}") end def image dir=SiSU_Env::Info_env.new(@md.fns) width="100" - width=@para[/<:image.+?width=``(\d+)''.+?>/im,1] + width=@txt[/<:image.+?width=``(\d+)''.+?>/im,1] width=width.to_i*0.4 - @para.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i, + @txt.gsub!(/<:image\s+((?:https?|file|ftp)\S+)\s+(\S+)\s+.+\s+?>/i, "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\2}}") - @para.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i, + @txt.gsub!(/<:image\s+(\S+)\s+.+\s+?>/i, "\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/\\1}") end def png # very messy clean up ! - work area, testing - z=@para[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile ! + z=@txt[/\\\{(.+?)\}(?:image|png)/,1] # match operator for z \\ fragile ! image,w,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') - @para.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"") # fragile match operator\\ fragile ! + @txt.gsub!(/\\\{\S+\.(png|jpg|gif).+?\}(image|png)/,"") # fragile match operator\\ fragile ! end def http # very messy clean up ! - work area, testing - z=@para[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile ! - url=@para[/((?:https?|file|ftp):\S+)/im,1] - if @para =~/\.(png|jpg|gif)/ + z=@txt[/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\//,1] # match operator for z \\ fragile ! + url=@txt[/((?:https?|file|ftp):\S+)/im,1] + if @txt =~/\.(png|jpg|gif)/ image,w,x,y=z.scan(/\S+/) image.gsub!(/\\/,'') width=200 @@ -496,11 +510,11 @@ WOK end if image dir=SiSU_Env::Info_env.new(@md.fns) - @para.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile ! + @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/, # fragile match operator\\ fragile ! "\n\\href{#{url}}{\\includegraphics*[width=#{width}pt]{#{dir.path.image_source_tex}/#{image}}}#{caption}") else link=z[/(.+?)\\/im,1] - @para.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile ! + @txt.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,"\n\\noindent\\href{#{url}}{#{link}}") # fragile match operator\\ fragile ! end end end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index e4bd9c00..c5ee2092 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -382,8 +382,10 @@ module SiSU_TeX @md.papersize_array.each do |ps| @@tableheader={ ps => { :p => 0, :l => 0 }} para,para_p=@para.dup,@para.dup #visit - format_l=SiSU_TeX_Pdf::Format_text_object.new(md,para,ps) - format_p=SiSU_TeX_Pdf::Format_text_object.new(md,para_p,ps) + txt_obj={:txt =>para,:paper_size =>ps} + format_l=SiSU_TeX_Pdf::Format_text_object.new(md,txt_obj) + txt_obj={:txt =>para_p,:paper_size =>ps} + format_p=SiSU_TeX_Pdf::Format_text_object.new(md,txt_obj) @block[ps]={ :l => format_l.longtable_landscape, :p => format_p.longtable_portrait @@ -411,7 +413,8 @@ module SiSU_TeX end def markup_common(para) tex_f=nil - mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) + txt_obj={:txt =>para} + mono=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj) if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ \ or @@flag_alt if para =~/#{Mx[:gr_o]}(?:code|alt|verse|group)#{Mx[:gr_c]}/ @@ -436,7 +439,8 @@ module SiSU_TeX elsif x =~/code/; @@flag_alt,@@flag_code=true,true elsif @@flag_alt if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/m - para=SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http + txt_obj={:txt =>para,:paper_size =>'a4'} + para=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http end @group_collect << para #<< "\n\n" end @@ -501,11 +505,13 @@ module SiSU_TeX end if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/ para=if para !~/\.(?:png|jpg|gif)/ - SiSU_TeX_Pdf::Format_text_object.new(@md,para,'a4').http + txt_obj={:txt =>para,:paper_size =>'a4'} + SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http else @block={} @md.papersize_array.each do |ps| - image=SiSU_TeX_Pdf::Format_text_object.new(@md,para,ps).http + txt_obj={:txt =>para,:paper_size =>ps} + image=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http @block[ps]={ :l => image, :p => image @@ -524,8 +530,10 @@ module SiSU_TeX title=@md.title.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') #no line splitting in heading neither html nor latex subtitle=@md.subtitle.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}|#{Mx[:br_paragraph]}|\\\\/,' - ') if @md.subtitle #no line splitting in heading neither html nor latex @md.papersize_array.each do |ps| - orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,ps,'portrait',"#{home}: - #{title} #{subtitle}") - orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,ps,'landscape',"#{home}: - #{title} #{subtitle}") + txt_obj={:txt =>"#{home}: - #{title} #{subtitle}",:paper_size =>ps,:orientation =>'portrait'} + orient_portrait=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj) + txt_obj={:txt =>"#{home}: - #{title} #{subtitle}",:paper_size =>ps,:orientation =>'landscape'} + orient_landscape=SiSU_TeX_Pdf::Format_head.new(@md,txt_obj) @@tex_head[ps][:p]=orient_portrait.document_head_with_orientation @@tex_head[ps][:l]=orient_landscape.document_head_with_orientation end @@ -544,8 +552,9 @@ WOK #end @copymark='' #check and remove as now is superflous x={} - x[:l]=SiSU_TeX_Pdf::Format_text_object.new(@md,@md.title,@md.subtitle).title_landscape - x[:p]=SiSU_TeX_Pdf::Format_text_object.new(@md,@md.title,@md.subtitle).title_portrait + txt_obj={:title =>@md.title,:subtitle =>@md.subtitle} + x[:l]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_landscape + x[:p]=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).title_portrait @tex_file << x x=nil if @md.dc_creator @@ -680,7 +689,8 @@ WOK paranum=if ocn; para[m,2] else '' end - do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,parablock,paranum) + txt_obj={:txt =>parablock,:ocn =>paranum} + do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj) para=do_duo.para_num if parablock elsif para =~/^#{Mx[:id_o]}~\d+;(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #2005 this is added for tables, rationalise m=/#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/m diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index f776dd5a..55a9473f 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -78,8 +78,24 @@ module SiSU_TeX_Pdf } @@sys=SiSU_Env::System_call.new @@dp=nil - def initialize(md,string,string1=nil) - @md,@string,@string1=md,string,string1 + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + @title =t_o[:title] || nil + @subtitle =t_o[:subtitle] || nil + @ps =t_o[:paper_size] || nil + @ocn =t_o[:ocn] || nil + @words =t_o[:words] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + p t_o.class + p caller + end + if defined? @md.image \ and @md.image =~/center/ @center_begin,@center_end='\begin{center}','\end{center}' @@ -90,12 +106,11 @@ module SiSU_TeX_Pdf @tx=SiSU_Env::Get_init.instance.tex @url_brace=SiSU_Viz::Skin.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine - @ps=string1 if string1=~/(?:a4|letter|legal|book|a5|b5)/i end def longtable_landscape @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u] + if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u] no_of_cols,cols_width,ocn=$1,$2,$3 tw=case @ps when /a4/i; @tx.a4.landscape.w #European default, SiSU default @@ -106,7 +121,7 @@ module SiSU_TeX_Pdf else @tx.a4.landscape.w #default currently A4 end textwidth=(tw.to_i/2) - 24 - @@tableheader[@ps][:l]=1 if @string =~/#{Mx[:gr_o]}Th/ + @@tableheader[@ps][:l]=1 if @txt =~/#{Mx[:gr_o]}Th/ w=cols_width.split(/;\s*/) @@number_of_cols=no_of_cols ||=@@number_of_cols #@@number_of_cols=0 unless @@number_of_cols.to_i > 0 @@ -122,36 +137,36 @@ module SiSU_TeX_Pdf @colW=@colW.join @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table) + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table) end - if @string =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ - @string.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") end - @string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') if @@tableheader[@ps][:l] == 1 - if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u - tablefoot=@string[/\/,1] - @string.gsub!(/\/,'') - @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') - @string.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") - @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u + tablefoot=@txt[/\/,1] + @txt.gsub!(/\/,'') + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') + @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") + @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[@ps][:l]=0 #@@tableheader[@ps][:l],@@number_of_cols=0,0 end else - if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u - @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,'\1&') - @string.gsub!(/&\s*$/," #@row_break") + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,'\1&') + @txt.gsub!(/&\s*$/," #@row_break") end end - @string=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @string - else @string + @txt=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @txt + else @txt end end def longtable_portrait @end_table='\end{longtable}' @row_break='\\\\\\' - if @string[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u] + if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:tc_p]}\\~(\d+;\w\d+;\w\d+)#{Mx[:gr_c]}/u] no_of_cols,cols_width,ocn=$1,$2,$3 tw=case @ps when /a4/i; @tx.a4.portrait.w #European default, SiSU default @@ -162,7 +177,7 @@ module SiSU_TeX_Pdf else @tx.a4.portrait.w #default currently A4 end textwidth=tw.to_i - 20 - @@tableheader[@ps][:p]=1 if @string =~/#{Mx[:gr_o]}Th/ + @@tableheader[@ps][:p]=1 if @txt =~/#{Mx[:gr_o]}Th/ w=cols_width.split(/;\s*/) @@number_of_cols=no_of_cols ||=@@number_of_cols @colW=[] @@ -178,30 +193,30 @@ module SiSU_TeX_Pdf @colW=@colW.join @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table") + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table") end - if @string =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ - @string.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") end - @string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') if @@tableheader[@ps][:p] == 1 - if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u - tablefoot=@string[/\/,1] - @string.gsub!(/\/,'') - @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') - @string.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") - @string="#@string \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + tablefoot=@txt[/\/,1] + @txt.gsub!(/\/,'') + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') + @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") + @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[@ps][:p]=0 #@@tableheader[@ps][:p],@@number_of_cols=0,0 end else - if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u - @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&') - @string.gsub!(/&\s*$/," #@row_break") + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&') + @txt.gsub!(/&\s*$/," #@row_break") end end - @string=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @string - else @string + @txt=if ocn; "#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}" + @txt + else @txt end end def scopedtable @@ -210,7 +225,7 @@ module SiSU_TeX_Pdf @end_table="\\end{tabular}" @row_break='\\\\\\\\' @break_page="#@row_break\n#@row_break \n" - if @string[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/u] + if @txt[/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c(\d+);(.+?)#{Mx[:gr_c]}/u] no_of_cols,cols_width=$1,$2 @w=cols_width.split(/;\s*/) @colW=[] @@ -219,28 +234,28 @@ module SiSU_TeX_Pdf @colW << "p{#{col_w}cm}" if col_w end @start_table="\\begin{tabular}{#@colW}\n" - @string.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#@start_table}") + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:gr_c]}/u,"#@start_table}") end - if @string =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ - @string.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") + if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ + @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/,"#@end_table") @@table_pg_break_counter=1 end - if @string =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u + if @txt =~/#{Mx[:tc_o]}#{Mx[:tc_p]}/u if @@table_pg_break_counter == 28 # taken from 34 ideal for portrait to 28 which suits landscape - @string="\n\n#@end_table \n#@break_page#@start_table\n" + @txt="\n\n#@end_table \n#@break_page#@start_table\n" @@table_pg_break_counter=1 else - @string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') + @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') @@table_pg_break_counter+=1 - tablefoot=@string[/\/,1] - @string.gsub!(/\/,'') + tablefoot=@txt[/\/,1] + @txt.gsub!(/\/,'') end end - if @string =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u - @string.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u,"\\1&") - @string.gsub!(/&\s*$/,"#@row_break") + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u,"\\1&") + @txt.gsub!(/&\s*$/,"#@row_break") end - @string + @txt end def heading_major(para,lev) #\emph{ title=@md.title @@ -264,90 +279,90 @@ module SiSU_TeX_Pdf para end def level1 - heading_major(@string,1) + heading_major(@txt,1) end def level2 - heading_major(@string,2) + heading_major(@txt,2) end def level3 - heading_major(@string,3) + heading_major(@txt,3) end def level4 - @string.strip! if @string - @string.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') - cont_ln=@string.dup + @txt.strip! if @txt + @txt.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') + cont_ln=@txt.dup cont_ln.gsub!(@@tex_pattern_margin_number,'') cont_ln.gsub!(/#{@@tex_backslash*2}/,"#{@@tex_backslash*4}") # added w42 cont_ln.gsub!(/#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*/,'') cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 title=@md.title - @string.gsub!(/#{@md.lv4}\s+(#{@md.lv4})/m,'\1') - if @string =~/#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|<:4-endnotes>/ + @txt.gsub!(/#{@md.lv4}\s+(#{@md.lv4})/m,'\1') + if @txt =~/#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|<:4-endnotes>/ # watch exclusion removes endnotes marker from pdf 2003w03 - @string.gsub!(/.+/m,'') + @txt.gsub!(/.+/m,'') end - if @string =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! + if @txt =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end - if @string !~/#{Mx[:lv_o]}4:/ - @string.gsub!(/(#{@md.lv4}.*)\n?$/m,"\\subsubsection*{\\1} + if @txt !~/#{Mx[:lv_o]}4:/ + @txt.gsub!(/(#{@md.lv4}.*)\n?$/m,"\\subsubsection*{\\1} \\addcontentsline{toc}{subsection}{#{cont_ln}} \\markright{#{title}}") else - @string.gsub!(/^\s*#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.*)?\n?$/m,"\\subsubsection*{\\1} + @txt.gsub!(/^\s*#{Mx[:lv_o]}4:\S+?#{Mx[:lv_c]}\s*(.*)?\n?$/m,"\\subsubsection*{\\1} \\addcontentsline{toc}{subsection}{#{cont_ln}} \\markright{#{title}}") end - @string.gsub!(/#{@md.lv4}\s*(.marginpar)/m,'\1') + @txt.gsub!(/#{@md.lv4}\s*(.marginpar)/m,'\1') end def level5 - # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@string*, same for next section 2002w46 - @string.strip! if @string - @string.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') - cont_ln=@string.dup + # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\@txt*, same for next section 2002w46 + @txt.strip! if @txt + @txt.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') + cont_ln=@txt.dup cont_ln.gsub!(@@tex_pattern_margin_number,'') cont_ln.gsub!(/#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*/,'') cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\\&/,' and ') #revisit: tmp bugfix 200507, substitutes & with 'and' in toc, needed e.g. for AT&T, see ffa - @string.gsub!(/#{@md.lv5}\s+(#{@md.lv5})/m,'\1') - if @string =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! + @txt.gsub!(/#{@md.lv5}\s+(#{@md.lv5})/m,'\1') + if @txt =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end - if @string !~/#{Mx[:lv_o]}5:/ - @string.gsub!(/(#{@md.lv5}.*?)\n?$/m,"\\subsubsection*{\\1} + if @txt !~/#{Mx[:lv_o]}5:/ + @txt.gsub!(/(#{@md.lv5}.*?)\n?$/m,"\\subsubsection*{\\1} \\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\ }") else - @string.gsub!(/^\s*#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m, + @txt.gsub!(/^\s*#{Mx[:lv_o]}5:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m, "\\subsubsection*{\\1} \\addcontentsline{toc}{subsubsection}{#{cont_ln} \\\\ }") end - @string.gsub!(/#{@md.lv5}\s*(.marginpar)/m,'\1') + @txt.gsub!(/#{@md.lv5}\s*(.marginpar)/m,'\1') end def level6 - # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@string*, same for previous section 2002w46 - @string.strip! if @string - @string.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') - cont_ln=@string.dup + # there is a problem here with creation of headers does not do what you would want it to header starts with a * and is not in bold work on \\sub@txt*, same for previous section 2002w46 + @txt.strip! if @txt + @txt.gsub!(/(?:\\begin\{bfseries\}|\\begin\{itshape\})(.+?)(?:\\end\{bfseries\}|\\end\{itshape\})/m,'\1') + cont_ln=@txt.dup cont_ln.gsub!(@@tex_pattern_margin_number,'') cont_ln.gsub!(/#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*/,'') cont_ln.gsub!(/\\footnote\[\d+\]\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 cont_ln.gsub!(/\\Footnote[A]\{[*+]+\d*\}\{%.+?\\end\{scriptsize\}\s*\}/m,'') #arbitrary bugfix, revisit should not be necessary, eg. wta.1994 2004w22 - @string.gsub!(/#{@md.lv6}\s+(#{@md.lv6})/m,'\1') - if @string =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! + @txt.gsub!(/#{@md.lv6}\s+(#{@md.lv6})/m,'\1') + if @txt =~/\\footnote/ #and para =~/^[1-6]#{@@tilde}/ # removing footnotes from headings! cont_ln.gsub!(/\s*\\footnote\[\d+\]\{%\n .+? \}\s*/,' ') cont_ln.gsub!(/\s*\\Footnote[A]\{[*+]+\d*\}\{%\n .+? \}\s*/,' ') end - @string.gsub!(/(#{@md.lv6}.*)\n?$/m, - "\\subsubsection*{\\1}") if (@string !~/#{Mx[:lv_o]}6:/) - @string.gsub!(/^\s*#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m, + @txt.gsub!(/(#{@md.lv6}.*)\n?$/m, + "\\subsubsection*{\\1}") if (@txt !~/#{Mx[:lv_o]}6:/) + @txt.gsub!(/^\s*#{Mx[:lv_o]}6:\S*?#{Mx[:lv_c]}\s*(.*)?\n?$/m, '\subsubsection*{\1}') - @string.gsub!(/#{@md.lv6}\s*(.marginpar)/m,'\1') + @txt.gsub!(/#{@md.lv6}\s*(.marginpar)/m,'\1') #end BUGWATCH end def indent(lev) @@ -362,25 +377,25 @@ para when /8/; '70mm' when /9/; '80mm' end - @string.gsub!(/#{Mx[:pa_o]}:i#{lev}#{Mx[:pa_c]}\s*(.*)/m, + @txt.gsub!(/#{Mx[:pa_o]}:i#{lev}#{Mx[:pa_c]}\s*(.*)/m, "\\begin{ParagraphIndent}{#{indent}}\\1 \\end{ParagraphIndent}}") end def symbol_graphic dir=SiSU_Env::Info_env.new(@md.fns) - image='c_' + /<:=\s*(\S+?)\s*>/m.match(@string).captures.join + '.png' #watch + image='c_' + /<:=\s*(\S+?)\s*>/m.match(@txt).captures.join + '.png' #watch if FileTest.file?("#{dir.path.image_source_tex}/#{image}") - @string.gsub!(/<:=\s*(\S+?)\s*>/, + @txt.gsub!(/<:=\s*(\S+?)\s*>/, "\\includegraphics*[width=11pt]{#{dir.path.image_source_tex}/c_\\1.png}") else tell=SiSU_Screen::Ansi.new(@md.cmd,"ERROR - image:",%{"#{image}" missing},"search path: #{dir.path.image_source_tex}") tell.error2 unless @md.cmd =~/q/ - @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile ! + @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/,'') # fragile match operator\\ fragile ! end end def image dir=SiSU_Env::Info_env.new(@md.fns) - image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@string).captures + image,m=/#{Mx[:lnk_o]}\s*(\S+)\s+.+?width=``(\d+)''.+?#{Mx[:lnk_c]}/m.match(@txt).captures width=m[1] || '100' width=width.to_i*0.4 image_source=if @md.fns =~/\.(?:ssm\.)?sst$/ \ @@ -397,17 +412,17 @@ para nil end if image_source - @string.gsub!(/#{Mx[:lnk_o]}\s*((?:https?|file|ftp):\/\/\S+)\s+(\S+).+?#{Mx[:lnk_c]}/, + @txt.gsub!(/#{Mx[:lnk_o]}\s*((?:https?|file|ftp):\/\/\S+)\s+(\S+).+?#{Mx[:lnk_c]}/, @center_begin + "\\href{\\1}{\\includegraphics*[width=#{width}pt]{#{image_source}/\\2}}" + @center_end ) - @string.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/, + @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/, @center_begin + "\\includegraphics*[width=#{width}pt]{#{image_source}/\\1}" + @center_end ) - else @string.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}') + else @txt.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\s+.+?#{Mx[:lnk_c]}/,'\1}') end end def png #fc missing image check dir=SiSU_Env::Info_env.new(@md.fns) # messy clean up - z=@string[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @string =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile ! + z=@txt[/#{Mx[:lnk_o]}(\S.+?)#{Mx[:lnk_c]}(?:image|png)/,1].strip if @txt =~ /#{Mx[:lnk_o]}\S.+?#{Mx[:lnk_c]}(?:image|png)/ # match operator for z \\ fragile ! if z #debug 2004w14 image=z[/(\S+?\.(?:png|jpg|gif)\b)/m] image.gsub!(/\\/,'') @@ -438,18 +453,18 @@ para nil end if image_source - @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile ! + @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/, # fragile match operator\\ fragile ! "#@center_begin\n\\includegraphics*[width=#{width}pt]{#{image_source}/#{image}}#{caption}#@center_end") - else @string.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'') + else @txt.gsub!(/#{Mx[:lnk_o]}\S+\.(png|jpg|gif).+?#{Mx[:lnk_c]}(image|png)/,'') end end def http_word_mode #(orientation='') # clean up ! - work area, testing dir=SiSU_Env::Info_env.new(@md.fns) - @words=[] + @w=[] @url_generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/ - @string.each do |word| - @words << if word=~@url_generic_rgx + @words.each do |word| + @w << if word=~@url_generic_rgx if word =~/#{Mx[:lnk_o]}(?:.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ punctuate=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join @@ -521,20 +536,21 @@ para else word end end - @words=@words.join - @words + @txt=@w.join + @txt end def http - wm=@string.dup.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) - @string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm,@ps).http_word_mode #GET PAPER SIZE AND USE IT + wm=@txt.dup.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) + txt_obj={:words =>wm,:paper_size =>@ps} + @txt=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http_word_mode #GET PAPER SIZE AND USE IT end def title - @string=SiSU_TeX_Pdf::Special_characters.new(@md,@string).special_characters_safe - if @string1 - @string1=SiSU_TeX_Pdf::Special_characters.new(@md,@string1).special_characters_safe - @string1.gsub!(/\$/,"\\$") - "\n\\title{#@string#{@@tex_backslash*2} \\textbf{\\normalsize #@string1}\\normalsize}" - else "\n\\title{#@string}" + @txt=SiSU_TeX_Pdf::Special_characters.new(@md,@title).special_characters_safe + if @subtitle + @subtitle=SiSU_TeX_Pdf::Special_characters.new(@md,@subtitle).special_characters_safe + @subtitle.gsub!(/\$/,"\\$") + "\n\\title{#@title#{@@tex_backslash*2} \\textbf{\\normalsize #@subtitle}\\normalsize}" + else "\n\\title{#@txt}" end end def title_landscape @@ -547,33 +563,49 @@ para paranumber_display=if @md.markup.inspect =~/no_ocn/ \ or @md.mod.inspect =~/--no-ocn/ '' - else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering + else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@ocn\\end{tiny}}}" #ocn object citation numbering end - if @string !~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ - @string.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect + if @txt !~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ + @txt.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect else - if (@string =~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})/) #watch - in 1-6 is suspect - @string.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #watch - in 1-6 is suspect - #@string.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\begin{bfseries}\\2 \\end{bfseries}\n") #watch - in 1-6 is suspect - #@string.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\emph{\\2}\n") #watch - in 1-6 is suspect - @string.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT? - #@string.gsub!(/^(<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT? + if (@txt =~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})/) #watch - in 1-6 is suspect + @txt.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #watch - in 1-6 is suspect + #@txt.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\begin{bfseries}\\2 \\end{bfseries}\n") #watch - in 1-6 is suspect + #@txt.gsub!(/^(#{Mx[:lv_o]}[1-6a-z-]:\S*?#{Mx[:lv_c]})\s*(.+)/m,"\\1 #{paranumber_display} \\emph{\\2}\n") #watch - in 1-6 is suspect + @txt.gsub!(/^(#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]})\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT? + #@txt.gsub!(/^(<:.+?>)\s*(.+)/m,"\\1 #{paranumber_display}\\2\n") #WHAT? else - @string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\1\n") - #@string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\begin{bfseries}\\1 \\end{bfseries}\n") - #@string.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display}\\emph{\\1}\n") + @txt.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\1\n") + #@txt.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display} \\begin{bfseries}\\1 \\end{bfseries}\n") + #@txt.gsub!(/((#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6}).+)$/,"\\2 #{paranumber_display}\\emph{\\1}\n") end end - @string + @txt end end class Format_head - def initialize(md,ps,layout=nil,string1=nil) - @md,@ps,@layout,@string1=md,ps,layout,string1 + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + #@title =t_o[:title] || nil + @subtitle =t_o[:subtitle] || nil + @ps =t_o[:paper_size] || nil + @ocn =t_o[:ocn] || nil + @layout=t_o[:orientation] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + p t_o.class + p caller + end + @tx=SiSU_Env::Get_init.instance.tex @url_brace=SiSU_Viz::Skin.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine - @ps=@string if @string=~/(?:a4|letter|legal|book|a5|b5)/i + @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i end def language @lang=if @md.dc_language[:code] @@ -786,7 +818,7 @@ WOK \\usepackage{thumbpdf} \\usepackage[#{@tex2pdf}, #{color.strip} - pdftitle={#@string1}, + pdftitle={#{@txt}}, % pdftitle={Untitled}, pdfauthor={LM-sisu-scribe}, pdfsubject={law}, @@ -820,7 +852,7 @@ WOK \\definecolor{myblue}{rgb}{0,0,0.5} \\definecolor{mywhite}{rgb}{1,1,1} WOK - elsif @string =~/dvi/ + elsif @txt =~/dvi/ <') #unless @string=~/<:code>/ # / SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX @@ -1095,7 +1127,7 @@ WOK end def xetex_special_characters_1(string) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list #p @@utf_8.list - #string=Iconv.conv('ISO-8859-1', 'UTF-8', @string) + #string=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) word=string.scan(/\S+|\n/) #unless line =~/^(?:0~\S|%+\s)/ para_array=[] string=if word @@ -1138,7 +1170,7 @@ WOK string.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-') # - SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#043#{Mx[:gl_c]}/,'+') # + SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#044#{Mx[:gl_c]}/,',') # + SiSU special character also LaTeX - string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @string=~/<:code>/ # / SiSU special character also LaTeX + string.gsub!(/#{Mx[:gl_o]}#038#{Mx[:gl_c]}/,'<=amp>') #unless @txt=~/<:code>/ # / SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'<=slash>') # / SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'<=backslash>') # \ SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'<=underscore>') # _ SiSU special character also LaTeX @@ -1275,33 +1307,33 @@ WOK string end def special_characters #special characters - some substitutions are sequence sensitive, rearrange with care. - string=@string + string=@txt case @tex2pdf when /pdf/ string=pdftex_special_characters_1(string) unless string.nil? - string=special_characters_unsafe_1(string) unless string.nil? #pdftex_special_characters_unsafe_1(@string) + string=special_characters_unsafe_1(string) unless string.nil? #pdftex_special_characters_unsafe_1(@txt) string=pdftex_special_characters_2(string) unless string.nil? string=pdftex_special_characters_3(string) unless string.nil? when /xe/ string=xetex_special_characters_1(string) unless string.nil? - string=special_characters_unsafe_1(string) unless string.nil? #xetex_special_characters_unsafe_1(@string) + string=special_characters_unsafe_1(string) unless string.nil? #xetex_special_characters_unsafe_1(@txt) string=xetex_special_characters_2(string) unless string.nil? #issues with xetex string=xetex_special_characters_3(string) unless string.nil? end - @string=string + @txt=string end def special_characters_safe #special characters - some substitutions are sequence sensitive, rearrange with care. - string=@string + string=@txt case @tex2pdf when /pdf/ - string=pdftex_special_characters_1(@string) unless string.nil? - string=pdftex_special_characters_2(@string) unless string.nil? - #special_characters_3(@string) + string=pdftex_special_characters_1(@txt) unless string.nil? + string=pdftex_special_characters_2(@txt) unless string.nil? + #special_characters_3(@txt) when /xe/ - string=xetex_special_characters_1(@string) unless string.nil? - string=xetex_special_characters_2(@string) unless string.nil? # remove this to start with, causes issues + string=xetex_special_characters_1(@txt) unless string.nil? + string=xetex_special_characters_2(@txt) unless string.nil? # remove this to start with, causes issues end - @string=string + @txt=string end end class Use_TeX diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 593d26c4..95da5d2d 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -289,7 +289,8 @@ WOK unless @rcdc m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ + txt_obj={:txt =>@sto.text} + format_scroll=SiSU_XML_format::Format_scroll.new(@md,txt_obj) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) @@ -342,26 +343,29 @@ WOK and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info - format_scroll=Format_scroll.new(@md,'
    MetaData') + txt_obj={:txt =>'
    MetaData'} + format_scroll=Format_scroll.new(@md,txt_obj) para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_scroll=Format_scroll.new(@md,'
    Owner Details') + txt_obj={:txt =>'
    Owner Details'} + format_scroll=Format_scroll.new(@md,txt_obj) @@xml[:owner_details]=format_scroll.bold_para para='' - elsif para =~/(.*)<:#>(.*)/ - one,two=$1,$2 - format_text=Format_text_object.new(one,two) - para=format_text.seg_no_paranum - end - if para =~// \ - and para =~/^(-\{{2}~\d+|)/ # -endnote - para='' + #elsif para =~/(.*)<:#>(.*)/ + # one,two=$1,$2 + # format_text=Format_text_object.new(one,two) + # para=format_text.seg_no_paranum end + #if para =~// \ + #and para =~/^(-\{{2}~\d+|)/ # -endnote + # para='' + #end para=case para when /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ if para =~/.*<:#>.*$/ - format_text=Format_text_object.new(para,'') + txt_obj={:txt =>para} + format_text=Format_text_object.new(@md,txt_obj) format_text.scr_inden_ocn_e_no_paranum end else para @@ -369,11 +373,6 @@ WOK if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ # i don't get the condition for no paranum end - if para =~/<:center>/ - one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=Format_text_object.new(one,two) - para=format_text.center - end else # end para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 2531a962..1fc6d221 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -313,7 +313,8 @@ WOK unless @rcdc m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ + txt_obj={:txt =>@sto.text} + format_scroll=SiSU_XML_format::Format_scroll.new(@md,txt_obj) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_structure(para,$1,@sto.ocn,$2) @@ -362,17 +363,20 @@ WOK and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ elsif para =~/(MetaData)/ \ and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info - format_scroll=Format_scroll.new(@md,'
    MetaData') + txt_obj={:txt =>'
    MetaData'} + format_scroll=Format_scroll.new(@md,txt_obj) para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_scroll=Format_scroll.new(@md,'
    Owner Details') + txt_obj={:txt =>'
    Owner Details'} + format_scroll=Format_scroll.new(@md,txt_obj) @@xml[:owner_details]=format_scroll.bold_para para='' - elsif para =~/(.*)(.*)/ - one,two=$1,$2 - format_text=Format_text_object.new(one,two) - para=format_text.seg_no_paranum + #elsif para =~/(.*)(.*)/ + # one,two=$1,$2 + # #txt_obj={:txt =>@sto.txt} + # format_text=Format_text_object.new(one,two) + # para=format_text.seg_no_paranum end if para =~// \ and para =~/^(-\{{2}~\d+|)/ # -endnote @@ -380,18 +384,14 @@ WOK end if para =~/.*<:#>.*$/ #investigate removal para=if para =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ - format_text=Format_text_object.new(para,'') + txt_obj={:txt =>para} + format_text=Format_text_object.new(@md,txt_obj) format_text.scr_inden_ocn_e_no_paranum end end if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ # i don't get the condition for no paranum end - if para =~/<:center>/ - one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=Format_text_object.new(one,two) - para=format_text.center - end else # end para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index 38ba0a87..b2bc0de7 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -371,7 +371,8 @@ WOK unless @rcdc m=/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ if para =~m - format_scroll=SiSU_XML_format::Format_scroll.new(@md,@sto.text) if @sto.format =~/i[1-9]|ordinary/ + txt_obj={:txt =>@sto.text} + format_scroll=SiSU_XML_format::Format_scroll.new(@md,txt_obj) if @sto.format =~/i[1-9]|ordinary/ case @sto.format when /^(1):(\S*)/ xml_markup(para) @@ -438,17 +439,19 @@ WOK #para=format_scroll.boldPara elsif para =~/(MetaData)/ \ and para =~/#{Mx[:id_o]}~\d+;[m]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ #debug 2003w46 add rc info - format_scroll=Format_scroll.new(@md,'
    MetaData') + txt_obj={:txt =>'
    MetaData'} + format_scroll=Format_scroll.new(@md,txt_obj) para=format_scroll.bold_para elsif para =~/(Owner Details)/ \ and para !~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ - format_scroll=Format_scroll.new(@md,'
    Owner Details') + txt_obj={:txt =>'
    Owner Details'} + format_scroll=Format_scroll.new(@md,txt_obj) @@xml[:owner_details]=format_scroll.bold_para para='' - elsif para =~/(.*)<:#>(.*)/ - one,two=$1,$2 - format_text=Format_text_object.new(one,two) - para=format_text.seg_no_paranum + #elsif para =~/(.*)<:#>(.*)/ + # one,two=$1,$2 + # format_text=Format_text_object.new(one,two) + # para=format_text.seg_no_paranum end if para =~// \ and para =~/^(-\{{2}~\d+|)/ # -endnote @@ -456,18 +459,14 @@ WOK end if para =~/.*<:#>.*$/ para=if para =~ /#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/ - format_text=Format_text_object.new(para,'') + txt_obj={:txt =>para} + format_text=Format_text_object.new(@md,txt_obj) format_text.scr_inden_ocn_e_no_paranum end end if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ # i don't get the condition for no paranum end - if para =~/<:center>/ - one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=Format_text_object.new(one,two) - para=format_text.center - end else # end para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para diff --git a/lib/sisu/v0/xml_format.rb b/lib/sisu/v0/xml_format.rb index 20eb6736..a801f9d2 100644 --- a/lib/sisu/v0/xml_format.rb +++ b/lib/sisu/v0/xml_format.rb @@ -282,64 +282,74 @@ WOK end class Format_text_object @@dp=nil - attr_accessor :md,:one,:two,:three,:parablock,:table,:link,:linkname,:format,:paranum,:p_num,:para_id,:headname,:margin,:paragraph,:table,:banner,:url,:icon,:font,:one_stripped - def initialize(md,*txt) - @md=md - txt[0].gsub!(/\.(html|pdf|php)/,'') if one =~/\.\.\/\S+/ - @one,@two,@three=txt[0],txt[1],txt[2] - @format,@parablock=txt[0],txt[1] - if txt[2]=~/\d+/ - @paranum=/(\d+)/m.match(txt[2])[1] + attr_accessor :md,:txt,:format,:paranum,:p_num,:para_id,:headname,:font + def initialize(md,t_o) + @md,@t_o=md,t_o + if t_o.class == Hash + @txt =t_o[:txt] || nil + @format =t_o[:format] || nil + @lnk_url =t_o[:lnk_url] || nil + @lnk_txt =t_o[:lnk_txt] || nil + @ocn =t_o[:ocn] || nil + #@h_name =t_o[:h_name] || nil + #elsif t_o.class == Array + # @txt =txt[0] + #elsif t_o.class == String + # @txt =txt + else + p t_o.class + p caller + end + if @t_o[:ocn]=~/\d+/ + @paranum=/(\d+)/m.match(@t_o[:ocn])[1] @headname='' #if txt[2]=~/\d+/ - m=/#{Mx[:lv_o]}\d:(\S+?)#{Mx[:lv_c]}/m.match(format) + m=/#{Mx[:lv_o]}\d:(\S+?)#{Mx[:lv_c]}/m.match(@format) headname=m[1] if m @headname=%{} unless headname.nil? @p_num=SiSU_XML_format::Paragraph_number.new(@md,@paranum) end - #{ rgx=/^[1-6-]~{1,2}/ #watch - link=txt[0].gsub(rgx,'') if @one =~rgx + @lnk_url=@lnk_url.gsub(rgx,'') if @lnk_url =~rgx @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern rgx=/~\{\d+\s+(.+?)#{Mx[:id_o]}#@dp#{Mx[:id_c]}\}~/ - link=txt[0].gsub(rgx,'\1') if txt[0] =~rgx - @link,@linkname=link,txt[1] + @lnk_url=@lnk_url.gsub(rgx,'\1') if @lnk_url =~rgx @vz=SiSU_Env::Get_init.instance.skin end def scr_endnote_body - "#@one " + "#{@txt} " end end class Format_scroll < Format_text_object - def initialize(*txt) - super(*txt) + def initialize(md,t_o) + super(md,t_o) end def heading_body - %{

    #{@p_num.name}#@headname#@parablock

    } + + %{

    #{@p_num.name}#{@headname}#{@txt}

    } + %{

    #{@p_num.display}

    \n} end def heading_body1 - %{

    #{@p_num.name}#@headname#@parablock

    } + + %{

    #{@p_num.name}#{@headname}#{@txt}

    } + %{

    #{@p_num.display}

    \n} end def heading_body2 - %{

    #{@p_num.name}#@headname#@parablock

    } + + %{

    #{@p_num.name}#{@headname}#{@txt}

    } + %{

    #{@p_num.display}

    \n} end def heading_body3 - %{

    #{@p_num.name}#@headname#@parablock

    } + + %{

    #{@p_num.name}#{@headname}#{@txt}

    } + %{

    #{@p_num.display}

    \n} end def heading_body4 - %{

    #{@p_num.name}#@headname#@parablock

    } + + %{

    #{@p_num.name}#{@headname}#{@txt}

    } + %{

    #{@p_num.display}

    \n} end def heading_body5 - %{
    #{@p_num.name}#@headname#@parablock
    } + + %{
    #{@p_num.name}#{@headname}#{@txt}
    } + %{

    #{@p_num.display}

    \n} end def heading_body6 - %{
    #{@p_num.name}#@headname#@parablock
    } + + %{
    #{@p_num.name}#{@headname}#{@txt}
    } + %{

    #{@p_num.display}

    \n} end end @@ -347,4 +357,3 @@ WOK end end __END__ - -- cgit v1.2.3 From 2a93f7b9fa048ffba2692cf53c407a943f54505c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 23 Aug 2008 22:12:15 -0400 Subject: minitoc added to concordance and manifest; dal, precision in endnote matching --- lib/sisu/v0/concordance.rb | 19 ++++++++++++------- lib/sisu/v0/dal.rb | 12 ++++++------ lib/sisu/v0/dal_syntax.rb | 11 ++++++----- lib/sisu/v0/html.rb | 4 ++-- lib/sisu/v0/manifest.rb | 21 +++++++++++++++++---- lib/sisu/v0/odf.rb | 18 +++++++++--------- lib/sisu/v0/param.rb | 2 +- lib/sisu/v0/plaintext.rb | 22 +++++++++++----------- lib/sisu/v0/plaintext_format.rb | 2 +- 9 files changed, 65 insertions(+), 46 deletions(-) diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 8fe8c4ed..485f3df5 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -68,6 +68,7 @@ module SiSU_Concordance include SiSU_Viz require "#{SiSU_lib}/html_format" include SiSU_HTML_Format + require "#{SiSU_lib}/html_minitoc" class Source def initialize(opt) @opt=opt @@ -105,22 +106,23 @@ module SiSU_Concordance #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) require "#{SiSU_lib}/shared_xml" require "#{SiSU_lib}/html" - def initialize(lnk,env,md) - @env,@md=env,md + def initialize(particulars) + @particulars,@md=particulars,particulars.md + @data=SiSU_HTML::Source::Html_environment.new(particulars).tuned_file_instructions @vz=SiSU_Env::Get_init.instance.skin - file_array=@env.read_source_file(@md.fns) txt_path=%{#{@md.dir_out}} SiSU_Env::Info_skin.new(@md).select @md_title=@md.title @fnb=@md.fnb @lex_button=%{SiSU home -->} - @lnk=lnk @doc_details =<
     

    #{@md.dc_title}

    #{@md.dc_creator}

    WOK end def create head_banner=SiSU_HTML_Format::Head_toc.new(@md) +minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet +toc='
    ' + minitoc.to_s + '
    ' < @@ -140,6 +142,8 @@ WOK #{@vz.js_top} #{head_banner.concordance_navigation_band('pdf')} + #{toc} +
    #@doc_details

    Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.
    [For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]

    (The word listing/index is Case sensitive: Capitalized words appear before lower case)

    @@ -148,7 +152,7 @@ WOK [if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.]

    - (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [ http://[web host]/#@fnb/concordance.html#your_word ] + (After the page is fully loaded) you can jump directly to a word by appending a hash (#) and the word to the url for this text, (do not forget that words are case sensitive, and may be listed twice (starting with and without an upper case letter)), #your_word # [ http://[web host]/#{@fnb}/concordance.html#your_word ]

    WOK end @@ -177,6 +181,7 @@ WOK include SiSU_Screen @@dp=nil def initialize(particulars) + @particulars=particulars begin @vz=SiSU_Env::Get_init.instance.skin @env,@md,@dal_array=particulars.env,particulars.md,particulars.dal_array @@ -308,7 +313,7 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - @file_index_all << SiSU_Concordance::Source::Doc_title.new('toc',@env,@md).create + @file_index_all << SiSU_Concordance::Source::Doc_title.new(@particulars).create for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase} keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html if keyword !~ @rxp_excluded0 @@ -321,7 +326,7 @@ WOK # special cases endnotes and header levels 1 - 3 end credits=@vz.credits_sisu - @file_index_all << "#{credits}\n" # footer + @file_index_all << %{
    #{credits}
    \n} # footer tell=SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}") tell.flow if @md.cmd =~/[MV]/ end diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 3187a538..a8bf1cd0 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -237,7 +237,7 @@ module SiSU_DAL para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}") para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}") #para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL - para.gsub!(/(#{Mx[:en_a_o]} )\s+/,'\1'); para.gsub!(/(~\{ )\s+/,'\1') + para.gsub!(/(#{Mx[:en_a_o]})\s*/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ') para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29 para.gsub!(/
    /,"#{Mx[:br_line]}") #needed by xml, xhtml etc. #para.gsub!(/

    /,'

    ') #consider @@ -852,7 +852,7 @@ module SiSU_DAL unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ case para # auto-numbered endnotes --> - when /#{Mx[:en_a_o]}\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ + when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+].+?#{Mx[:en_b_c]}/ para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) word_mode=endnote_call_number(word_mode) @@ -876,15 +876,15 @@ module SiSU_DAL case word when /#{Mx[:en_a_o]}/ unless word =~/#{Mx[:en_a_o]}[*+]+/ - word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter} ") + word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter}") @@endnote_counter+=1 end when /#{Mx[:en_b_o]}/ if word =~/#{Mx[:en_b_o]}[+]/ - word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag} ") + word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag}") @@endnote_counter_dag+=1 else - word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk} ") + word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk}") @@endnote_counter_asterisk+=1 end when /~\^|<:e>/ @@ -1127,7 +1127,7 @@ module SiSU_DAL end def strip_clean_extra_spaces(s) # dal output tuned s=s.dup - s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') + s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ s=s.gsub(/ [ ]+/,' ') s=s.gsub(/^ [ ]+/,'') s=s.gsub(/ [ ]+$/,'') diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 98c8cf51..8e439870 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -238,8 +238,9 @@ module SiSU_Syntax line=line_array.join(' ') line=line.strip end - line.gsub!(/~\{(.+?)\}~/m,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") - line.gsub!(/~\[(.+?)\]~/m,"#{Mx[:en_b_o]}\\1#{Mx[:en_b_c]}") + line.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]) + line.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify + line.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) if @md.subtitle and not @md.subtitle.empty? if line =~/(?:by\s+)?(?:@creator|@author)/ line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title} - #{@md.subtitle},
    \\2#{@md.dc_creator}") @@ -286,11 +287,11 @@ module SiSU_Syntax line.gsub!(/(?:<:?br>|
    )/,"#{Mx[:br_line]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <:i\1> ') if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ ([^}]+?)\s*\}((?:https?|file|ftp):\S+)\s*#{Mx[:en_a_o]}(.+?)#{Mx[:en_a_c]}/m, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]} \\3 \\4 #{Mx[:en_a_c]}") # watch + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3 #{Mx[:en_a_o]}\\3 \\4#{Mx[:en_a_c]}") # watch end if line=~/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m line.gsub!(/(^|#{Mx[:gl_c]}| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+?)([;,.]?(?=\s|$))/m, - "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]} \\3 #{Mx[:en_a_c]} ") + "\\1#{Mx[:lnk_o]}\\2#{Mx[:lnk_c]}\\3\\4 #{Mx[:en_a_o]}\\3#{Mx[:en_a_c]} ") #text url endnote url shortcut {~^ [text] }http://url is { [text] }http://url #{Mx[:en_a_o]} http://url #{Mx[:en_a_c]} [plus adjustment for commas] #means for this class, non-object, un-numbered ~# will not work # shortcut should not be used in conjunction with rebgular matches #reversed order, and addition of no-tilde.. end @@ -322,7 +323,7 @@ module SiSU_Syntax line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url)) line.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added - line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]} \\1 #{Mx[:en_a_c]}") #not tested + line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested line.gsub!(/^\s*_\*\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut #line.gsub!(/^\s*_(\*+)\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut line.gsub!(/^\s*_([1-9])\*\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 2dc75d60..e73157bd 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -155,7 +155,7 @@ module SiSU_HTML def tuned_file_instructions @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md - @md.sfx='' + #@md.sfx='' @md.sfx='' if @md.cmd =~/z/ if @md.cmd =~/h/ \ or @md.fns =~/\~[a-z]{2,3}\.s?/ #multilingual document protection is a bit arbitrary, (needed by existing server configuration), add configuration overide... @@ -275,7 +275,7 @@ module SiSU_HTML when /^\s*#{Mx[:lv_o]}4:\S+/; Toc.new(para_toc,@md).level_4 when /^\s*#{Mx[:lv_o]}5:\S*/; Toc.new(para_toc,@md).level_5 when /^\s*#{Mx[:lv_o]}6:\S*/; Toc.new(para_toc,@md).level_6 - when /^\s*4~!/; Toc.new(para_toc).level_crosslink + when /^\s*4~!/; Toc.new(para_toc).level_crosslink else end if @@firstseg.nil? \ diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index 6bdfdae4..104d3fc9 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -60,13 +60,21 @@ =end module SiSU_Manifest require "#{SiSU_lib}/sysenv" - require "#{SiSU_lib}/i18n" include SiSU_Env + require "#{SiSU_lib}/i18n" + require "#{SiSU_lib}/particulars" + include SiSU_Particulars + require "#{SiSU_lib}/html_minitoc" + require "#{SiSU_lib}/html" + include SiSU_HTML_Format + require "#{SiSU_lib}/param" include SiSU_Param include SiSU_Viz class Source def initialize(opt) @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + @data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns) @doc_language=l[:l] end @@ -83,16 +91,16 @@ module SiSU_Manifest tell.green_hi_blue unless @opt.cmd =~/q/ tell=SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}") tell.grey_tab if @opt.cmd =~/v/i - Output_Info.new(@md).check_output + Output_Info.new(@md,@data).check_output rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error ensure end end private class Output_Info [],:html=>[] } - @md,@fns=md + @md,@fns,@data=md,md.fns,data @env=SiSU_Env::Info_env.new(@md.fns) @fnb=@md.fnb @base_url,@base_url_src,@base_url_pod="#{@env.url.root}/#@fnb","#{@env.url.src_txt}","#{@env.url.src_pod}" @@ -523,6 +531,8 @@ module SiSU_Manifest end def check_output begin + minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet + toc='

    ' + minitoc.to_s + '
    ' id,file='','' vz=SiSU_Env::Get_init.instance.skin banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \ @@ -555,6 +565,8 @@ SiSU manifest: #{@md.title} #{banner_table} +#{toc} +

    #{@md.dc_title}

    #{@md.dc_creator}

    @@ -600,6 +612,7 @@ WOK language_versions @manifest[:html] <<< + #{vz.credits_splash} #{vz.credits_sisu} diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index d21a8628..03a94ce6 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -128,7 +128,7 @@ module SiSU_ODF end # Used for extraction of endnotes from paragraphs def extract_endnotes(para='') - notes=para.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/) + notes=para.scan(/#{Mx[:en_a_o]}(\d+\s+.+?)\s*#{Mx[:id_o]}#@dp#{Mx[:id_c]}#{Mx[:en_a_c]}/)[1] @n=[] notes.each do |n| #high cost to deal with
    appropriately within odf, consider n=n.dup.to_s @@ -283,24 +283,24 @@ module SiSU_ODF end def footnote(para) @astx||=10000 - para.gsub!(/#{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]}|#{Mx[:en_a_c]})/,'\1') + para.gsub!(/#{Mx[:id_o]}#@dp#{Mx[:id_c]}(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,'\1') #para.gsub!(/
    <:i[1-9]>/,'
    ') - if para =~/#{Mx[:en_a_o]}\d+\s+/ + if para =~/#{Mx[:en_a_o]}\d+\s+/ para=para.gsub(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/,'\1 \2') end - if para=~/#{Mx[:en_b_o]}[*+]\d+\s/ #editor notes, squre bracket series - asterisk=para.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/) + if para=~/#{Mx[:en_a_o]}[*+]+\s/ + asterisk=para.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/) asterisk.each do |x| a=x[0].gsub(/([*+])/,"\\\\\\1") - para=para.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{\\1 \\2}) + para=para.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{\\1 \\2}) @astx+=1 end end - if para=~/#{Mx[:en_a_o]}[*+]+\s/ - asterisk=para.scan(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/) + if para=~/#{Mx[:en_b_o]}[*+]\d+\s/ + asterisk=para.scan(/#{Mx[:en_b_o]}([*+]\d+)\s+(.+?)#{Mx[:en_b_c]}/) asterisk.each do |x| a=x[0].gsub(/([*+])/,"\\\\\\1") - para=para.gsub(/#{Mx[:en_a_o]}(#{a})\s+(.+?)#{Mx[:en_a_c]}/,%{\\1 \\2}) + para=para.gsub(/#{Mx[:en_b_o]}(#{a})\s+(.+?)#{Mx[:en_b_c]}/,%{\\1 \\2}) @astx+=1 end end diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 43b2d862..3cfbf1e5 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -195,7 +195,7 @@ module SiSU_Param end @papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general @sfx_src=@fns[m,2] - @sfx=nil + @sfx='.html' # #@sfx=nil watch @flag_auto_heading_num=false if @fns =~ /(?:-|ssm\.)?sst$/ #watch @env_out_root=@env.path.output diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 132f2997..9d25ed73 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -66,7 +66,7 @@ module SiSU_Plaintext include SiSU_Param include SiSU_Viz require "#{SiSU_lib}/plaintext_format" - include Format + include SiSU_Plaintext_format require "#{SiSU_lib}/shared_txt" require "#{SiSU_lib}/shared_structure" pwd=Dir.pwd @@ -334,7 +334,7 @@ WOK if para !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ if para =~@regx #/.+?<~\d+;\w\d+;\w\d+>.*/ #watch change paranum=para[@regx,3] - @p_num=Format::Paragraph_number.new(paranum) + @p_num=SiSU_Plaintext_format::Paragraph_number.new(paranum) end @sto=SiSU_Structure::Split_text_object.new(@md,para).txt ### problem in scroll, it appears tables are getting paragraph numbers @@ -378,10 +378,10 @@ WOK #@plaintext[:owner_details]=formatMono.bold_para #para='' elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! check - elsif para =~/(.*)(.*)/ - one,two=$1,$2 - format_text=Format_text_object.new(one,two) - para=format_text.seg_no_paranum + #elsif para =~/(.*)(.*)/ + # one,two=$1,$2 + # format_text=Format_text_object.new(one,two) + # para=format_text.seg_no_paranum end para='' if (para =~// \ and para =~/^(-\{{2}~\d+|)/) # -endnote @@ -396,11 +396,11 @@ WOK if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ # i don't get the condition for no paranum end - if para =~/<:center>/ - one,two=/(.*)<:center>(.*)/.match(para)[1,2] - format_text=Format_text_object.new(one,two) - para=format_text.center - end + #if para =~/<:center>/ + # one,two=/(.*)<:center>(.*)/.match(para)[1,2] + # format_text=Format_text_object.new(one,two) + # para=format_text.center + #end para.gsub!(/#{Mx[:id_o]}.+?#{Mx[:id_c]}/,' ') if para ## Clean Prepared Text para.gsub!(//,' ') if para ## Clean Prepared Text para.gsub!(/<:\S+>/,' ') if para ## Clean Prepared Text diff --git a/lib/sisu/v0/plaintext_format.rb b/lib/sisu/v0/plaintext_format.rb index ddac2e32..cada3425 100644 --- a/lib/sisu/v0/plaintext_format.rb +++ b/lib/sisu/v0/plaintext_format.rb @@ -58,7 +58,7 @@ ** Description: plaintext formatting template =end -module Format +module SiSU_Plaintext_format require "#{SiSU_lib}/param" include SiSU_Param include SiSU_Viz -- cgit v1.2.3 From f1fe4547034011194e913ffd70820e1c4f39d6ba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 24 Aug 2008 12:48:32 -0400 Subject: minitoc added, used by manifest and concordance; html css div sorting a earlier commit relies on minitoc prior to its addition, this fixes that issue html css divs, need to be watched across different html output --- lib/sisu/v0/css.rb | 4 +- lib/sisu/v0/defaults.rb | 3 +- lib/sisu/v0/html_format.rb | 4 +- lib/sisu/v0/html_minitoc.rb | 241 +++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v0/html_segments.rb | 10 +- lib/sisu/v0/manifest.rb | 8 +- 6 files changed, 256 insertions(+), 14 deletions(-) create mode 100644 lib/sisu/v0/html_minitoc.rb diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index 449f51d8..b5b08698 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -743,7 +743,7 @@ WOK margin-bottom: 0px; } - div.substance, div.main_column { + div.substance { width: 100%; background-color: #ffffff; } @@ -775,7 +775,7 @@ WOK padding-left: 1em; background-color: #eeeeee; } - div.content { + div.content, div.main_column { margin: 0; padding: 0; border-left: 13em solid #ffffff; diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 821893fc..491be5ff 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -1628,12 +1628,11 @@ WOK end def credits_sisu %{
    -

    #{widget_sisu} #{widget_way_better} -

    } +
    } end def credits_splash end diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index 1d82ddfe..a73f3533 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -837,9 +837,7 @@ WOK - - - + } end def navigation_band(segtocband,seg_table_top_control) #change name to navigaion_band_banner diff --git a/lib/sisu/v0/html_minitoc.rb b/lib/sisu/v0/html_minitoc.rb new file mode 100644 index 00000000..44ed57d2 --- /dev/null +++ b/lib/sisu/v0/html_minitoc.rb @@ -0,0 +1,241 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + minitoc + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end + module SiSU_HTML_minitoc + require "#{SiSU_lib}/html_tune" + include SiSU_Tune + class Toc_mini + @@seg_mini=nil + @@seg_url='' + @@dp,@@firstseg=nil,nil + def initialize(md,data) + @md,@data=md,data + @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + @pat_heading=/^#{Mx[:lv_o]}[1-6]:\S*?#{Mx[:lv_c]}\s*(.*)#{Mx[:id_o]}~(\d+);(?:[hm]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + @pat_strip_heading_name=/(.+?)<\/a>/ + @tell=SiSU_Screen::Ansi.new(@md.cmd) if @md + end + def songsheet + SiSU_Screen::Ansi.new(@md.cmd,'Toc').txt_grey unless @md.cmd =~/q/ + toc=nil + @toc=[] + @data.each do |txt| + if txt =~/^(?:#{Mx[:lv_o]}[1-6]:|4~!)/ + txt.gsub!(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,'') #remove endnotes from toc + txt.gsub!(/ \d+<\/sup> <\/a>/,'') + txt.gsub!(@pat_strip_heading_name,'\1') + txt.gsub(/(.*?)<\/a>(.*)/,'\1') #2002w42 altered gsub! - problematic? - suspect + toc=case txt + when /^\s*#{Mx[:lv_o]}1:\S*/; Toc_mini.new(@md,txt).level_1 + when /^\s*#{Mx[:lv_o]}2:\S*/; Toc_mini.new(@md,txt).level_2 + when /^\s*#{Mx[:lv_o]}3:\S*/; Toc_mini.new(@md,txt).level_3 + when /^\s*#{Mx[:lv_o]}4:\S+/; Toc_mini.new(@md,txt).level_4 + when /^\s*#{Mx[:lv_o]}5:\S*/; Toc_mini.new(@md,txt).level_5 + when /^\s*#{Mx[:lv_o]}6:\S*/; Toc_mini.new(@md,txt).level_6 + when /^\s*4~!/; Toc.new(txt).level_crosslink + else + end + @toc << toc + end + end + @toc + end + protected + def level_concordance + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + @@seg_mini << format_head_toc.mini_seg_concordance + end + def level_metadata + format_head_toc=SiSU_HTML_Format::Head_toc.new(@md) + @@seg_mini << format_head_toc.mini_seg_metadata + end + def level_word_index + format_head_toc=SiSU_HTML_Format::Head_toc.new(@d0c) + @@seg_mini << format_head_toc.mini_concordance + end + def level_1 + txt=@data + unless txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt.gsub!(@pat_strip_heading_name,'\1') + end + txt[@pat_heading] + linkname,ocn=$1.strip,$2 if $& + title=unless txt =~/Document Information/; linkname + else + link='metadata' + %{#{linkname}} + end + toc={} + txt_obj={:txt =>title} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc_mini=if txt =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ + format_toc.mini_tail + else format_toc.mini_lev1 + end + toc_mini + end + def level_2 + txt=@data + unless txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt.gsub!(@pat_strip_heading_name,'\1') + end + txt[@pat_heading] + linkname,ocn=$1.strip,$2 if $& + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev2 + toc_mini + end + def level_3 + txt=@data + txt[@pat_heading] + linkname,ocn=$1.strip,$2 if $& + txt_obj={:txt =>linkname} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev3 + toc_mini + end + def level_4 + txt=@data + unless txt =~/~metadata/ + unless txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt.gsub!(@pat_strip_heading_name,'\1') + txt[@pat_heading] + linkname,ocn=$1.strip,$2 if $& + end + txt.gsub!(/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') + if txt =~/^#{Mx[:lv_o]}4:/ + seg_link=txt.gsub(/^\s*#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}\s*(.+?)$/, + %{ + \\2 + }) + if seg_link =~/(#{Mx[:id_o]}\~\d+;(?:\w|[0-6]:\d+);\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]})$/m + m=/#{$1}/m + seg_link.gsub!(m,'') + end + @@seg_url=txt[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?$/,1] + elsif txt =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/ + seg_link=txt.gsub(/^\s*(#{@md.lv4}\s+)\s*(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/, + %{\\1 \\2 \\3 }) + end + txt_obj={:txt =>seg_link} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev4 + toc_mini + end + end + def level_5 + txt=@data + if txt !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt.gsub!(@pat_strip_heading_name,'\1') + end + txt[@pat_heading] + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + end + toc={} + if txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + m=/#{$1}/ + txt.gsub!(m,'') + title=linkname + else + lnk_n_txt=%{ + #{linkname} + } + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev5 + end + toc_mini + end + def level_6 + txt=@data + if txt !~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + txt.gsub!(@pat_strip_heading_name,'\1') + end + txt[@pat_heading] + linkname,ocn=$1.strip,$2 if $& + if ocn \ + and ocn !~/#/ + p_num=SiSU_HTML_Format::Paragraph_number.new(@md,ocn) + end + toc={} + if txt =~/#{Mx[:id_o]}~0;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/ + m=/#{$1}/ + txt.gsub!(m,'') + title=linkname + else + lnk_n_txt=%{ + #{linkname} + } + txt_obj={:txt =>lnk_n_txt} + format_toc=SiSU_HTML_Format::Format_toc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev6 + end + toc_mini + end + end + end +__END__ + diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index b457fe5c..11c95755 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -221,11 +221,11 @@ module SiSU_HTML_seg if @@is1 == 1 @dc_creator=%{#{@md.dc_creator}\n} if @md.dc_creator.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) - conditional_div_close=unless @@get_hash_fn =~/metadata/ #watch + conditional_div_close=if @@get_hash_fn =~/metadata/ #watch '' else '' end - @@seg[:tocband_bannerless] << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) @@seg[:headers] << format_head_seg.seg_head_escript if SiSU_HTML_Format::Head_seg.method_defined? :seg_head_escript #debug PHP move up in text #bug @@seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator).gsub(clean,'') ocn=if @@header1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/]; $1 @@ -380,11 +380,13 @@ module SiSU_HTML_seg def tail format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] - @@seg[:tail] << format_head_seg.endnote_section_open + @@seg[:tail] << '
    ' if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 @@seg[:tail] << format_head_seg.endnote_mark @@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| end + @@seg[:tail] << '
    ' + @@seg[:tail] << '' #this div closes div class content end #@@seg[:tail] << '
     
    ' ads=SiSU_HTML_promo::Ad.new(@md) @@ -397,7 +399,7 @@ module SiSU_HTML_seg if type !~/endnote/ filename_seg << @@minitoc << @@seg[:headers] << @@seg[:main] else - filename_seg << @@seg[:header_endnotes] << @@minitoc << @@seg[:headers] << %{\n
    \n} << @@seg[:endnote_all] #<< '
    ' + filename_seg << @@seg[:header_endnotes] << @@minitoc << @@seg[:headers] << %{\n
    \n} << @@seg[:endnote_all] #<< '
    ' << '' end filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits] filename_seg.flatten!.compact! diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index 104d3fc9..ffd99695 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -532,7 +532,6 @@ module SiSU_Manifest def check_output begin minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet - toc='
    ' + minitoc.to_s + '
    ' id,file='','' vz=SiSU_Env::Get_init.instance.skin banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ \ @@ -565,7 +564,9 @@ SiSU manifest: #{@md.title} #{banner_table} -#{toc} +
    +#{minitoc.to_s} +

    #{@md.dc_title}

    #{@md.dc_creator}

    @@ -613,8 +614,9 @@ WOK @manifest[:html] <<<
    -#{vz.credits_splash} +
    #{vz.credits_sisu} +
    WOK -- cgit v1.2.3 From c6d41d9367afc974fe60ca27cb890568609b5f12 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 27 Aug 2008 00:43:43 -0400 Subject: texpdf: paper use dimensions url and urlbreaks removal of a maths package gives back typeface changes like bold better representation of tilde changelog update --- CHANGELOG | 20 +++++++++++++++----- conf/sisu/version.yml | 4 ++-- lib/sisu/v0/defaults.rb | 22 +++++++++++----------- lib/sisu/v0/texpdf.rb | 1 + lib/sisu/v0/texpdf_format.rb | 36 +++++++++++++++++++----------------- 5 files changed, 48 insertions(+), 35 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0b081f64..e6d12f84 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,19 +9,29 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-08-14:32/4) +%% sisu_0.69.0.orig.tar.gz (2008-08-26:34/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc sisu_0.69.0-1.diff.gz - * middle layer, url representation + * html increased use of css, necessary to re-initialise sisu output directory + with new css files [version number bump] - * html increased use of css, includes segmented html minitoc - necessary to re-initialise sisu output directory with new css files - [version number bump] sisu -CC + * html css, use of mini table of contents + + * texpdf + * pdf document typesetting dimensions + * url and urlbreaks line breaking fix + * better representation of tilde + * removal of a maths package gives back typeface changes like bold + + * middle layer, url representation changed, downstream code affected + + * internal greater use of passing of hash to formatting modules + %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz cecae8b828aa187b22354f2ee9e8a8b5244dd9f4 1509605 sisu_0.68.0.orig.tar.gz diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index 7e7b8d10..d9f5b0e2 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- :version: 0.69.0-beta -:date_stamp: 2008w32/4 -:date: "2008-08-14" +:date_stamp: 2008w34/2 +:date: "2008-08-26" :project: SiSU diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 491be5ff..801b6434 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -2095,10 +2095,10 @@ WOK end def landscape def w - 262 + 250 end def h - 168 + 160 end def img_px 348 @@ -2113,7 +2113,7 @@ WOK 166 end def h - 216 + 212 end def img_px 468 @@ -2122,7 +2122,7 @@ WOK end def landscape def w - 242 + 234 end def h 166 @@ -2149,7 +2149,7 @@ WOK end def landscape def w - 314 + 306 end def h 166 @@ -2167,7 +2167,7 @@ WOK 140 end def h - 210 + 204 end def img_px 356 @@ -2176,10 +2176,10 @@ WOK end def landscape def w - 216 + 208 end def h - 136 + 130 end def img_px 280 @@ -2194,7 +2194,7 @@ WOK 112 end def h - 170 + 162 end def img_px 280 @@ -2203,10 +2203,10 @@ WOK end def landscape def w - 176 + 164 end def h - 110 + 100 end def img_px 230 diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index c5ee2092..19e0a119 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -542,6 +542,7 @@ module SiSU_TeX \\tolerance=500 \\makeatother \\makeatother +\\sloppy \\begin{document} WOK sisu_rc_footnote=if @md.sc_info; @tex.doc_sc_info_footnote_full diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 55a9473f..58dca26e 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -701,7 +701,7 @@ WOK def tex_head_paper_landscape(d) </,' ') string.gsub!(/<\/a>/,' ') string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - '\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, - ' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + ' \begin{scriptsize}\url{\1} \end{scriptsize}\2') #special case string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - '\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration + '\begin{scriptsize}\\url{\1}\end{scriptsize}\2') #specially escaped url no decoration unless @@flag_code string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, - "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start + "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start else #code-block: angle brackets special characters, note _ already escaped string.gsub!(/\\_/,'{\UseTextSymbol{OML}{>}}') @@ -1103,7 +1105,7 @@ WOK #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text - string.gsub!(/<=tilde>/,'{\~~}') + string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') #string.gsub!(/<=caret>/,'\^{}') @@ -1212,14 +1214,14 @@ WOK string.gsub!(//,' ') string.gsub!(/<\/a>/,' ') string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - '\1\begin{scriptsize}\\href{\2}{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url + '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, - ' \begin{scriptsize}\href{\1}{\1} \end{scriptsize}\2') #special case + ' \begin{scriptsize}\url{\1} \end{scriptsize}\2') #special case string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - '\begin{scriptsize}\\href{\1}{\1}\end{scriptsize}\2') #specially escaped url no decoration + '\begin{scriptsize}\\url{\1}\end{scriptsize}\2') #specially escaped url no decoration unless @@flag_code string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, - "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\href{\\2}{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start + "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start else #code-block: angle brackets special characters, note _ already escaped string.gsub!(/\\_/,'{\UseTextSymbol{OML}{>}}') @@ -1274,7 +1276,7 @@ WOK #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text - string.gsub!(/<=tilde>/,'{\~~}') + string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') #string.gsub!(/<=caret>/,'\^{}') -- cgit v1.2.3 From 602a7b497284baa85bac466ba5c4e28ec9e7c554 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 27 Aug 2008 23:38:37 -0400 Subject: texpdf: landscape tables in two column text fixed; footnote margin increased --- CHANGELOG | 1 + lib/sisu/v0/texpdf_format.rb | 16 ++++++---------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e6d12f84..9f6603d3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,6 +27,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * url and urlbreaks line breaking fix * better representation of tilde * removal of a maths package gives back typeface changes like bold + * landscape output, tables fixed * middle layer, url representation changed, downstream code affected diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 58dca26e..b193a345 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -124,7 +124,6 @@ module SiSU_TeX_Pdf @@tableheader[@ps][:l]=1 if @txt =~/#{Mx[:gr_o]}Th/ w=cols_width.split(/;\s*/) @@number_of_cols=no_of_cols ||=@@number_of_cols - #@@number_of_cols=0 unless @@number_of_cols.to_i > 0 @colW=[] @colW << '{' w.each do |x| @@ -137,7 +136,7 @@ module SiSU_TeX_Pdf @colW=@colW.join @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table) + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table") end if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") @@ -151,11 +150,10 @@ module SiSU_TeX_Pdf @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[@ps][:l]=0 - #@@tableheader[@ps][:l],@@number_of_cols=0,0 end else if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u - @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u,'\1&') + @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\1&') @txt.gsub!(/&\s*$/," #@row_break") end end @@ -184,8 +182,7 @@ module SiSU_TeX_Pdf @colW << '{' w.each do |x| x.strip! - x=(x.to_i * textwidth)/100 - #x=(x.to_i/100.0 * 160) + x=(x.to_i * textwidth)/100 #x=(x.to_i/100.0 * 160) col_w=x.to_s # x.gsub(/.+/,'l\|') #unless x.nil? @colW << "p{#{col_w}mm}" if col_w end @@ -193,21 +190,20 @@ module SiSU_TeX_Pdf @colW=@colW.join @start_table="#{Mx[:id_o]}~#{ocn}#{Mx[:id_c]}\n\\setlength{\\LTleft}{0pt}\n\\setlength{\\LTright}{\\fill}\n" + "\\begin{tiny}\n\\begin{longtable}#@colW\n" - @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,"#@start_table") + @txt.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}\s+c\d+?;.+#{Mx[:tc_p]}\\~\d+;\w\d+;\w\d+#{Mx[:gr_c]}/u,@start_table) end if @txt =~/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/ @txt.gsub!(/#{Mx[:gr_o]}TZ#{Mx[:gr_c]}/," #@end_table\n\\end{tiny}") end @txt.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}/u,'') if @@tableheader[@ps][:p] == 1 - if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|!)/u + if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_p]})/u tablefoot=@txt[/\/,1] @txt.gsub!(/\/,'') @txt.gsub!(/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u,'\bfseries \1&') @txt.gsub!(/&\s*$/," #@row_break \\hline\\endhead #@row_break") @txt="#@txt \\multicolumn{#{@@number_of_cols}}{l}{\\tiny #{tablefoot}} \\\\ \\hline\n\\endfoot\n\\hline\n" if tablefoot @@tableheader[@ps][:p]=0 - #@@tableheader[@ps][:p],@@number_of_cols=0,0 end else if @txt =~/#{Mx[:tc_p]}\d+?#{Mx[:tc_p]}(.+?)(?:#{Mx[:tc_p]}|#{Mx[:tc_c]})/u @@ -904,7 +900,7 @@ WOK \\makeatletter #{endnotes} \\usepackage[multiple,marginal]{footmisc} -% \\setlength\\footnotemargin{40pt} +\\setlength\\footnotemargin{-20pt} \\usepackage[para]{manyfoot} \\DeclareNewFootnote{A} %\\DeclareNewFootnote[para]{A} -- cgit v1.2.3 From c01a2c64c26396b5e61f49c272010794937d0c60 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 27 Aug 2008 23:41:14 -0400 Subject: texpdf, footnotes align left (ragged), footnote numbers removed from margin --- lib/sisu/v0/texpdf_format.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index b193a345..04dae4d8 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -899,8 +899,8 @@ WOK \\setcounter{tocdepth}{4} \\makeatletter #{endnotes} -\\usepackage[multiple,marginal]{footmisc} -\\setlength\\footnotemargin{-20pt} +\\usepackage[multiple,ragged]{footmisc} +\\setlength\\footnotemargin{12pt} \\usepackage[para]{manyfoot} \\DeclareNewFootnote{A} %\\DeclareNewFootnote[para]{A} -- cgit v1.2.3 From a0012a41b4aa49cdf05d9f5f55a67673bf4c8bb2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 28 Aug 2008 23:19:32 -0400 Subject: texpdf: removed space at beginning of paragraph; grouped text url fix --- CHANGELOG | 20 ++++++++++++-------- conf/sisu/version.yml | 4 ++-- lib/sisu/v0/texpdf.rb | 2 +- lib/sisu/v0/texpdf_format.rb | 6 +++--- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9f6603d3..41a3f097 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,18 +9,18 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-08-26:34/2) +%% sisu_0.69.0.orig.tar.gz (2008-08-28:34/4) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc sisu_0.69.0-1.diff.gz - * html increased use of css, necessary to re-initialise sisu output directory - with new css files [version number bump] - - sisu -CC - - * html css, use of mini table of contents + * html + * increased use of css, necessary to re-initialise sisu output directory + with new css files [version number bump] + sisu -CC + * html css, use of mini table of contents placed in left column for + segmented text * texpdf * pdf document typesetting dimensions @@ -28,10 +28,14 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * better representation of tilde * removal of a maths package gives back typeface changes like bold * landscape output, tables fixed + * paragraph alignment, assigned 0 width to required space, (removing space + at beginning of paragraph) + * footnote, number placement changed, and left alignment (ragged edges) + used * middle layer, url representation changed, downstream code affected - * internal greater use of passing of hash to formatting modules + * internal, greater use of passing of hash to formatting modules %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index d9f5b0e2..70d4f342 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- :version: 0.69.0-beta -:date_stamp: 2008w34/2 -:date: "2008-08-26" +:date_stamp: 2008w34/4 +:date: "2008-08-28" :project: SiSU diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 19e0a119..f86d8729 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -72,7 +72,7 @@ module SiSU_TeX @@tabular="{tabular}" @@column_instruct=@@squigle_close=@@tex_line_mode=@@tex_word_mode=@@line_mode='' @@tex_debug_counter=@@table_pagebreak_counter=@@tex_footnote_call_counter=@@tex_table_flag=@@tex_counter=@@tex_column=@@tex_columns=@@tex_columns=@@counting=0 - @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}~\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/ + @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/ #@@tex_pattern_margin_number="\\\\marginpar.+?\s+" @@n=@@tableheader=@@rights=nil @@date ||=SiSU_Env::Info_date.new diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 04dae4d8..c224d4aa 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -68,7 +68,7 @@ module SiSU_TeX_Pdf @@sys=SiSU_Env::System_call.new @@tex_backslash="\\\\" @@tilde='\\\\\\~' #?? debug crazy - @@tex_pattern_margin_number=/\\begin\{tiny\}~\\end\{tiny\}\{\\marginpar.+?\}\}\}/ + @@tex_pattern_margin_number=/\\begin\{tiny\}\\hspace\{0mm\}\\end\{tiny\}\{\\marginpar.+?\}\}\}/ @@tableheader={ 'a4' => { :p => 0, :l => 0 }, 'a5' => { :p => 0, :l => 0 }, @@ -559,7 +559,7 @@ para paranumber_display=if @md.markup.inspect =~/no_ocn/ \ or @md.mod.inspect =~/--no-ocn/ '' - else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@ocn\\end{tiny}}}" #ocn object citation numbering + else "\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}#@ocn\\end{tiny}}}" #ocn object citation numbering end if @txt !~/^(?:#{Mx[:lv_o]}[1-6a-z-]:|#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/ @txt.gsub!(/^\s*(.+)/m,"#{paranumber_display}\\1\n") #watch - in 1-6 is suspect @@ -1189,7 +1189,7 @@ WOK string.gsub!(/\#/,'\#') string.gsub!(/\%/,'\%') string.gsub!(/\~/,'\~') #revist, should not be necessary to mark remaining tildes - if string !~/^\s*#{Mx[:lnk_o]}|#{Mx[:lnk_c]}image\s/ + if string !~/^\s*#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\s/ string.gsub!(/_/,'\_') end string.gsub!(/\{/,'\{') -- cgit v1.2.3 From 749e0d8443028eaff7af93d17c8dae8d44be42bc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 29 Aug 2008 21:40:02 -0400 Subject: texpdf: paper use dimensions, tolerance, url matching; removal of dummy headings when not used; manifest presentation * texpdf: paper use dimensions, tolerance, url matching; * removal of dummy headings when not used (html scroll, latex/pdf, odf) * manifest presentation --- CHANGELOG | 10 +++++--- lib/sisu/v0/defaults.rb | 12 +++++----- lib/sisu/v0/html_scroll.rb | 1 + lib/sisu/v0/i18n.rb | 54 +++++++++++++++++++++++++++++++++++++++----- lib/sisu/v0/manifest.rb | 29 ++++++++++++++++-------- lib/sisu/v0/odf.rb | 1 + lib/sisu/v0/plaintext.rb | 4 ---- lib/sisu/v0/texpdf.rb | 15 +++++++----- lib/sisu/v0/texpdf_format.rb | 20 ++++++++-------- lib/sisu/v0/xml.rb | 3 --- 10 files changed, 102 insertions(+), 47 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 41a3f097..e4f5dd41 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,20 +21,24 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu -CC * html css, use of mini table of contents placed in left column for segmented text + * manifest presentation * texpdf * pdf document typesetting dimensions - * url and urlbreaks line breaking fix - * better representation of tilde - * removal of a maths package gives back typeface changes like bold + * url matching and urlbreaks line breaks fix * landscape output, tables fixed * paragraph alignment, assigned 0 width to required space, (removing space at beginning of paragraph) * footnote, number placement changed, and left alignment (ragged edges) used + * removal of a maths package gives back typeface changes like bold + * better representation of tilde + * tolerance * middle layer, url representation changed, downstream code affected + * dummy headings removed when not used, latex/pdf, odf, html scroll + * internal, greater use of passing of hash to formatting modules %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 801b6434..a3e1b16d 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -2095,7 +2095,7 @@ WOK end def landscape def w - 250 + 238 end def h 160 @@ -2122,7 +2122,7 @@ WOK end def landscape def w - 234 + 226 end def h 166 @@ -2140,7 +2140,7 @@ WOK 168 end def h - 294 + 286 end def img_px 474 @@ -2149,7 +2149,7 @@ WOK end def landscape def w - 306 + 296 end def h 166 @@ -2176,7 +2176,7 @@ WOK end def landscape def w - 208 + 200 end def h 130 @@ -2203,7 +2203,7 @@ WOK end def landscape def w - 164 + 152 end def h 100 diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 9286df10..3e72f855 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -87,6 +87,7 @@ module SiSU_HTML_scroll #if para =~/^#{Mx[:lv_o]}\d:endnotes#{Mx[:lv_c]}\s*Endnotes/ ## para.gsub!(/Endnotes.+/,'') #end + para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ if para =~/^#{Mx[:lv_o]}\d:meta#{Mx[:lv_c]}\s*Document Information/ para.gsub!(/(Document Information(?: \(metadata\))?)/,'\1') end diff --git a/lib/sisu/v0/i18n.rb b/lib/sisu/v0/i18n.rb index 8ac3ffc8..286ba65d 100644 --- a/lib/sisu/v0/i18n.rb +++ b/lib/sisu/v0/i18n.rb @@ -105,6 +105,9 @@ module SiSU_Translate def metadata @lang_class.metadata end + def filetype_description + @lang_class.filetype_description + end def file_size @lang_class.file_size end @@ -258,6 +261,9 @@ module SiSU_Translate def language @lang_class.language end + def manifest_description + @lang_class.manifest_description + end def manifest_description_output @lang_class.manifest_description_output end @@ -314,6 +320,9 @@ module SiSU_Translate def description 'description' end + def filetype_description + 'filetype description' + end def metadata 'metadata' end @@ -464,11 +473,14 @@ module SiSU_Translate def language_version_list 'Document Language Versions, manifests' end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end def manifest_description_output - 'SiSU manifest' + 'Available document filetypes' end def manifest_description_metadata - 'SiSU manifest of document metadata' + 'Document Metadata' end def language_list_translated lang=case @trans_str @@ -513,6 +525,9 @@ module SiSU_Translate def description 'description' end + def filetype_description + description + end def metadata 'metadonnées' end @@ -663,6 +678,9 @@ module SiSU_Translate def language_version_list 'Versions des langues du document, manifestes' end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end def manifest_description_output 'Manifeste SiSU du document généré' end @@ -712,6 +730,9 @@ module SiSU_Translate def description 'Beschreibung' end + def filetype_description + description + end def metadata 'Metadata' end @@ -862,6 +883,9 @@ module SiSU_Translate def language_version_list 'verfügbare Sprachen' end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end def manifest_description_output 'SiSU Zusammenfassung des Dokumentes' end @@ -907,10 +931,13 @@ module SiSU_Translate end def filename 'nombre del fichero' - end - def description - 'descripción' - end + end + def description + 'descripción' + end + def filetype_description + description + end def metadata 'metadatos' end @@ -1061,6 +1088,9 @@ module SiSU_Translate def language_version_list 'Document Language Versions, manifests' end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end def manifest_description_output 'Manifiesto SiSU de salida generada' end @@ -1110,6 +1140,9 @@ module SiSU_Translate def description 'descrizione' end + def filetype_description + description + end def metadata 'metadati' end @@ -1260,6 +1293,9 @@ module SiSU_Translate def language_version_list 'Traduzioni disponibili' end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end def manifest_description_output 'Inventario SiSU dell\'output generato' end @@ -1309,6 +1345,9 @@ module SiSU_Translate def description 'kuvaus' end + def filetype_description + description + end def metadata 'metadata' end @@ -1459,6 +1498,9 @@ module SiSU_Translate def language_version_list 'Dokumentin kieliversiot, manifestit' end + def manifest_description + 'SiSU manifest of document filetypes and metadata' + end def manifest_description_output 'Tuotetun tuloksen SISU-manifesti' end diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index ffd99695..78045e80 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -65,6 +65,7 @@ module SiSU_Manifest require "#{SiSU_lib}/particulars" include SiSU_Particulars require "#{SiSU_lib}/html_minitoc" + #require "#{SiSU_lib}/html_format" require "#{SiSU_lib}/html" include SiSU_HTML_Format require "#{SiSU_lib}/param" @@ -119,7 +120,7 @@ module SiSU_Manifest manifest << x end end - def summarize(id,file,img='') + def summarize(id,file,img='● ') size=(File.size("#{@base_path}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" @@ -177,7 +178,7 @@ module SiSU_Manifest elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root) else url end - @manifest[:html] << %{

    #{lnk}

      #{@url_brace.xml_open}#{static}#{@url_brace.xml_close}

    #{lnk}

      #{@url_brace.xml_open}#{static}#{@url_brace.xml_close}

    WOK published_versions @manifest[:html] << '
    ' @manifest[:html] <<<#{@translate.manifest_description_output} - - +

    #{@translate.description}

    #{@translate.filename}

    #{@translate.file_size}

    (kB)

    + WOK output_tests @@ -589,7 +600,7 @@ WOK @manifest[:html] << '

    #{@translate.filetype_description}

    #{@translate.filename}

    #{@translate.file_size}

    (kB)

    ' @manifest[:html] <<<#{@translate.manifest_description_metadata} - +
    WOK metadata_tests @@ -597,8 +608,8 @@ WOK

    #{@translate.metadata}

    #{@translate.description}

    WOK @manifest[:html] <<< -

    #{@translate.suggested_links}:

    WOK links_tests @manifest[:html] <<<#{@translate.language_version_list} -
    +
    WOK diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 03a94ce6..6b1491c2 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -441,6 +441,7 @@ module SiSU_ODF data.each do |para| #p para if para =~safe_characters and @md.cmd =~/V/ #KEEP #para.gsub!(/<(~\d+;(?:\w|[0-6]:)\d+;\w\d+)><(#@dp:#@dp)>/,'<\1><\2>') + para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ para_array=[] word=para.scan(/\S+|\n/) if word diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 9d25ed73..4dd808fc 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -378,10 +378,6 @@ WOK #@plaintext[:owner_details]=formatMono.bold_para #para='' elsif para =~/(#{Mx[:tc_p]}|#{Mx[:gr_o]}Th?)/u #tables ! check - #elsif para =~/(.*)(.*)/ - # one,two=$1,$2 - # format_text=Format_text_object.new(one,two) - # para=format_text.seg_no_paranum end para='' if (para =~// \ and para =~/^(-\{{2}~\d+|)/) # -endnote diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index f86d8729..3cf560c4 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -344,6 +344,7 @@ module SiSU_TeX # DEBUG 2003w16 this is a kludge, because i could not get parameters # from param, Sort out ... revert to more elegant solution # even more of a kludge as had to insert newlines where code is used not satisfactory, think about + para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ para=if para =~/#{Mx[:br_nl]}|\n/; para.split(/#{Mx[:br_nl]}|\n/) else para end @@ -438,7 +439,7 @@ module SiSU_TeX end elsif x =~/code/; @@flag_alt,@@flag_code=true,true elsif @@flag_alt - if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/m + if para =~ /(?:https?|file|ftp)/m txt_obj={:txt =>para,:paper_size =>'a4'} para=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http end @@ -503,7 +504,7 @@ module SiSU_TeX end para end - if para =~ /#{Mx[:lnk_c]}(?:https?|file|ftp)/ + if para =~ /(?:https?|file|ftp)/ para=if para !~/\.(?:png|jpg|gif)/ txt_obj={:txt =>para,:paper_size =>'a4'} SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj).http @@ -539,10 +540,12 @@ module SiSU_TeX end @tex_file <<< # note this bit of dereferencing magic + s_lnk_url=%<\\begin{scriptsize}\\url{#{url}}\\end{scriptsize}> # note this bit of dereferencing magic else url.gsub!(/\.\.\//,'') s_lnk_url="(#{@tex.site}) \\\\\n" + ' ' + "\\begin{scriptsize}" + - %<\\href\{#{@vz.url_root_http}/#{url}\}\{#{@vz.url_root_http}/#{url}\}> + # note this bit of dereferencing magic + %<\\url\{#{@vz.url_root_http}/#{url}\}> + # note this bit of dereferencing magic "\\end{scriptsize}" end @tex_file << " #{s_lnk} \\\\\n #{s_lnk_url} \n" unless @md.doc_skin =~/skin_mail/ diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index c224d4aa..b6a1e1f2 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -461,9 +461,9 @@ para @url_generic_rgx=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+/ @words.each do |word| @w << if word=~@url_generic_rgx - if word =~/#{Mx[:lnk_o]}(?:.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ - regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ - punctuate=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.join + if word =~/#{Mx[:lnk_o]}(?:.+?)#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?(?:[;.,]?(?:\s|$)|(?:\s|$))/ + regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ + punctuate=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?([;.,]?(?:\s|$))/.match(word).captures.join else regx_url=%r/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\S+)/ punctuate='' @@ -1042,14 +1042,14 @@ WOK string.gsub!(/&\S+?;/,' ') string.gsub!(//,' ') string.gsub!(/<\/a>/,' ') - string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?:\s|$))/, '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, ' \begin{scriptsize}\url{\1} \end{scriptsize}\2') #special case string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, '\begin{scriptsize}\\url{\1}\end{scriptsize}\2') #specially escaped url no decoration unless @@flag_code - string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start else #code-block: angle brackets special characters, note _ already escaped string.gsub!(/\\_/,'\<') #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') - string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + string.gsub!(/((?:\\href|\\url)\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') @@ -1209,14 +1209,14 @@ WOK string.gsub!(/&\S+?;/,' ') string.gsub!(//,' ') string.gsub!(/<\/a>/,' ') - string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + string.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?:\s|$))/, '\1\begin{scriptsize}\url{\2}\end{scriptsize}\3') #special case \{ e.g. \}http://url string.gsub!(/[^\}>_]((?:https?|file|ftp):\/\/\S+?)(<\/\S>)/, ' \begin{scriptsize}\url{\1} \end{scriptsize}\2') #special case - string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, + string.gsub!(/\B(?:\\_|\\)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?:\s|$))/, '\begin{scriptsize}\\url{\1}\end{scriptsize}\2') #specially escaped url no decoration unless @@flag_code - string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + string.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, "\\1#{@url_brace.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@url_brace.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start else #code-block: angle brackets special characters, note _ already escaped string.gsub!(/\\_/,'\<') #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') - string.gsub!(/(\href\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + string.gsub!(/((?:\\href|\\url)?\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 1fc6d221..4826a503 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -389,9 +389,6 @@ WOK format_text.scr_inden_ocn_e_no_paranum end end - if para !~/#{@vz.margin_txt_0}|#{@vz.margin_txt_1}|#{@vz.margin_txt_2}/ - # i don't get the condition for no paranum - end else # end para.gsub!(/#{Mx[:pa_o]}:\S+#{Mx[:pa_c]}/,'') if para -- cgit v1.2.3 From b2ef41078f8704e16c589063cde225874a3069f9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 2 Sep 2008 23:23:12 -0400 Subject: html segments; sql db field lengths increased --- CHANGELOG | 2 ++ lib/sisu/v0/db_columns.rb | 36 ++++++++++++++++++------------------ lib/sisu/v0/html_segments.rb | 7 +++---- 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e4f5dd41..716c399e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -35,6 +35,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * better representation of tilde * tolerance + * db table field lengths (varchar), increased + * middle layer, url representation changed, downstream code affected * dummy headings removed when not used, latex/pdf, odf, html scroll diff --git a/lib/sisu/v0/db_columns.rb b/lib/sisu/v0/db_columns.rb index fcb37812..87e14b01 100644 --- a/lib/sisu/v0/db_columns.rb +++ b/lib/sisu/v0/db_columns.rb @@ -62,28 +62,28 @@ module SiSU_DB_columns class Column_size def lt_title - 320 + 600 end def lt_subtitle - 320 + 600 end def lt_creator - 200 + 600 end def lt_illustrator - 200 + 600 end def lt_translator - 200 + 600 end def lt_prepared_by - 200 + 600 end def lt_digitized_by - 200 + 600 end def lt_subject - 400 + 600 end def lt_date 10 @@ -104,25 +104,25 @@ module SiSU_DB_columns 10 end def lt_type - 100 + 600 end def lt_description - 800 + 2000 end def lt_publisher - 120 + 600 end def lt_contributor - 120 + 600 end def lt_format - 100 + 600 end def lt_identifier 256 end def lt_source - 100 + 200 end def lt_language 30 @@ -143,16 +143,16 @@ module SiSU_DB_columns 100 end def lt_rights - 800 + 2000 end def lt_copyright - 200 + 2000 end def lt_owner - 100 + 600 end def lt_keywords - 200 + 600 end def lt_comment 600 diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 11c95755..8d89de28 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -195,7 +195,6 @@ module SiSU_HTML_seg end end end - @@seg[:main] << "\n\n" data end def header_art(para) @@ -380,7 +379,7 @@ module SiSU_HTML_seg def tail format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] - @@seg[:tail] << '
    ' + @@seg[:tail] << %{\n
    \n
    \n} if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 @@seg[:tail] << format_head_seg.endnote_mark @@seg[:tail] << @@seg_endnotes[@@get_hash_fn].flatten #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| @@ -397,9 +396,9 @@ module SiSU_HTML_seg filename_seg=[] filename_seg << @@seg[:title] << @@seg[:tocband_banner] if type !~/endnote/ - filename_seg << @@minitoc << @@seg[:headers] << @@seg[:main] + filename_seg << @@minitoc << @@seg[:headers] << @@seg[:main] << "\n
    \n" else - filename_seg << @@seg[:header_endnotes] << @@minitoc << @@seg[:headers] << %{\n
    \n} << @@seg[:endnote_all] #<< '
    ' << '
    ' + filename_seg << @@seg[:header_endnotes] << @@minitoc << @@seg[:headers] << %{\n
    \n} << @@seg[:endnote_all] << '
    ' end filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits] filename_seg.flatten!.compact! -- cgit v1.2.3 From 2a738f528cb87793ff7f8312099666af1e21f44c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 3 Sep 2008 22:25:03 -0400 Subject: xml character encoding adjusted; xml image match; odf issue with '@' symbol in url --- lib/sisu/v0/character_encoding.rb | 4 +++- lib/sisu/v0/odf.rb | 7 +++++-- lib/sisu/v0/param.rb | 42 +++++++++++++++++++-------------------- lib/sisu/v0/shared_xml.rb | 29 +++++++++++++++++++++++++++ lib/sisu/v0/xhtml.rb | 2 +- lib/sisu/v0/xml.rb | 2 +- lib/sisu/v0/xml_dom.rb | 2 +- 7 files changed, 61 insertions(+), 27 deletions(-) diff --git a/lib/sisu/v0/character_encoding.rb b/lib/sisu/v0/character_encoding.rb index 60c2f335..aa856cdd 100644 --- a/lib/sisu/v0/character_encoding.rb +++ b/lib/sisu/v0/character_encoding.rb @@ -374,7 +374,9 @@ module SiSU_character_encode ['ü', 252, '374', '\303\274', 'ü', 'ü', 'ü', '\"{u}', '', 'Small u, umlaut ü' ], ['ý', 253, '375', '\303\275', 'ý', 'ý', 'ý', '', '', 'Small y, acute accent ý' ], ['þ', 254, '376', '\303\276', 'þ', 'þ', 'þ', '', '', 'Small thorn, Icelandic þ' ], - ['ÿ', 255, '377', '\303\277', 'ÿ', 'ÿ', 'ÿ', '', '', 'Smally y, umlaut ÿ' ] + ['ÿ', 255, '377', '\303\277', 'ÿ', 'ÿ', 'ÿ', '', '', 'Smally y, umlaut ÿ' ], + ['∝', , '', '', '∝', '∝', '∝', '', '', 'proportional to U+221D (8733) ∝' ], + ['∞', , '', '', '∞', '∞', '∞', '', '', 'infinity U+221E (8734) ∞' ], ] end end diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 6b1491c2..bf23f91f 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -267,7 +267,7 @@ module SiSU_ODF #para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, also works #%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) #http ftp matches with decoration para.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}}) + %{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}}) if para !~/http:\/\// # improve upon, document crash where url contains '@' symbol para=case para when /^#{Mx[:pa_o]}:i([1-9])#{Mx[:pa_c]}/m m=$1 @@ -443,6 +443,7 @@ module SiSU_ODF #para.gsub!(/<(~\d+;(?:\w|[0-6]:)\d+;\w\d+)><(#@dp:#@dp)>/,'<\1><\2>') para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ para_array=[] + para.gsub!(//,'>') word=para.scan(/\S+|\n/) if word word.each do |w| # _ - / # | : ! ^ ~ @@ -487,8 +488,10 @@ module SiSU_ODF para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') - para.gsub!(/`/,"'") + para.gsub!(/[`’]/,"'") para.gsub!(/­/u,'-') + para.gsub!(/ /u, ' ') # space identify + para.gsub!(/ /u, ' ') # space identify para.gsub!(/·/u,'*') para.gsub!(/[“”]/u,'""') para.gsub!(/[­–—]/u,'-') #— – chk diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 3cfbf1e5..b211f5c1 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -368,32 +368,32 @@ module SiSU_Param @dc_date_modified=date @date_modified_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - when /^(?:0~type|@type:)\s+(.+?)$/m; @dc_type=$1 #% metainfo DC - when /^(?:0~format|@format:)\s+(.+?)$/m; @dc_format=$1 #% metainfo DC - #when /^(?:0~identifier|@identifier:)\s+(.+?)$/m; @dc_identifier=$1 #% metainfo DC - when /^(?:0~source|@source:)\s+(.+?)$/m; @dc_source=$1 #% metainfo DC - when /^(?:0~language(?:\.document)?|@language(?:\.document)?:)\s+(.+?)$/m #% metainfo DC + when /^(?:0~type|@type:)\s+(.+?)$/m; @dc_type=$1 #% metainfo DC + when /^(?:0~format|@format:)\s+(.+?)$/m; @dc_format=$1 #% metainfo DC + #when /^(?:0~identifier|@identifier:)\s+(.+?)$/m; @dc_identifier=$1 #% metainfo DC + when /^(?:0~source|@source:)\s+(.+?)$/m; @dc_source=$1 #% metainfo DC + when /^(?:0~language(?:\.document)?|@language(?:\.document)?:)\s+(.+?)$/m #% metainfo DC x=$1.strip lang=SiSU_Env::Standardise_language.new(x.dup) @dc_language[:code]=lang.code @dc_language[:name]=lang.title - when /^(?:0~language\.original|@language\.original:)\s+(.+?)$/m #% metainfo DC + when /^(?:0~language\.original|@language\.original:)\s+(.+?)$/m #% metainfo DC x=$1.strip lang=SiSU_Env::Standardise_language.new(x.dup) @language_original[:name]=lang.title - when /^(?:0~relation|@relation:)\s+(.+?)$/m; @dc_relation=$1 #% metainfo DC - when /^(?:0~coverage|@coverage:)\s+(.+?)$/m; @dc_coverage=$1 #% metainfo DC - when /^(?:0~rights|@rights:)\s+(.+?)$/m; @dc_rights=$1 #% metainfo DC copyright, public domain, copyleft, creative commons, etc. - when /^(?:0~papersize|@papersize:)\s+(.+?)$/m #% metainfo DC + when /^(?:0~relation|@relation:)\s+(.+?)$/m; @dc_relation=$1 #% metainfo DC + when /^(?:0~coverage|@coverage:)\s+(.+?)$/m; @dc_coverage=$1 #% metainfo DC + when /^(?:0~rights|@rights:)\s+(.+?)$/m; @dc_rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. + when /^(?:0~papersize|@papersize:)\s+(.+?)$/m #% metainfo DC l=$1 if @mod.inspect !~/--papersize[=-]\S+/ l=determine_papersize(l.dup) @papersize=l end - when /^(?:0~keywords?|@keywords?:?)\s+(.+?)$/m; @keywords=$1 #% metainfo DC - when /^(?:0~comments?|@comments?:?)\s+(.+?)$/m; @comments=$1 #% metainfo DC - when /^(?:0~abstract|@abstract)\s+(.+?)$/m; @abstract=$1 #% metainfo DC - when /^(?:0~tags?|@tags?:)\s+\S/m #% metainfo + when /^(?:0~keywords?|@keywords?:?)\s+(.+?)$/m; @keywords=$1 #% metainfo DC + when /^(?:0~comments?|@comments?:?)\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^(?:0~abstract|@abstract)\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^(?:0~tags?|@tags?:)\s+\S/m #% metainfo tags=para.match(/^(?:0~tags?|@tags?:)\s+(.+)\Z/m)[1] tags.split(/,|$/).each do |tag| tag.strip! @@ -403,18 +403,18 @@ module SiSU_Param tag_a=tag_a.split(/:/).join('][') @tag_a << tag_a end - when /^(?:0~catalogue|@catalogue:)\s+(.+)?$/m #% metainfo + when /^(?:0~catalogue|@catalogue:)\s+(.+)?$/m #% metainfo m=$1 @cls_pg=m.match(/pg=(\S+)/)[1] if m =~/pg=/ @cls_isbn=m.match(/isbn=(\S+)/)[1] if m =~/isbn=/ @cls_dewey=m.match(/dewey=(\S+)/)[1] if m =~/dewey=/ @cls_loc=m.match(/loc=(\S+)/)[1] if m =~/loc=/ - when /^(?:0~class(?:ify)?_loc|@class(?:ify)?_loc:)\s+(.+?)$/m; @cls_loc=$1 #% metainfo - when /^(?:0~class(?:ify)?_dewey|@class(?:ify)?_dewey:)\s+(.+?)$/m; @cls_dewey=$1 #% metainfo - when /^(?:0~class(?:ify)?_pg|@class(?:ify)?_pg)\s+(.+?)$/m; @cls_pg=$1 #% metainfo - when /^(?:0~(?:class(?:ify)?_)?isbn|@(?:class(?:ify)?_)?isbn)\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo - when /^(?:0~images?|@images?:)\s+(.+?)$/m; @image=$1 #% processing - when /^(?:0~(?:toc|structure)|@(?:toc|structure):)\s+(.+?)\Z/m #% processing + when /^(?:0~class(?:ify)?_loc|@class(?:ify)?_loc:)\s+(.+?)$/m; @cls_loc=$1 #% metainfo + when /^(?:0~class(?:ify)?_dewey|@class(?:ify)?_dewey:)\s+(.+?)$/m; @cls_dewey=$1 #% metainfo + when /^(?:0~class(?:ify)?_pg|@class(?:ify)?_pg)\s+(.+?)$/m; @cls_pg=$1 #% metainfo + when /^(?:0~(?:class(?:ify)?_)?isbn|@(?:class(?:ify)?_)?isbn)\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo + when /^(?:0~images?|@images?:)\s+(.+?)$/m; @image=$1 #% processing + when /^(?:0~(?:toc|structure)|@(?:toc|structure):)\s+(.+?)\Z/m #% processing doc_toc_str=$1 @toc=doc_toc_str.split(/;\s*/) @toc=[ @toc ] if @toc == String diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 9203f0df..228a5c14 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -166,6 +166,8 @@ module SiSU_XML_munge #¢£¥§©ª«®°±²³µ¶¹º»¼½¾×÷ ##para.gsub!(//, '&#;') ##para.gsub!(//, '&;') + para.gsub!(//u, '>') # '>' # > para.gsub!(/¢/u, '¢') # '¢' # ¢ para.gsub!(/£/u, '£') # '£' # £ para.gsub!(/¥/u, '¥') # '¥' # ¥ @@ -250,10 +252,23 @@ module SiSU_XML_munge para.gsub!(/ü/u, 'ý') # 'ü' # ý para.gsub!(/þ/u, 'þ') # 'þ' # þ para.gsub!(/ÿ/u, 'ÿ') # 'ÿ' # ÿ + para.gsub!(/‘/u, '‘') # '‘' # ‘ + para.gsub!(/’/u, '’') # '’' # ’ + para.gsub!(/–/u, '–') # – # – + para.gsub!(/—/u, '—') # — # — + para.gsub!(/∝/u, '∝') # ∝ # ∝ + para.gsub!(/∞/u, '∞') # ∞ # ∞ + para.gsub!(/™/u, '™') # ™ # ™ + para.gsub!(/✠/u, '†') # † # † incorrect replacement! † + para.gsub!(/ /u, ' ') # space identify + para.gsub!(/ /u, ' ') # space identify end end def html(para='') if @sys.locale =~/utf-?8/i # instead ucs for utf8 #require 'iconv' ? Iñtërnâtiônàlizætiøn + para.gsub!(/ /u, ' ') # space identify + para.gsub!(/ /u, ' ') # space identify + else para.gsub!(/¢/u, '¢') # ¢ para.gsub!(/£/u, '£') # £ para.gsub!(/¥/u, '¥') # ¥ @@ -338,6 +353,16 @@ module SiSU_XML_munge para.gsub!(/ü/u, 'ü') # ý para.gsub!(/þ/u, 'þ') # þ para.gsub!(/ÿ/u, 'ÿ') # ÿ + para.gsub!(/‘/u, '&#lsquo;') # ‘ # ‘ + para.gsub!(/’/u, '&#rsquo;') # ’ # ’ + para.gsub!(/–/u, '–') # – # – + para.gsub!(/—/u, '—') # — # — + para.gsub!(/∝/u, '∝') # ∝ # ∝ + para.gsub!(/∞/u, '∞') # ∞ # ∞ + para.gsub!(/™/u, '™') # ™ # ™ + para.gsub!(/✠/u, '†') # † # † incorrect replacement † + para.gsub!(/ /u, ' ') # space identify + para.gsub!(/ /u, ' ') # space identify end end self @@ -381,6 +406,10 @@ module SiSU_XML_munge %{[\\1] \\4}) para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}(https?:\/\/\S+)/, %{\\1}) + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, + %{[\\1] \\4}) + para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?#{Mx[:lnk_c]}image/, + %{\\1}) para.gsub!(/(^|#{Mx[:gl_c]}|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, '\1\2\4') #watch, compare html_tune para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 95da5d2d..5f99cacf 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -267,8 +267,8 @@ WOK (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } data.each do |para| - para=@trans.markup(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 + para=@trans.markup(para) if para =~/^#{Rx[:meta]}\s*.+?$/ # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 4826a503..49c71b88 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -291,8 +291,8 @@ WOK (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } data.each do |para| - para=@trans.markup(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 + para=@trans.markup(para) if para =~/^#{Rx[:meta]}\s*.+?$/ # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index b2bc0de7..13aed504 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -349,8 +349,8 @@ WOK (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } data.each do |para| - para=@trans.markup(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 + para=@trans.markup(para) if para =~/^#{Rx[:meta]}\s*(.+?)$/ # for headers d_meta=SiSU_text_utils::Header_scan.new(@md,para).meta if d_meta; xml_head(d_meta) -- cgit v1.2.3 From fc826abef5f83543f2cf00938b6d656e3b2c2821 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 3 Sep 2008 22:40:23 -0400 Subject: dal, left and right quotes (single & double) kept; previously converted to ordinary quotes (watch) --- lib/sisu/v0/dal.rb | 4 ---- lib/sisu/v0/shared_xml.rb | 12 +++++++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index a8bf1cd0..e75309f9 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -240,13 +240,9 @@ module SiSU_DAL para.gsub!(/(#{Mx[:en_a_o]})\s*/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ') para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29 para.gsub!(/
    /,"#{Mx[:br_line]}") #needed by xml, xhtml etc. - #para.gsub!(/

    /,'

    ') #consider - para.gsub!(/`/,"'") para.gsub!(/\t/,' ') para.gsub!(/\342\200\231/u,"'") #if para =~/’/ #Avoid #‘ ’ #“ ” para.gsub!(/�/u,' ') #watch, replace with char code - para.gsub!(/[“”]/u,'""') - para.gsub!(/[­–—]/u,'-') #— – chk para.gsub!(/·/u,'*') para.gsub!(/\\copy(?:right)?\b/,'©') para.gsub!(/\\trademark\b|\\tm\b/,'®') diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 228a5c14..7ecc52bb 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -254,6 +254,8 @@ module SiSU_XML_munge para.gsub!(/ÿ/u, 'ÿ') # 'ÿ' # ÿ para.gsub!(/‘/u, '‘') # '‘' # ‘ para.gsub!(/’/u, '’') # '’' # ’ + para.gsub!(/“/u, '“') # “ # “ + para.gsub!(/”/u, '”') # ” # ” para.gsub!(/–/u, '–') # – # – para.gsub!(/—/u, '—') # — # — para.gsub!(/∝/u, '∝') # ∝ # ∝ @@ -355,6 +357,8 @@ module SiSU_XML_munge para.gsub!(/ÿ/u, 'ÿ') # ÿ para.gsub!(/‘/u, '&#lsquo;') # ‘ # ‘ para.gsub!(/’/u, '&#rsquo;') # ’ # ’ + para.gsub!(/“/u, '“') # “ # “ + para.gsub!(/”/u, '”') # ” # ” para.gsub!(/–/u, '–') # – # – para.gsub!(/—/u, '—') # — # — para.gsub!(/∝/u, '∝') # ∝ # ∝ @@ -369,11 +373,13 @@ module SiSU_XML_munge end def tidywords(wordlist) wordlist.each do |x| + #imperfect solution will not catch all possible cases x.gsub!(/&/,'&') unless x =~/&\S+;/ + x.gsub!(/&([A-Z])/,'&\1') end end def markup(para='') - wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 + wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
    ') para.gsub!(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') @@ -439,7 +445,7 @@ module SiSU_XML_munge "#{@dir.url.images_local}\/\\1") para.gsub!(/ /,' ') #para.gsub!(/ /,' ') #clean - wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 + wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para end @@ -462,7 +468,7 @@ module SiSU_XML_munge "#{@dir.url.images_local}\/\\1") para.gsub!(/ /,' ') #para.gsub!(/ /,' ') #clean - wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 + wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para end -- cgit v1.2.3 From 7c96df7fc4f45f820d74421d60bdcd61a10d3709 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 5 Sep 2008 00:59:01 -0400 Subject: dal, bullet footnotes fix (check numbered bullets, should also be ok) --- lib/sisu/v0/dal.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index e75309f9..6bfbd76e 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -237,7 +237,7 @@ module SiSU_DAL para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}") para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}") #para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL - para.gsub!(/(#{Mx[:en_a_o]})\s*/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ') + para.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ') para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29 para.gsub!(/
    /,"#{Mx[:br_line]}") #needed by xml, xhtml etc. para.gsub!(/\t/,' ') @@ -848,7 +848,7 @@ module SiSU_DAL unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ case para # auto-numbered endnotes --> - when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+].+?#{Mx[:en_b_c]}/ + when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) word_mode=endnote_call_number(word_mode) @@ -872,15 +872,15 @@ module SiSU_DAL case word when /#{Mx[:en_a_o]}/ unless word =~/#{Mx[:en_a_o]}[*+]+/ - word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter}") + word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter} ") @@endnote_counter+=1 end when /#{Mx[:en_b_o]}/ if word =~/#{Mx[:en_b_o]}[+]/ - word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag}") + word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag} ") @@endnote_counter_dag+=1 else - word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk}") + word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk} ") @@endnote_counter_asterisk+=1 end when /~\^|<:e>/ -- cgit v1.2.3 From 9432d0345a982f2c64c684cc913b704cca5660f5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 5 Sep 2008 01:24:49 -0400 Subject: character given to represent non-break space in internal code (dal, constants and affected downstream code) --- lib/sisu/v0/constants.rb | 2 +- lib/sisu/v0/dal.rb | 18 +++++++------- lib/sisu/v0/dal_doc_str_code.rb | 2 +- lib/sisu/v0/dal_syntax.rb | 45 +++++++++++++++++----------------- lib/sisu/v0/db_import.rb | 2 +- lib/sisu/v0/html_tune.rb | 1 + lib/sisu/v0/manpage.rb | 6 ++--- lib/sisu/v0/odf.rb | 7 +----- lib/sisu/v0/shared_xml.rb | 8 +++--- lib/sisu/v0/spell.rb | 3 ++- lib/sisu/v0/sst_do_inline_footnotes.rb | 2 +- lib/sisu/v0/sst_to_s_xml_dom.rb | 2 +- lib/sisu/v0/texinfo_format.rb | 3 +-- lib/sisu/v0/texpdf_format.rb | 8 +++--- lib/sisu/v0/wikispeak.rb | 2 +- 15 files changed, 54 insertions(+), 57 deletions(-) diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index 2c08bdfa..96878fcf 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -90,6 +90,7 @@ Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}" #non substantive text sort: <-#> <~#> Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph) Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) +Mx[:nbsp]= '▭ ' Mx[:br_line]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" Mx[:br_paragraph]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" Mx[:br_nl]= "#{Mx[:mk_o]}nl#{Mx[:mk_c]}" @@ -172,4 +173,3 @@ check: ▶this is text or an image◀http:// ◀this is text or an image▶ http:// - diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 6bfbd76e..25b7528e 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -407,14 +407,14 @@ module SiSU_DAL if describe tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry if describe =~/^~\^ / - "     {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} " + "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} " else - "     { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} " + "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} " end else if describe =~/^~\^ / - "     {#{describe} }../#{url_dir}/#{o_f} " - else "     { #{describe} }../#{url_dir}/#{o_f} " + "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} " + else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} " end end end @@ -428,13 +428,13 @@ module SiSU_DAL if describe tuned_file_tmp << if @u.remote x=if describe =~/zip/ - "     {#{describe} }#{@u.src_pod}/#{o_f} " - else "     {#{describe} }#{@u.src_txt}/#{o_f} " + "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} " + else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} " end else x=if describe =~/zip/ - "     { #{describe} }../pod/#{o_f} " - else "     { #{describe} }../zip/#{o_f} " + "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} " + else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} " end end end @@ -1137,7 +1137,7 @@ module SiSU_DAL #% same as db clean --> s=s.gsub(/(.+?)<\/del>/,'DELETED(\1)') # deletions s=s.gsub(/(\d+)<\/sup>/,'[\1]') - s=s.gsub(/(?: \\;)+/,' ') + s=s.gsub(/(?:#{Mx[:nbsp]})+/,' ') #s=s.gsub(//,"[TABLE]\n") # tables #s=s.gsub(//,'\1') # tables #s=s.gsub(/¡¡\d+¡/,' ') # tables diff --git a/lib/sisu/v0/dal_doc_str_code.rb b/lib/sisu/v0/dal_doc_str_code.rb index 82ada040..27e20d51 100644 --- a/lib/sisu/v0/dal_doc_str_code.rb +++ b/lib/sisu/v0/dal_doc_str_code.rb @@ -170,7 +170,7 @@ module SiSU_document_structure_code data.each do |line| if line =~/\S/ \ and line !~/^code\{|^\}code|#{Mx[:gr_o]}code.+/ - line.gsub!(/\s\s/,'  ') + line.gsub!(/\s\s/,"#{Mx[:nbsp]}#{Mx[:nbsp]}") line.gsub!(/^/,"#{Mx[:gr_o]}codeline#{Mx[:gr_c]}") if type=='code' # try sort for texpdf special case if line =~/(?:https?|file|ftp):\/\/\S+$/ line.gsub!(/$/," #{Mx[:br_nl]}") diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 8e439870..acdec0e4 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -260,6 +260,7 @@ module SiSU_Syntax line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here line.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30 line.gsub!(//,'<:\1>') #escaped special character + line.gsub!(/ /,"#{Mx[:nbsp]}") #escaped special character line.gsub!(/\\~/,"#{Mx[:gl_o]}#126#{Mx[:gl_c]}") #escaped special character line.gsub!(/\\\{/,"#{Mx[:gl_o]}#123#{Mx[:gl_c]}") #escaped special character line.gsub!(/\\\}/,"#{Mx[:gl_o]}#125#{Mx[:gl_c]}") #escaped special character @@ -298,31 +299,31 @@ module SiSU_Syntax #line.gsub!(/(^| )\{~\^ (.+?)\s*\}((?:https?|file|ftp):\S+)\s+~\{(.+?)\}~/,'\1{ \2 }\3 ~{ \3 \4 }~') # watch line.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:
    |
    )\s*_([12])\s+/,'
    <:i\1> ') # depreciated -->#{Mx[:fa_c]} - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)e\{(.+?)\}e/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)b\{(.+?)\}b/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)u\{(.+?)\}u/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)c\{(.+?)\}c/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)i\{(.+?)\}i/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics # depreciated ^ - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)!\{(.+?)\}!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #emphasis + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)\*\{(.+?)\}\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[\{]|\>)_\{(.+?)\}_/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}") #underscore + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|#{Mx[:lnk_o]}|[\(\[]|\(|\>)\/\{(.+?)\}\//,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}") #italics + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\"\{(.+?)\}\"/,"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? line.gsub!(/(^|[^\\])\^\{(.+?)\}\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |\(|\>|\S)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|\(|\>|\S)9\{(.+?)\}9/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript line.gsub!(/(^|[^\\]),\{(.+?)\},/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url)) + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/,"\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/,"\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\!(\S+?)\!/,"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}") #bold single word, watch + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\/([\(\)a-zA-Z0-9']+?)\/([^a-zA-Z0-9]|[ ,.;:'"~$]|$)/,"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}\\3") #italics single word, watch + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)_(\S+?)_([.,!'")]?(?:\s|$))/,"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}\\3") #underscore single word, watch (made more complicated by url decoration escape tag (_url)) line.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/,"\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch - line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]| |#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added + line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested line.gsub!(/^\s*_\*\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut #line.gsub!(/^\s*_(\*+)\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut @@ -355,7 +356,7 @@ module SiSU_Syntax line.gsub!(/_<:(\S+?)_>/,'<:\1>') #convert <:\S+> back, clumsy line.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert

    back, clumsy line.gsub!(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

    back, clumsy - line.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n  ") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") + line.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") else # 0~ end line diff --git a/lib/sisu/v0/db_import.rb b/lib/sisu/v0/db_import.rb index 52bb3ad2..f02ccd3f 100644 --- a/lib/sisu/v0/db_import.rb +++ b/lib/sisu/v0/db_import.rb @@ -147,7 +147,7 @@ module SiSU_DB_import def strip_markup(string) #define rules, make same as in dal clean string.gsub!(/#{Mx[:fa_superscript_o]}(\d+)#{Mx[:fa_superscript_c]}/,'[\1]') string.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/,'') - string.gsub!(/(?: \\;)+/,' ') + string.gsub!(/(?: \\;|#{Mx[:nbsp]})+/,' ') string.gsub!(/#{Mx[:gr_o]}T[h]?#{Mx[:tc_p]}.+?#{Mx[:gr_c]}/u,"[TABLE]\n") #tables #CHECK should take whole table string.gsub!(/#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}\d+(.+)#{Mx[:tc_c]}/u,'\1') #tables string.gsub!(/#{Mx[:tc_p]}#{Mx[:tc_p]}\d+#{Mx[:tc_p]}/u,' ') #tables diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index f06b8764..99f2d7f4 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -245,6 +245,7 @@ module SiSU_Tune para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'
    ') + para.gsub!(/#{Mx[:nbsp]}/,' ') para.gsub!(/<(p|br)>/,'<\1 />') para=SiSU_Tune::Clean_html.new(para).clean @tuned_file << para diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 77d6e408..597099ed 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -144,7 +144,7 @@ module SiSU_manpage end wrap=util.line_wrap if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m - wrap.gsub!(/(^| |\s|\*)\\\*/,'\1\\\\\*') #man page requires + wrap.gsub!(/(^| |#{Mx[:nbsp]}|\s|\*)\\\*/,'\1\\\\\*') #man page requires wrap.gsub!(/\s\.(\S+)/,' \\.\1') wrap.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape wrap.gsub!(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<\s]+?)([.,]?(?:\s|$))/,'\1\2\3') para.gsub!(/(.+?)<\/a>/m,'\1') para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links - para.gsub!(/ /,' ') # decide on + para.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on para.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index bf23f91f..d6558634 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -307,7 +307,7 @@ module SiSU_ODF para end def group_clean(para) - para.gsub!(/&nbsp;| /,' ') + para.gsub!(/&nbsp;| |#{Mx[:nbsp]}/,' ') para.gsub!(//,'>') para.gsub!(/<(text:span text:style-name="T[1-5]"|\/text:span)>/,'<\1>') #works, not ideal para.gsub!(/#{Mx[:br_line]}/,'
    ') @@ -447,9 +447,6 @@ module SiSU_ODF word=para.scan(/\S+|\n/) if word word.each do |w| # _ - / # | : ! ^ ~ - unless w =~/#{Mx[:id_o]}~\S+?;\S+?;\S+?#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|#{Mx[:gr_o]}.+?#{Mx[:gr_c]}|<[:!][^<>]+?>/ - w.gsub!(/^<([^<>][^<>][^<>][^<>]+?)>$/,'<\1>') #refix - end unless para =~/^(?:#{Rx[:meta]}|%+ )/m w.gsub!(/&#(?:126|152);/,'~') #126 usual if w !~/&\S{1,7};/ \ @@ -488,12 +485,10 @@ module SiSU_ODF para.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'\1') para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'\1') para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'\1') - para.gsub!(/[`’]/,"'") para.gsub!(/­/u,'-') para.gsub!(/ /u, ' ') # space identify para.gsub!(/ /u, ' ') # space identify para.gsub!(/·/u,'*') - para.gsub!(/[“”]/u,'""') para.gsub!(/[­–—]/u,'-') #— – chk para.gsub!(/ < /i,'<') para.gsub!(/\\copy(?:right)?\b/,'©') diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 7ecc52bb..437f5482 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -422,12 +422,12 @@ module SiSU_XML_munge %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, '\1\2') #escaped urls not linked, deal with later - para.gsub!(/ /,' ') + para.gsub!(/ |#{Mx[:nbsp]}/,' ') #para.gsub!(/ /,' ') #clean else para.gsub!(/(^|[^}])_/m,'\1>') #code-block: angle brackets special characters para.gsub!(/(^|[^}])_/m,'\1>') - para.gsub!(/ /,' ') + para.gsub!(/ |#{Mx[:nbsp]}/,' ') end para end @@ -443,7 +443,7 @@ module SiSU_XML_munge para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{@dir.url.images_local}\/\\1") - para.gsub!(/ /,' ') + para.gsub!(/ |#{Mx[:nbsp]}/,' ') #para.gsub!(/ /,' ') #clean wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip @@ -466,7 +466,7 @@ module SiSU_XML_munge para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{@dir.url.images_local}\/\\1") - para.gsub!(/ /,' ') + para.gsub!(/ |#{Mx[:nbsp]}/,' ') #para.gsub!(/ /,' ') #clean wordlist=para.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip diff --git a/lib/sisu/v0/spell.rb b/lib/sisu/v0/spell.rb index 477a472f..8f89c470 100644 --- a/lib/sisu/v0/spell.rb +++ b/lib/sisu/v0/spell.rb @@ -72,7 +72,8 @@ module Utility end def check @input.each do |data| - data.gsub!(/(https?|www|ftp|gopher|png|jpg|gif|html|htm| )\S+/i,' ') + data.gsub!(/(https?|www|ftp|gopher|png|jpg|gif|html|htm)\S+/i,' ') + data.gsub!(/( |#{Mx[:nbsp]})/i,' ') data.gsub!(/<\/?(table|tr|td|b|p|href).*?>/i,' ') data.gsub!(/(<==.+|<:\S+>||^0~.+|\{\{\{|~)/,' ') data.gsub!(/(["|<>)(\n'`'.;&_-]|\=)/,' ') diff --git a/lib/sisu/v0/sst_do_inline_footnotes.rb b/lib/sisu/v0/sst_do_inline_footnotes.rb index ba1f6379..514eb2c8 100644 --- a/lib/sisu/v0/sst_do_inline_footnotes.rb +++ b/lib/sisu/v0/sst_do_inline_footnotes.rb @@ -473,7 +473,7 @@ module SiSU_Convert_footnotes #% same as db clean --> s=s.gsub(/(.+?)<\/del>/,'DELETED(\1)') # deletions s=s.gsub(/(\d+)<\/sup>/,'[\1]') - s=s.gsub(/(?: \\;)+/,' ') + s=s.gsub(/(?: \\;|#{Mx[:nbsp]})+/,' ') #checking source Mx not necessary s=s.gsub(/\{.+?\.(?:png|jpg|gif).+?\}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search s=s.gsub(/\s\s+/,' ') diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index efb60a88..30dc370a 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -367,7 +367,7 @@ WOK "#{dir.url.images_local}/\\1") para.gsub!(/#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{dir.url.images_local}/\\1") - para.gsub!(/ /,' ') + para.gsub!(/ |#{Mx[:nbsp]}/,' ') # checking source Mx not necessary para=SiSU_document_structure::Structure.new(@md,para).structure @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 para.gsub!(/^0~(\S+)/,"#{Mx[:lv_o]}@\\1#{Mx[:lv_c]}") diff --git a/lib/sisu/v0/texinfo_format.rb b/lib/sisu/v0/texinfo_format.rb index cdfa6a75..22fd7a84 100644 --- a/lib/sisu/v0/texinfo_format.rb +++ b/lib/sisu/v0/texinfo_format.rb @@ -367,8 +367,7 @@ WOK @txt.gsub!(/@/i,'@@') @txt.gsub!(/\{/,'@{'); @txt.gsub!(/\}/,'@}') #@txt.gsub!(/(^|[\s*!\/#_-])\{/,'\1@{'); @txt.gsub!(/\}([\s*!\/#_-]|$)/,'@}\1') - @txt.gsub!(/  /,' ') # ~ character for hardspace - @txt.gsub!(/ /,' ') # ~ character for hardspace + @txt.gsub!(/(?: |#{Mx[:nbsp]})+/,' ') # ~ character for hardspace @txt.gsub!(/&(\S+?);/,' ') @txt.gsub!(/&/,'<=and>') @txt.gsub!(/(\s+&\s+)/,' and ') diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index b6a1e1f2..58a057d8 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -987,7 +987,7 @@ WOK string.gsub!(/.+?<-#>/,'') string.gsub!(/#{Mx[:br_eof]}|#{Mx[:br_endnotes]}/,'') #problem sequence -> - string.gsub!(/&(?:nbsp);/,'<=hardspace>') # < SiSU special character also LaTeX + string.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'<=hardspace>') # < SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#nbsp#{Mx[:gl_c]}/,'<=hardspace>') # < SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<=lt>') # < SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX @@ -1027,7 +1027,7 @@ WOK end string.gsub!(/\{/,'\{') #string.gsub!(/\}/,'\}') - string.gsub!(/ /,'~') # ~ character for hardspace + string.gsub!(/ |#{Mx[:nbsp]}/,'~') # ~ character for hardspace # sequence important must appear after removal of { and } string.gsub!(/&\S+?;/,'') #hmmm # sequence imortant place before removal of & @@ -1155,7 +1155,7 @@ WOK string.gsub!(/#{Mx[:br_endnotes]}/,'') #string.gsub!(//,'') #problem sequence -> - string.gsub!(/&(?:nbsp);/,'<=hardspace>') # < SiSU special character also LaTeX + string.gsub!(/&(?:nbsp);|#{Mx[:nbsp]}/,'<=hardspace>') # < SiSU special character also LaTeX string.gsub!(/&(?:lt|#060);/,'<=lt>') # < SiSU special character also LaTeX string.gsub!(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'<=gt>') # > SiSU special character also LaTeX #string.gsub!(/#{Mx[:gl_o]}(&#(?:[a-z]+|[0-9]+);)#{Mx[:gl_c]}/,'\1') @@ -1194,7 +1194,7 @@ WOK end string.gsub!(/\{/,'\{') string.gsub!(/\}/,'\}') - string.gsub!(/ /,'~') # ~ character for hardspace + string.gsub!(/ |#{Mx[:nbsp]}/,'~') # ~ character for hardspace # sequence important must appear after removal of { and } string.gsub!(/&\S+?;/,'') #hmmm # sequence imortant place before removal of & diff --git a/lib/sisu/v0/wikispeak.rb b/lib/sisu/v0/wikispeak.rb index 0e8d3989..d9cb3cbd 100644 --- a/lib/sisu/v0/wikispeak.rb +++ b/lib/sisu/v0/wikispeak.rb @@ -260,7 +260,7 @@ WOK para.gsub!(/^\s*#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/,'') # remove empty lines - check para.gsub!(/
    (.+?)<\/a>/m,'\1') para.gsub!(/<:name#\S+?>/,'') # remove name links - para.gsub!(/ /,' ') # decide on + para.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') -- cgit v1.2.3 From e46264082eaca056dddabf4f1d02732a88a305e8 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 7 Sep 2008 14:07:18 -0400 Subject: minor unicode for a type of cross --- lib/sisu/v0/constants.rb | 2 -- lib/sisu/v0/shared_xml.rb | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index 96878fcf..f352ab7c 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -170,6 +170,4 @@ check: '〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕' ◁▷ -▶this is text or an image◀http:// - ◀this is text or an image▶ http:// diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 437f5482..bf59830f 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -261,7 +261,7 @@ module SiSU_XML_munge para.gsub!(/∝/u, '∝') # ∝ # ∝ para.gsub!(/∞/u, '∞') # ∞ # ∞ para.gsub!(/™/u, '™') # ™ # ™ - para.gsub!(/✠/u, '†') # † # † incorrect replacement! † + para.gsub!(/✠/u, '✠') # ✗ # ✠ para.gsub!(/ /u, ' ') # space identify para.gsub!(/ /u, ' ') # space identify end @@ -364,7 +364,8 @@ module SiSU_XML_munge para.gsub!(/∝/u, '∝') # ∝ # ∝ para.gsub!(/∞/u, '∞') # ∞ # ∞ para.gsub!(/™/u, '™') # ™ # ™ - para.gsub!(/✠/u, '†') # † # † incorrect replacement † + para.gsub!(/✠/u, '✠') # ✠ + #para.gsub!(/✠/u, '†') # † # † incorrect replacement † para.gsub!(/ /u, ' ') # space identify para.gsub!(/ /u, ' ') # space identify end -- cgit v1.2.3 From 3655940354be602e6e69e1e8445d157bcb89c965 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 7 Sep 2008 23:16:47 -0400 Subject: book index (markup adjustment, dal module); dal numbering moved to separate module; version date --- CHANGELOG | 8 +- conf/sisu/version.yml | 4 +- lib/sisu/v0/constants.rb | 1 + lib/sisu/v0/dal.rb | 335 +------------------------------------- lib/sisu/v0/dal_idx.rb | 201 +++++++++++++++++++++++ lib/sisu/v0/dal_numbering.rb | 374 +++++++++++++++++++++++++++++++++++++++++++ lib/sisu/v0/dal_syntax.rb | 2 +- lib/sisu/v0/param.rb | 7 +- lib/sisu/v0/plaintext.rb | 2 +- 9 files changed, 598 insertions(+), 336 deletions(-) create mode 100644 lib/sisu/v0/dal_idx.rb create mode 100644 lib/sisu/v0/dal_numbering.rb diff --git a/CHANGELOG b/CHANGELOG index 716c399e..936acd5a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,7 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-08-28:34/4) +%% sisu_0.69.0.orig.tar.gz (2008-09-07:35/7) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc @@ -37,12 +37,18 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * db table field lengths (varchar), increased + * book type index + * markup adjustment, book type index introduced + * dal, book type indexing module + * middle layer, url representation changed, downstream code affected * dummy headings removed when not used, latex/pdf, odf, html scroll * internal, greater use of passing of hash to formatting modules + * dal, numbering moved to separate module + %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz cecae8b828aa187b22354f2ee9e8a8b5244dd9f4 1509605 sisu_0.68.0.orig.tar.gz diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index 70d4f342..d3ddf9f7 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- :version: 0.69.0-beta -:date_stamp: 2008w34/4 -:date: "2008-08-28" +:date_stamp: 2008w35/7 +:date: "2008-09-07" :project: SiSU diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index f352ab7c..3f050df7 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -90,6 +90,7 @@ Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}" #non substantive text sort: <-#> <~#> Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph) Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) +Mx[:idx_o]='▢ '; Mx[:idx_c]='▢ ' # Mx[:nbsp]= '▭ ' Mx[:br_line]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" Mx[:br_paragraph]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 25b7528e..aa4758b7 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -65,6 +65,8 @@ module SiSU_DAL require "#{SiSU_lib}/param" require "#{SiSU_lib}/dal_syntax" require "#{SiSU_lib}/dal_doc_str" + require "#{SiSU_lib}/dal_idx" + require "#{SiSU_lib}/dal_numbering" require "#{SiSU_lib}/i18n" require "#{SiSU_lib}/shared_sem" include SiSU_Env @@ -211,7 +213,8 @@ module SiSU_DAL data=character_check(data) data=images(data) data=SiSU_document_structure::Tables.new(@md,data).tables - data=numbering_song(data) #tr issue + data=SiSU_numbering::Numbering.new(@md,data).numbering_song + data=SiSU_book_index::Book_index.new(data).indexing_song if @md.book_index data=endnotes(data) data=object_digest(data) meta=metadata(data) @@ -449,7 +452,7 @@ module SiSU_DAL end def substitutions_and_insertions?(data) data_expand=[] - if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content preceeds it) + if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it) data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') end @@ -507,332 +510,6 @@ module SiSU_DAL end end end - def numbering_song(data) - data=number_plaintext_para(data) - data=name_endnote_seg(data) #tr issue - data=auto_number_heading_ie_title(data) #tr issue - data=ocn(data) #watch - data=minor_numbering(data) - data=name_para_seg_filename(data) - data=set_heading_seg(data) unless @md.set_heading_seg - data=set_heading_top(data) unless @md.set_heading_top - data=set_header_title(data) unless @md.set_header_title - data - end - def number_plaintext_para(data) - @tuned_file=[] - data.each do |para| - if para !~/#{Mx[:gr_o]}(?:code|group|alt|poem|verse)#{Mx[:gr_c]}|#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ - para.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks - end - para.gsub!(/^/,"\n") unless para =~/#{Mx[:tc_p]}/u - para.gsub!(/^\s+|\s$/,"\n") - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - def name_endnote_seg(data) - @tuned_file=[] - data.each do |para| - para.gsub!(/<:3>\s*<:ee>/, <<-WOK -#{@@endnote['special_align']}


    \r -#{@@endnote['seg_name_3']}

    -#{@@endnote['special_align_close']} - WOK - ) - para.gsub!(/<:2>\s*<:ee>/, <<-WOK -#{@@endnote['special_align']}


    \r -#{@@endnote['seg_name_2']}

    -#{@@endnote['special_align_close']} - WOK - ) - para.gsub!(/<:1>\s*<:ee>/, <<-WOK -#{@@endnote['special_align']}


    \r -#{@@endnote['seg_name_1']}

    -#{@@endnote['special_align_close']} - WOK - ) - @tuned_file << para - end - # debug 2003w46 adding revision control info - if @md.flag_auto_endnotes \ - and @md.flag_separate_endnotes_make - @tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" - end - @tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON - @tuned_file=@tuned_file.flatten - end - def owner_details_seg - data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details" - end - def number_sub_heading(para,num,title_no) - case para - when /#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/; para.gsub!(/#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/,"#{title_no} ") - when /^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/; para.gsub!(/^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/,"#{title_no} ") - when /^#{Mx[:lv_o]}#{num}:[a-z_\.]+#{Mx[:lv_c]}/ - para.gsub!(/^#{Mx[:lv_o]}#{num}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,%{#{Mx[:lv_o]}#{num}:\\1#{Mx[:lv_c]} #{title_no} \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}}) - when /^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}\s*#{title_no}/ - para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]}") #where title contains title number - else para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]} #{title_no} ") #main, where title number is to be provided - end - if @md.toc_lev_limit \ - and @md.toc_lev_limit < num - para.gsub!(/^#{Mx[:lv_o]}[5-9]:\S*?#{Mx[:lv_c]}/,'!_ ') #bold line, watch - end - para - end - def auto_number_heading_ie_title(data) #also does some segment naming - @tuned_file=[] - if @md.markup =~/num_top/ \ - or @md.num_top # watch, 2003w23 - input="#{@md.markup}"[/num_top\=([1-6])/,1] if @md.markup - input||=@md.num_top if @md.num_top !~/^$/ - end - num_top=input.to_i - t_no1=t_no2=t_no3=t_no4=0 - no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3) - t_not=0 - data.each do |para| #@md.seg_names << [additions to segment names] - if (@md.markup =~/num_top/ \ - or (@md.num_top \ - and @md.num_top !~/^$/)) \ - and para !~/^#{Rx[:meta]}/ - if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \ - and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/) - t_not+=1 #; t_no2=0; t_no3=0 - para.gsub!(/^(#{Mx[:lv_o]}#{no1}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") - para.gsub!(/^(#{Mx[:lv_o]}#{no2}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") - para.gsub!(/^(#{Mx[:lv_o]}#{no3}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") - para.gsub!(/^(#{Mx[:lv_o]}#{no4}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") - end - if para =~/#{Mx[:lv_o]}#{no1}:/ - @subnumber=1 - @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/ - end - if para =~/^#{Mx[:lv_o]}[1-6]:[\w-]*#{Mx[:lv_c]}/ \ - and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s*[\d.]+)\s/ \ - and para !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ - if para =~/^#{Mx[:lv_o]}#{no1}:/ - t_no1+=1; t_no2=0; t_no3=0 - title_no="#{t_no1}" - if not @md.seg_names.nil? \ - and not @md.seg_names.include?(title_no) - para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*(\S+)#/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329) - para.gsub!(/^#{no1}\{\s+(Article|Clause|Section)\s+#/i,%{#{no1}~#{title_no} \\1 #{title_no}. }) - unless para =~/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review - para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]}#{title_no}. ") - end - @md.seg_names << title_no - #else puts "warning segment name #{title_no} already exists" - end - unless para =~/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required - para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i, - %{#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}#{title_no}. \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}}) - end - para.gsub!(/^#{Mx[:lv_o]}#{no1}:##{Mx[:lv_c]}/,"#{title_no}. ") #watch - para.gsub!(/^#{no1}~#\s*/,"#{title_no}. ") - end - if para =~/^#{Mx[:lv_o]}#{no2}:\S*?#{Mx[:lv_c]}/ - t_no2+=1; t_no3=0 - title_no="#{t_no1}.#{t_no2}" - para=number_sub_heading(para,no2,title_no) - end - if para =~/^#{Mx[:lv_o]}#{no3}:\S*?#{Mx[:lv_c]}/ - t_no3+=1 - title_no="#{t_no1}.#{t_no2}.#{t_no3}" - para=number_sub_heading(para,no3,title_no) - end - elsif para =~/^#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}/ # endnotes, watch2005 - para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}") #"#{no1}~\\1 ") - para.gsub!(/^#{Mx[:lv_o]}#{no2}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no2}:\\1#{Mx[:lv_c]}") - para.gsub!(/^#{Mx[:lv_o]}#{no3}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no3}:\\1#{Mx[:lv_c]}") - end - elsif @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4 - if para =~/^#{Mx[:lv_o]}[1-9]:#{Mx[:lv_c]}([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d - name_num=$1 - para.gsub!(/^#{Mx[:lv_o]}([1-9]:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{name_num}#{Mx[:lv_c]}") - end - if @md.toc_lev_limit - end - end - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - def ocn(data) #and auto segment numbering increment - @tuned_file=[] - object_array=SiSU_document_structure::OCN.new(@md,data).ocn - object_array.each do |o| - @tuned_file <<= if o.ocn; "#{o.txt} #{Mx[:id_o]}~#{o.ocn};#{o.lv};#{o.type}#{Mx[:id_c]}" #main ocn descriptor - else o.txt - end - end - @tuned_file=@tuned_file.flatten - end - def minor_numbering(data) #and auto segment numbering increment - @tuned_file=[] - number_small,letter_small=0,0 - letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z ) - data.each do |para| - if para =~/\w|\S|<|\(/ - if para !~/^%% |#{Rx[:meta]}|^0~|^#{Mx[:lv_o]}endnotes:|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}:p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|#{Mx[:gr_o]}(?:alt|code|group|poem|table)#{Mx[:gr_c]}|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$||||

    |<\/tr>|
    |\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here #  added with Tune.code #¡ - if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/; number_small,letter_small=0,0 #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) - end - if para =~/^#[ 1]/ - letter_small=0 - number_small=0 if para =~ /^#1/ - number_small+=1 - para.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004 - end - if para =~/^_# / - para.gsub!(/^_# /,"#{Mx[:fa_o]}:i1#{Mx[:fa_c]} #{letter[letter_small]}. ") #change 2004 - letter_small+=1 - end - end - end - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - def name_para_seg_filename(data) - # paragraph name/numbering rules - # manual naming overrides, manual naming may be - # alpha-numeric characters mixed, - # 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) - # [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 - # if the title/heading text starts with a numeric, then that is used (1 3.1 3rd etc.) - # otherwise the level 4 segment number from the embedded document structure info is used - # if there is none a sequential number is designated, preceded by an underscore - @tuned_file=[] - art_filename_auto=1 - @counter=1 - @unique_auto_name=[] - if not @md.seg_autoname_safe and @md.cmd =~/[MV]/ - puts 'manual segment names, numbers used as names, risk warning (segmented html)' - end - data.each do |para| - para=SiSU_document_structure::Structure.new(@md,para).structure_markup - if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}/ - if para=~/^#{Mx[:lv_o]}[4]:#{Mx[:lv_c]}/ \ - and not @md.set_heading_seg - @md.set_heading_seg=true - end - if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}(?:\s*\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name - pattern=$1 - pattern.gsub!(/(?:[:,-]|\W)/,'.') - pattern.gsub!(/\.$/,'') - if not @md.seg_names.nil? \ - and not @md.seg_names.include?(pattern) - para.gsub!(/^#{Mx[:lv_o]}([456]):#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1:#{pattern}#{Mx[:lv_c]}") - @md.seg_names << pattern - else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/ - end - end - if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}.+?;4:(\d+);/m #extract segment name from embedded document structure info - pattern=$1 - pattern.gsub!(/(?:[:,-]|\W)/,'.') - pattern.gsub!(/\.$/,'') - if not @md.seg_names.nil? \ - and not @md.seg_names.include?(pattern) - para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{pattern}#{Mx[:lv_c]}") - @md.seg_names << pattern - else - para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1~#{pattern}#{Mx[:lv_c]}") - @md.seg_names << "~#{pattern}" - end - end - if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}/ #if still not segment name, provide a numerical one - if not @md.seg_names.nil? \ - and not @md.seg_names.include?(art_filename_auto) - para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,%{#{Mx[:lv_o]}\\1~#{art_filename_auto}#{Mx[:lv_c]}}) - @md.seg_names << art_filename_auto - else puts 'segment name (numbering) error' - end - art_filename_auto+=1 - end - end - @tuned_file << if para =~/^#{Mx[:lv_o]}([1-6]):\S*?#{Mx[:lv_c]}/m \ - and (@md.pagenew or @md.pagebreak) - m=$1 #watch ref~ - para_tmp=[] - if @md.pagenew.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page_new]}\n" << para - elsif @md.pagebreak.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page]}\n" << para - end - para_result=unless para_tmp.length > 0; para - else para_tmp - end - else para - end - end - if @md.seg_names.length > 0 - @md.set_heading_seg=true - end - @tuned_file=@tuned_file.flatten - end - def set_heading_top(data) #% make sure no false positives - unless @md.set_heading_top - puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/ - @tuned_file=[] - data.each do |para| - unless @md.set_heading_top - if para !~/^(?:#{Rx[:meta]}|@\S+:|0~\S+)\s/m \ - and para !~/\A\s*\Z/m - @md.set_heading_top=true - head=if @md.title ; "#{Mx[:lv_o]}1:#{Mx[:lv_c]} #{@md.title}" - else "#{Mx[:lv_o]}1:#{Mx[:lv_c]} [no title provided]" - end - @tuned_file << head - end - end - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - end - def set_heading_seg(data) #% make sure no false positives - unless @md.set_heading_seg - puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/ - @tuned_file=[] - data.each do |para| - unless @md.set_heading_seg - if para !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[123]:\S*?#{Mx[:lv_c]})/m \ - and para !~/\A\s*\Z/m \ - and para !~/#{Mx[:br_page]}|#{Mx[:br_page_new]}/ - @md.set_heading_seg=true - head=if @md.title ; "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [#{@md.title}]" - else "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [segment]" - end - @tuned_file << head - end - end - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - end - def set_header_title(data) #% make sure no false positives - unless @md.set_header_title - puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/ - @tuned_file=[] - data.each do |para| - unless @md.set_header_title - if para !~/^%{1,2}\s/m \ - and para !~/\A\s*\Z/m - @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" - @md.title=@md.heading_seg_first - @md.set_header_title=true - end - end - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - end def endnotes(data) @tuned_file=[] endnote_no,endnote_ref=1,1 @@ -1058,7 +735,7 @@ module SiSU_DAL para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch para_plus_en=para.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) para_tail=if para =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m - /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1] + /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.*?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1] else '' end para_plus_en << para_tail diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb new file mode 100644 index 00000000..5e07396a --- /dev/null +++ b/lib/sisu/v0/dal_idx.rb @@ -0,0 +1,201 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_book_index + class Book_index + def initialize(data) + @data=data + end + def indexing_song + @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ + #@rgx_idx=/\s*#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ + @rgx_idx_ocn_init=/#{Mx[:idx_o]}(.+?)#{Mx[:idx_c]}\s*#{Mx[:id_o]}~(\d+)\S+?#{Mx[:id_c]}/ + @rgx_idx_ocn=/(.+?)~(\d+)/ + @data=extract_book_index(@data) + @data=clean_index(@data) + @data + end + def extract_book_index(data) + tuned_file=[] + idx_array=[] + data.each do |para| + idx_array << @rgx_idx_ocn_init.match(para)[0].gsub(@rgx_idx_ocn_init,'\1~\2') if para =~ @rgx_idx_ocn_init + tuned_file << para if para + end + idx_array.each do |i| + i.gsub!(@rgx_idx_ocn_init,'\1~\2') + end + idx_array=construct_idx_array(idx_array) if idx_array.length > 0 + if idx_array.length > 0 + the_idx=construct_book_index(idx_array) + screen_print(the_idx) + end + tuned_file + end + def construct_idx_array(idx_array) + idx_lst=[] + idx_array.each do |idx| + idx_list,ocn=@rgx_idx_ocn.match(idx)[1,2] + idx_lst <<=if idx_list =~/;/ + g=idx_list.scan(/[^;]+/) + idxl=[] + g.each do |i| + idxl << { :rough_idx => i, :ocn => ocn } + end + idxl + else { :rough_idx => idx_list, :ocn => ocn } + end + end + idx_lst.flatten! + idx_lst + end + def construct_book_index(idx_array) + @the_idx={} + idx_array.each do |idx| + idx_lst=idx[:rough_idx].scan(/[^|:]+/) + if idx_lst[0] =~/.+?\+\d+/ + use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] + else use=idx_lst[0] + end + @the_idx[use]={} unless @the_idx[use] and defined? @the_idx[use] + idx_lst.each do |i| + i.strip! + i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/ + x=if idx_lst.length == 1 or idx_lst[0] == i + @the_idx[use]['a1']=[] unless @the_idx[use]['a1'] and defined? @the_idx[use]['a1'] + x=if r + @the_idx[use]['a1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" } + "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" + else + @the_idx[use]['a1'] << { :ocn => idx[:ocn] } + "#{i} #{idx[:ocn]}" + end + else + @the_idx[use]['b1']={} unless @the_idx[use]['b1'] and defined? @the_idx[use]['b1'] + @the_idx[use]['b1'][i]=[] unless @the_idx[use]['b1'][i] and defined? @the_idx[use]['b1'][i] + x=if r + @the_idx[use]['b1'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" } + "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" + else + @the_idx[use]['b1'][i] << { :ocn => idx[:ocn] } + "#{idx_lst[0]}:#{i} #{idx[:ocn]}" + end + end + end + end + the_idx=@the_idx.sort + #p the_idx; p '-----' + the_idx + end + def screen_print(the_idx) + the_idx.each do |i| + i.each do |x| + if x.class == String + print "\n" + x + ', ' + elsif x.class == Array + p 'array error? -->' + print x + elsif x.class == Hash + if x['a1'].class == Array + x['a1'].each do |a| + if a[:range] + print a[:range] + ', ' + elsif a[:ocn] + print a[:ocn] + ', ' + else p 'error' + end + end + end + if x['b1'] + m=x['b1'] + m=m.sort + m.each do |k,y| + if k !~/a1/ + print "\n\t" + k + ', ' + #p y + y.each do |z| + if z[:range] + print z[:range] + ', ' + elsif z[:ocn] + print z[:ocn] + ', ' + else p 'error' + end + end + end + end + end + end + end + end + end + def clean_index(data) + tuned_file=[] + data.each do |para| + para.gsub!(@rgx_idx,'') + tuned_file << para + end + tuned_file + end + end +end + +__END__ + diff --git a/lib/sisu/v0/dal_numbering.rb b/lib/sisu/v0/dal_numbering.rb new file mode 100644 index 00000000..e14b87d7 --- /dev/null +++ b/lib/sisu/v0/dal_numbering.rb @@ -0,0 +1,374 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_numbering + class Numbering + def initialize(md,data) + @md,@data=md,data + end + def numbering_song + data=@data + data=number_plaintext_para(data) + #data=name_endnote_seg(data) #tr issue + data=auto_number_heading_ie_title(data) #tr issue + data=ocn(data) #watch + data=minor_numbering(data) + data=name_para_seg_filename(data) + data=set_heading_seg(data) unless @md.set_heading_seg + data=set_heading_top(data) unless @md.set_heading_top + data=set_header_title(data) unless @md.set_header_title + data + end + def number_plaintext_para(data) + @tuned_file=[] + data.each do |para| + if para !~/#{Mx[:gr_o]}(?:code|group|alt|poem|verse)#{Mx[:gr_c]}|#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ + para.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks + end + para.gsub!(/^/,"\n") unless para =~/#{Mx[:tc_p]}/u + para.gsub!(/^\s+|\s$/,"\n") + @tuned_file << para + end + @tuned_file=@tuned_file.flatten + end + def name_endnote_seg(data) + @tuned_file=[] + if @md.flag_auto_endnotes \ + and @md.flag_separate_endnotes_make + @tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" + end + @tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON + @tuned_file=@tuned_file.flatten + end + def owner_details_seg + data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details" + end + def number_sub_heading(para,num,title_no) + case para + when /#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/; para.gsub!(/#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/,"#{title_no} ") + when /^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/; para.gsub!(/^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/,"#{title_no} ") + when /^#{Mx[:lv_o]}#{num}:[a-z_\.]+#{Mx[:lv_c]}/ + para.gsub!(/^#{Mx[:lv_o]}#{num}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,%{#{Mx[:lv_o]}#{num}:\\1#{Mx[:lv_c]} #{title_no} \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}}) + when /^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}\s*#{title_no}/ + para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]}") #where title contains title number + else para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]} #{title_no} ") #main, where title number is to be provided + end + if @md.toc_lev_limit \ + and @md.toc_lev_limit < num + para.gsub!(/^#{Mx[:lv_o]}[5-9]:\S*?#{Mx[:lv_c]}/,'!_ ') #bold line, watch + end + para + end + def auto_number_heading_ie_title(data) #also does some segment naming + @tuned_file=[] + if @md.markup =~/num_top/ \ + or @md.num_top # watch, 2003w23 + input="#{@md.markup}"[/num_top\=([1-6])/,1] if @md.markup + input||=@md.num_top if @md.num_top !~/^$/ + end + num_top=input.to_i + t_no1=t_no2=t_no3=t_no4=0 + no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3) + t_not=0 + data.each do |para| #@md.seg_names << [additions to segment names] + if (@md.markup =~/num_top/ \ + or (@md.num_top \ + and @md.num_top !~/^$/)) \ + and para !~/^#{Rx[:meta]}/ + if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \ + and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/) + t_not+=1 #; t_no2=0; t_no3=0 + para.gsub!(/^(#{Mx[:lv_o]}#{no1}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + para.gsub!(/^(#{Mx[:lv_o]}#{no2}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + para.gsub!(/^(#{Mx[:lv_o]}#{no3}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + para.gsub!(/^(#{Mx[:lv_o]}#{no4}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2") + end + if para =~/#{Mx[:lv_o]}#{no1}:/ + @subnumber=1 + @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/ + end + if para =~/^#{Mx[:lv_o]}[1-6]:[\w-]*#{Mx[:lv_c]}/ \ + and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s*[\d.]+)\s/ \ + and para !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/ + if para =~/^#{Mx[:lv_o]}#{no1}:/ + t_no1+=1; t_no2=0; t_no3=0 + title_no="#{t_no1}" + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(title_no) + para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*(\S+)#/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329) + para.gsub!(/^#{no1}\{\s+(Article|Clause|Section)\s+#/i,%{#{no1}~#{title_no} \\1 #{title_no}. }) + unless para =~/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review + para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]}#{title_no}. ") + end + @md.seg_names << title_no + #else puts "warning segment name #{title_no} already exists" + end + unless para =~/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required + para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i, + %{#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}#{title_no}. \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}}) + end + para.gsub!(/^#{Mx[:lv_o]}#{no1}:##{Mx[:lv_c]}/,"#{title_no}. ") #watch + para.gsub!(/^#{no1}~#\s*/,"#{title_no}. ") + end + if para =~/^#{Mx[:lv_o]}#{no2}:\S*?#{Mx[:lv_c]}/ + t_no2+=1; t_no3=0 + title_no="#{t_no1}.#{t_no2}" + para=number_sub_heading(para,no2,title_no) + end + if para =~/^#{Mx[:lv_o]}#{no3}:\S*?#{Mx[:lv_c]}/ + t_no3+=1 + title_no="#{t_no1}.#{t_no2}.#{t_no3}" + para=number_sub_heading(para,no3,title_no) + end + elsif para =~/^#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}/ # endnotes, watch2005 + para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}") #"#{no1}~\\1 ") + para.gsub!(/^#{Mx[:lv_o]}#{no2}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no2}:\\1#{Mx[:lv_c]}") + para.gsub!(/^#{Mx[:lv_o]}#{no3}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no3}:\\1#{Mx[:lv_c]}") + end + elsif @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4 + if para =~/^#{Mx[:lv_o]}[1-9]:#{Mx[:lv_c]}([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d + name_num=$1 + para.gsub!(/^#{Mx[:lv_o]}([1-9]:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{name_num}#{Mx[:lv_c]}") + end + if @md.toc_lev_limit + end + end + @tuned_file << para + end + @tuned_file=@tuned_file.flatten + end + def ocn(data) #and auto segment numbering increment + @tuned_file=[] + object_array=SiSU_document_structure::OCN.new(@md,data).ocn + object_array.each do |o| + @tuned_file <<= if o.ocn; "#{o.txt} #{Mx[:id_o]}~#{o.ocn};#{o.lv};#{o.type}#{Mx[:id_c]}" #main ocn descriptor + else o.txt + end + end + @tuned_file=@tuned_file.flatten + end + def minor_numbering(data) #and auto segment numbering increment + @tuned_file=[] + number_small,letter_small=0,0 + letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z ) + data.each do |para| + if para =~/\w|\S|<|\(/ + if para !~/^%% |#{Rx[:meta]}|^0~|^#{Mx[:lv_o]}endnotes:|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}:p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|#{Mx[:gr_o]}(?:alt|code|group|poem|table)#{Mx[:gr_c]}|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$||||
    |<\/tr>|
    |\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here #  added with Tune.code #¡ + if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/; number_small,letter_small=0,0 #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) + end + if para =~/^#[ 1]/ + letter_small=0 + number_small=0 if para =~ /^#1/ + number_small+=1 + para.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004 + end + if para =~/^_# / + para.gsub!(/^_# /,"#{Mx[:fa_o]}:i1#{Mx[:fa_c]} #{letter[letter_small]}. ") #change 2004 + letter_small+=1 + end + end + end + @tuned_file << para + end + @tuned_file=@tuned_file.flatten + end + def name_para_seg_filename(data) + # paragraph name/numbering rules + # manual naming overrides, manual naming may be + # alpha-numeric characters mixed, + # 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) + # [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 + # if the title/heading text starts with a numeric, then that is used (1 3.1 3rd etc.) + # otherwise the level 4 segment number from the embedded document structure info is used + # if there is none a sequential number is designated, preceded by an underscore + @tuned_file=[] + art_filename_auto=1 + @counter=1 + @unique_auto_name=[] + if not @md.seg_autoname_safe and @md.cmd =~/[MV]/ + puts 'manual segment names, numbers used as names, risk warning (segmented html)' + end + data.each do |para| + para=SiSU_document_structure::Structure.new(@md,para).structure_markup + if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}/ + if para=~/^#{Mx[:lv_o]}[4]:#{Mx[:lv_c]}/ \ + and not @md.set_heading_seg + @md.set_heading_seg=true + end + if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}(?:\s*\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name + pattern=$1 + pattern.gsub!(/(?:[:,-]|\W)/,'.') + pattern.gsub!(/\.$/,'') + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(pattern) + para.gsub!(/^#{Mx[:lv_o]}([456]):#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1:#{pattern}#{Mx[:lv_c]}") + @md.seg_names << pattern + else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/ + end + end + if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}.+?;4:(\d+);/m #extract segment name from embedded document structure info + pattern=$1 + pattern.gsub!(/(?:[:,-]|\W)/,'.') + pattern.gsub!(/\.$/,'') + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(pattern) + para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{pattern}#{Mx[:lv_c]}") + @md.seg_names << pattern + else + para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1~#{pattern}#{Mx[:lv_c]}") + @md.seg_names << "~#{pattern}" + end + end + if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}/ #if still not segment name, provide a numerical one + if not @md.seg_names.nil? \ + and not @md.seg_names.include?(art_filename_auto) + para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,%{#{Mx[:lv_o]}\\1~#{art_filename_auto}#{Mx[:lv_c]}}) + @md.seg_names << art_filename_auto + else puts 'segment name (numbering) error' + end + art_filename_auto+=1 + end + end + @tuned_file << if para =~/^#{Mx[:lv_o]}([1-6]):\S*?#{Mx[:lv_c]}/m \ + and (@md.pagenew or @md.pagebreak) + m=$1 #watch ref~ + para_tmp=[] + if @md.pagenew.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page_new]}\n" << para + elsif @md.pagebreak.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page]}\n" << para + end + para_result=unless para_tmp.length > 0; para + else para_tmp + end + else para + end + end + if @md.seg_names.length > 0 + @md.set_heading_seg=true + end + @tuned_file=@tuned_file.flatten + end + def set_heading_top(data) #% make sure no false positives + unless @md.set_heading_top + puts "\tdocument contains no top level heading, (will have to manufacture one)" if @md.cmd =~/[MV]/ + @tuned_file=[] + data.each do |para| + unless @md.set_heading_top + if para !~/^(?:#{Rx[:meta]}|@\S+:|0~\S+)\s/m \ + and para !~/\A\s*\Z/m + @md.set_heading_top=true + head=if @md.title ; "#{Mx[:lv_o]}1:#{Mx[:lv_c]} #{@md.title}" + else "#{Mx[:lv_o]}1:#{Mx[:lv_c]} [no title provided]" + end + @tuned_file << head + end + end + @tuned_file << para + end + @tuned_file=@tuned_file.flatten + end + end + def set_heading_seg(data) #% make sure no false positives + unless @md.set_heading_seg + puts "\tdocument contains no segment level, (will have to manufacture one)" if @md.cmd =~/[MV]/ + @tuned_file=[] + data.each do |para| + unless @md.set_heading_seg + if para !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[123]:\S*?#{Mx[:lv_c]})/m \ + and para !~/\A\s*\Z/m \ + and para !~/#{Mx[:br_page]}|#{Mx[:br_page_new]}/ + @md.set_heading_seg=true + head=if @md.title ; "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [#{@md.title}]" + else "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [segment]" + end + @tuned_file << head + end + end + @tuned_file << para + end + @tuned_file=@tuned_file.flatten + end + end + def set_header_title(data) #% make sure no false positives + unless @md.set_header_title + puts "\t no document title provided, (will have to manufacture one)" if @md.cmd =~/[MV]/ + @tuned_file=[] + data.each do |para| + unless @md.set_header_title + if para !~/^%{1,2}\s/m \ + and para !~/\A\s*\Z/m + @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}" + @md.title=@md.heading_seg_first + @md.set_header_title=true + end + end + @tuned_file << para + end + @tuned_file=@tuned_file.flatten + end + end + end +end +__END__ diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index acdec0e4..80635f36 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -326,7 +326,7 @@ module SiSU_Syntax line.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>|\d+)\^(\S+?)\^/,"\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript single word, watch digit added line.gsub!(/<[:e]\s+(.+?)!?>/,"#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested line.gsub!(/^\s*_\*\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut - #line.gsub!(/^\s*_(\*+)\s*/,"#{Mx[:gl_bullet]}") #bullets, shortcut + line.gsub!(/=\{(.+?)\}/,"#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") # line.gsub!(/^\s*_([1-9])\*\s*/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut #line.gsub!(/^\s*_([1-9])(\*+)\s*/,"#{Mx[:fa_o]}:i\\1#{Mx[:fa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut line.gsub!(/^\s*_([1-9])\s+/,"#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index b211f5c1..7994487d 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -119,13 +119,13 @@ module SiSU_Param @doc={ :lv=>[] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag + attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis,:ec,:opt,:sem_tag,:book_index def initialize(fns_array,opt) @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil @man_section=1 @man_name='man page "name/whatis" information not provided, set in header @man: name=[whatis information]' @data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data - @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo=false,false,false,false,false,false + @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_index=false,false,false,false,false,false,false @seg_autoname_safe=true @sem_tag=false @markup_instruction,@markup_declared,@image='','','' #check which other values should be set to empty rather than nil @@ -576,6 +576,9 @@ module SiSU_Param end end end + if not @book_index and para =~/^=\{(.+?)\}\s*$/ + @book_index=true + end unless @code_flag case para when /~\{\s+.+?\}~/m #% processing diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index 4dd808fc..fb4b1115 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -321,7 +321,7 @@ WOK para.gsub!(/(^|#{Mx[:gl_c]}|\s)[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') para.gsub!(/
    (.+?)<\/a>/m,'\1') para.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links - para.gsub!(/ /,' ') # decide on + para.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') #para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') -- cgit v1.2.3 From 798d710dea23806e428ec7636dad4c1d872166e3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Sep 2008 22:24:15 -0400 Subject: dal, several modules split into separate files --- CHANGELOG | 4 +- lib/sisu/v0/dal.rb | 608 +----------------------- lib/sisu/v0/dal_character_check.rb | 112 +++++ lib/sisu/v0/dal_doc_str.rb | 4 +- lib/sisu/v0/dal_endnotes.rb | 132 +++++ lib/sisu/v0/dal_expand_insertions.rb | 155 ++++++ lib/sisu/v0/dal_hash_digest.rb | 176 +++++++ lib/sisu/v0/dal_idx.rb | 8 +- lib/sisu/v0/dal_images.rb | 125 +++++ lib/sisu/v0/dal_metadata.rb | 228 +++++++++ lib/sisu/v0/dal_numbering.rb | 10 +- lib/sisu/v0/dal_substitutions_and_insertions.rb | 131 +++++ 12 files changed, 1098 insertions(+), 595 deletions(-) create mode 100644 lib/sisu/v0/dal_character_check.rb create mode 100644 lib/sisu/v0/dal_endnotes.rb create mode 100644 lib/sisu/v0/dal_expand_insertions.rb create mode 100644 lib/sisu/v0/dal_hash_digest.rb create mode 100644 lib/sisu/v0/dal_images.rb create mode 100644 lib/sisu/v0/dal_metadata.rb create mode 100644 lib/sisu/v0/dal_substitutions_and_insertions.rb diff --git a/CHANGELOG b/CHANGELOG index 936acd5a..4964ab06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,7 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-09-07:35/7) +%% sisu_0.69.0.orig.tar.gz (2008-09-08:36/1) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc @@ -47,7 +47,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * internal, greater use of passing of hash to formatting modules - * dal, numbering moved to separate module + * dal, several modules split into separate files %% sisu_0.68.0.orig.tar.gz (2008-07-22:29/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.68.0.orig.tar.gz diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index aa4758b7..d091284d 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -60,15 +60,22 @@ =end module SiSU_DAL - require "#{SiSU_lib}/defaults" - require "#{SiSU_lib}/sysenv" - require "#{SiSU_lib}/param" - require "#{SiSU_lib}/dal_syntax" - require "#{SiSU_lib}/dal_doc_str" - require "#{SiSU_lib}/dal_idx" - require "#{SiSU_lib}/dal_numbering" - require "#{SiSU_lib}/i18n" - require "#{SiSU_lib}/shared_sem" + require "#{SiSU_lib}/defaults" # defaults.rb + require "#{SiSU_lib}/sysenv" # sysenv.rb + require "#{SiSU_lib}/param" # param.rb + require "#{SiSU_lib}/dal_syntax" # dal_syntax.rb + require "#{SiSU_lib}/dal_doc_str" # dal_doc_str.rb + require "#{SiSU_lib}/dal_idx" # dal_idx.rb + require "#{SiSU_lib}/dal_numbering" # dal_numbering.rb + require "#{SiSU_lib}/dal_hash_digest" # dal_hash_digest.rb + require "#{SiSU_lib}/dal_endnotes" # dal_endnotes.rb + require "#{SiSU_lib}/dal_images" # dal_images.rb + require "#{SiSU_lib}/dal_metadata" # dal_metadata.rb + require "#{SiSU_lib}/dal_character_check" # dal_character_check.rb + require "#{SiSU_lib}/dal_substitutions_and_insertions" # dal_substitutions_and_insertions.rb + require "#{SiSU_lib}/dal_expand_insertions" # dal_expand_insertions.rb + require "#{SiSU_lib}/i18n" # i18n.rb + require "#{SiSU_lib}/shared_sem" # shared_sem.rb include SiSU_Env include SiSU_Param include SiSU_Viz @@ -76,9 +83,6 @@ module SiSU_DAL class Instantiate < SiSU_Param::Parameters::Instructions def initialize @@flag_vocab=0 - @@endnote={} - @@endnote_array=@@word_mode=[] - @@endnote_counter,@@endnote_counter_asterisk,@@endnote_counter_dag=1,1,1 #added @@line_mode='' end end @@ -171,26 +175,17 @@ module SiSU_DAL end end class Make - @@endnote={} - @@endnote_array=@@word_mode=[] - @@endnote_counter,@@endnote_counter_asterisk,@@endnote_counter_dag=1,1,1 - @@comment='%' + #@@comment='%' @@dp=nil def initialize(md,data) @md,@data=md,data - @@word_mode=[] + #@@word_mode=[] @env=SiSU_Env::Info_env.new(@md.fns) @skin=SiSU_Env::Info_skin.new(@md) @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern - l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns) - @language=l[:l] - @tr=SiSU_Translate::Source.new(@md,@language) end def reset @@flag_vocab=0 - @@endnote={} - @@endnote_array=@@word_mode=[] - @@endnote_counter,@@endnote_counter_asterisk,@@endnote_counter_dag=1,1,1 @@line_mode='' end def song @@ -199,9 +194,9 @@ module SiSU_DAL @metafile="#{@env.path.dal}/#{@md.fns}.meta" my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) data=data.join.split("\n\n") - data=expand_insertions?(data) + data=SiSU_insertions::Insertions.new(data).expand_insertions? data=SiSU_document_structure::Code.new(@md,data).code - data=substitutions_and_insertions?(data) + data=SiSU_substitute_and_insert::SI.new(@md,data).substitutions_and_insertions? data_new=[] data.each do |x| data_new << if x =~ /\n\n/m; x.split(/\n\n+/) @@ -210,14 +205,15 @@ module SiSU_DAL end data=data_new.flatten data=SiSU_Syntax::Markup.new(@md,data).songsheet - data=character_check(data) - data=images(data) + data,endnote_array=SiSU_character_check::Check.new(data).character_check_and_oldstyle_endnote_array + data=SiSU_images::Images.new(@md,data).images data=SiSU_document_structure::Tables.new(@md,data).tables data=SiSU_numbering::Numbering.new(@md,data).numbering_song data=SiSU_book_index::Book_index.new(data).indexing_song if @md.book_index - data=endnotes(data) - data=object_digest(data) - meta=metadata(data) + data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes + data=SiSU_hash::Object_digest.new(@md,data,@env).object_digest + meta=SiSU_metadata::Metadata.new(@md,data).metadata + #meta=metadata(data) outputdata=data + meta if @md.cmd =~/[mM]/ SiSU_DAL::Output.new(@md,outputdata).hard_output @@ -227,100 +223,6 @@ module SiSU_DAL outputdata end protected - def character_check(data) - require 'iconv' - reset - @tuned_file=[] - endnote_no=1 - data.each do |para| - para.strip! - para.gsub!(/^([12])~\?\s+/,'\1~ ') #conditional header for incorporated document 2004w12 - para.gsub!(/^[{~}]\s*$/,'') - para.gsub!(/^#{@@comment}.*/,'') #remove comment and divider #% - para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}") - para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}") - #para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL - para.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ') - para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29 - para.gsub!(/
    /,"#{Mx[:br_line]}") #needed by xml, xhtml etc. - para.gsub!(/\t/,' ') - para.gsub!(/\342\200\231/u,"'") #if para =~/’/ #Avoid #‘ ’ #“ ” - para.gsub!(/�/u,' ') #watch, replace with char code - para.gsub!(/·/u,'*') - para.gsub!(/\\copy(?:right)?\b/,'©') - para.gsub!(/\\trademark\b|\\tm\b/,'®') - #non_utf8(para) - para=para + "\n" - unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ - case para - when /\^~/ # endnotes - #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ - sub_para=para.dup - @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip - endnote_no+=1 - para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion - end - end - @tuned_file << para unless para.nil? - end - @tuned_file=@tuned_file.flatten - end - def images(data) - tuned_file=[] - @rmgk=false - if SiSU_Env::Info_settings.new.program?('rmagick'); @rmgk=SiSU_Env::Load.new('RMagick').prog - else tell=SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml') - tell.warn if @md.cmd =~/[vVM]/ - end - data.each do |para| - para.strip! - if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ - if para !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/ - m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/ - if @rmgk - imgs=para.scan(m).flatten - images=imgs.each do |image| - dir=SiSU_Env::Info_env.new(@md.fns) - path_image=[dir.path.image_source_local_tex,dir.path.image_source_remote_tex,dir.path.image_source_tex] - image_path=nil - path_image.each do |image_path| - break if FileTest.exist?("#{image_path}/#{image}") - end - if FileTest.exist?("#{image_path}/#{image}") - img=Magick::ImageList.new("#{image_path}/#{image}") - img_col,img_row=img.columns,img.rows - if img_col > img_row #landscape - if img_col> 640 #480 - img_col=640 #480 - img_row=((1.00*img_col/img.columns)*img.rows).round - end - else #portrait - if img_col> 640 #480 - img_col=640 #480 - img_row=((1.00*img_col/img.columns)*img.rows).round - end - if img_row > 640 - img_row=640 - img_col=((1.00*img_row/img.rows)*img.columns).round - end - end - para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}") - else para.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]') - end - end - else - images=para.scan(m) do |image| - tell=SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick is required',image) - tell.warn #unless @opt.cmd =~/q/ - end - end - end - end - para.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ - tuned_file << para unless para.nil? - end - tuned_file - end def output_filetypes_in_cmd(cmd_shortcut,source=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used cf_defaults=SiSU_Env::Info_processing_flag.new @@ -366,464 +268,6 @@ module SiSU_DAL file_type_names[:src]=file_type_names[:src].flatten file_type_names end - def expand_insertions?(data) - tuned_file,tuned_file_tmp=[],[] - data.each do |para| - if para !~/^%+\s/ \ - and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ - txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil - @u=SiSU_Env::Info_env.new.url - if defined? @u.remote - if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m - pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6 - elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/ - pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5 - end - manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n" - else - puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" - if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ - txt,cmd,url_dir,note=$1,$2,$3,$4 - manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n" - end - end - tuned_file_tmp << manifest - output_filetypes=output_filetypes_in_cmd(cmd,source) - output_filetypes[:gen].each do |o_f| - describe = case o_f - when /sisu_manifest.html/; '~^ document manifest' - when /toc.html/; ' html, segmented text' - when /doc.html/; ' html, scroll, document in one' - when /landscape.pdf/; ' pdf, landscape' - when /portrait.pdf/; ' pdf, portrait' - when /opendocument.odt/; ' odf:odt, open document text' - when /scroll.xhtml/; ' xhtml scroll' - when /sax.xml/; ' xml, sax' - when /dom.xml/; ' xml, dom' - when /plain.txt/; ' plain text utf-8' - #when /manpage.1/; ' man, 1' - when /wiki.txt/; ' wiki text' - when /concordance.html/; ' concordance' - when /digest.txt/; ' dcc, document content certificate (digests)' - else nil - end - if describe - tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry - if describe =~/^~\^ / - "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} " - else - "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} " - end - else - if describe =~/^~\^ / - "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} " - else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} " - end - end - end - end - output_filetypes[:src].each do |o_f| - describe=case o_f - when /#{source}\.zip/; ' markup source (zipped) pod' - when /#{source}/; ' markup source text' - else nil - end - if describe - tuned_file_tmp << if @u.remote - x=if describe =~/zip/ - "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} " - else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} " - end - else - x=if describe =~/zip/ - "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} " - else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} " - end - end - end - end - tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group' - #tuned_file << 'group{' << tuned_file_tmp.join("\n").strip << '}group' - tuned_file_tmp=[] - else tuned_file << para - end - end - tuned_file - end - def substitutions_and_insertions?(data) - data_expand=[] - if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it) - data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') - data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') - end - if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier - data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1') - data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1') - end - data.each do |para| - if para =~/<:insert\d+!?>/ \ - and para !~/^%\s+/ - @skin.select - ins=SiSU_Viz::Inserts.new - case para - when /^\s*<:insert1>\s*$/ - para=[] - ins.insert1.split(/\n\n/).each{|x| para << x } - when /^\s*<:insert2>\s*$/ - para=[] - ins.insert2.split(/\n\n/).each{|x| para << x } - when /^\s*<:insert3>\s*$/ - para=[] - ins.insert3.split(/\n\n/).each{|x| para << x << "\n"} - para=ins.insert3 - when /^\s*<:insert4>\s*$/ - para=[] - ins.insert4.split(/\n\n/).each{|x| para << x << "\n"} - para=ins.insert4 - when /^\s*<:insert5>\s*$/ - para=[] - ins.insert5.split(/\n\n/).each{|x| para << x << "\n"} - when /^\s*<:insert6>\s*$/ - para=[] - ins.insert6.split(/\n\n/).each{|x| para << x << "\n"} - when /^\s*<:insert7>\s*$/ - para=[] - ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} - end - para.each{|x| data_expand << x } - else data_expand << para - end - data_expand.flatten! - data_expand.compact! - end - data_expand.each do |para| - para=if @md.markup_version.to_f >= 0.38 - SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize - else - SiSU_document_structure::Structure.new(@md,para).structure_marks - end - #para.gsub!(//,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate? - para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 - if para =~/^@\S+?:/ - para.gsub!(/^@(\S+?):\s+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}") - para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}") - end - end - end - def endnotes(data) - @tuned_file=[] - endnote_no,endnote_ref=1,1 - #% endnote work zone - data.each do |para| - # manually numbered endnotes --> - if @md.mod.inspect =~/--no-asterisk|--no-annotate/ - para.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') - end - if @md.mod.inspect =~/--no-dagger|--no-annotate/ - para.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') - end - unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ - case para - # auto-numbered endnotes --> - when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ - para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 - word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) - word_mode=endnote_call_number(word_mode) - para=word_mode.join(' ') - endnote_ref+=1 - when /~\^(?:\s|$)|<:e>/ - #%Note inserts endnotes previously gathered from /^(|[-~]\{{3})/ (in earlier loop) - word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) - word_mode=endnote_call_number(word_mode) - para=word_mode.join(' ') - endnote_ref+=1 - end - end - @tuned_file << para - end - @tuned_file=@tuned_file.flatten - end - def endnote_call_number(data) - data.each do |word| - unless data =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ - case word - when /#{Mx[:en_a_o]}/ - unless word =~/#{Mx[:en_a_o]}[*+]+/ - word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter} ") - @@endnote_counter+=1 - end - when /#{Mx[:en_b_o]}/ - if word =~/#{Mx[:en_b_o]}[+]/ - word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag} ") - @@endnote_counter_dag+=1 - else - word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk} ") - @@endnote_counter_asterisk+=1 - end - when /~\^|<:e>/ - word.gsub!(/~\^|<:e>/,"#{@@endnote_array[@@endnote_counter-1]}") - @@endnote_counter+=1 - end - end - end - end - def metadata(data) - meta,@dc,@rc,@cvs,dctitle,add=Array.new(6){[]} - dir=SiSU_Env::Info_env.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" - ocnm=ocnd=ocnv=0 - ocnm+=1 - header1="\n#{Mx[:lv_o_1]}meta#{Mx[:lv_c]}Document Information (metadata) #{Mx[:id_o]}~0;0:0;m#{ocnm}#{Mx[:id_c]}" - ocnm+=1 - header4="\n#{Mx[:lv_o_4]}metadata#{Mx[:lv_c]}Metadata #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}" - ocnm+=1; ocnd+=1 - head_no_dc="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - ocnm+=1; ocnd+=1 - head_no_dc_tag="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - data.each do |para| - case para - when /^#{Mx[:meta_o]}(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)#{Mx[:meta_c]}/i - m=$1 - ocnm+=1; ocnd+=1 - @dc << case para - when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/ - "\n#{@tr.dc_title}: #{Mx[:fa_underscore_o]}#{@md.dc_title}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}(?:creator|author)#{Mx[:meta_c]}/ - "\n#{@tr.creator}: #{Mx[:fa_underscore_o]}#{@md.dc_creator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /#{Mx[:meta_o]}(?:translator|translated_by)#{Mx[:meta_c]}/ - "\n#{@tr.translator}: #{Mx[:fa_underscore_o]}#{@md.translator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}(?:illustrator|illustrated_by)#{Mx[:meta_c]}/ - "\n#{@tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.illustrator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}prepared_by#{Mx[:meta_c]}/ - "\n#{@tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.prepared_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}digitized_by#{Mx[:meta_c]}/ - "\n#{@tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.digitized_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}description#{Mx[:meta_c]}/ - "\n#{@tr.description}: #{Mx[:fa_underscore_o]}#{@md.dc_description}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}subject#{Mx[:meta_c]}/ - "\n#{@tr.subject}: #{Mx[:fa_underscore_o]}#{@md.dc_subject}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}abstract#{Mx[:meta_c]}/ - "\n#{@tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.dc_abstract}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}publisher#{Mx[:meta_c]}/ - "\n#{@tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.dc_publisher}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}contributor#{Mx[:meta_c]}/ - "\n#{@tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.dc_contributor}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}date.created#{Mx[:meta_c]}/ - "\n#{@tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.dc_date_created}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}date.issued#{Mx[:meta_c]}/ - "\n#{@tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.dc_date_issued}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}date.available#{Mx[:meta_c]}/ - "\n#{@tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.dc_date_available}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}date.modified#{Mx[:meta_c]}/ - "\n#{@tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.dc_date_modified}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}date.valid#{Mx[:meta_c]}/ - "\n#{@tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.dc_date_valid}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}date#{Mx[:meta_c]}/ - "\n#{@tr.date}: #{Mx[:fa_underscore_o]}#{@md.dc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}type#{Mx[:meta_c]}/ - "\n#{@tr.type}: #{Mx[:fa_underscore_o]}#{@md.dc_type}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}format#{Mx[:meta_c]}/ - "\n#{@tr.format}: #{Mx[:fa_underscore_o]}#{@md.dc_format}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}rights#{Mx[:meta_c]}/ - "\n#{@tr.rights}: #{Mx[:fa_underscore_o]}#{@md.dc_rights}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}identifier#{Mx[:meta_c]}/ - "\n#{@tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.dc_identifier}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}source#{Mx[:meta_c]}/ - "\n#{@tr.source}: #{Mx[:fa_underscore_o]}#{@md.dc_source}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}language#{Mx[:meta_c]}/ - "\n#{@tr.language}: #{Mx[:fa_underscore_o]}#{@md.dc_language}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}language.original#{Mx[:meta_c]}/ - "\n#{@tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.language_original}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}relation#{Mx[:meta_c]}/ - "\n#{@tr.relation}: #{Mx[:fa_underscore_o]}#{@md.dc_relation}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}coverage#{Mx[:meta_c]}/ - "\n#{@tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.dc_coverage}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}keywords#{Mx[:meta_c]}/ - "\n#{@tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.keywords}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}comments#{Mx[:meta_c]}/ - "\n#{@tr.comments}: #{Mx[:fa_underscore_o]}#{@md.comments}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}cls_loc#{Mx[:meta_c]}/ - "\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}cls_dewey#{Mx[:meta_c]}/ - "\n#{@tr.cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}(?:cls_gutenberg|cls_pg)#{Mx[:meta_c]}/ - "\n#{@tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.cls_gutenberg}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - #"\n#{@tr.cls_gutenberg}: #{@md.cls_pg} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}cls_isbn#{Mx[:meta_c]}/ - "\n#{@tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.cls_isbn}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}prefix(?:_a)?#{Mx[:meta_c]}/ - "\n#{@tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.prefix_a}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - when /^#{Mx[:meta_o]}prefix_b#{Mx[:meta_c]}/ - "\n#{@tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.prefix_b}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" - else para.gsub(/^#{Mx[:meta_o]}(#{m})\s+(.+)/m,"\n#{m.capitalize}: #{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}") - end - end - end - ocnm+=1; ocnv+=1 - head_no_rc="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - head_no_rc_tag="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - data.each do |para| - case para - when /^0~(?:cvs|rcs)\+\s+/ #note the + sign to turn on use of cvs id - ocnm+=1; ocnv+=1 - @cvs << "#{@tr.sc_number}: #{Mx[:fa_underscore_o]}#{@md.sc_number}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - @cvs << "#{@tr.sc_date}: #{Mx[:fa_underscore_o]}#{@md.sc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - @cvs << "CVS/RCS time: #{Mx[:fa_underscore_o]}#{@md.sc_time}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - when /^0~cvs[+\s]/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP - when /^0~cvs\s+/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP - end - end - if true #default version information - ocnm+=1; ocnv+=1 - if @md.sc_filename \ - and @md.sc_filename.length > 3 - @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.sc_filename}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - else @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - end - ocnm+=1; ocnv+=1 - if @md.file_encoding \ - and @md.file_encoding.length > 3 #translate - @rc << "Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - end - ocnm+=1; ocnv+=1 - if @md.dgst #change. enable by default - @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - end - if @md.dgst_skin #change. enable by default - @rc << "Skin_Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - end - @rc << "#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0 - @rc << "#{@tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - if @md.sisu_version[:version] - @rc << "#{@tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]}) #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - ocnm+=1; ocnv+=1 - end - @rc << "#{@tr.ruby_version}: #{Mx[:fa_underscore_o]} #{@md.ruby_version}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" - end - meta << Mx[:br_page_new] << header1 << header4 - meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}" - meta << "#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC) #{head_no_dc}" if @dc.length > 0 - meta << "#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]} #{head_no_dc_tag}" if @dc.length > 0 - @dc.each { |x| meta << x } - meta << "#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0 - if @cvs.length > 0 - meta << "#{Mx[:fa_italics_o]}Note the version information provided here, is specific to the host site.#{Mx[:fa_italics_c]} #{head_no_rc_tag}" - @cvs.each { |x| meta << x } - end - @rc.each { |x| meta << x } - ## ENDNOTE RELATED endnote related - meta << "\n#{Mx[:br_eof]}" - meta=object_digest(meta) - end - def stamped(para,hash_class) - @tuned=[] - para=strip_clean_extra_spaces(para) - digest_all=hash_class.hexdigest(para) # print "#{hash_class.name}: "; puts digest_all #length==32 or 64 - stripped=strip_clean_of_markup(para) - digest_strip=hash_class.hexdigest(stripped) - unless para =~/#{Mx[:fa_o]}code#{Mx[:fa_c]}/ - case para - when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m - en_and_para,en_and_para_digest=[],[] - para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch - para_plus_en=para.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) - para_tail=if para =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m - /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.*?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1] - else '' - end - para_plus_en << para_tail - en_and_para_digest << endnote_digest(para_plus_en) - para_new=en_and_para_digest.join(' ') - @tuned << para_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? - else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? - end - else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? - end - @tuned.join - end - def object_digest(data) - # 1. clean/stripped text without any markup, paragraph, headings etc. without endnotes - # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph) - # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?]) - # [digests should not include other digests] - # vim==/<[0-9a-f]\{#{@@dl}\}\(:[0-9a-f]\{#{@@dl}\}\)\?>/ - require 'digest/md5' - require 'digest/sha2' - @tuned_file=[] - data.compact! - data.each do |para| - para.strip! - if para=~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ \ - and para !~/#{Rx[:meta]}/ #test should not be necessary remove - if @env.digest.type =~/sha256/ - for hash_class in [ Digest::SHA256 ] - @tuned_file << stamped(para,hash_class) - end - else - for hash_class in [ Digest::MD5 ] - @tuned_file << stamped(para,hash_class) - end - end - else @tuned_file << para unless para.nil? - end - end - @tuned_file=@tuned_file.flatten - #use md5 or to create hash of each dal object including ocn, & add into to each dal object - end - def endnote_digest(data) - para_bit=[] - data.each do |en_plus| - para_bit <<= case en_plus - when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ - if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/ - para_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4] - stripped_en=strip_clean_of_markup(en_txt) - digest_en_strip=if @env.digest.type =~/sha256/ - Digest::SHA256.hexdigest(stripped_en) - else - Digest::MD5.hexdigest(stripped_en) - end - para_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close - else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up - end - else en_plus - end - end - para_bit.join - end - def strip_clean_extra_spaces(s) # dal output tuned - s=s.dup - s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ - s=s.gsub(/ [ ]+/,' ') - s=s.gsub(/^ [ ]+/,'') - s=s.gsub(/ [ ]+$/,'') - s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') - s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') - end - def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean - #consider: <\/?[ib]>|<(?:\/ )?br>|(.+?)<\/del> - s=s.dup - s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^#{Mx[:lv_o]}[1-6]:\S+?#{Mx[:lv_c]}|#{Mx[:en_a_o]}\d+\s.+?#{Mx[:en_a_c]})/m,'') # markup and endnotes removed - #% same as db clean --> - s=s.gsub(/(.+?)<\/del>/,'DELETED(\1)') # deletions - s=s.gsub(/(\d+)<\/sup>/,'[\1]') - s=s.gsub(/(?:#{Mx[:nbsp]})+/,' ') - #s=s.gsub(//,"[TABLE]\n") # tables - #s=s.gsub(//,'\1') # tables - #s=s.gsub(/¡¡\d+¡/,' ') # tables - #s=s.gsub(/¡/,' ') # tables tidy later - #s=s.gsub(/<.+?>/,'') - s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search - s=s.gsub(/\s\s+/,' ') - s=s.strip - end end end __END__ diff --git a/lib/sisu/v0/dal_character_check.rb b/lib/sisu/v0/dal_character_check.rb new file mode 100644 index 00000000..8cee0a13 --- /dev/null +++ b/lib/sisu/v0/dal_character_check.rb @@ -0,0 +1,112 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end + +module SiSU_character_check + class Check + def initialize(data) + @data=data + @comment='%' + @endnote_array=[] + end + def character_check_and_oldstyle_endnote_array + require 'iconv' + data=@data + #reset + @tuned_file,@endnote_array=[],[] + endnote_no=1 + data.each do |para| + para.strip! + para.gsub!(/^([12])~\?\s+/,'\1~ ') #conditional header for incorporated document 2004w12 + para.gsub!(/^[{~}]\s*$/,'') + para.gsub!(/^#{@comment}.*/,'') #remove comment and divider #% + para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}") + para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}") + #para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL + para.gsub!(/(#{Mx[:en_a_o]})\s*\s+/,'\1 '); para.gsub!(/(~\{\s*)\s+/,'\1 ') + para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29 + para.gsub!(/
    /,"#{Mx[:br_line]}") #needed by xml, xhtml etc. + para.gsub!(/\t/,' ') + para.gsub!(/\342\200\231/u,"'") #if para =~/’/ #Avoid #‘ ’ #“ ” + para.gsub!(/�/u,' ') #watch, replace with char code + para.gsub!(/·/u,'*') + para.gsub!(/\\copy(?:right)?\b/,'©') + para.gsub!(/\\trademark\b|\\tm\b/,'®') + #non_utf8(para) + para=para + "\n" + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ + case para + when /\^~/ # endnotes + #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ + sub_para=para.dup + @endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/,%{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip + endnote_no+=1 + para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion + end + end + @tuned_file << para unless para.nil? + end + @tuned_file=@tuned_file.flatten + [@tuned_file,@endnote_array] + end + end +end +__END__ diff --git a/lib/sisu/v0/dal_doc_str.rb b/lib/sisu/v0/dal_doc_str.rb index d34bf01e..ac7e2b49 100644 --- a/lib/sisu/v0/dal_doc_str.rb +++ b/lib/sisu/v0/dal_doc_str.rb @@ -59,8 +59,8 @@ =end module SiSU_document_structure - require "#{SiSU_lib}/dal_doc_str_tables" - require "#{SiSU_lib}/dal_doc_str_code" + require "#{SiSU_lib}/dal_doc_str_tables" # dal_doc_str_tables.rb + require "#{SiSU_lib}/dal_doc_str_code" # dal_doc_str_code.rb class Structure def initialize(md,para) @md,@para=md,para diff --git a/lib/sisu/v0/dal_endnotes.rb b/lib/sisu/v0/dal_endnotes.rb new file mode 100644 index 00000000..47f872ec --- /dev/null +++ b/lib/sisu/v0/dal_endnotes.rb @@ -0,0 +1,132 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_endnotes + class Endnotes + def initialize(md,data,endnote_array=nil) + @md,@data,@endnote_array=md,data,endnote_array + @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + end + def endnotes + data=@data + @tuned_file=[] + endnote_no,endnote_ref=1,1 + #% endnote work zone + data.each do |para| + # manually numbered endnotes --> + if @md.mod.inspect =~/--no-asterisk|--no-annotate/ + para.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'') + end + if @md.mod.inspect =~/--no-dagger|--no-annotate/ + para.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') + end + unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ + case para + # auto-numbered endnotes --> + when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ + para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 + word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) + word_mode=endnote_call_number(word_mode) + para=word_mode.join(' ') + endnote_ref+=1 + when /~\^(?:\s|$)|<:e>/ + #%Note inserts endnotes previously gathered from /^(|[-~]\{{3})/ (in earlier loop) + word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m) + word_mode=endnote_call_number(word_mode) + para=word_mode.join(' ') + endnote_ref+=1 + end + end + @tuned_file << para + end + @endnote_counter,@endnote_counter_asterisk,@endnote_counter_dag=1,1,1 + @tuned_file=@tuned_file.flatten + end + def endnote_call_number(data) + data.each do |word| + unless data =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/ + case word + when /#{Mx[:en_a_o]}/ + unless word =~/#{Mx[:en_a_o]}[*+]+/ + word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@endnote_counter} ") + @endnote_counter+=1 + end + when /#{Mx[:en_b_o]}/ + if word =~/#{Mx[:en_b_o]}[+]/ + word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@endnote_counter_dag} ") + @endnote_counter_dag+=1 + else + word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ") + @endnote_counter_asterisk+=1 + end + when /~\^|<:e>/ + if @endnote_array + word.gsub!(/~\^|<:e>/,"#{@endnote_array[@endnote_counter-1]}") + @endnote_counter+=1 + end + end + end + end + end + end +end +__END__ + diff --git a/lib/sisu/v0/dal_expand_insertions.rb b/lib/sisu/v0/dal_expand_insertions.rb new file mode 100644 index 00000000..1ab0c03b --- /dev/null +++ b/lib/sisu/v0/dal_expand_insertions.rb @@ -0,0 +1,155 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_insertions + class Insertions + def initialize(data) + @data=data + end + def expand_insertions? + data=@data + tuned_file,tuned_file_tmp=[],[] + data.each do |para| + if para !~/^%+\s/ \ + and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ + txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil + @u=SiSU_Env::Info_env.new.url + if defined? @u.remote + if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m + pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6 + elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/ + pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5 + end + manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n" + else + puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" + if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ + txt,cmd,url_dir,note=$1,$2,$3,$4 + manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n" + end + end + tuned_file_tmp << manifest + output_filetypes=output_filetypes_in_cmd(cmd,source) + output_filetypes[:gen].each do |o_f| + describe = case o_f + when /sisu_manifest.html/; '~^ document manifest' + when /toc.html/; ' html, segmented text' + when /doc.html/; ' html, scroll, document in one' + when /landscape.pdf/; ' pdf, landscape' + when /portrait.pdf/; ' pdf, portrait' + when /opendocument.odt/; ' odf:odt, open document text' + when /scroll.xhtml/; ' xhtml scroll' + when /sax.xml/; ' xml, sax' + when /dom.xml/; ' xml, dom' + when /plain.txt/; ' plain text utf-8' + #when /manpage.1/; ' man, 1' + when /wiki.txt/; ' wiki text' + when /concordance.html/; ' concordance' + when /digest.txt/; ' dcc, document content certificate (digests)' + else nil + end + if describe + tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry + if describe =~/^~\^ / + "#{Mx[:nbsp]*4} {#{describe} }#{@u.remote}/#{url_dir}/#{o_f} " + else + "#{Mx[:nbsp]*4} { #{describe} }#{@u.remote}/#{url_dir}/#{o_f} " + end + else + if describe =~/^~\^ / + "#{Mx[:nbsp]*4} {#{describe} }../#{url_dir}/#{o_f} " + else "#{Mx[:nbsp]*4} { #{describe} }../#{url_dir}/#{o_f} " + end + end + end + end + output_filetypes[:src].each do |o_f| + describe=case o_f + when /#{source}\.zip/; ' markup source (zipped) pod' + when /#{source}/; ' markup source text' + else nil + end + if describe + tuned_file_tmp << if @u.remote + x=if describe =~/zip/ + "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_pod}/#{o_f} " + else "#{Mx[:nbsp]*4} {#{describe} }#{@u.src_txt}/#{o_f} " + end + else + x=if describe =~/zip/ + "#{Mx[:nbsp]*4} { #{describe} }../pod/#{o_f} " + else "#{Mx[:nbsp]*4} { #{describe} }../zip/#{o_f} " + end + end + end + end + tuned_file << 'group{' << tuned_file_tmp.join("\n") << '}group' + #tuned_file << 'group{' << tuned_file_tmp.join("\n").strip << '}group' + tuned_file_tmp=[] + else tuned_file << para + end + end + tuned_file + end + end +end +__END__ + diff --git a/lib/sisu/v0/dal_hash_digest.rb b/lib/sisu/v0/dal_hash_digest.rb new file mode 100644 index 00000000..7588bd47 --- /dev/null +++ b/lib/sisu/v0/dal_hash_digest.rb @@ -0,0 +1,176 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end + +module SiSU_hash + class Object_digest + def initialize(md,data,env=nil) + @md,@data,@env=md,data,env + @env ||=SiSU_Env::Info_env.new(@md.fns) + end + def object_digest + # 1. clean/stripped text without any markup, paragraph, headings etc. without endnotes + # 2. endnotes clean/stripped text digest only (there may be several endnotes within a paragraph) + # 3. whole object, text with markup and any endnotes, (question: with or without the endnote digests??? presumption better without, [however may be easier to check with?]) + # [digests should not include other digests] + # vim==/<[0-9a-f]\{#{@@dl}\}\(:[0-9a-f]\{#{@@dl}\}\)\?>/ + require 'digest/md5' + require 'digest/sha2' + data=@data + @tuned_file=[] + data.compact! + data.each do |para| + para.strip! + if para=~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ \ + and para !~/#{Rx[:meta]}/ #test should not be necessary remove + if @env.digest.type =~/sha256/ + for hash_class in [ Digest::SHA256 ] + @tuned_file << stamped(para,hash_class) + end + else + for hash_class in [ Digest::MD5 ] + @tuned_file << stamped(para,hash_class) + end + end + else @tuned_file << para unless para.nil? + end + end + @tuned_file=@tuned_file.flatten + #use md5 or to create hash of each dal object including ocn, & add into to each dal object + end + def endnote_digest(data) + para_bit=[] + data.each do |en_plus| + para_bit <<= case en_plus + when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ + if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/ + para_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4] + stripped_en=strip_clean_of_markup(en_txt) + digest_en_strip=if @env.digest.type =~/sha256/ + Digest::SHA256.hexdigest(stripped_en) + else + Digest::MD5.hexdigest(stripped_en) + end + para_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close + else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up + end + else en_plus + end + end + para_bit.join + end + def stamped(para,hash_class) + @tuned=[] + para=strip_clean_extra_spaces(para) + digest_all=hash_class.hexdigest(para) # print "#{hash_class.name}: "; puts digest_all #length==32 or 64 + stripped=strip_clean_of_markup(para) + digest_strip=hash_class.hexdigest(stripped) + unless para =~/#{Mx[:fa_o]}code#{Mx[:fa_c]}/ + case para + when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m + en_and_para,en_and_para_digest=[],[] + para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch + para_plus_en=para.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m) + para_tail=if para =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m + /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.*?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1] + #/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1] + else '' + end + para_plus_en << para_tail + en_and_para_digest << endnote_digest(para_plus_en) + para_new=en_and_para_digest.join(' ') + @tuned << para_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? + else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? + end + else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil? + end + @tuned.join + end + def strip_clean_extra_spaces(s) # dal output tuned + s=s.dup + s=s.gsub(/[ ]+([,.;:?](?:$|\s))/,'\1') unless s =~/#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/ + s=s.gsub(/ [ ]+/,' ') + s=s.gsub(/^ [ ]+/,'') + s=s.gsub(/ [ ]+$/,'') + s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') + s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2') + end + def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean + #consider: <\/?[ib]>|<(?:\/ )?br>|(.+?)<\/del> + s=s.dup + s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^#{Mx[:lv_o]}[1-6]:\S+?#{Mx[:lv_c]}|#{Mx[:en_a_o]}\d+\s.+?#{Mx[:en_a_c]})/m,'') # markup and endnotes removed + #% same as db clean --> + s=s.gsub(/(.+?)<\/del>/,'DELETED(\1)') # deletions + s=s.gsub(/(\d+)<\/sup>/,'[\1]') + s=s.gsub(/(?:#{Mx[:nbsp]})+/,' ') + #s=s.gsub(//,"[TABLE]\n") # tables + #s=s.gsub(//,'\1') # tables + #s=s.gsub(/¡¡\d+¡/,' ') # tables + #s=s.gsub(/¡/,' ') # tables tidy later + #s=s.gsub(/<.+?>/,'') + s=s.gsub(/#{Mx[:lnk_o]}.+?\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:https?|file|ftp)\\\:\S+ /,' [image] ') # else image names found in search + s=s.gsub(/\s\s+/,' ') + s=s.strip + end + end +end +__END__ + diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index 5e07396a..607686a3 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -80,9 +80,9 @@ module SiSU_book_index idx_array << @rgx_idx_ocn_init.match(para)[0].gsub(@rgx_idx_ocn_init,'\1~\2') if para =~ @rgx_idx_ocn_init tuned_file << para if para end - idx_array.each do |i| - i.gsub!(@rgx_idx_ocn_init,'\1~\2') - end + #idx_array.each do |i| + # i.gsub!(@rgx_idx_ocn_init,'\1~\2') + #end idx_array=construct_idx_array(idx_array) if idx_array.length > 0 if idx_array.length > 0 the_idx=construct_book_index(idx_array) @@ -189,7 +189,7 @@ module SiSU_book_index def clean_index(data) tuned_file=[] data.each do |para| - para.gsub!(@rgx_idx,'') + para.gsub!(/\n*#{@rgx_idx}/m,'') tuned_file << para end tuned_file diff --git a/lib/sisu/v0/dal_images.rb b/lib/sisu/v0/dal_images.rb new file mode 100644 index 00000000..75fa333c --- /dev/null +++ b/lib/sisu/v0/dal_images.rb @@ -0,0 +1,125 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_images + class Images + def initialize(md,data) + @md,@data=md,data + end + def images + data=@data + tuned_file=[] + @rmgk=false + if SiSU_Env::Info_settings.new.program?('rmagick'); @rmgk=SiSU_Env::Load.new('RMagick').prog + else tell=SiSU_Screen::Ansi.new(@md.cmd,'use of RMagick is not enabled in sisurc.yml') + tell.warn if @md.cmd =~/[vVM]/ + end + data.each do |para| + para.strip! + if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ + if para !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+\s+/ + m=/#{Mx[:lnk_o]}\s*(\S+\.(?:png|jpg|gif))/ + if @rmgk + imgs=para.scan(m).flatten + images=imgs.each do |image| + dir=SiSU_Env::Info_env.new(@md.fns) + path_image=[dir.path.image_source_local_tex,dir.path.image_source_remote_tex,dir.path.image_source_tex] + image_path=nil + path_image.each do |image_path| + break if FileTest.exist?("#{image_path}/#{image}") + end + if FileTest.exist?("#{image_path}/#{image}") + img=Magick::ImageList.new("#{image_path}/#{image}") + img_col,img_row=img.columns,img.rows + if img_col > img_row #landscape + if img_col> 640 #480 + img_col=640 #480 + img_row=((1.00*img_col/img.columns)*img.rows).round + end + else #portrait + if img_col> 640 #480 + img_col=640 #480 + img_row=((1.00*img_col/img.columns)*img.rows).round + end + if img_row > 640 + img_row=640 + img_col=((1.00*img_row/img.rows)*img.columns).round + end + end + para.gsub!(/(#{image})/,"#{image} #{img_col}x#{img_row}") + else para.gsub!(/#{Mx[:lnk_o]}\s*(\S+)\.(png|jpg|gif).+?#{Mx[:lnk_c]}((?:https?|file|ftp):\S+|image)/,'[ \1 (\2 missing) ]') + end + end + else + images=para.scan(m) do |image| + tell=SiSU_Screen::Ansi.new(@md.cmd,'where image dimensions have not been provided RMagick is required',image) + tell.warn #unless @opt.cmd =~/q/ + end + end + end + end + para.gsub!(/(#{Mx[:lnk_o]})\s*(\S+\.(?:png|jpg|gif))\s+/i,'\1\2 ') if para =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif).+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\S+|image)/ + tuned_file << para unless para.nil? + end + tuned_file + end + end +end +__END__ diff --git a/lib/sisu/v0/dal_metadata.rb b/lib/sisu/v0/dal_metadata.rb new file mode 100644 index 00000000..900c5495 --- /dev/null +++ b/lib/sisu/v0/dal_metadata.rb @@ -0,0 +1,228 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_metadata + class Metadata + def initialize(md,data) + @md,@data=md,data + l=SiSU_Env::Standardise_language.new.file_to_language(md.fns) + language=l[:l] + @tr=SiSU_Translate::Source.new(md,language) + end + def metadata + data=@data + meta,@dc,@rc,@cvs,dctitle,add=Array.new(6){[]} + dir=SiSU_Env::Info_env.new(@md.fns) + base_html="#{dir.url.root}/#{@md.fnb}" + ocnm=ocnd=ocnv=0 + ocnm+=1 + header1="\n#{Mx[:lv_o_1]}meta#{Mx[:lv_c]}Document Information (metadata) #{Mx[:id_o]}~0;0:0;m#{ocnm}#{Mx[:id_c]}" + ocnm+=1 + header4="\n#{Mx[:lv_o_4]}metadata#{Mx[:lv_c]}Metadata #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}" + ocnm+=1; ocnd+=1 + head_no_dc="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + ocnm+=1; ocnd+=1 + head_no_dc_tag="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + data.each do |para| + case para + when /^#{Mx[:meta_o]}(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)#{Mx[:meta_c]}/i + m=$1 + ocnm+=1; ocnd+=1 + @dc << case para + when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/ + "\n#{@tr.dc_title}: #{Mx[:fa_underscore_o]}#{@md.dc_title}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}(?:creator|author)#{Mx[:meta_c]}/ + "\n#{@tr.creator}: #{Mx[:fa_underscore_o]}#{@md.dc_creator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /#{Mx[:meta_o]}(?:translator|translated_by)#{Mx[:meta_c]}/ + "\n#{@tr.translator}: #{Mx[:fa_underscore_o]}#{@md.translator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}(?:illustrator|illustrated_by)#{Mx[:meta_c]}/ + "\n#{@tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.illustrator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}prepared_by#{Mx[:meta_c]}/ + "\n#{@tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.prepared_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}digitized_by#{Mx[:meta_c]}/ + "\n#{@tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.digitized_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}description#{Mx[:meta_c]}/ + "\n#{@tr.description}: #{Mx[:fa_underscore_o]}#{@md.dc_description}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}subject#{Mx[:meta_c]}/ + "\n#{@tr.subject}: #{Mx[:fa_underscore_o]}#{@md.dc_subject}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}abstract#{Mx[:meta_c]}/ + "\n#{@tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.dc_abstract}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}publisher#{Mx[:meta_c]}/ + "\n#{@tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.dc_publisher}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}contributor#{Mx[:meta_c]}/ + "\n#{@tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.dc_contributor}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.created#{Mx[:meta_c]}/ + "\n#{@tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.dc_date_created}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.issued#{Mx[:meta_c]}/ + "\n#{@tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.dc_date_issued}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.available#{Mx[:meta_c]}/ + "\n#{@tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.dc_date_available}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.modified#{Mx[:meta_c]}/ + "\n#{@tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.dc_date_modified}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date.valid#{Mx[:meta_c]}/ + "\n#{@tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.dc_date_valid}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}date#{Mx[:meta_c]}/ + "\n#{@tr.date}: #{Mx[:fa_underscore_o]}#{@md.dc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}type#{Mx[:meta_c]}/ + "\n#{@tr.type}: #{Mx[:fa_underscore_o]}#{@md.dc_type}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}format#{Mx[:meta_c]}/ + "\n#{@tr.format}: #{Mx[:fa_underscore_o]}#{@md.dc_format}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}rights#{Mx[:meta_c]}/ + "\n#{@tr.rights}: #{Mx[:fa_underscore_o]}#{@md.dc_rights}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}identifier#{Mx[:meta_c]}/ + "\n#{@tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.dc_identifier}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}source#{Mx[:meta_c]}/ + "\n#{@tr.source}: #{Mx[:fa_underscore_o]}#{@md.dc_source}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}language#{Mx[:meta_c]}/ + "\n#{@tr.language}: #{Mx[:fa_underscore_o]}#{@md.dc_language}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}language.original#{Mx[:meta_c]}/ + "\n#{@tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.language_original}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}relation#{Mx[:meta_c]}/ + "\n#{@tr.relation}: #{Mx[:fa_underscore_o]}#{@md.dc_relation}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}coverage#{Mx[:meta_c]}/ + "\n#{@tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.dc_coverage}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}keywords#{Mx[:meta_c]}/ + "\n#{@tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.keywords}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}comments#{Mx[:meta_c]}/ + "\n#{@tr.comments}: #{Mx[:fa_underscore_o]}#{@md.comments}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}cls_loc#{Mx[:meta_c]}/ + "\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}cls_dewey#{Mx[:meta_c]}/ + "\n#{@tr.cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}(?:cls_gutenberg|cls_pg)#{Mx[:meta_c]}/ + "\n#{@tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.cls_gutenberg}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + #"\n#{@tr.cls_gutenberg}: #{@md.cls_pg} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}cls_isbn#{Mx[:meta_c]}/ + "\n#{@tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.cls_isbn}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}prefix(?:_a)?#{Mx[:meta_c]}/ + "\n#{@tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.prefix_a}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + when /^#{Mx[:meta_o]}prefix_b#{Mx[:meta_c]}/ + "\n#{@tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.prefix_b}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}" + else para.gsub(/^#{Mx[:meta_o]}(#{m})\s+(.+)/m,"\n#{m.capitalize}: #{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}") + end + end + end + ocnm+=1; ocnv+=1 + head_no_rc="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + head_no_rc_tag="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + data.each do |para| + case para + when /^0~(?:cvs|rcs)\+\s+/ #note the + sign to turn on use of cvs id + ocnm+=1; ocnv+=1 + @cvs << "#{@tr.sc_number}: #{Mx[:fa_underscore_o]}#{@md.sc_number}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + @cvs << "#{@tr.sc_date}: #{Mx[:fa_underscore_o]}#{@md.sc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + @cvs << "CVS/RCS time: #{Mx[:fa_underscore_o]}#{@md.sc_time}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + when /^0~cvs[+\s]/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP + when /^0~cvs\s+/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP + end + end + if true #default version information + ocnm+=1; ocnv+=1 + if @md.sc_filename \ + and @md.sc_filename.length > 3 + @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.sc_filename}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + else @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + end + ocnm+=1; ocnv+=1 + if @md.file_encoding \ + and @md.file_encoding.length > 3 #translate + @rc << "Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + end + ocnm+=1; ocnv+=1 + if @md.dgst #change. enable by default + @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + end + if @md.dgst_skin #change. enable by default + @rc << "Skin_Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + end + @rc << "#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0 + @rc << "#{@tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + if @md.sisu_version[:version] + @rc << "#{@tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]}) #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + ocnm+=1; ocnv+=1 + end + @rc << "#{@tr.ruby_version}: #{Mx[:fa_underscore_o]} #{@md.ruby_version}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}" + end + meta << Mx[:br_page_new] << header1 << header4 + meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}" + meta << "#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC) #{head_no_dc}" if @dc.length > 0 + meta << "#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]} #{head_no_dc_tag}" if @dc.length > 0 + @dc.each { |x| meta << x } + meta << "#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0 + if @cvs.length > 0 + meta << "#{Mx[:fa_italics_o]}Note the version information provided here, is specific to the host site.#{Mx[:fa_italics_c]} #{head_no_rc_tag}" + @cvs.each { |x| meta << x } + end + @rc.each { |x| meta << x } + ## ENDNOTE RELATED endnote related + meta << "\n#{Mx[:br_eof]}" + meta=SiSU_hash::Object_digest.new(@md,meta,@env).object_digest + end + end +end +__END__ diff --git a/lib/sisu/v0/dal_numbering.rb b/lib/sisu/v0/dal_numbering.rb index e14b87d7..fd873da2 100644 --- a/lib/sisu/v0/dal_numbering.rb +++ b/lib/sisu/v0/dal_numbering.rb @@ -67,7 +67,7 @@ module SiSU_numbering def numbering_song data=@data data=number_plaintext_para(data) - #data=name_endnote_seg(data) #tr issue + data=name_endnote_seg(data) #tr issue data=auto_number_heading_ie_title(data) #tr issue data=ocn(data) #watch data=minor_numbering(data) @@ -90,13 +90,13 @@ module SiSU_numbering @tuned_file=@tuned_file.flatten end def name_endnote_seg(data) - @tuned_file=[] + tuned_file=data if @md.flag_auto_endnotes \ and @md.flag_separate_endnotes_make - @tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" + tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" end - @tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON - @tuned_file=@tuned_file.flatten + tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON + tuned_file=tuned_file.flatten end def owner_details_seg data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details" diff --git a/lib/sisu/v0/dal_substitutions_and_insertions.rb b/lib/sisu/v0/dal_substitutions_and_insertions.rb new file mode 100644 index 00000000..dad07ec9 --- /dev/null +++ b/lib/sisu/v0/dal_substitutions_and_insertions.rb @@ -0,0 +1,131 @@ +# coding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + #___# + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_substitute_and_insert + class SI + def initialize(md,data) + @md,@data=md,data + end + def substitutions_and_insertions? + data=@data + data_expand=[] + if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content precedes it) + data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') + data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') + end + if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier + data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1') + data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1') + end + data.each do |para| + if para =~/<:insert\d+!?>/ \ + and para !~/^%\s+/ + @skin.select + ins=SiSU_Viz::Inserts.new + case para + when /^\s*<:insert1>\s*$/ + para=[] + ins.insert1.split(/\n\n/).each{|x| para << x } + when /^\s*<:insert2>\s*$/ + para=[] + ins.insert2.split(/\n\n/).each{|x| para << x } + when /^\s*<:insert3>\s*$/ + para=[] + ins.insert3.split(/\n\n/).each{|x| para << x << "\n"} + para=ins.insert3 + when /^\s*<:insert4>\s*$/ + para=[] + ins.insert4.split(/\n\n/).each{|x| para << x << "\n"} + para=ins.insert4 + when /^\s*<:insert5>\s*$/ + para=[] + ins.insert5.split(/\n\n/).each{|x| para << x << "\n"} + when /^\s*<:insert6>\s*$/ + para=[] + ins.insert6.split(/\n\n/).each{|x| para << x << "\n"} + when /^\s*<:insert7>\s*$/ + para=[] + ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} + end + para.each{|x| data_expand << x } + else data_expand << para + end + data_expand.flatten! + data_expand.compact! + end + data_expand.each do |para| + para=if @md.markup_version.to_f >= 0.38 + SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize + else + SiSU_document_structure::Structure.new(@md,para).structure_marks + end + #para.gsub!(//,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate? + para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 + if para =~/^@\S+?:/ + para.gsub!(/^@(\S+?):\s+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}") + para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}") + end + end + end + end +end +__END__ + -- cgit v1.2.3 From 1529e474fd5c8a67679438e8f2cea5cd6d26db3d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Sep 2008 23:09:37 -0400 Subject: book index, sample html file and to screen sisu markup sample added (-M flag) --- lib/sisu/v0/css.rb | 12 +++++ lib/sisu/v0/dal.rb | 2 +- lib/sisu/v0/dal_idx.rb | 144 +++++++++++++++++++++++++++++++++++++++++++------ lib/sisu/v0/sysenv.rb | 3 +- 4 files changed, 143 insertions(+), 18 deletions(-) diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index b5b08698..ec71c4f3 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -358,6 +358,18 @@ WOK margin-top: 1px; margin-bottom: 3px; } + p.book_index_lev1 { + line-height: 100%; + margin-top: 4px; + margin-bottom: 1px; + } + p.book_index_lev2 { + line-height: 100%; + text-align: left; + margin-left: 3em; + margin-top: 1px; + margin-bottom: 3px; + } p.quickref { font-size: 10px; diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index d091284d..a00d307b 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -209,7 +209,7 @@ module SiSU_DAL data=SiSU_images::Images.new(@md,data).images data=SiSU_document_structure::Tables.new(@md,data).tables data=SiSU_numbering::Numbering.new(@md,data).numbering_song - data=SiSU_book_index::Book_index.new(data).indexing_song if @md.book_index + data=SiSU_book_index::Book_index.new(@md,data,@env).indexing_song if @md.book_index data=SiSU_endnotes::Endnotes.new(@md,data,endnote_array).endnotes data=SiSU_hash::Object_digest.new(@md,data,@env).object_digest meta=SiSU_metadata::Metadata.new(@md,data).metadata diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index 607686a3..26fc66b6 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -61,14 +61,21 @@ =end module SiSU_book_index class Book_index - def initialize(data) - @data=data - end - def indexing_song + def initialize(md,data,env=nil) + @md,@data,@env=md,data,env @rgx_idx=/#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ #@rgx_idx=/\s*#{Mx[:idx_o]}(?:.+?)#{Mx[:idx_c]}\s*/ @rgx_idx_ocn_init=/#{Mx[:idx_o]}(.+?)#{Mx[:idx_c]}\s*#{Mx[:id_o]}~(\d+)\S+?#{Mx[:id_c]}/ + @rgx_idx_ocn_seg=/(.+?)~(\d+)~(\S+)/ @rgx_idx_ocn=/(.+?)~(\d+)/ + @rxp_lv1=/^#{Mx[:lv_o]}1:/ + @rxp_lv2=/^#{Mx[:lv_o]}2:/ + @rxp_lv3=/^#{Mx[:lv_o]}3:/ + @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/ + @rxp_to=Regexp.new("#{Mx[:id_o]}~(\\d+);(?:[oh]|[0-6]:)\\d+;\\w\\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|#{Mx[:id_o]}\S+?#{Mx[:id_c]}$") + @env ||=SiSU_Env::Info_env.new(@md.fns) + end + def indexing_song @data=extract_book_index(@data) @data=clean_index(@data) @data @@ -77,7 +84,9 @@ module SiSU_book_index tuned_file=[] idx_array=[] data.each do |para| - idx_array << @rgx_idx_ocn_init.match(para)[0].gsub(@rgx_idx_ocn_init,'\1~\2') if para =~ @rgx_idx_ocn_init + if para =~@rxp_seg; @seg=para[@rxp_seg,1] + end + idx_array << @rgx_idx_ocn_init.match(para)[0].gsub(@rgx_idx_ocn_init,"\\1~\\2~#{@seg}") if para =~ @rgx_idx_ocn_init tuned_file << para if para end #idx_array.each do |i| @@ -85,23 +94,32 @@ module SiSU_book_index #end idx_array=construct_idx_array(idx_array) if idx_array.length > 0 if idx_array.length > 0 - the_idx=construct_book_index(idx_array) - screen_print(the_idx) + if @md.cmd.inspect =~/M/ + the_idx=construct_book_index(idx_array) + screen_print(the_idx) if @md.cmd.inspect =~/M/ + puts "\n---" + path="#{@env.path.output}/#{@md.fnb}" + @file_index_all=File.open("#{path}/#{@md.fn[:book_index]}",'w') + screen_html(the_idx) + @file_index_all.close + puts "\n---" + screen_sisu_markup(the_idx) + end end tuned_file end def construct_idx_array(idx_array) idx_lst=[] idx_array.each do |idx| - idx_list,ocn=@rgx_idx_ocn.match(idx)[1,2] + idx_list,ocn,seg=@rgx_idx_ocn_seg.match(idx)[1..3] idx_lst <<=if idx_list =~/;/ g=idx_list.scan(/[^;]+/) idxl=[] g.each do |i| - idxl << { :rough_idx => i, :ocn => ocn } + idxl << { :rough_idx => i, :ocn => ocn, :seg => seg } end idxl - else { :rough_idx => idx_list, :ocn => ocn } + else { :rough_idx => idx_list, :ocn => ocn, :seg => seg } end end idx_lst.flatten! @@ -122,20 +140,20 @@ module SiSU_book_index x=if idx_lst.length == 1 or idx_lst[0] == i @the_idx[use]['a1']=[] unless @the_idx[use]['a1'] and defined? @the_idx[use]['a1'] x=if r - @the_idx[use]['a1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" } + @the_idx[use]['a1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] } "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" else - @the_idx[use]['a1'] << { :ocn => idx[:ocn] } + @the_idx[use]['a1'] << { :ocn => idx[:ocn], :seg => idx[:seg] } "#{i} #{idx[:ocn]}" end else @the_idx[use]['b1']={} unless @the_idx[use]['b1'] and defined? @the_idx[use]['b1'] @the_idx[use]['b1'][i]=[] unless @the_idx[use]['b1'][i] and defined? @the_idx[use]['b1'][i] x=if r - @the_idx[use]['b1'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" } + @the_idx[use]['b1'][i] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] } "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}" else - @the_idx[use]['b1'][i] << { :ocn => idx[:ocn] } + @the_idx[use]['b1'][i] << { :ocn => idx[:ocn], :seg => idx[:seg] } "#{idx_lst[0]}:#{i} #{idx[:ocn]}" end end @@ -186,6 +204,102 @@ module SiSU_book_index end end end + def screen_html(the_idx) + @file_index_all << %{\n } + the_idx.each do |i| + i.each do |x| + if x.class == String + @file_index_all << %{\n

    #{x}, } + #@file_index_all << %{
    \n#{x}, } + print %{
    \n#{x}, } + elsif x.class == Array + p 'array error? -->' + print x + elsif x.class == Hash + if x['a1'].class == Array + x['a1'].each do |a| + if a[:range] + @file_index_all << %{
    #{a[:range]}, } + print %{#{a[:range]}, } + elsif a[:ocn] + @file_index_all << %{#{a[:ocn]}, } + print %{#{a[:ocn]}, } + else p 'error' + end + end + @file_index_all << '

    ' + end + if x['b1'] + m=x['b1'] + m=m.sort + m.each do |k,y| + if k !~/a1/ + @file_index_all << %{\n

    #{k}, } + #@file_index_all << %{
    \n\t#{k}, } + print %{
    \n\t#{k}, } + #p y + y.each do |z| + if z[:range] + @file_index_all << %{#{z[:range]}, } + print %{#{z[:range]}, } + elsif z[:ocn] + @file_index_all << %{#{z[:ocn]}, } + print %{#{z[:ocn]}, } + else p 'error' + end + end + @file_index_all << '

    ' + end + end + end + end + end + end + end + def screen_sisu_markup(the_idx) + the_idx.each do |i| + i.each do |x| + if x.class == String + print %{\n\n#{Mx[:fa_bold_o]}#{x}#{Mx[:fa_bold_c]}, } + #print %{\n\n#{Mx[:gr_o]}\n#{Mx[:fa_bold_o]}#{x}#{Mx[:fa_bold_c]}, } + #print "\n" + x + ', ' + elsif x.class == Array + p 'array error? -->' + print x + elsif x.class == Hash + if x['a1'].class == Array + x['a1'].each do |a| + if a[:range] + print %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, } + elsif a[:ocn] + print %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, } + else p 'error' + end + end + end + if x['b1'] + m=x['b1'] + m=m.sort + m.each do |k,y| + if k !~/a1/ + print %{\n #{k}, } + #print "\n\t" + k + ', ' + y.each do |z| + if z[:range] + print %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, } + elsif z[:ocn] + print %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, } + else p 'error' + end + end + puts " #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" + end + end + end + end + end + end + end def clean_index(data) tuned_file=[] data.each do |para| @@ -196,6 +310,4 @@ module SiSU_book_index end end end - __END__ - diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index ed0012e2..93e6ea8e 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -518,7 +518,8 @@ module SiSU_Env :sxs => filename(code,@fnb,'.sxs.xml'), :sxd => filename(code,@fnb,'.sxd.xml'), :sxn => filename(code,@fnb,'.sxn.xml'), - :sisupod => filename(nil,@fnz,'') + :sisupod => filename(nil,@fnz,''), + :book_index => filename(code,'book_index','.html'), } @fn end -- cgit v1.2.3 From 291080c0495f59f031bf5c0de2482f1bc7df59f2 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 10 Sep 2008 21:24:31 -0400 Subject: primarily on book index where (markup) provided * book index, html, tex/pdf, xml * texpdf no ocn if ocn is 0 * odf, plaintext, if book index? remove ... do other outputs for which not relevant * concordance, better matches * constants, dal special character for hardspace changed as (ruby) regx bug in replacing it in xml, odd but move on Note: to fix html seg headers for endnotes and for index --- CHANGELOG | 2 +- conf/sisu/version.yml | 4 +- lib/sisu/v0/concordance.rb | 22 +++--- lib/sisu/v0/constants.rb | 2 +- lib/sisu/v0/dal.rb | 56 +++++++++++++-- lib/sisu/v0/dal_idx.rb | 157 ++++++++++++++++++++----------------------- lib/sisu/v0/dal_syntax.rb | 1 + lib/sisu/v0/html.rb | 3 - lib/sisu/v0/html_segments.rb | 86 ++++++++++++++---------- lib/sisu/v0/odf.rb | 1 + lib/sisu/v0/particulars.rb | 13 +++- lib/sisu/v0/plaintext.rb | 1 + lib/sisu/v0/shared_xml.rb | 4 +- lib/sisu/v0/sysenv.rb | 6 ++ lib/sisu/v0/texpdf.rb | 1 + 15 files changed, 214 insertions(+), 145 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4964ab06..f066aac9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,7 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-09-08:36/1) +%% sisu_0.69.0.orig.tar.gz (2008-09-10:36/3) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index d3ddf9f7..913d5a5f 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- :version: 0.69.0-beta -:date_stamp: 2008w35/7 -:date: "2008-09-07" +:date_stamp: 2008w36/3 +:date: "2008-09-10" :project: SiSU diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 485f3df5..fad91d14 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -121,8 +121,8 @@ WOK end def create head_banner=SiSU_HTML_Format::Head_toc.new(@md) -minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet -toc='
    ' + minitoc.to_s + '
    ' + minitoc=SiSU_HTML_minitoc::Toc_mini.new(@md,@data).songsheet + toc='
    ' + minitoc.to_s + '
    ' < @@ -199,7 +199,8 @@ WOK @rxp_t3=Regexp.new('^T3') @rxp_excluded1=/(?:https?|file|ftp):\/\/\S+/ @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#@dp|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!! - @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|#{Mx[:gr_o]}code#{Mx[:gr_o]}.+?#{Mx[:gr_o]}code-end#{Mx[:gr_o]}|<\S+?>|#{Mx[:id_o]}\S+?#{Mx[:id_c]}|\w+|[a-zA-Z]+}mi + @rgx_splitlist=%r{[—.,;:-]|#{Mx[:id_o]}\S+?#{Mx[:id_c]}}mi + @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|#{Mx[:gr_o]}code#{Mx[:gr_o]}.+?#{Mx[:gr_o]}code-end#{Mx[:gr_o]}|<\S+?>|\w+|[a-zA-Z]+}mi rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error end end @@ -223,13 +224,13 @@ WOK @sfx='.html' #used for hardlinks, previous setting @sfx='', web server takes care of suffix @word_location_seg=wordlocation.gsub(/(.+?)\#(\d+)/,"#{@md.fnl[:pre]}\\1#{@md.fnl[:mid]}#@sfx#{@md.fnl[:post]}#\\2") unless wordlocation.nil? case @wordlocation - when @rxp_t1 - %{[H]#@show, } - when @rxp_t2 - %{[H]#@show, } - when @rxp_t3 - %{[H]#@show, } - else %{#@show, } + when @rxp_t1 + %{[H]#@show, } + when @rxp_t2 + %{[H]#@show, } + when @rxp_t3 + %{[H]#@show, } + else %{#@show, } end end def map_para @@ -243,6 +244,7 @@ WOK end if toy =~/\d+/ \ and toy !~/^0$/ + line=line.split(@rgx_splitlist).join(' ') #%take in word or other match for word in line.scan(@rgx_scanlist) #%take in word or other match #word.gsub!(@rxp_clean,'') word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}(?:http)?/,'') diff --git a/lib/sisu/v0/constants.rb b/lib/sisu/v0/constants.rb index 3f050df7..414732e1 100644 --- a/lib/sisu/v0/constants.rb +++ b/lib/sisu/v0/constants.rb @@ -91,7 +91,7 @@ Mx[:gl_bullet]= "#{Mx[:gl_o]}●#{Mx[:gl_c]}" Mx[:pa_non_object_dummy_heading]="#{Mx[:pa_o]}-##{Mx[:pa_c]}" #unnumbered paragraph, delete when not required [used in dummy headings, eg. for segmented html] (place marker at end of paragraph) Mx[:pa_non_object_no_heading]="#{Mx[:pa_o]}~##{Mx[:pa_c]}" #unnumbered paragraph (place marker at end of paragraph) Mx[:idx_o]='▢ '; Mx[:idx_c]='▢ ' # -Mx[:nbsp]= '▭ ' +Mx[:nbsp]= '░' #'▭ ' Mx[:br_line]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" Mx[:br_paragraph]= "#{Mx[:mk_o]}br#{Mx[:mk_c]}" Mx[:br_nl]= "#{Mx[:mk_o]}nl#{Mx[:mk_c]}" diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index a00d307b..c01c2d0a 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -87,13 +87,14 @@ module SiSU_DAL end end class Source 0 if idx_array.length > 0 - if @md.cmd.inspect =~/M/ - the_idx=construct_book_index(idx_array) - screen_print(the_idx) if @md.cmd.inspect =~/M/ - puts "\n---" - path="#{@env.path.output}/#{@md.fnb}" - @file_index_all=File.open("#{path}/#{@md.fn[:book_index]}",'w') - screen_html(the_idx) - @file_index_all.close - puts "\n---" - screen_sisu_markup(the_idx) + the_idx=construct_book_index(idx_array) + #screen_print(the_idx) if @md.cmd.inspect =~/V/ + sisu_markup_idx,html_idx=nil,nil + if @md.book_index + idx=index(the_idx) + output_html_idx(idx[:html]) + html_idx=idx[:html] + sisu_markup_idx=idx[:sst] end end - tuned_file + [tuned_file,sisu_markup_idx,html_idx] + end + def output_html_idx(html_idx) + if @md.book_index + path="#{@env.path.output}/#{@md.fnb}" + Dir.mkdir(path) unless FileTest.directory?(path) + html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w') + puts "#{path}/#{@md.fn[:book_index]}" + #html_file(the_idx) + html_idx.each {|x| html_index_file << x } + html_index_file.close + end end def construct_idx_array(idx_array) idx_lst=[] @@ -163,11 +170,22 @@ module SiSU_book_index #p the_idx; p '-----' the_idx end - def screen_print(the_idx) + def index(the_idx) + @x=1 + @idx={} + @idx[:sst],@idx[:html]=[],[] + @idx[:sst] << "\n\n#{Mx[:br_page_new]}" + @idx[:sst] << "\n\n#{Mx[:lv_o]}2:#{Mx[:lv_c]}Index #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" + @idx[:sst] << "\n\n#{Mx[:lv_o]}4:idx#{Mx[:lv_c]} [Index] #{Mx[:pa_non_object_dummy_heading]} #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" the_idx.each do |i| i.each do |x| if x.class == String - print "\n" + x + ', ' + @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } + aname=x.gsub(/\s+/,'_') + @idx[:html] << %{\n

    #{x}, } + @o=@idx[:sst].index(@idx[:sst].last) #@o=@idx[:sst].length - 1 + @q=@idx[:html].index(@idx[:html].last) #@o=@idx[:html].length - 1 + print "\n" + x + ', ' if @md.cmd =~/V/ elsif x.class == Array p 'array error? -->' print x @@ -175,43 +193,55 @@ module SiSU_book_index if x['a1'].class == Array x['a1'].each do |a| if a[:range] - print a[:range] + ', ' + @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, } + @idx[:html][@q]=@idx[:html][@q] + %{#{a[:range]}, } + print a[:range] + ', ' if @md.cmd =~/V/ elsif a[:ocn] - print a[:ocn] + ', ' + @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, } + @idx[:html][@q]=@idx[:html][@q] + %{#{a[:ocn]}, } + print a[:ocn] + ', ' if @md.cmd =~/V/ else p 'error' end end + @idx[:html][@q]=@idx[:html][@q] + '

    ' end if x['b1'] m=x['b1'] m=m.sort m.each do |k,y| if k !~/a1/ - print "\n\t" + k + ', ' - #p y + @idx[:sst][@o]=@idx[:sst][@o] + %{#{k}, } + @idx[:html][@q]=@idx[:html][@q] + %{\n

    #{k}, } + print "\n\t" + k + ', ' if @md.cmd =~/V/ y.each do |z| if z[:range] - print z[:range] + ', ' + @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, } + @idx[:html][@q]=@idx[:html][@q] + %{#{z[:range]}, } + print z[:range] + ', ' if @md.cmd =~/V/ elsif z[:ocn] - print z[:ocn] + ', ' + @idx[:sst][@o]=@idx[:sst][@o] + %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, } + @idx[:html][@q]=@idx[:html][@q] + %{#{z[:ocn]}, } + print z[:ocn] + ', ' if @md.cmd =~/V/ else p 'error' end end + @idx[:html][@q]=@idx[:html][@q] + '

    ' end end end + @idx[:sst][@o]=@idx[:sst][@o] + " #{Mx[:id_o]}~0;0:0;x#{@x}#{Mx[:id_c]}" + @x +=1 end end end + print "\n" if @md.cmd =~/V/ + @idx end - def screen_html(the_idx) - @file_index_all << %{\n } + def screen_print(the_idx) the_idx.each do |i| i.each do |x| if x.class == String - @file_index_all << %{\n

    #{x}, } - #@file_index_all << %{
    \n#{x}, } - print %{
    \n#{x}, } + print "\n" + x + ', ' elsif x.class == Array p 'array error? -->' print x @@ -219,36 +249,28 @@ module SiSU_book_index if x['a1'].class == Array x['a1'].each do |a| if a[:range] - @file_index_all << %{#{a[:range]}, } - print %{#{a[:range]}, } + print a[:range] + ', ' elsif a[:ocn] - @file_index_all << %{#{a[:ocn]}, } - print %{#{a[:ocn]}, } + print a[:ocn] + ', ' else p 'error' end end - @file_index_all << '

    ' end if x['b1'] m=x['b1'] m=m.sort m.each do |k,y| if k !~/a1/ - @file_index_all << %{\n

    #{k}, } - #@file_index_all << %{
    \n\t#{k}, } - print %{
    \n\t#{k}, } + print "\n\t" + k + ', ' #p y y.each do |z| if z[:range] - @file_index_all << %{#{z[:range]}, } - print %{#{z[:range]}, } + print z[:range] + ', ' elsif z[:ocn] - @file_index_all << %{#{z[:ocn]}, } - print %{#{z[:ocn]}, } + print z[:ocn] + ', ' else p 'error' end end - @file_index_all << '

    ' end end end @@ -256,49 +278,18 @@ module SiSU_book_index end end end - def screen_sisu_markup(the_idx) - the_idx.each do |i| - i.each do |x| - if x.class == String - print %{\n\n#{Mx[:fa_bold_o]}#{x}#{Mx[:fa_bold_c]}, } - #print %{\n\n#{Mx[:gr_o]}\n#{Mx[:fa_bold_o]}#{x}#{Mx[:fa_bold_c]}, } - #print "\n" + x + ', ' - elsif x.class == Array - p 'array error? -->' - print x - elsif x.class == Hash - if x['a1'].class == Array - x['a1'].each do |a| - if a[:range] - print %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, } - elsif a[:ocn] - print %{#{Mx[:lnk_o]}#{a[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{a[:seg]}.html##{a[:ocn]}, } - else p 'error' - end - end - end - if x['b1'] - m=x['b1'] - m=m.sort - m.each do |k,y| - if k !~/a1/ - print %{\n #{k}, } - #print "\n\t" + k + ', ' - y.each do |z| - if z[:range] - print %{#{Mx[:lnk_o]}#{z[:range]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, } - elsif z[:ocn] - print %{#{Mx[:lnk_o]}#{z[:ocn]}#{Mx[:lnk_c]}#{@env.url.root}/#{@md.fnb}/#{z[:seg]}.html##{z[:ocn]}, } - else p 'error' - end - end - puts " #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}" - end - end - end + def clean_and_insert_index(data,sisu_markup_idx) + tuned_file=[] + data.each do |para| + para.gsub!(/\n*#{@rgx_idx}/m,'') + tuned_file << para + if para =~/#{Mx[:br_endnotes]}/ and sisu_markup_idx + sisu_markup_idx.each do |idx| + tuned_file << idx end end end + tuned_file end def clean_index(data) tuned_file=[] diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 80635f36..cbcd42f9 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -357,6 +357,7 @@ module SiSU_Syntax line.gsub!(/_<(br(?: \/)?)_>/,'<\1>') #convert

    back, clumsy line.gsub!(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

    back, clumsy line.gsub!(/#{Mx[:gr_o]}codeline#{Mx[:gr_c]}/,"\n#{Mx[:nbsp]}#{Mx[:nbsp]}") #temporary fix, prefer: #line.gsub!(/<:codeline>/,"\n") + line else # 0~ end line diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index e73157bd..df53d1b7 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -173,9 +173,6 @@ module SiSU_HTML @md.file_type='html' if @md.cmd =~/[hon]/ directories newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/ - my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) - @fnm=my_make_source_file.marshal_meta - @tune_verse_marshal=my_make_source_file.marshal_tune dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet @tuned_file_array diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 8d89de28..796c3939 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -62,14 +62,43 @@ module SiSU_HTML_seg require "#{SiSU_lib}/shared_html" require "#{SiSU_lib}/html" require "#{SiSU_lib}/html_promo" + class Seg_output + def initialize(outputfile,seg,minitoc,type='') + @output_seg_file,@seg,@minitoc,@type=outputfile,seg,minitoc,type + end + def output #CONSIDER + if @seg[:title] =~/\S/ #kludge (for exception file better.ways, how ironic) get a real ruby test, e.g. test that not array or... + filename_seg=[] + filename_seg << @seg[:title] << @seg[:tocband_banner] + if @type =~/endnote/ +#p @seg[:headers] #FIX endnote header + filename_seg << @seg[:header_endnotes] << @minitoc << @seg[:headers] << %{\n
    \n} << @seg[:endnote_all] << '
    ' # << '' + elsif @type =~/idx/ +#p @seg[:headers] #FIX inserted index header + filename_seg << @seg[:header_idx] << @minitoc << @seg[:headers] << %{\n
    \n} << @seg[:idx] << '
    ' # << '' + else + filename_seg << @minitoc << @seg[:headers] << @seg[:main] << "\n\n" + end + filename_seg << @seg[:tail] << @seg[:tocband_bannerless] << @seg[:credits] + filename_seg.flatten!.compact! + filename_seg.each do |para| + unless para =~/\A\s*\Z/ + para.strip! + @output_seg_file << para + end + end + @output_seg_file.close + end + end + end class Seg @@seg,@@seg_subtoc,@@seg_endnotes,@@seg_ad={},{},{},{} - @@seg_name,@@seg_name_html,@@seg_name_php=[],[],[] - @@filename_seg=@@filename_segphp=@@seg_url=@@fn=@@to_lev4=@@get_hash_to=@@get_hash_fn='' + @@seg_name,@@seg_name_html=[],[] + @@seg_url=@@fn=@@to_lev4=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 @@is4=@@is3=@@is2=@@is1=0 @@header1=@@header2=@@header3=@@header4=0 - @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(10){[]} + @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(11){[]} @@seg[:header_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@flag_alt=false @@ -85,7 +114,7 @@ module SiSU_HTML_seg end def songsheet begin - @@minitoc=SiSU_HTML::Source::Toc.new(@data,@md).minitoc + @minitoc=SiSU_HTML::Source::Toc.new(@data,@md).minitoc data=get_subtoc_endnotes(@data) data=articles(data) Seg.new.cleanup # (((( added )))) @@ -103,6 +132,13 @@ module SiSU_HTML_seg @h_sfx='.php' if @md.file_type =~/php/ @h_sfx=@md.sfx if @md.file_type =~/html/ @h_sfx='.html' if @md.file_type =~/html/ #used in creating file, not to be omitted. + idx_html=nil + if @md.book_index + my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) + idx_html=SiSU_Particulars::Combined_singleton.instance.get_html_idx(@md.opt).html_idx + idx_html.each {|x| @@seg[:idx] << x } + @@seg[:header_idx]='' + end data.each do |para| if para =~/^#{Mx[:lv_o]}4:/ @@seg_name << para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/,1] @@ -153,20 +189,24 @@ module SiSU_HTML_seg mkdir_p(@md.dir_out) unless FileTest.directory?(@md.dir_out) #bug - added specifically for nav! not needed by regular seg, check !!! Seg.new('',@md).tail segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#@h_sfx#{@md.fnl[:post]}" - @@filename_seg=File.new(segfilename,'w') if @@seg_name_html[tracking-1] - unless (@@seg_name_html[tracking-1] =~/endnotes/) - Seg.new.output - else Seg.new.output('endnotes') + @output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] + if @@seg_name_html[tracking-1] !~/endnotes|idx/ + Seg_output.new(@output_seg_file,@@seg,@minitoc).output + elsif @@seg_name_html[tracking-1] =~/endnotes/ + Seg_output.new(@output_seg_file,@@seg,@minitoc,'endnotes').output + elsif @@seg_name_html[tracking-1] =~/idx/ + Seg_output.new(@output_seg_file,@@seg,@minitoc,'idx').output + else p 'check' end Seg.new.reinitialise header_art(para) head(para) if @@seg_name_html[tracking] =~/metadata/ # this is for metadata segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking]}#{@md.fnl[:mid]}#@h_sfx#{@md.fnl[:post]}" - @@filename_seg=File.new(segfilename,'w') - Seg.new.reinitialise + @output_seg_file=File.new(segfilename,'w') + Seg.new.reinitialise #BUG with items following endnote, and occurring before metadata, this becomes a bug ... work area for book index, FIX flagend="x" - @@filename_seg.close #%(((( EOF )))) --> + @output_seg_file.close #%(((( EOF )))) --> end end if tracking == 0 @@ -391,26 +431,6 @@ module SiSU_HTML_seg ads=SiSU_HTML_promo::Ad.new(@md) @@seg[:credits] << format_head_seg.credit << ads.div.close << ads.display << format_head_seg.html_close end - def output(type='') - if @@seg[:title] =~/\S/ #kludge (for exception file better.ways, how ironic) get a real ruby test, e.g. test that not array or... - filename_seg=[] - filename_seg << @@seg[:title] << @@seg[:tocband_banner] - if type !~/endnote/ - filename_seg << @@minitoc << @@seg[:headers] << @@seg[:main] << "\n\n" - else - filename_seg << @@seg[:header_endnotes] << @@minitoc << @@seg[:headers] << %{\n
    \n} << @@seg[:endnote_all] << '
    ' - end - filename_seg << @@seg[:tail] << @@seg[:tocband_bannerless] << @@seg[:credits] - filename_seg.flatten!.compact! - filename_seg.each do |para| - unless para =~/\A\s*\Z/ - para.strip! - @@filename_seg << para - end - end - @@filename_seg.close - end - end def reinitialise @@seg[:title],@@seg[:dot_nav],@@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]} @@segtocband=nil @@ -433,11 +453,9 @@ module SiSU_HTML_seg @@seg_endnotes_array=[] if para=~/^#{Mx[:lv_o]}4:/ @@fns_previous=@md.fns if para=~/^#{Mx[:lv_o]}1:meta#{Mx[:lv_c]}/ end - if para =~/^#{Mx[:lv_o]}4:/ #% EXTRACTION OF SUB-TOCs + if para =~/^#{Mx[:lv_o]}4:/ #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs @@seg_subtoc[@@fn]=@@seg_subtoc_array @@seg_subtoc_array=[] - end - if para =~/^#{Mx[:lv_o]}4:/ #% SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs if para !~/^#{Mx[:lv_o]}4:metadata#{Mx[:lv_c]}/ m=para[/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}.+?#{Mx[:id_o]}~(\d+);(?:[oh]|4:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}$/] end diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index d6558634..05a6272c 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -439,6 +439,7 @@ module SiSU_ODF bullet=image_src('bullet_09.png') cp("#{bullet}/bullet_09.png","#{@env.path.odf}/Pictures/.") #if image_src('bullet_09.png') data.each do |para| + para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove #p para if para =~safe_characters and @md.cmd =~/V/ #KEEP #para.gsub!(/<(~\d+;(?:\w|[0-6]:)\d+;\w\d+)><(#@dp:#@dp)>/,'<\1><\2>') para='' if para =~/#{Mx[:lv_o]}\d+:.*?#{Mx[:lv_c]}.+?#{Mx[:pa_non_object_dummy_heading]}/ diff --git a/lib/sisu/v0/particulars.rb b/lib/sisu/v0/particulars.rb index 8ae4f66e..59b8956b 100644 --- a/lib/sisu/v0/particulars.rb +++ b/lib/sisu/v0/particulars.rb @@ -92,7 +92,11 @@ module SiSU_Particulars set_env set_md end - attr_accessor :opt,:md + def get_html_idx(opt) + @opt=opt + set_html_idx + end + attr_accessor :opt,:md,:html_idx def set_md begin @md=SiSU_Param::Parameters.new(@opt).get @@ -116,6 +120,13 @@ module SiSU_Particulars rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error end end + def set_html_idx + begin + @html_idx=SiSU_DAL::Source.new(@md).get_idx_html + self + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + end + end end end __END__ diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index fb4b1115..754e366d 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -275,6 +275,7 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| + para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}") para.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index bf59830f..41e8c393 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -423,13 +423,11 @@ module SiSU_XML_munge %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, '\1\2') #escaped urls not linked, deal with later - para.gsub!(/ |#{Mx[:nbsp]}/,' ') - #para.gsub!(/ /,' ') #clean else para.gsub!(/(^|[^}])_/m,'\1>') #code-block: angle brackets special characters para.gsub!(/(^|[^}])_/m,'\1>') - para.gsub!(/ |#{Mx[:nbsp]}/,' ') end + para.gsub!(/ |#{Mx[:nbsp]}/m,' ') para end def markup_light(para='') diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 93e6ea8e..25cf90ec 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -3033,12 +3033,18 @@ WOK def file_meta File.new("#{@env.path.dal}/#@fns.meta",'w+') end + def file_meta_idx_html + File.new("#{@env.path.dal}/#@fns.idx.html",'w+') + end def file_note File.new("#{Dir.pwd}/#@fns.fn",'w+') end def marshal_meta "#{@env.path.dal}/#@fns.meta.rbm" end + def marshal_meta_idx_html + "#{@env.path.dal}/#@fns.idx_html.rbm" + end def meta "#{@env.path.dal}/#@fns.meta" end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index 3cf560c4..885643cf 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -693,6 +693,7 @@ WOK paranum=if ocn; para[m,2] else '' end + paranum = '' if paranum.to_i == 0 txt_obj={:txt =>parablock,:ocn =>paranum} do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,txt_obj) para=do_duo.para_num if parablock -- cgit v1.2.3 From bb1e2142668528a5e584b6b493c00f23aa59c637 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Sep 2008 01:46:25 -0400 Subject: dal_idx: strip before sort; fix bug where first lev is range --- .../conf/editor-syntax-etc/vim/syntax/sisu.vim | 4 +++- lib/sisu/v0/dal_idx.rb | 26 ++++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) 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 f29bc268..11e8a629 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -81,6 +81,7 @@ syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endn syn region sisu_comment matchgroup=sisu_comment start="^%\{1,2\} " end="$" "font face curly brackets "syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline +syn region sisu_index matchgroup=sisu_index_block start="^={" end="}" syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*" syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!" syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_" @@ -162,7 +163,6 @@ hi def link sisu_linked String hi def link sisu_fontface Include hi def link sisu_strikeout DiffDelete hi def link sisu_content_alt Special -hi def link sisu_sem_content String hi def link sisu_sem_content SpecialKey hi def link sisu_sem_block Special hi def link sisu_sem_marker Visual @@ -173,6 +173,8 @@ hi def link sisu_sem_ex_marker_block Folded hi def link sisu_sem_ex_content Comment "hi def link sisu_sem_ex_content SpecialKey hi def link sisu_sem_ex_block Comment +hi def link sisu_index SpecialKey +hi def link sisu_index_block Visual hi def link sisu_content_endnote Special hi def link sisu_control Define hi def link sisu_ocn Include diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index 74ec0d15..f8eb5e45 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -104,17 +104,6 @@ module SiSU_book_index end [tuned_file,sisu_markup_idx,html_idx] end - def output_html_idx(html_idx) - if @md.book_index - path="#{@env.path.output}/#{@md.fnb}" - Dir.mkdir(path) unless FileTest.directory?(path) - html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w') - puts "#{path}/#{@md.fn[:book_index]}" - #html_file(the_idx) - html_idx.each {|x| html_index_file << x } - html_index_file.close - end - end def construct_idx_array(idx_array) idx_lst=[] idx_array.each do |idx| @@ -123,6 +112,7 @@ module SiSU_book_index g=idx_list.scan(/[^;]+/) idxl=[] g.each do |i| + i.strip! idxl << { :rough_idx => i, :ocn => ocn, :seg => seg } end idxl @@ -136,6 +126,7 @@ module SiSU_book_index @the_idx={} idx_array.each do |idx| idx_lst=idx[:rough_idx].scan(/[^|:]+/) + idx_lst[0].strip! if idx_lst[0] =~/.+?\+\d+/ use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] else use=idx_lst[0] @@ -144,7 +135,7 @@ module SiSU_book_index idx_lst.each do |i| i.strip! i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/ - x=if idx_lst.length == 1 or idx_lst[0] == i + x=if idx_lst.length == 1 or idx_lst[0].gsub(/\+\d+/,'') == i @the_idx[use]['a1']=[] unless @the_idx[use]['a1'] and defined? @the_idx[use]['a1'] x=if r @the_idx[use]['a1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] } @@ -278,6 +269,17 @@ module SiSU_book_index end end end + def output_html_idx(html_idx) + if @md.book_index + path="#{@env.path.output}/#{@md.fnb}" + Dir.mkdir(path) unless FileTest.directory?(path) + html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w') + puts "#{path}/#{@md.fn[:book_index]}" + #html_file(the_idx) + html_idx.each {|x| html_index_file << x } + html_index_file.close + end + end def clean_and_insert_index(data,sisu_markup_idx) tuned_file=[] data.each do |para| -- cgit v1.2.3 From b3f2c67fd2d5b6c396eada917e2ef6dc069e5ea3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 13 Sep 2008 00:53:58 -0400 Subject: dal_idx: capitalize first letter of index lev1 for sort; provide letter a-z navigation --- lib/sisu/v0/dal_idx.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index f8eb5e45..9691a997 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -131,6 +131,7 @@ module SiSU_book_index use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] else use=idx_lst[0] end + use=use[0].chr.capitalize + use[1,use.length] @the_idx[use]={} unless @the_idx[use] and defined? @the_idx[use] idx_lst.each do |i| i.strip! @@ -168,12 +169,25 @@ module SiSU_book_index @idx[:sst] << "\n\n#{Mx[:br_page_new]}" @idx[:sst] << "\n\n#{Mx[:lv_o]}2:#{Mx[:lv_c]}Index #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" @idx[:sst] << "\n\n#{Mx[:lv_o]}4:idx#{Mx[:lv_c]} [Index] #{Mx[:pa_non_object_dummy_heading]} #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" + @alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @idx[:html] << '

    ' + @alph.each {|x| @idx[:html] << %{#{x}, }} + @idx[:html] << '

    ' + @letter=@alph.shift + @idx[:html] << %{\n
    \n

    A

    } the_idx.each do |i| i.each do |x| if x.class == String + f=/^(\S)/.match(x)[1] + if @letter < f + while @letter < f + @letter=@alph.shift + @idx[:html] << %{\n
    \n

    #{@letter}

    } + end + end @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } aname=x.gsub(/\s+/,'_') - @idx[:html] << %{\n

    #{x}, } + @idx[:html] << %{\n

    #{x}, } @o=@idx[:sst].index(@idx[:sst].last) #@o=@idx[:sst].length - 1 @q=@idx[:html].index(@idx[:html].last) #@o=@idx[:html].length - 1 print "\n" + x + ', ' if @md.cmd =~/V/ -- cgit v1.2.3 From dbde53fbcfb79fd01762d97fac929af2a4cfc26a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 13 Sep 2008 23:27:28 -0400 Subject: dal_idx, and concordance, letter list for navigation --- CHANGELOG | 2 ++ lib/sisu/v0/concordance.rb | 25 +++++++++++++++++++------ lib/sisu/v0/dal_idx.rb | 14 +++++++------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f066aac9..3c345cbd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * markup adjustment, book type index introduced * dal, book type indexing module + * book type index and concordance, letter list for navigation + * middle layer, url representation changed, downstream code affected * dummy headings removed when not used, latex/pdf, odf, html scroll diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index fad91d14..dd4411ac 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -207,11 +207,11 @@ WOK def songsheet begin mkdir_p(@path) unless FileTest.directory?(@path) - @file_index_all=File.open("#@path/#{@md.fn[:concordance]}",'w') + @file_concordance=File.open("#@path/#{@md.fn[:concordance]}",'w') map_para rescue; SiSU_Errors::Info_error.new($!,$@,@md.cmd,@md.fns).error ensure - @file_index_all.close + @file_concordance.close end end protected @@ -315,20 +315,33 @@ WOK end scr='Full Text scroll: doc#  ' seg='' - @file_index_all << SiSU_Concordance::Source::Doc_title.new(@particulars).create + @file_concordance << SiSU_Concordance::Source::Doc_title.new(@particulars).create + alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + @file_concordance << '

    ' + alph.each {|x| @file_concordance << %{#{x}, }} + @file_concordance << '

    ' + letter=alph.shift + @file_concordance << %{\n
    \n

    A

    } for word in @freq.keys.sort! {|a,b| a.downcase<=>b.downcase} + f=/^(\S)/.match(word)[1] + if letter < f.upcase + while letter < f.upcase + letter=alph.shift + @file_concordance << %{\n
    \n

    #{letter}

    } + end + end keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html if keyword !~ @rxp_excluded0 if @word_map[word][0] =~ /\d+/ wm=[] - @file_index_all << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} + @file_concordance << %{#{keyword}#{seg}#{@word_map[word].uniq.compact.join}} end - @file_index_all << '

    ' + @file_concordance << '

    ' end # special cases endnotes and header levels 1 - 3 end credits=@vz.credits_sisu - @file_index_all << %{
    #{credits}
    \n} # footer + @file_concordance << %{
    #{credits}
    \n} # footer tell=SiSU_Screen::Ansi.new(@md.cmd,@md.fns,"#{@env.path.output_tell}/#{@md.fn[:concordance]}") tell.flow if @md.cmd =~/[MV]/ end diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index 9691a997..a5806d06 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -169,20 +169,20 @@ module SiSU_book_index @idx[:sst] << "\n\n#{Mx[:br_page_new]}" @idx[:sst] << "\n\n#{Mx[:lv_o]}2:#{Mx[:lv_c]}Index #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" @idx[:sst] << "\n\n#{Mx[:lv_o]}4:idx#{Mx[:lv_c]} [Index] #{Mx[:pa_non_object_dummy_heading]} #{Mx[:id_o]}~0;0:0;x0#{Mx[:id_c]}" - @alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] + alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @idx[:html] << '

    ' - @alph.each {|x| @idx[:html] << %{#{x}, }} + alph.each {|x| @idx[:html] << %{#{x}, }} @idx[:html] << '

    ' - @letter=@alph.shift + letter=alph.shift @idx[:html] << %{\n
    \n

    A

    } the_idx.each do |i| i.each do |x| if x.class == String f=/^(\S)/.match(x)[1] - if @letter < f - while @letter < f - @letter=@alph.shift - @idx[:html] << %{\n
    \n

    #{@letter}

    } + if letter < f + while letter < f + letter=alph.shift + @idx[:html] << %{\n
    \n

    #{letter}

    } end end @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } -- cgit v1.2.3 From 87a7cfcd56eed6746b1500c88df3fc3e76a81668 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Sep 2008 21:52:19 -0400 Subject: various small fixes * html segments, name more accurately * rough description of how book index markup works * clean out book index from these outputs * book markup sample, free as in freedom, start doing book index, only letter "A" done so far * texpdf, url matching, special characters * # Please enter the commit message for your changes. --- CHANGELOG | 1 + conf/sisu/version.yml | 6 +- data/doc/sisu/html/sisu.1.html | 1918 ++++++++++---------- ...lman_crusade_for_free_software.sam_williams.sst | 55 +- .../sisu_manual/sisu_markup.sst | 68 +- lib/sisu/v0/dal_idx.rb | 3 +- lib/sisu/v0/html_segments.rb | 26 +- lib/sisu/v0/manpage.rb | 1 + lib/sisu/v0/texinfo.rb | 1 + lib/sisu/v0/texpdf_format.rb | 19 +- man/man1/sisu.1 | 81 + 11 files changed, 1219 insertions(+), 960 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 3c345cbd..1aa748d4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz * footnote, number placement changed, and left alignment (ragged edges) used * removal of a maths package gives back typeface changes like bold + * url matching, special characters * better representation of tilde * tolerance diff --git a/conf/sisu/version.yml b/conf/sisu/version.yml index 913d5a5f..11d4c1f2 100644 --- a/conf/sisu/version.yml +++ b/conf/sisu/version.yml @@ -1,5 +1,5 @@ --- -:version: 0.69.0-beta -:date_stamp: 2008w36/3 -:date: "2008-09-10" +:version: 0.69.0 +:date_stamp: 2008w37/1 +:date: "2008-09-15" :project: SiSU diff --git a/data/doc/sisu/html/sisu.1.html b/data/doc/sisu/html/sisu.1.html index f7b70fcd..1848611b 100644 --- a/data/doc/sisu/html/sisu.1.html +++ b/data/doc/sisu/html/sisu.1.html @@ -10,13 +10,13 @@

    Name

    sisu - documents: markup, structuring, publishing in multiple standard -formats, and search +formats, and search

    Synopsis

    sisu [-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard ] sisu [-Ddcv] [instruction] sisu [-CcFLSVvW] SISU - -MANUAL, RALPH AMISSAH -

    WHAT IS SISU? -

    1. INTRODUCTION - WHAT IS SISU? +MANUAL, RALPH AMISSAH +

    WHAT IS SISU? +

    1. INTRODUCTION - WHAT IS SISU?

    SiSU is a framework for document structuring, publishing (in multiple open standard formats) and search, comprising of: (a) a lightweight document @@ -24,13 +24,13 @@ structure and presentation markup syntax; and (b) an accompanying engine for generating standard document format outputs from documents prepared in sisu markup syntax, which is able to produce multiple standard outputs (including the population of sql databases) that (can) share a common numbering -system for the citation of text within a document. +system for the citation of text within a document.

    SiSU is developed under an open source, software libre license (GPL3). Its use case for development is to cope with medium to large document sets with evolving markup related technologies, which should be prepared once, and for which you want multiple output formats that can be updated and a common mechanism for cross-output-format -citation, and search. +citation, and search.

    SiSU both defines a markup syntax and provides an engine that produces open standards format outputs from documents prepared with SiSU markup. From a single lightly prepared document sisu custom builds @@ -42,7 +42,7 @@ of representation of the document. Significantly SiSU markup is more spar than html and outputs which include html, LaTeX, landscape and portrait pdfs, Open Document Format (ODF), all of which can be added to and updated. SiSU is also able to populate SQL type databases at an object level, which -means that searches can be made with that degree of granularity. +means that searches can be made with that degree of granularity.

    Source document preparation and output generation is a two step process: (i) document source is prepared, that is, marked up in sisu markup syntax and (ii) the @@ -59,14 +59,14 @@ by these documents and at these locations within each document). Document output formats share a common object numbering system for locating content. This is particularly suitable for works (finalized texts as opposed to works that are frequently changed or updated) for which it provides a fixed -means of reference of content. +means of reference of content.

    In preparing a SiSU document you optionally provide semantic information related to the document in a document header, and in marking up the substantive text provide information on the structure of the document, primarily indicating heading levels and footnotes. You also provide information on basic text attributes where used. The rest is automatic, sisu from this information custom builds[^2] the different forms -of output requested. +of output requested.

    SiSU works with an abstraction of the document based on its structure which is comprised of its structure (or frame)[^3] and the objects[^4] it contains, which enables SiSU to represent the document @@ -80,7 +80,7 @@ pages; and in publishing in different formats, html, landscape and portrait pdf etc. again page numbers are of no use to cite text in a manner that is relevant against the different output types. Dealing with documents at an object level together with object numbering also has implications for -search. +search.

    One of the challenges of maintaining documents is to keep them in a format that would allow users to use them without depending on a proprietary software popular at the time. Consider the ease of dealing with legacy proprietary @@ -104,38 +104,38 @@ and the archival of documents), and existing output to be updated (html has evolved and the related module has been updated repeatedly over the years, presumably when the World Wide Web Consortium (w3c) finalises html 5 which is currently under development, the html module will again be updated -allowing all existing documents to be regenerated as html 5). +allowing all existing documents to be regenerated as html 5).

    The document formats are written to the file-system and available for indexing by independent indexing tools, whether off the web like Google and Yahoo or on the site -like Lucene and Hyperestraier. +like Lucene and Hyperestraier.

    SiSU also provides other features such as concordance files and document content certificates, and the working against an abstraction of document structure has further possibilities for the research and development of other document representations, the availability of objects is useful for example for topic maps and the commercial law thesaurus by Vikki Rogers and Al Krtizer, together with the flexibility -of SiSU offers great possibilities. +of SiSU offers great possibilities.

    SiSU is primarily for published works, which can take advantage of the citation system to reliably reference its documents. SiSU works well in a complementary manner with such collaborative technologies as Wikis, which can take advantage of and be used to discuss -the substance of content prepared in SiSU +the substance of content prepared in SiSU

    <http://www.jus.uio.no/sisu -> +>

    2. -COMMANDS SUMMARY -

    2.1 SYNOPSIS +COMMANDS SUMMARY +

    2.1 SYNOPSIS

    SiSU - Structured information, Serialized -Units - a document publishing system +Units - a document publishing system

    sisu [  -abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9 - ] [  filename/  wildcard  ] -

    sisu [  -Ddcv  ] [  instruction  ] + ] [  filename/  wildcard  ] +

    sisu [  -Ddcv  ] [  instruction  ]

    sisu [  -CcFLSVvW - ] + ]

    Note: commands should be issued from within the directory that contains -the marked up files, cd to markup directory. -

    2.2 DESCRIPTION +the marked up files, cd to markup directory. +

    2.2 DESCRIPTION

    SiSU SiSU is a document publishing system, that from a simple single marked-up document, produces multiple of output formats including: plaintext, html, LaTeX, @@ -143,8 +143,8 @@ pdf, xhtml, XML, info, and SQL (PostgreSQL and SQLite), which share numbered text objects ( structure information. For more see: <http://www.jus.uio.no/sisu > -

    2.3 DOCUMENT PROCESSING COMMAND FLAGS -

    +

    2.3 DOCUMENT PROCESSING COMMAND FLAGS +

    -a [filename/wildcard]
    @@ -153,12 +153,12 @@ with Unix linefeeds and without markup, (object numbers are omitted), has footnotes at end of each paragraph that contains them [  -A  for  equivalent  dos  (linefeed)  output  file] [see  -e  for (Options include: --endnotes for endnotes --footnotes for footnotes at the end of each paragraph --unix for unix linefeed -(default) --msdos for msdos linefeed) +(default) --msdos for msdos linefeed)

    -b [filename/wildcard]
    produces xhtml/XML -output for browser viewing (sax parsing). +output for browser viewing (sax parsing).

    -C [--init-site]
    @@ -168,7 +168,7 @@ files such as css and dtd files are not updated if they already exist unless modifier is used). -C --init-site configure/initialise site more extensive than -C on its own, shared output directory files/force update, existing shared output config files such as css and dtd files are updated if this modifier -is used. +is used.

    -CC
    @@ -177,7 +177,7 @@ shared output directory (config files such as css and dtd files are not updated if they already exist unless modifier is used). The equivalent of: -C --init-site configure/initialise site, more extensive than -C on its own, shared output directory files/force update, existing shared output config -files such as css and dtd files are updated if -CC is used. +files such as css and dtd files are updated if -CC is used.

    -c [filename/wildcard] @@ -185,14 +185,14 @@ files such as css and dtd files are updated if -CC is used.
    screen toggle ansi screen colour on or off depending on default set (unless -c flag is used: if sisurc colour default is set to ’true’, output to screen will be with colour, if sisurc colour default is set to ’false’ or is undefined -screen output will be without colour). +screen output will be without colour).

    -D [instruction] [filename]
    database postgresql ( --pgsql may be used instead) possible instructions, include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove -[filename]; see database section below. +[filename]; see database section below.

    -d [--db-[database  type  (sqlite|pg)]] @@ -201,7 +201,7 @@ postgresql ( --pgsql may be used instead) possible instructions, include: --sqlite may be used instead) or to specify another database --db-[pgsql,  sqlite] (however see -D) possible instructions include: --createdb; --create; --dropall; --import [filename]; --update [filename]; --remove [filename]; see database section -below. +below.

    -F [--webserv=webrick]
    @@ -217,13 +217,13 @@ usually 80). The samples are dumped in the present work directory which must be writable, (with screen instructions given that they be copied to the cgi-bin directory). -Fv (in addition to the above) provides some information -

    on setting up hyperestraier for sisu +

    on setting up hyperestraier for sisu

    -H [filename/wildcard]
    produces html without link suffixes (.html .pdf etc.) ( an appropriately configured web -server. [behaviour  switched  after  0.35 see  -h]. +server. [behaviour  switched  after  0.35 see  -h].

    -h [filename/wildcard]
    @@ -231,34 +231,34 @@ server. [behaviour  switched  after  0.35 see  -h]. html (with hardlinks i.e. with name suffixes in links/local urls). html, with internal document links that include the document suffix, i.e. whether it is .html or .pdf (required for browsing directly off a file system, and works -with most web servers). [behaviour  switched  after  0.35  see  -H]. +with most web servers). [behaviour  switched  after  0.35  see  -H].

    -I [filename/wildcard]
    -
    produces texinfo and info file, (view with pinfo). +
    produces texinfo and info file, (view with pinfo).

    -i [filename/wildcard]
    -
    produces man page of file, not suitable for all outputs. +
    produces man page of file, not suitable for all outputs.

    -L
    prints license -information. +information.

    -M [filename/wildcard/url]
    maintenance mode files created for -processing preserved and their locations indicated. (also see -V) +processing preserved and their locations indicated. (also see -V)

    -m [filename/wildcard/url]
    assumed for most other flags, creates new meta-markup file, (the metaverse ) that is used in all subsequent processing of other output. This step is -assumed for most processing flags. To skip it see -n +assumed for most processing flags. To skip it see -n

    -N [filename/wildcard/url] @@ -266,18 +266,18 @@ assumed for most processing flags. To skip it see -n
    document digest or document content certificate ( DCC ) as md5 digest tree of the document: the digest for the document, and digests for each object contained within the document (together with information on software versions -that produced it) (digest.txt). -NV for verbose digest output to screen. +that produced it) (digest.txt). -NV for verbose digest output to screen.

    -n [filename/wildcard/url]
    skip meta-markup (building of -m which is otherwise -assumed by most processing flags. +assumed by most processing flags.

    -o [filename/wildcard/url]
    output basic -document in opendocument file format (opendocument.odt). +document in opendocument file format (opendocument.odt).

    -p [filename/wildcard] @@ -285,12 +285,12 @@ document in opendocument file format (opendocument.odt).
    produces LaTeX pdf (portrait.pdf & landscape.pdf). Default paper size is set in config file, or document header, or provided with additional command line parameter, e.g. --papersize-a4 preset sizes include: ’A4’, U.S. ’letter’ and -’legal’ and book sizes ’A5’ and ’B5’ (system defaults to A4). +’legal’ and book sizes ’A5’ and ’B5’ (system defaults to A4).

    -q [filename/wildcard]
    -
    quiet less output to screen. +
    quiet less output to screen.

    -R [filename/wildcard]
    @@ -299,7 +299,7 @@ to remote host using rsync. This requires that sisurc.yml has been provided with information on hostname and username, and that you have your different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is -used together with other flags, it is not). Also see -r +used together with other flags, it is not). Also see -r

    -r [filename/wildcard] @@ -307,7 +307,7 @@ used together with other flags, it is not). Also see -r
    copies sisu output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you -

    have your +

    have your

    -S
    @@ -316,7 +316,7 @@ including sisu markup source files and the directories local configuration file, images and skins. Note: this only includes the configuration files or skins contained in ./_sisu not those in ~/.sisu -S [filename/wildcard] option. Note: (this
    - option is tested only with zsh). + option is tested only with zsh).

    -S [filename/wildcard]
    @@ -340,12 +340,12 @@ the individual files for sending). See the -S option without [filename/wildcard]

    -s [filename/wildcard]
    -
    copies sisu markup file to output directory. +
    copies sisu markup file to output directory.

    -t [filename/wildcard  (*.termsheet.rb)]
    -
    standard form document builder, preprocessing feature +
    standard form document builder, preprocessing feature

    @@ -357,35 +357,35 @@ information on the output that would be produced), -u provides url output mapping for those flags requested for processing. The default assumes sisu_webrick is running and provides webrick url mappings where appropriate, but these -

    can be switched to file system paths in sisurc.yml +

    can be switched to file system paths in sisurc.yml

    -u [filename/wildcard]
    provides url mapping of output files for the flags requested for processing, -

    also see -U +

    also see -U

    -V
    on its own, provides SiSU version and environment information -(sisu --help env) +(sisu --help env)

    -V [filename/wildcard]
    even more verbose than the -v flag. -(also see -M) +(also see -M)

    -v
    -
    on its own, provides SiSU version information +
    on its own, provides SiSU version information

    -v [filename/wildcard]
    provides verbose output of what is being built, where it is being built (and error messages if any), as with -u flag provides a url mapping of files -created for each of the processing flag requests. See also -V +created for each of the processing flag requests. See also -V

    -W
    @@ -393,7 +393,7 @@ created for each of the processing flag requests. See also -V webrick webserver points at sisu output directories, the default port is set to 8081 and can be changed in the resource configuration files. [tip:  the  webrick  server  requires  link  suffixes,  so  html  output  should  be  created - using  the  -h  option  rather  than and search -H;  also,  note  -F  webrick  ]. + using  the  -h  option  rather  than and search -H;  also,  note  -F  webrick  ].

    -w @@ -401,24 +401,24 @@ set to 8081 and can be changed in the resource configuration files. [tip:
    produces concordance (wordmap) a rudimentary index of all the words in a document. (Concordance files are not generated for documents of over 260,000 words unless this limit is increased in the file -sisurc.yml) +sisurc.yml)

    -X [filename/wildcard]
    produces XML output with deep document -structure, in the nature of dom. +structure, in the nature of dom.

    -x [filename/wildcard]
    produces XML output -shallow structure (sax parsing). +shallow structure (sax parsing).

    -Y [filename/wildcard]
    produces a short sitemap entry for the document, based on html output and the sisu_manifest. --sitemaps generates/updates the sitemap index of existing sitemaps. (Experimental, -[g,y,m  announcement  this  week]) +[g,y,m  announcement  this  week])

    -y [filename/wildcard]
    @@ -438,41 +438,41 @@ combination of -[mMvVq]), will remove the related document output directory.
    -z [filename/wildcard]
    produces php (zend) [this  feature  is  disabled  for - the  time being] + the  time being]

    -3. COMMAND LINE MODIFIERS -

    +3. COMMAND LINE MODIFIERS +

    --no-ocn
    [with  -h  -H  or  -p] switches off object citation numbering. Produce output without identifying numbers -in margins of html or LaTeX/pdf output. +in margins of html or LaTeX/pdf output.

    --no-annotate
    strips output text of -editor endnotes[^*1] denoted by asterisk or dagger/plus sign +editor endnotes[^*1] denoted by asterisk or dagger/plus sign

    --no-asterisk
    -
    strips output text of editor endnotes[^*2] denoted by asterisk sign +
    strips output text of editor endnotes[^*2] denoted by asterisk sign

    --no-dagger
    -
    strips output text of editor endnotes[^+1] denoted by dagger/plus sign +
    strips output text of editor endnotes[^+1] denoted by dagger/plus sign

    -4. DATABASE COMMANDS -

    dbi - database interface +4. DATABASE COMMANDS +

    dbi - database interface

    -D or --pgsql set for postgresql -d or --sqlite default set for sqlite -d is modifiable with --db=[database  type - (pgsql  or  sqlite)] -

    + (pgsql  or  sqlite)] +

    -Dv --createall
    @@ -483,13 +483,13 @@ created manually and given the same name as working directory, as requested) -Dv --createdb initially NOTE: at the present time for postgresql it may be necessary to manually create the database. The command would be ’createdb [database name]’ where database name would be SiSU_[present  working  directory - name  (without  path)]. Please use only alphanumerics and underscores. + name  (without  path)]. Please use only alphanumerics and underscores.

    -Dv --import
    [filename/wildcard] imports data specified to postgresql db (rb.dbi) -[  -dv  --import  sqlite  equivalent] +[  -dv  --import  sqlite  equivalent]

    -Dv --update
    @@ -500,18 +500,18 @@ specified data to postgresql db (rb.dbi) [  -dv  --update  sqlite
    -D --remove
    [filename/wildcard] removes specified data to postgresql db (rb.dbi) -[  -d  --remove  sqlite  equivalent] +[  -d  --remove  sqlite  equivalent]

    -D --dropall
    kills data --dropall  sqlite  equivalent] -

    The v in e.g. -Dv is for verbose output. +

    The v in e.g. -Dv is for verbose output.

    5. SHORTCUTS, SHORTHAND FOR MULTIPLE -FLAGS -

    +FLAGS +

    --update [filename/wildcard]
    @@ -520,30 +520,30 @@ the flags required to update this output. This means that if only html and pdf output was requested on previous runs, only the -hp files will be applied, and only these will be generated this time, together with the summary. This can be very convenient, if you offer different outputs of different files, -and just want to do the same again. +and just want to do the same again.

    -0 to -5 [filename  or  wildcard]
    Default shorthand mappings (note that the defaults can be changed/configured in -the sisurc.yml file): +the sisurc.yml file):

    -0
    -mNhwpAobxXyYv [this  is  the  default  action  run  when - no  i.e.  on  ’sisu  [filename]’] + no  i.e.  on  ’sisu  [filename]’]

    -1
    -
    -mNHwpy +
    -mNHwpy

    -2
    -
    -mNHwpaoy +
    -mNHwpaoy

    -3
    -
    -mNhwpAobxXyY +
    -mNhwpAobxXyY

    -4
    @@ -551,164 +551,164 @@ the sisurc.yml file):

    -

    - -

    import +

    import

    -5
    -
    -mNhwpAobxXDyY --update +
    -mNhwpAobxXDyY --update

    add -v for verbose mode and -c for color, -e.g. sisu -2vc [filename  or +e.g. sisu -2vc [filename  or

    consider -u for appended url info or -v for verbose -

    output +

    output

    -5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING +5.1 COMMAND LINE WITH FLAGS - BATCH PROCESSING

    In the data directory -run sisu -mh filename or wildcard eg. cisg.sst documents. +run sisu -mh filename or wildcard eg. cisg.sst documents.

    Running sisu (alone without any flags, filenames or wildcards) brings up the interactive help, -as does any sisu command that is not recognised. Enter to escape. +as does any sisu command that is not recognised. Enter to escape.

    6. HELP - -

    6.1 SISU MANUAL + +

    6.1 SISU MANUAL

    The most up to date information on sisu should be contained -in the sisu_manual, available at: +in the sisu_manual, available at:

    <http://sisudoc.org/sisu/sisu_manual/ >
    - +

    The manual can be generated from source, found respectively, either -within the SiSU tarball or installed locally at: +within the SiSU tarball or installed locally at:

    ./data/doc/sisu/sisu_markup_samples/sisu_manual/
    - +

    /usr/share/doc/sisu/sisu_markup_samples/sisu_manual/
    - -

    move to the respective directory and type e.g.: + +

    move to the respective directory and type e.g.:

    sisu sisu_manual.ssm
    - -

    6.2 SISU MAN PAGES + +

    6.2 SISU MAN PAGES

    If SiSU is installed on your system usual man commands -should be available, try: +should be available, try:

    man sisu
    - +

    man sisu_markup
    - +

    man sisu_commands
    - +

    Most SiSU man pages are generated directly from sisu documents that are used to prepare the sisu manual, the sources files for which are located -within the SiSU tarball at: +within the SiSU tarball at:

    ./data/doc/sisu/sisu_manual/
    - -

    Once installed, directory equivalent to: + +

    Once installed, directory equivalent to:

    /usr/share/doc/sisu/sisu_manual/
    - -

    Available man pages are converted back to html using man2html: + +

    Available man pages are converted back to html using man2html:

    /usr/share/doc/sisu/html/
    - +

    ./data/doc/sisu/html/
    - -

    An online version of the sisu man page is available here: + +

    An online version of the sisu man page is available here:

    * various sisu man pages <http://www.jus.uio.no/sisu/man/ -> [^7] +> [^7]

    * sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1.html > -[^8] -

    6.3 SISU BUILT-IN INTERACTIVE HELP +[^8] +

    6.3 SISU BUILT-IN INTERACTIVE HELP

    This is particularly useful for -getting the current sisu setup/environment information: +getting the current sisu setup/environment information:

    sisu --help
    - +

    sisu --help [subject]
    - +

    sisu --help commands
    - +

    sisu --help markup
    - +

    sisu --help env [for  feedback  on  the  way  your  system  is
    setup  with  regard  to  sisu]
    - +

    sisu -V [environment  information,  same  as  above  command]
    - +

    sisu (on its own provides version and some help information)
    - +

    Apart from real-time information on your current configuration the SiSU manual and man pages are likely to contain more up-to-date information than -the sisu interactive help (for example on commands and markup). +the sisu interactive help (for example on commands and markup).

    NOTE: Running the command sisu (alone without any flags, filenames or wildcards) brings up the interactive help, as does any sisu command that is not recognised. -Enter to escape. -

    6.4 HELP SOURCES +Enter to escape. +

    6.4 HELP SOURCES

    For lists of alternative help sources, -see: -

    man page +see: +

    man page

    man sisu_help_sources
    - -

    man2html + +

    man2html

    /usr/share/doc/sisu/sisu_manual/sisu_help_sources/index.html
    - -

    sisu generated html + +

    sisu generated html

    /usr/share/doc/sisu/html/sisu_help_sources/index.html
    - +

    <http://sisudoc.org/sisu/sisu_help_sources/index.html >
    - -

    7. INTRODUCTION TO SISU MARKUP[^9] -

    7.1 SUMMARY + +

    7. INTRODUCTION TO SISU MARKUP[^9] +

    7.1 SUMMARY

    SiSU source documents -are plaintext (UTF-8)[^10] files +are plaintext (UTF-8)[^10] files

    All paragraphs are separated by an empty -line. -

    Markup is comprised of: +line. +

    Markup is comprised of:

    * at the top of a document, the document header made up of semantic meta-data about the document and if desired additional processing instructions (such an instruction to automatically number headings -from a particular level down) +from a particular level down)

    * followed by the prepared substantive text of which the most important single characteristic is the markup of different heading levels, which define the primary outline of the document -structure. Markup of substantive text includes: +structure. Markup of substantive text includes:

    * heading levels defines document structure
    - +

    * text basic attributes, italics, bold etc.
    - +

    * grouped text (objects), which are to be treated differently, such as code
    blocks or poems.
    - +

    * footnotes/endnotes
    - +

    * linked text and images
    - +

    * paragraph actions, such as indent, bulleted, numbered-lists, etc.
    - +

    Some interactive help on markup is available, by typing sisu and selecting -

    markup or sisu --help markup -

    To check the markup in a file: +

    markup or sisu --help markup +

    To check the markup in a file:

    sisu --identify [filename].sst
    - -

    For brief descriptive summary of markup history + +

    For brief descriptive summary of markup history

    sisu --query-history
    - -

    or if for a particular version: + +

    or if for a particular version:

    sisu --query-0.38
    - -

    7.2 MARKUP EXAMPLES -

    7.2.1 ONLINE + +

    7.2 MARKUP EXAMPLES +

    7.2.1 ONLINE

    Online markup examples are available together with the respective outputs produced from <http://www.jus.uio.no/sisu/SiSU/examples.html > or from <http://www.jus.uio.no/sisu/sisu_examples/ -> +>

    There is of course this document, which provides a cursory overview of sisu markup and the respective output produced: <http://www.jus.uio.no/sisu/sisu_markup/ -> +>

    Some example marked up files are available as html with syntax highlighting for viewing: <http://www.jus.uio.no/sisu/sample/syntax > @@ -716,28 +716,28 @@ up files are available as html with syntax highlighting for viewing: < an alternative presentation of markup syntax: <http://www.jus.uio.no/sisu/sample/on_markup.txt > -

    7.2.2 INSTALLED +

    7.2.2 INSTALLED

    With SiSU installed sample skins may be found in: /usr/share/doc/sisu/sisu_markup_samples/dfsg (or equivalent directory) and if sisu-markup-samples is installed also under: -

    /usr/share/doc/sisu/sisu_markup_samples/non-free -

    8. MARKUP OF HEADERS +

    /usr/share/doc/sisu/sisu_markup_samples/non-free +

    8. MARKUP OF HEADERS

    Headers consist of semantic meta-data about a document, which can be used by any output module of the program; and may in addition include extra -processing instructions. +processing instructions.

    Note: the first line of a document may include information on the markup version used in the form of a comment. Comments are a percentage mark at the start of a paragraph (and as the first character -in a line of text) followed by a space and the comment: -

    +in a line of text) followed by a space and the comment: +


      % this would be a comment
     
    -

    8.1 SAMPLE HEADER +

    8.1 SAMPLE HEADER

    This current document has a header similar to this -one (without the comments): -

    +one (without the comments): +


      % SiSU 0.57
       @title: SiSU
    @@ -775,50 +775,50 @@ documents that request them, all documents in a directory, or be site-wide.
       { SiSU Download }http://www.jus.uio.no/sisu/SiSU/download.html
       { SiSU Changelog }http://www.jus.uio.no/sisu/SiSU/changelog.html
     
    -

    8.2 AVAILABLE HEADERS +

    8.2 AVAILABLE HEADERS

    Header tags appear at the beginning of a document and provide meta information on the document (such as the Dublin Core), or information as to how the document as a whole is to be processed. All header instructions take either the form @headername: or 0~headername. All -

    Dublin Core meta tags are available +

    Dublin Core meta tags are available

    @indentifier: information or instructions -

    where the information +

    where the information

    Note: a header where used should only be used once; all headers apart from @title: are optional; the @structure: header -is used to describe document structure, and can be useful to know. +is used to describe document structure, and can be useful to know.

    This -

    is a sample header +

    is a sample header

    % SiSU 0.38 [declared  file-type  identifier  with  markup - version] -

    + version] +

    @title:  [title  text] This is the title of the document and used as such, this header is the only one that is
    - mandatory -

    @subtitle: The Subtitle if any + mandatory +

    @subtitle: The Subtitle if any

    @creator: [or  @author:] Name -

    of Author -

    @subject: (whatever your subject) -

    @description: +

    of Author +

    @subject: (whatever your subject) +

    @description:

    @publisher: -

    @contributor: -

    @translator:  [or  @translated_by:] +

    @contributor: +

    @translator:  [or  @translated_by:]

    @illustrator:  [or - @illustrated_by:] -

    @prepared_by:  [or  @digitized_by:] + @illustrated_by:] +

    @prepared_by:  [or  @digitized_by:]

    @date: 2000-08-27 -[  also  @date.created:  @date.issued:  @date.available:  @date.valid:  ] -

    +[  also  @date.created:  @date.issued:  @date.available:  @date.valid:  ] +

    @type: -

    article -

    @format: -

    @identifier: -

    @source: +

    article +

    @format: +

    @identifier: +

    @source:

    @language: [or  @language.document:] [country  code  for  language  if  available,  or  language,  English,  en  is  the  default  setting] (en - English, fr - French, de - German, it - Italian, es @@ -826,50 +826,50 @@ used as such, this header is the only one that is
    is - Icelandic, nl - Dutch, et - Estonian, hu - Hungarian, pl - Polish, ro - Romanian, ru - Russian, el - Greek, uk - Ukranian, tr - Turkish, sk - Slovak, sl - Slovenian, hr - Croatian, cs - Czech, bg - Bul garian ) [however,  encodings - are  not  available  for  all  of  the languages  listed.] + are  not  available  for  all  of  the languages  listed.]

    [@language.original: - original  language  in  which  the  work  was published] + original  language  in  which  the  work  was published]

    @papersize: (A4|US_letter|book_B5|book_A5|US_legal) -

    @relation: -

    @coverage: +

    @relation: +

    @coverage:

    @rights: Copyright (c) Name of Right Holder, all rights reserved, or as granted: public domain, copyleft, creative commons -variant, etc. -

    @owner: +variant, etc. +

    @owner:

    @keywords: text document generation processing management latex pdf structured xml citation [your  keywords  here,  used - for  example  by  rss  feeds, + for  example  by  rss  feeds,

    @abstract: [paper  abstract,  placed  after  table - of  contents] -

    @comment: [...] + of  contents] +

    @comment: [...]

    @catalogue: loc=[Library  of  Congress  classification]; dewey=[Dewey rss  feeds, isbn=[ISBN]; pg=[Project  Gutenberg  text  number] -

    @classify_loc: [Library  of  Congress  classification] +

    @classify_loc: [Library  of  Congress  classification]

    @classify_dewey: -[Dewey  classification] -

    @classify_isbn: [ISBN] +[Dewey  classification] +

    @classify_isbn: [ISBN]

    @classify_pg: [Project - Gutenberg  text  number] + Gutenberg  text  number]

    @prefix: [prefix  is  placed  just  after  table  of - contents] + contents]

    @prefix_a: [prefix  is  placed  just  before  table  of  contents - -  not -

    @prefix_b: + -  not +

    @prefix_b:

    @rcs: $Id: sisu_markup.sst,v 1.2 2007/09/08 17:12:47 ralph Exp $ [used  by  rcs or  cvs  to  embed  version  (revision  control)  information  into document,  rcs  or  cvs  can  usefully  provide  a  history  of updates  to - a  document  ] + a  document  ]

    @structure: PART; CHAPTER; SECTION; ARTICLE; none; none; optional, document structure can be defined by words to match or regular expression (the regular expression is assumed to start at the beginning of a line of text i.e. ^) default markers :A~ to :C~ and 1~ to 6~ can be used within text instead, without this header tag, and may be used to supplement the instructions provided in this header tag if provided (@structure: is -a synonym for @toc:) +a synonym for @toc:)

    @level: newpage=3; breakpage=4 [paragraph  level, - used  by  latex  to  breakpages,  the  page  is  optional  eg.  in  newpage] + used  by  latex  to  breakpages,  the  page  is  optional  eg.  in  newpage]

    @markup: information on the markup used, e.g. new=1,2,3; break=4; num_top=4 [or is newpage=1,2,3;  breakpage=4;  num_top=4] newpage and breakpage, heading level, @@ -883,17 +883,17 @@ page for both single and double column texts. num_top=4 [auto-number  docum  is provided  within  document,  without  the  repetition  of  a  number in  a  header.] [In  0.38  notation,  you  would  map  to  the equivalent  levels,  the  examples  provided  would  map  to  the following  new=A,B,C;  break=1;  num_top=1  [or  newpage=A,B,C; -breakpage=1;  num_top=1] see headings] +breakpage=1;  num_top=1] see headings]

    @bold: [regular  expression  of  words/phrases - to  be  made  bold] + to  be  made  bold]

    @italics: [regular  expression  of  words/phrases  to  italicise]

    @vocabulary: name of taxonomy/vocabulary/wordlist to use against document

    @skin: skin_doc_[name_of_desired_document_skin] skins change default settings related to the appearance of documents generated, such as the -urls of the home site, and the icon/logo for the document or site. -

    +urls of the home site, and the icon/logo for the document or site. +

    @man: @@ -903,56 +903,56 @@ formats, and search; synopsis=sisu [-abcDdFHhIiMmNnopqRrSsTtUuVvwXxYyZz0-9] [filename/wildcard ] sisu [-Ddcv] [instruction] sisu [-CcFLSVvW] the man page category number (default 1) and special tags used in preparing man -

    page headings +

    page headings

    @links: { SiSU }http://www.jus.uio.no/sisu/; { FSF }http://www.fsf.org

    @promo: sisu, ruby, search_libre_docs, open_society [places  content  in  right  pane  in  html,  makes  use  of  commented  out  sample  in  document and  promo.yml, - commented  out  sample  in  document + commented  out  sample  in  document

    -9. MARKUP OF SUBSTANTIVE TEXT +9. MARKUP OF SUBSTANTIVE TEXT

    9.1 HEADING -

    LEVELS +

    LEVELS

    Heading levels are :A~ ,:B~ ,:C~ ,1~ ,2~ ,3~ ... :A - :C being part / section headings, followed by other heading levels, and 1 -6 being headings followed by substantive text or sub-headings. :A~ usually the title :A~? conditional level 1 heading (used where a stand-alone document may be imported -into another) +into another)

    :A~ [heading  text] Top level heading [this  usually  has  similar  content  to  the  ] NOTE: the heading levels described here are in -0.38 notation, see heading +0.38 notation, see heading

    :B~ [heading  text] Second level heading [this - is  a  heading  level  divider] + is  a  heading  level  divider]

    :C~ [heading  text] Third level heading [this - is  a  heading  level  divider] + is  a  heading  level  divider]

    1~ [heading  text] Top level heading preceding substantive text of document or sub-heading 2, the heading level that would normally be marked 1. or 2. or 3. etc. in a document, and the level on which sisu by default would break html output into named segments, names are provided automatically if none are given (a number), otherwise takes the -

    form 1~my_filename_for_this_segment +

    form 1~my_filename_for_this_segment

    2~ [heading  text] Second level heading preceding substantive text of document or sub-heading 3, the heading level -that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc. in a document. -

    +that would normally be marked 1.1 or 1.2 or 1.3 or 2.1 etc. in a document. +

    3~ [heading  text] Third level heading preceding substantive text of document, that would normally be marked 1.1.1 or 1.1.2 or 1.2.1 or 2.1.1 etc. in a document -

    +


      1~filename level 1 heading,
       % the primary division such as Chapter that is followed by substantive
     text, and may be further subdivided (this is the level on which by default
     html segments are made)
     
    -

    9.2 FONT ATTRIBUTES -

    markup example: -

    +

    9.2 FONT ATTRIBUTES +

    markup example: +


      normal text !{emphasis}! *{bold text}* _{underscore}_ /{italics}/
       normal text
    @@ -960,192 +960,192 @@ html segments are made)
       *{bold text}*
       _{underscore}_
       /{italics}/
    -
    + 
       ^{superscript}^
       ,{subscript},
       +{inserted text}+
       -{strikethrough}-
     
    -

    resulting output: +

    resulting output:

    normal text emphasis bold text underscore italics <cite>citation</cite> ^superscript^  [subscript] <ins>inserted text</ins> <del>strikethrough</del> -

    normal text -

    -

    bold text -

    underscore -

    italics -

    <cite>citation</cite> +

    normal text +

    +

    bold text +

    underscore +

    italics +

    <cite>citation</cite>

    - ^superscript^ -

    [subscript] -

    <ins>inserted text</ins> + ^superscript^ +

    [subscript] +

    <ins>inserted text</ins>

    <del>strikethrough</del> -

    9.3 INDENTATION AND BULLETS -

    markup example: -

    +

    9.3 INDENTATION AND BULLETS +

    markup example: +


      ordinary paragraph
       _1 indent paragraph one step
       _2 indent paragraph two steps
       _9 indent paragraph nine steps
     
    -

    -

    resulting output: -

    ordinary paragraph +

    +

    resulting output: +

    ordinary paragraph

    indent paragraph one step
    - +

    indent paragraph two steps
    - +

    indent paragraph nine steps
    - -

    markup example: -

    + +

    markup example: +


      _* bullet text
       _1* bullet text, first indent
       _2* bullet text, two step indent
     
    -

    resulting output: -

    * bullet text +

    resulting output: +

    * bullet text

    * bullet text, first indent
    - +

    * bullet text, two step indent
    - +

    Numbered List (not to be confused with headings/titles, (document structure)) -

    markup example: -

    +

    markup example: +


      # numbered list                numbered list 1., 2., 3, etc.
       _# numbered list numbered list indented a., b., c., d., etc.
     
    -

    9.4 FOOTNOTES / ENDNOTES +

    9.4 FOOTNOTES / ENDNOTES

    Footnotes and endnotes not distinguished in markup. They are automatically numbered. Depending on the output file format (html, odf, pdf etc.), the document output selected will have either footnotes -or endnotes. -

    markup example: -

    +or endnotes. +

    markup example: +


      ~{ a footnote or endnote }~
     
    -

    resulting output: -

    [^11] -

    markup example: -

    +

    resulting output: +

    [^11] +

    markup example: +


      normal text~{ self contained endnote marker & endnote in one }~ continues
     
    -

    resulting output: -

    normal text[^12] continues -

    markup example: -

    +

    resulting output: +

    normal text[^12] continues +

    markup example: +


      normal text ~{* unnumbered asterisk footnote/endnote, insert multiple
     asterisks if required }~ continues
       normal text ~{** another unnumbered asterisk footnote/endnote }~ continues
     
    -

    resulting output: -

    normal text [^*] continues +

    resulting output: +

    normal text [^*] continues

    normal text [^**] continues -

    -

    markup example: -

    +

    +

    markup example: +


      normal text ~[*  editors  notes,  numbered  asterisk  footnote/endnote  series
      ]~ continues
       normal text ~[+  editors  notes,  numbered  asterisk  footnote/endnote  series
      ]~ continues
     
    -

    resulting output: -

    normal text [^*3] continues +

    resulting output: +

    normal text [^*3] continues

    normal text [^+2] continues -

    -

    Alternative endnote pair notation for footnotes/endnotes: -

    +

    +

    Alternative endnote pair notation for footnotes/endnotes: +


      % note the endnote marker
       normal text~^ continues
       ^~ endnote text following the paragraph in which the marker occurs
     
    -

    the standard and pair notation cannot be mixed in the same document +

    the standard and pair notation cannot be mixed in the same document

    -

    9.5 LINKS -

    9.5.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS +

    9.5 LINKS +

    9.5.1 NAKED URLS WITHIN TEXT, DEALING WITH URLS

    urls are found within text and marked up automatically. A url within text is automatically hyperlinked to itself and by default decorated with angled braces, unless they are contained within a code block (in which case they are passed as normal text), or escaped by a preceding underscore (in which case the decoration -is omitted). -

    markup example: -

    +is omitted). +

    markup example: +


      normal text http://www.jus.uio.no/sisu continues
     
    -

    resulting output: +

    resulting output:

    normal text <http://www.jus.uio.no/sisu -> continues +> continues

    An -

    escaped url without decoration -

    markup example: -

    +

    escaped url without decoration +

    markup example: +


      normal text http://www.jus.uio.no/sisu continues
       deb http://www.jus.uio.no/sisu/archive unstable main non-free
     
    -

    resulting output: +

    resulting output:

    normal text http://www.jus.uio.no/sisu - continues + continues

    deb

    http://www.jus.uio.no/sisu/archive - unstable main non-free + unstable main non-free

    where a code block is used there is neither decoration nor hyperlinking, code blocks are discussed -

    later in this document -

    resulting output: -

    +

    later in this document +

    resulting output: +


      deb http://www.jus.uio.no/sisu/archive unstable main non-free
       deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
     
    -

    To link text or an image to a url the markup is as follows +

    To link text or an image to a url the markup is as follows

    markup example: -

    +


      about { SiSU }http://url.org markup
     
    -

    9.5.2 LINKING TEXT -

    resulting output: +

    9.5.2 LINKING TEXT +

    resulting output:

    about SiSU <http://www.jus.uio.no/sisu/ > -

    markup +

    markup

    A shortcut notation is available so the url link may also be provided -

    automatically as a footnote -

    markup example: -

    +

    automatically as a footnote +

    markup example: +


      about {~^ SiSU }http://url.org markup
     
    -

    resulting output: +

    resulting output:

    about SiSU <http://www.jus.uio.no/sisu/ -> [^13] markup +> [^13] markup

    -

    9.5.3 LINKING IMAGES -

    markup example: -

    +

    9.5.3 LINKING IMAGES +

    markup example: +


          [ tux.png ]
       % various url linked images
    @@ -1153,37 +1153,37 @@ is used there is neither decoration nor hyperlinking, code blocks are discussed
           [ GnuDebianLinuxRubyBetterWay.png ]
       {~^ ruby_logo.png
     
    -

    resulting output: -

    [ tux.png ] -

    tux.png 64x80 +

    resulting output: +

    [ tux.png ] +

    tux.png 64x80

    [  ruby_logo  (png  missing) - ]  [^14] -

    GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby + ]  [^14] +

    GnuDebianLinuxRubyBetterWay.png 100x101 and Ruby

    linked url footnote -

    shortcut -

    +

    shortcut +


      {~^  [text  to  link] }http://url.org
       % maps to: {  [text  to  link] }http://url.org ~{ http://url.org }~
       % which produces hyper-linked text within a document/paragraph, with an
     endnote providing the url for the text location used in the hyperlink
     
    -

    +


      text marker *~name
     

    note at a heading level the same is automatically achieved by providing names to headings 1, 2 and 3 i.e. 2~[name] and 3~[name] or in the case of -auto-heading numbering, without further intervention. -

    9.6 GROUPED TEXT +auto-heading numbering, without further intervention. +

    9.6 GROUPED TEXT

    9.6.1 -

    TABLES -

    Tables may be prepared in two either of two forms +

    TABLES +

    Tables may be prepared in two either of two forms

    markup example: -

    +


      table{ c3; 40; 30; 30;
       This is a table
    @@ -1194,14 +1194,14 @@ auto-heading numbering, without further intervention.
       column three of row two, and so on
       }table
     
    -

    resulting output: +

    resulting output:

     [table  omitted,  see  other  document  formats]
    - +

    a second form may be easier to work with in cases where there is not -

    much information in each column -

    markup example: [^15] -

    +

    much information in each column +

    markup example: [^15] +


      !_ Table 3.1: Contributors to Wikipedia, January 2001 - June 2005
       {table~h 24; 12; 12; 12; 12; 12; 12;}
    @@ -1213,38 +1213,38 @@ auto-heading numbering, without further intervention.
        8,442|   16,945
       Very active contributors***     |        0|       31|      190|      692|
        1,639|    3,016
    -  No. of English language articles|       25|   16,000|  101,000|  190,000|
    +  No. of English language articles|       25|   16,000|  101,000|  190,000| 
     320,000|  630,000
    -  No. of articles, all languages  |       25|   19,000|  138,000|  490,000|
    +  No. of articles, all languages  |       25|   19,000|  138,000|  490,000| 
     862,000|1,600,000
       \* Contributed at least ten times; \** at least 5 times in last month;
     \* more than 100 times in last month.
     
    -

    resulting output: +

    resulting output:

    Table 3.1: Contributors to Wikipedia, January 2001 -- June 2005 +- June 2005

     [table  omitted,  see  other  document  formats]
    - +

    * Contributed at least ten times; ** at least 5 times in last month; -*** more than 100 times in last month. -

    9.6.2 POEM -

    basic markup: -

    +*** more than 100 times in last month. +

    9.6.2 POEM +

    basic markup: +


      poem{
         Your poem here
       }poem
       Each verse in a poem is given a separate object number.
     
    -

    markup example: -

    +

    markup example: +


      poem{
                           ’Fury said to a
                          mouse, That he
                        met in the
                      house,
    -
    + 
                     both go to
                       law:  I will
                         prosecute
    @@ -1269,13 +1269,13 @@ auto-heading numbering, without further intervention.
                     wasting
                    our
                     breath.
    -
    + 
                        judge, I’ll
                          be jury,
                                Said
                           cunning
                             old Fury:
    -
    + 
                             try the
                                whole
                                 cause,
    @@ -1286,8 +1286,8 @@ auto-heading numbering, without further intervention.
                              death.
       }poem
     
    -

    resulting output: -

    +

    resulting output: +

    ’Fury said to a
    mouse, That he
    met in the
    @@ -1332,25 +1332,25 @@ auto-heading numbering, without further intervention. you
    to
    death.
    - -

    9.6.3 GROUP -

    basic markup: -

    + +

    9.6.3 GROUP +

    basic markup: +


      group{
         Your grouped text here
       }group
       A group is treated as an object and given a single object number.
     
    -

    markup example: -

    +

    markup example: +


      group{
                           ’Fury said to a
                          mouse, That he
                        met in the
                      house,
    -
    + 
                     both go to
                       law:  I will
                         prosecute
    @@ -1375,13 +1375,13 @@ auto-heading numbering, without further intervention.
                     wasting
                    our
                     breath.
    -
    + 
                        judge, I’ll
                          be jury,
                                Said
                           cunning
                             old Fury:
    -
    + 
                             try the
                                whole
                                 cause,
    @@ -1392,8 +1392,8 @@ auto-heading numbering, without further intervention.
                              death.
       }group
     
    -

    resulting output: -

    +

    resulting output: +

    ’Fury said to a
    mouse, That he
    met in the
    @@ -1438,25 +1438,25 @@ auto-heading numbering, without further intervention. you
    to
    death.
    - -

    9.6.4 CODE + +

    9.6.4 CODE

    Code tags are used to escape regular sisu markup, and have been used extensively within this document to provide examples of SiSU markup. You cannot however use code tags to escape code tags. They are however -used in the same way as group or poem tags. +used in the same way as group or poem tags.

    A code-block is treated as an object and given a single object number. [an more than 100 times in last month. option  to  number  each  line  of  code  may  be  considered  at more than -100 times in last month. some  later  time] +100 times in last month. some  later  time]

    use of code tags instead of -poem compared, resulting output: -

    +poem compared, resulting output: +


                          ’Fury said to a
                          mouse, That he
                        met in the
                      house,
    -
    + 
                     both go to
                       law:  I will
                         prosecute
    @@ -1481,13 +1481,13 @@ poem compared, resulting output:
                     wasting
                    our
                     breath.
    -
    + 
                        judge, I’ll
                          be jury,
                                Said
                           cunning
                             old Fury:
    -
    + 
                             try the
                                whole
                                 cause,
    @@ -1497,7 +1497,59 @@ poem compared, resulting output:
                             to
                              death.
     
    -

    10. COMPOSITE DOCUMENTS MARKUP +

    9.7 BOOK INDEX +

    To make an index append to paragraph the book index term +relates to it, using an equal sign and curly braces. +

    Currently two levels +are provided, a main term and if needed a sub-term. Sub-terms are separated +from the main term by a colon. +

    +


    +

        Paragraph containing main term and sub-term.
    +    ={Main term:sub-term}
    +
    +

    The index syntax starts on a new line, but there should not be an empty +line between paragraph and index markup. +

    The structure of the resulting +index would be: +

    +


    +

        Main term, 1
    +      sub-term, 1
    +
    +

    Several terms may relate to a paragraph, they are separated by a semicolon. +If the term refers to more than one paragraph, indicate the number of paragraphs. + +

    +


    +

        Paragraph containing main term, second term and sub-term.
    +    ={first term; second term: sub-term}
    +
    +

    The structure of the resulting index would be: +

    +


    +

        First term, 1,
    +    Second term, 1,
    +      sub-term, 1
    +
    +

    If multiple sub-terms appear under one paragraph, they are separated under +the main term heading from each other by a pipe symbol. +

    +


    +

        Paragraph containing main term, second term and sub-term.
    +    ={Main term:sub-term+1|second sub-term
    +    A paragraph that continues discussion of the first sub-term
    +
    +

    The plus one in the example provided indicates the first sub-term spans +one additional paragraph. The logical structure of the resulting index would +be: +

    +


    +

        Main term, 1,
    +      sub-term, 1-3,
    +      second sub-term, 1,
    +
    +

    10. COMPOSITE DOCUMENTS MARKUP

    It is possible to build a document by creating a master document that requires other documents. The documents required may be complete documents that could be generated independently, @@ -1511,11 +1563,11 @@ within a master document .sst regular markup file, or .ssi (insert

    A secondary file of the composite document is built prior to processing -

    with the same prefix and the suffix ._sst +

    with the same prefix and the suffix ._sst

    basic markup for importing a -

    document into a master document -

    +

    document into a master document +


      << filename1.sst
       << filename2.ssi
    @@ -1525,83 +1577,83 @@ results in the text thus linked becoming hyperlinked to the document it
     is calling in which is convenient for editing. Alternative markup for importation
     of documents under consideration, and occasionally supported have been.
     
    -

    +


      << filename.ssi
       <<{filename.ssi}
       % using textlink alternatives
       << |filename.ssi|@|^|
     
    -

    MARKUP SYNTAX HISTORY +

    MARKUP SYNTAX HISTORY

    11. NOTES RELATED TO FILES-TYPES AND MARKUP SYNTAX - +

    0.38 is substantially current, depreciated 0.16 supported, though file -

    names were changed at 0.37 +

    names were changed at 0.37

    * sisu --query=[sisu  version  [0.38] or ’history] -

    provides a short history of changes to SiSU markup +

    provides a short history of changes to SiSU markup

    0.57 (2007w34/4) SiSU 0.57 is the same as 0.42 with the introduction of some a shortcut to use the headers @title and @creator in the first heading [expanded  using - the  and  @author:] -

    + the  and  @author:] +


      :A~ @title by @author
     

    0.52 (2007w14/6) declared document type identifier at start of text/document:

    .B SiSU
    - 0.52 -

    or, backward compatible using the comment marker: + 0.52 +

    or, backward compatible using the comment marker:

    %
    - SiSU 0.38 + SiSU 0.38

    variations include ’ SiSU (text|master|insert) [version]’ and ’sisu-[version]’ -

    0.51 (2007w13/6) skins changed (simplified), markup unchanged +

    0.51 (2007w13/6) skins changed (simplified), markup unchanged

    0.42 (2006w27/4) -* (asterisk) type endnotes, used e.g. in relation to author +* (asterisk) type endnotes, used e.g. in relation to author

    SiSU 0.42 is the same as 0.38 with the introduction of some additional endnote types,

    Introduces some variations on endnotes, in particular the use of the -

    asterisk -

    +

    asterisk +


      ~{* for example for describing an author }~ and ~{** for describing a
     second author }~
     
    -

    * for example for describing an author +

    * for example for describing an author

    ** for describing a second author -

    and -

    +

    and +


      ~[*  my  note  ]~ or ~[+  another  note  ]~
     
    -

    which numerically increments an asterisk and plus respectively +

    which numerically increments an asterisk and plus respectively

    *1 my -

    note +1 another note +

    note +1 another note

    0.38 (2006w15/7) introduced new/alternative notation for headers, e.g. @title: (instead of 0~title), and accompanying document -structure markup, :A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6) +structure markup, :A,:B,:C,1,2,3 (maps to previous 1,2,3,4,5,6)

    SiSU 0.38 introduced alternative experimental header and heading/structure markers, -

    +


      @headername: and headers :A~ :B~ :C~ 1~ 2~ 3~
     
    -

    as the equivalent of: -

    +

    as the equivalent of: +


      0~headername and headers 1~ 2~ 3~ 4~ 5~ 6~
     

    The internal document markup of SiSU 0.16 remains valid and standard Though -

    note that SiSU 0.37 introduced a new file naming convention +

    note that SiSU 0.37 introduced a new file naming convention

    SiSU has in effect two sets of levels to be considered, using 0.38 notation A-C headings/levels, pre-ordinary paragraphs /pre-substantive text, and 1-3 headings/levels, levels @@ -1617,45 +1669,45 @@ your face and likely to be understood fairly quickly); the substantive text follows levels 1,2,3 and it is ’nice’ to do most work in those levels

    0.37 (2006w09/7) introduced new file naming convention, .sst (text), .ssm -(master), .ssi (insert), markup syntax unchanged +(master), .ssi (insert), markup syntax unchanged

    SiSU 0.37 introduced new file naming convention, using the file extensions .sst .ssm and .ssi to replace .s1 .s2 .s3 .r1 .r2 .r3 and .si
    - -

    this is captured by the following file ’rename’ instruction: -

    + +

    this is captured by the following file ’rename’ instruction: +


      rename ’s/.s[123]$/.sst/’ *.s{1,2,3}
       rename ’s/.r[123]$/.ssm/’ *.r{1,2,3}
       rename ’s/.si$/.ssi/’ *.si
     
    -

    The internal document markup remains unchanged, from SiSU 0.16 +

    The internal document markup remains unchanged, from SiSU 0.16

    0.35 (2005w52/3) -sisupod, zipped content file introduced +sisupod, zipped content file introduced

    0.23 (2005w36/2) utf-8 for markup -

    file +

    file

    0.22 (2005w35/3) image dimensions may be omitted if rmagick is available -

    to be relied upon -

    0.20.4 (2005w33/4) header 0~links +

    to be relied upon +

    0.20.4 (2005w33/4) header 0~links

    0.16 (2005w25/2) substantial changes introduced to make markup cleaner, header 0~title type, and headings [1-6]~ introduced, also percentage sign (%) at start of a text line as comment -

    marker -

    SiSU 0.16 (0.15 development branch) introduced the use of +

    marker +

    SiSU 0.16 (0.15 development branch) introduced the use of

    the -header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~ +header 0~ and headings/structure 1~ 2~ 3~ 4~ 5~ 6~

    in place of the 0.1 -header, heading/structure notation +header, heading/structure notation

    SiSU 0.1 headers and headings structure -represented by header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{ +represented by header 0{~ and headings/structure 1{ 2{ 3{ 4{~ 5{ 6{

    12. -SISU FILETYPES +SISU FILETYPES

    SiSU has plaintext and binary filetypes, and can process -either type of document. -

    12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT +either type of document. +

    12.1 .SST .SSM .SSI MARKED UP PLAIN TEXT

    SiSU documents are prepared as plain-text (utf-8) files with SiSU markup. They may make reference to and contain images (for example), which are stored in the directory @@ -1664,259 +1716,259 @@ that may be distinguished by the file extension used: regular text .sst; master documents, composite documents that incorporate other text, which can be any regular text or text insert; and inserts the contents of which are like regular text except these are marked .ssi and are not processed.
    - +

    SiSU processing can be done directly against a sisu documents; which may be located locally or on a remote server for which a url is provided. -

    SiSU source markup can be shared with the command: +

    SiSU source markup can be shared with the command:

    sisu -s [filename]
    - -

    12.1.1 SISU TEXT - REGULAR FILES (.SST) + +

    12.1.1 SISU TEXT - REGULAR FILES (.SST)

    The most common form of document -in SiSU , see the section on SiSU markup. +in SiSU , see the section on SiSU markup.

    <http://www.jus.uio.no/sisu/sisu_markup >

    <http://www.jus.uio.no/sisu/sisu_manual -> -

    12.1.2 SISU MASTER FILES (.SSM) +> +

    12.1.2 SISU MASTER FILES (.SSM)

    Composite documents which incorporate other SiSU documents which may be either regular SiSU text .sst which may be generated independently, or inserts prepared solely for the purpose of being incorporated into one or more master documents.

    The mechanism by which master files incorporate other documents is described -as one of the headings under under SiSU markup in the SiSU manual. +as one of the headings under under SiSU markup in the SiSU manual.

    Note: Master documents may be prepared in a similar way to regular documents, and processing will occur normally if a .sst file is renamed .ssm without requiring any other documents; the .ssm marker flags that the document may -contain other documents. +contain other documents.

    Note: a secondary file of the composite document is built prior to processing with the same prefix and the suffix ._sst [^16]

    <http://www.jus.uio.no/sisu/sisu_markup -> +>

    <http://www.jus.uio.no/sisu/sisu_manual > -

    12.1.3 SISU INSERT FILES (.SSI) +

    12.1.3 SISU INSERT FILES (.SSI)

    Inserts are documents prepared solely for the purpose of being incorporated into one or more master documents. They resemble regular SiSU text files except they are ignored by the SiSU processor. Making a file a .ssi file is a quick and convenient way of flagging that -it is not intended that the file should be processed on its own. +it is not intended that the file should be processed on its own.

    12.2 SISUPOD, -ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP) +ZIPPED BINARY CONTAINER (SISUPOD.ZIP, .SSP)

    A sisupod is a zipped SiSU text file or set of SiSU text files and any associated images that they -contain (this will be extended to include sound and multimedia-files) -

    +contain (this will be extended to include sound and multimedia-files) +

    SiSU plaintext files rely on a recognised directory structure to find contents such as images associated with documents, but all images for example for all documents contained in a directory are located in the sub-directory _sisu/image. Without the ability to create a sisupod it can be inconvenient to manually identify all other files associated with a document. A sisupod automatically bundles all associated files with the document that is turned -into a pod. +into a pod.

    The structure of the sisupod is such that it may for example contain a single document and its associated images; a master document and its associated documents and anything else; or the zipped contents -of a whole directory of prepared SiSU documents. +of a whole directory of prepared SiSU documents.

    The command to create -a sisupod is: +a sisupod is:

    sisu -S [filename]
    - -

    Alternatively, make a pod of the contents of a whole directory: -

    + +

    Alternatively, make a pod of the contents of a whole directory: +

    sisu -S
    - +

    SiSU processing can be done directly against a sisupod; which may be -located locally or on a remote server for which a url is provided. +located locally or on a remote server for which a url is provided.

    <http://www.jus.uio.no/sisu/sisu_commands >

    <http://www.jus.uio.no/sisu/sisu_manual -> +>

    13. EXPERIMENTAL ALTERNATIVE INPUT -REPRESENTATIONS -

    13.1 ALTERNATIVE XML +REPRESENTATIONS +

    13.1 ALTERNATIVE XML

    SiSU offers alternative XML input representations of documents as a proof of concept, experimental feature. They are however not strictly maintained, and incomplete and should be -handled with care. +handled with care.

    convert from sst to simple xml representations (sax, -dom and node): +dom and node):

    sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
    - +

    sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
    - +

    sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
    - -

    + +

    convert to sst from any sisu xml representation (sax, dom and node):

    sisu --from-xml2sst [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    or the same: + +

    or the same:

    sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    13.1.1 XML SAX REPRESENTATION + +

    13.1.1 XML SAX REPRESENTATION

    To convert from sst to simple xml (sax) -representation: +representation:

    sisu --to-sax [filename/wildcard] or sisu --to-sxs [filename/wildcard]
    - -

    To convert from any sisu xml representation back to sst + +

    To convert from any sisu xml representation back to sst

    sisu --from-xml2sst [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    or the same: + +

    or the same:

    sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    13.1.2 XML DOM REPRESENTATION + +

    13.1.2 XML DOM REPRESENTATION

    To convert from sst to simple xml (dom) -representation: +representation:

    sisu --to-dom [filename/wildcard] or sisu --to-sxd [filename/wildcard]
    - -

    To convert from any sisu xml representation back to sst + +

    To convert from any sisu xml representation back to sst

    sisu --from-xml2sst [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    or the same: + +

    or the same:

    sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    13.1.3 XML NODE REPRESENTATION + +

    13.1.3 XML NODE REPRESENTATION

    To convert from sst to simple xml (node) -representation: +representation:

    sisu --to-node [filename/wildcard] or sisu --to-sxn [filename/wildcard]
    - -

    To convert from any sisu xml representation back to sst + +

    To convert from any sisu xml representation back to sst

    sisu --from-xml2sst [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    or the same: + +

    or the same:

    sisu --from-sxml [filename/wildcard  [.sxs.xml,.sxd.xml,sxn.xml]]
    - -

    14. CONFIGURATION -

    14.1 DETERMINING THE CURRENT CONFIGURATION + +

    14. CONFIGURATION +

    14.1 DETERMINING THE CURRENT CONFIGURATION

    Information on the current configuration of SiSU should be available with the help -command: +command:

    sisu -v
    - -

    which is an alias for: + +

    which is an alias for:

    sisu --help env
    - +

    Either of these should be executed from within a directory that contains -sisu markup source documents. -

    14.2 CONFIGURATION FILES (CONFIG.YML) +sisu markup source documents. +

    14.2 CONFIGURATION FILES (CONFIG.YML)

    SiSU configration parameters are adjusted in the configuration file, which can be used to override the defaults set. This includes such things as which directory interim processing should be done in and where the generated -output should be placed. +output should be placed.

    The SiSU configuration file is a yaml file, which -means indentation is significant. +means indentation is significant.

    SiSU resource configuration is determined -by looking at the following files if they exist: +by looking at the following files if they exist:

    ./_sisu/sisurc.yml
    - +

    ~/.sisu/sisurc.yml
    - +

    /etc/sisu/sisurc.yml
    - -

    The search is in the order listed, and the first one found is used. + +

    The search is in the order listed, and the first one found is used.

    In the absence of instructions in any of these it falls back to the internal -program defaults. +program defaults.

    Configuration determines the output and processing directories -and the database access details. +and the database access details.

    If SiSU is installed a sample sisurc.yml -

    may be found in /etc/sisu/sisurc.yml -

    15. SKINS +

    may be found in /etc/sisu/sisurc.yml +

    15. SKINS

    Skins modify the default appearance of document output on a document, directory, or site wide basis. -Skins are looked for in the following locations: +Skins are looked for in the following locations:

    ./_sisu/skin
    - +

    ~/.sisu/skin
    - +

    /etc/sisu/skin
    - +

    Within the skin directory are the following the default sub-directories -for document skins: +for document skins:

    ./skin/doc
    - +

    ./skin/dir
    - +

    ./skin/site
    - +

    A skin is placed in the appropriate directory and the file named skin_[name].rb

    The skin itself is a ruby file which modifies the default appearances -set in the program. -

    15.1 DOCUMENT SKIN +set in the program. +

    15.1 DOCUMENT SKIN

    Documents take on a document skin, -if the header of the document specifies a skin to be used. -

    +if the header of the document specifies a skin to be used. +


      @skin: skin_united_nations
     
    -

    15.2 DIRECTORY SKIN +

    15.2 DIRECTORY SKIN

    A directory may be mapped on to a particular skin, so all documents within that directory take on a particular appearance. If a skin exists in the skin/dir with the same name as the document directory, it will automatically be used for each of the documents in that directory, (except where a document specifies the use of another skin, in the skin/doc -directory). +directory).

    A personal habit is to place all skins within the doc directory, and symbolic links as needed from the site, or dir directories as required. -

    15.3 SITE SKIN -

    A site skin, modifies the program default skin. +

    15.3 SITE SKIN +

    A site skin, modifies the program default skin.

    15.4 SAMPLE -

    SKINS -

    With SiSU installed sample skins may be found in: +

    SKINS +

    With SiSU installed sample skins may be found in:

    /etc/sisu/skin/doc and
    /usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/doc
    - +

    (or equivalent directory) and if sisu-markup-samples is installed also -under: +under:

    /usr/share/doc/sisu/sisu_markup_samples/non-free/_sisu/skin/doc
    - +

    Samples of list.yml and promo.yml (which are used to create the right -column list) may be found in: +column list) may be found in:

    /usr/share/doc/sisu/sisu_markup_samples/dfsg/_sisu/skin/yml (or equivalent
    directory)
    - -

    16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML) + +

    16. CSS - CASCADING STYLE SHEETS (FOR HTML, XHTML AND XML)

    CSS files to modify the appearance of SiSU html, XHTML or XML may be placed in the configuration directory: ./_sisu/css; ~/.sisu/css or; /etc/sisu/css and these will be copied to the
    - output directories with the command sisu -CC. + output directories with the command sisu -CC.

    The basic CSS file for html output is html.css, placing a file of that name in directory _sisu/css or equivalent will result in the default file of that name being overwritten. -

    HTML: html.css -

    XML DOM: dom.css -

    XML SAX: sax.css -

    XHTML: xhtml.css +

    HTML: html.css +

    XML DOM: dom.css +

    XML SAX: sax.css +

    XHTML: xhtml.css

    - The default homepage may use homepage.css or html.css + The default homepage may use homepage.css or html.css

    Under consideration is to permit the placement of a CSS file with a different name in directory _sisu/css directory or equivalent, and change the default CSS file that -is looked for in a skin.[^17] -

    17. ORGANISING CONTENT +is looked for in a skin.[^17] +

    17. ORGANISING CONTENT

    17.1 DIRECTORY STRUCTURE -

    AND MAPPING +

    AND MAPPING

    The output directory root can be set in the sisurc.yml file. Under the root, subdirectories are made for each directory in which a document set resides. If you have a directory named poems or conventions, that directory @@ -1924,7 +1976,7 @@ will be created under the output directory root and the output for all documents contained in the directory of a particular name will be generated to subdirectories beneath that directory (poem or conventions). A document will be placed in a subdirectory of the same name as the document with -the filetype identifier stripped (.sst .ssm) +the filetype identifier stripped (.sst .ssm)

    The last part of a directory path, representing the sub-directory in which a document set resides, is the directory name that will be used for the output directory. This has @@ -1940,45 +1992,45 @@ named after each institution, and these would be output to the same output directory. Skins could be associated with each institution on a directory basis and resulting documents will take on the appropriate different appearance. -

    17.2 ORGANISING CONTENT -

    18. HOMEPAGES +

    17.2 ORGANISING CONTENT +

    18. HOMEPAGES

    SiSU is about the ability to auto-generate documents. Home pages are regarded as custom built items, and are not created by SiSU SiSU has a default home page, which will not be appropriate for use with other sites, and the means to provide your own home page instead -in one of two ways as part of a site’s configuration, these being: +in one of two ways as part of a site’s configuration, these being:

    1. through placing your home page and other custom built documents in the subdirectory _sisu/home/ (this probably being the easier and more convenient option) -

    2. through providing what you want as the home page in a skin, +

    2. through providing what you want as the home page in a skin,

    Document sets are contained in directories, usually organised by site or subject. Each directory can/should have its own homepage. See the section on directory -structure and organisation of content. +structure and organisation of content.

    18.1 HOME PAGE AND OTHER CUSTOM BUILT -

    PAGES IN A SUB-DIRECTORY +

    PAGES IN A SUB-DIRECTORY

    Custom built pages, including the home page index.html may be placed within the configuration directory _sisu/home/ in any of the locations that is searched for the configuration directory, namely ./_sisu; ~/_sisu; /etc/sisu From there they are copied to the root of the -output directory with the command: +output directory with the command:

    sisu -CC
    - -

    18.2 HOME PAGE WITHIN A SKIN + +

    18.2 HOME PAGE WITHIN A SKIN

    Skins are described in a separate section, but basically are a file written in the programming language Ruby that may be provided to change the defaults that are provided with sisu with -respect to individual documents, a directories contents or for a site. +respect to individual documents, a directories contents or for a site.

    If you wish to provide a homepage within a skin the skin should be in the directory _sisu/skin/dir and have the name of the directory for which it is to become the home page. Documents in the directory commercial_law would have the homepage modified in skin_commercial law.rb; or the directory -

    poems in skin_poems.rb -

    +

    poems in skin_poems.rb +


        class Home
           def homepage
    @@ -1994,20 +2046,20 @@ index.html
           end
         end
     
    -

    19. MARKUP AND OUTPUT EXAMPLES -

    19.1 MARKUP EXAMPLES +

    19. MARKUP AND OUTPUT EXAMPLES +

    19.1 MARKUP EXAMPLES

    Current markup examples and document output samples are provided at <http://www.jus.uio.no/sisu/SiSU/examples.html >

    Some markup with syntax highlighting may be found under <http://www.jus.uio.no/sisu/sample/syntax > -but is not as up to date. +but is not as up to date.

    For some documents hardly any markup at all is required at all, other than a header, and an indication that the levels -to be taken into account by the program in generating its output are. +to be taken into account by the program in generating its output are.

    20. -SISU SEARCH - INTRODUCTION +SISU SEARCH - INTRODUCTION

    SiSU output can easily and conveniently be indexed by a number of standalone indexing tools, such as Lucene, Hyperestraier. @@ -2015,28 +2067,28 @@ indexed by a number of standalone indexing tools, such as Lucene, Hyperestraier. the text object citation system is available hypothetically at least, for all forms of output, it is possible to search the sql database, and either read results from that database, or just as simply map the results to the -html output, which has richer text markup. +html output, which has richer text markup.

    In addition to this SiSU has the ability to populate a relational sql type database with documents at an object level, with objects numbers that are shared across different output types, which make them searchable with that degree of granularity. Basically, your match criteria is met by these documents and at these locations within each document, which can be viewed within the database directly -or in various output formats. -

    21. SQL +or in various output formats. +

    21. SQL

    21.1 POPULATING SQL TYPE DATABASES

    SiSU feeds sisu markupd documents into sql type databases PostgreSQL[^18] and/or SQLite[^19] database together with information related to document -structure. +structure.

    This is one of the more interesting output forms, as all the structural data of the documents are retained (though can be ignored by the user of the database should they so choose). All site texts/documents -are (currently) streamed to four tables: +are (currently) streamed to four tables:

    * one containing semantic (and other) headers, including, title, author,
    subject, (the Dublin Core...);
    - +

    * another the substantive texts by individual
    along with structural information, each paragraph being identifiable by its
    @@ -2044,25 +2096,25 @@ by its
    substantive text of each paragraph quite naturally being searchable (both in
    formatted and clean text versions for searching); and
    - +

    * a third containing endnotes cross-referenced back to the paragraph from
    which they are referenced (both in formatted and clean text versions for
    searching).
    - +

    * a fourth table with a one to one relation with the headers table contains
    full text versions of output, eg. pdf, html, xml, and ascii.
    - -

    There is of course the possibility to add further structures. + +

    There is of course the possibility to add further structures.

    At this level SiSU loads a relational database with documents chunked into objects, their smallest logical structurally constituent parts, as text objects, with their object citation number and all other structural information needed to construct the document. Text is stored (at this text object level) with and without elementary markup tagging, the stripped version being -so as to facilitate ease of searching. +so as to facilitate ease of searching.

    Being able to search a relational database at an object level with the SiSU citation system is an effective way of locating content generated by SiSU object numbers, and all versions @@ -2072,158 +2124,158 @@ output formats, with live links to the precise locations in the database or in html/xml documents; or, the structural information provided makes it possible to search the full contents of the database and have headings in which search content appears, or to search only headings etc. (as the -Dublin Core is incorporated it is easy to make use of that as well). +Dublin Core is incorporated it is easy to make use of that as well).

    22. -POSTGRESQL -

    22.1 NAME +POSTGRESQL +

    22.1 NAME

    SiSU - Structured information, Serialized Units -- a document publishing system, postgresql dependency package +- a document publishing system, postgresql dependency package

    22.2 DESCRIPTION

    Information related to using postgresql with sisu (and related to the sisu_postgresql dependency package, which is a dummy package to install dependencies needed for SiSU to populate a postgresql database, this being -part of SiSU - man sisu). -

    22.3 SYNOPSIS +part of SiSU - man sisu). +

    22.3 SYNOPSIS

    sisu -D [instruction] [filename/wildcard  if  required]
    - +

    sisu -D --pg --[instruction] [filename/wildcard  if  required]
    - -

    22.4 COMMANDS + +

    22.4 COMMANDS

    Mappings to two databases are provided by default, postgresql and sqlite, the same commands are used within sisu to construct and populate databases however -d (lowercase) denotes sqlite and -D (uppercase) denotes -postgresql, alternatively --sqlite or --pgsql may be used +postgresql, alternatively --sqlite or --pgsql may be used

    -D or --pgsql may -be used interchangeably. -

    22.4.1 CREATE AND DESTROY DATABASE -

    +be used interchangeably. +

    22.4.1 CREATE AND DESTROY DATABASE +

    --pgsql --createall
    initial step, creates required relations (tables, indexes) in existing (postgresql) database (a database should be created manually and given -the same name as working directory, as requested) (rb.dbi) +the same name as working directory, as requested) (rb.dbi)

    sisu -D --createdb
    -

    creates database where no database existed before +

    creates database where no database existed before

    sisu -D --create
    creates -

    database tables where no database tables existed before +

    database tables where no database tables existed before

    sisu -D --Dropall
    destroys database (including all its content)! kills data and drops tables, indexes and database associated with a given directory (and directories -of the same name). +of the same name).

    sisu -D --recreate
    destroys existing database and builds -

    a new empty database structure +

    a new empty database structure

    -22.4.2 IMPORT AND REMOVE DOCUMENTS -

    +22.4.2 IMPORT AND REMOVE DOCUMENTS +

    sisu -D --import -v [filename/wildcard]
    populates database with the contents of the file. Imports documents(s) specified to a postgresql database (at an -object level). +object level).

    sisu -D --update -v [filename/wildcard]
    updates file contents -

    in database +

    in database

    sisu -D --remove -v [filename/wildcard]
    removes specified document -from postgresql database. +from postgresql database.

    -23. SQLITE -

    23.1 NAME +23. SQLITE +

    23.1 NAME

    SiSU - Structured information, -Serialized Units - a document publishing system. -

    23.2 DESCRIPTION +Serialized Units - a document publishing system. +

    23.2 DESCRIPTION

    Information related to using sqlite with sisu (and related to the sisu_sqlite dependency package, which is a dummy package to install dependencies needed for SiSU -to populate an sqlite database, this being part of SiSU - man sisu). +to populate an sqlite database, this being part of SiSU - man sisu).

    23.3 -

    SYNOPSIS +

    SYNOPSIS

    sisu -d [instruction] [filename/wildcard  if  required]
    - +

    sisu -d --(sqlite|pg) --[instruction] [filename/wildcard  if
    required]
    - -

    23.4 COMMANDS + +

    23.4 COMMANDS

    Mappings to two databases are provided by default, postgresql and sqlite, the same commands are used within sisu to construct and populate databases however -d (lowercase) denotes sqlite and -D (uppercase) denotes -postgresql, alternatively --sqlite or --pgsql may be used +postgresql, alternatively --sqlite or --pgsql may be used

    -d or --sqlite may -be used interchangeably. -

    23.4.1 CREATE AND DESTROY DATABASE -

    +be used interchangeably. +

    23.4.1 CREATE AND DESTROY DATABASE +

    --sqlite --createall
    initial step, creates required relations (tables, indexes) in existing (sqlite) database (a database should be created manually and given the -same name as working directory, as requested) (rb.dbi) +same name as working directory, as requested) (rb.dbi)

    sisu -d --createdb
    -

    creates database where no database existed before +

    creates database where no database existed before

    sisu -d --create
    creates -

    database tables where no database tables existed before +

    database tables where no database tables existed before

    sisu -d --dropall
    destroys database (including all its content)! kills data and drops tables, indexes and database associated with a given directory (and directories -of the same name). +of the same name).

    sisu -d --recreate
    destroys existing database and builds -

    a new empty database structure +

    a new empty database structure

    -23.4.2 IMPORT AND REMOVE DOCUMENTS -

    +23.4.2 IMPORT AND REMOVE DOCUMENTS +

    sisu -d --import -v [filename/wildcard]
    populates database with the contents of the file. Imports documents(s) specified to an sqlite database (at an object -level). +level).

    sisu -d --update -v [filename/wildcard]
    @@ -2233,13 +2285,13 @@ level).
    sisu -d --remove -v [filename/wildcard]
    removes specified document from sqlite -database. +database.

    -24. INTRODUCTION +24. INTRODUCTION

    24.1 SEARCH - DATABASE FRONTEND SAMPLE, UTILISING DATABASE AND SISU FEATURES, INCLUDING OBJECT CITATION NUMBERING (BACKEND -CURRENTLY POSTGRESQL) +CURRENTLY POSTGRESQL)

    Sample search frontend <http://search.sisudoc.org > [^20] A small database and sample query front-end (search from) that makes @@ -2250,24 +2302,24 @@ locations within each document the matches are found. These results are relevant across all outputs using object citation numbering, which includes html, XML, LaTeX, PDF and indeed the SQL database. You can then refer to one of the other outputs or in the SQL database expand the text within -the matched objects (paragraphs) in the documents matched. +the matched objects (paragraphs) in the documents matched.

    Note you may set results either for documents matched and object number locations within each matched document meeting the search criteria; or display the names of the documents matched along with the objects (paragraphs) that meet -the search criteria.[^22] -

    +the search criteria.[^22] +

    sisu -F --webserv-webrick
    builds a cgi web search -

    frontend for the database created +

    frontend for the database created

    The following is feedback on the setup -on a machine provided by the help command: +on a machine provided by the help command:

    sisu --help sql
    - -

    + +


      Postgresql
         user:             ralph
    @@ -2278,237 +2330,237 @@ on a machine provided by the help command:
         current db set:   /home/ralph/sisu_www/sisu/sisu_sqlite.db
         dbi connect       DBI:SQLite:/home/ralph/sisu_www/sisu/sisu_sqlite.db
     
    -

    Note on databases built +

    Note on databases built

    By default, [unless  otherwise  specified] databases are built on a directory basis, from collections of documents within that directory. The name of the directory you choose to work from is used as the database name, i.e. if you are working in a directory called /home/ralph/ebook the database SiSU_ebook is used. [otherwise  a  manual  mapping  for  the  collection - is + is

    -24.2 SEARCH FORM -

    +24.2 SEARCH FORM +

    sisu -F
    generates a sample search form, which must -

    be copied to the web-server cgi directory +

    be copied to the web-server cgi directory

    sisu -F --webserv-webrick
    generates a sample search form for use with the webrick server, which must be copied -

    to the web-server cgi directory +

    to the web-server cgi directory

    sisu -Fv
    as above, and provides some information -

    on setting up hyperestraier +

    on setting up hyperestraier

    sisu -W
    starts the webrick server which should -

    be available wherever sisu is properly installed +

    be available wherever sisu is properly installed

    The generated search -

    form must be copied manually to the webserver directory as instructed +

    form must be copied manually to the webserver directory as instructed

    -25. HYPERESTRAIER -

    See the documentation for hyperestraier: +25. HYPERESTRAIER +

    See the documentation for hyperestraier:

    <http://hyperestraier.sourceforge.net/ >
    - +

    /usr/share/doc/hyperestraier/index.html
    - +

    man estcmd
    - -

    on sisu_hyperestraier: + +

    on sisu_hyperestraier:

    man sisu_hyperestraier
    - +

    /usr/share/doc/sisu/sisu_markup/sisu_hyperestraier/index.html
    - +

    NOTE: the examples that follow assume that sisu output is placed in -

    the directory /home/ralph/sisu_www +

    the directory /home/ralph/sisu_www

    (A) to generate the index within the -webserver directory to be indexed: +webserver directory to be indexed:

    estcmd gather -sd [index  name] [directory  path  to  index]
    - +

    the following are examples that will need to be tailored according to -your needs: +your needs:

    cd /home/ralph/sisu_www
    - +

    estcmd gather -sd casket /home/ralph/sisu_www
    - +

    you may use the ’find’ command together with ’egrep’ to limit indexing to particular document collection directories within the web server directory:

    find /home/ralph/sisu_www -type f | egrep
    ’/home/ralph/sisu_www/sisu/.+?.html$’ |estcmd gather -sd casket -
    - +

    Check which directories in the webserver/output directory (~/sisu_www or elsewhere depending on configuration) you wish to include in the search -index. +index.

    As sisu duplicates output in multiple file formats, it it is probably preferable to limit the estraier index to html output, and as it may also be desirable to exclude files ’plain.txt’, ’toc.html’ and ’concordance.html’, as -these duplicate information held in other html output e.g. +these duplicate information held in other html output e.g.

    find /home/ralph/sisu_www -type f | egrep
    ’/sisu_www/(sisu|bookmarks)/.+?.html$’ | egrep -v
    ’(doc|concordance).html$’ |estcmd gather -sd casket -
    - +

    from your current document preparation/markup directory, you would construct -a rune along the following lines: +a rune along the following lines:

    find /home/ralph/sisu_www -type f | egrep ’/home/ralph/sisu_www/([specify
    first  directory  for  inclusion]|[specify  second  directory  for
    inclusion]|[another  directory  for  inclusion?  ...])/.+?.html$’ |
    egrep -v ’(doc|concordance).html$’ |estcmd gather -sd
    /home/ralph/sisu_www/casket -
    - -

    (B) to set up the search form + +

    (B) to set up the search form

    (i) copy estseek.cgi to your cgi directory -and set file permissions to 755: +and set file permissions to 755:

    sudo cp -vi /usr/lib/estraier/estseek.cgi /usr/lib/cgi-bin
    - +

    sudo chmod -v 755 /usr/lib/cgi-bin/estseek.cgi
    - +

    sudo cp -v /usr/share/hyperestraier/estseek.* /usr/lib/cgi-bin
    - +

    [see  estraier  documentation  for  paths]
    - +

    (ii) edit estseek.conf, with attention to the lines starting ’indexname:’ -and ’replace:’: +and ’replace:’:

    indexname: /home/ralph/sisu_www/casket
    - +

    replace: ^file:///home/ralph/sisu_www{{!}}http://localhost
    - +

    replace: /index.html?${{!}}/
    - -

    (C) to test using webrick, start webrick: + +

    (C) to test using webrick, start webrick:

    sisu -W
    - +

    and try open the url: <http://localhost:8081/cgi-bin/estseek.cgi -> +>

    26. SISU_WEBRICK - -

    26.1 NAME + +

    26.1 NAME

    SiSU - Structured information, Serialized Units - a document -

    publishing system -

    26.2 SYNOPSIS -

    sisu_webrick [port] -

    or +

    publishing system +

    26.2 SYNOPSIS +

    sisu_webrick [port] +

    or

    sisu -W [port] -

    26.3 DESCRIPTION +

    26.3 DESCRIPTION

    sisu_webrick is part of SiSU (man sisu) sisu_webrick starts Ruby ’s Webrick web-server and points it to the directories to which SiSU output is written, providing a list of these directories (assuming -SiSU is in use and they exist). +SiSU is in use and they exist).

    The default port for sisu_webrick is set to 8081, this may be modified in the yaml file: ~/.sisu/sisurc.yml a sample of which is provided as /etc/sisu/sisurc.yml (or in the equivalent directory -on your system). -

    26.4 SUMMARY OF MAN PAGE +on your system). +

    26.4 SUMMARY OF MAN PAGE

    sisu_webrick, may be started on it’s own with the command: sisu_webrick [port] or using the sisu command -with the -W flag: sisu -W [port] +with the -W flag: sisu -W [port]

    where no port is given and settings are -

    unchanged the default port is 8081 +

    unchanged the default port is 8081

    26.5 DOCUMENT PROCESSING COMMAND FLAGS

    sisu -W [port] starts Ruby Webrick web-server, serving SiSU output directories, on the port provided, or if no port is provided and the defaults have not -

    been changed in ~/.sisu/sisurc.yaml then on port 8081 +

    been changed in ~/.sisu/sisurc.yaml then on port 8081

    26.6 FURTHER INFORMATION

    For more information on SiSU see: <http://www.jus.uio.no/sisu -> +>

    or man sisu -

    26.7 AUTHOR -

    Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com +

    26.7 AUTHOR +

    Ralph Amissah ralph@amissah.com or ralph.amissah@gmail.com

    -

    26.8 SEE ALSO +

    26.8 SEE ALSO

    sisu(1)
    - +

    sisu_vim(7)
    - +

    sisu(8)
    - -

    27. REMOTE SOURCE DOCUMENTS + +

    27. REMOTE SOURCE DOCUMENTS

    SiSU processing instructions can be run against remote source documents by providing the url of the documents against which the processing instructions are to be carried out. The remote SiSU documents can either be sisu marked up files in plaintext .sst or .ssm or; -zipped sisu files, sisupod.zip or filename.ssp +zipped sisu files, sisupod.zip or filename.ssp

    .sst / .ssm - sisu text files

    SiSU can be run against source text files on a remote machine, provide the processing instruction and the url. The source file and any associated -parts (such as images) will be downloaded and generated locally. -

    +parts (such as images) will be downloaded and generated locally. +


      sisu -3 http://[provide  url  to  valid  .sst  or  .ssm  file]
     

    Any of the source documents in the sisu examples page can be used in this way, see <http://www.jus.uio.no/sisu/SiSU/examples.html > and use the url -for the desired document. +for the desired document.

    NOTE: to set up a remote machine to serve SiSU documents in this way, images should be in the directory relative to the -

    document source ../_sisu/image -

    sisupod - zipped sisu files +

    document source ../_sisu/image +

    sisupod - zipped sisu files

    A sisupod is the zipped content of a sisu marked up text or texts and any other associated -parts to the document such as images. +parts to the document such as images.

    SiSU can be run against a sisupod on a (local or) remote machine, provide the processing instruction and the url, the sisupod will be downloaded and the documents it contains generated -locally. -

    +locally. +


      sisu -3 http://[provide  url  to  valid  sisupod.zip  or  .ssp  file]
     

    Any of the source documents in the sisu examples page can be used in this way, see <http://www.jus.uio.no/sisu/SiSU/examples.html > and use the url -for the desired document. -

    REMOTE DOCUMENT OUTPUT -

    28. REMOTE OUTPUT -

    +for the desired document. +

    REMOTE DOCUMENT OUTPUT +

    28. REMOTE OUTPUT +

    Once properly configured SiSU output can be automatically posted once generated -to a designated remote machine using either rsync, or scp. +to a designated remote machine using either rsync, or scp.

    In order to do this some ssh authentication agent and keychain or similar tool will need to be configured. Once that is done the placement on a remote host can be done seamlessly with the -r (for scp) or -R (for rsync) flag, which -may be used in conjunction with other processing flags, e.g. -

    +may be used in conjunction with other processing flags, e.g. +


      sisu -3R sisu_remote.sst
     
    -

    28.1 COMMANDS -

    +

    28.1 COMMANDS +

    -R [filename/wildcard]
    @@ -2517,7 +2569,7 @@ host using rsync. This requires that sisurc.yml has been provided with informati on hostname and username, and that you have your different if -R is used with other flags from if used alone. Alone the rsync --delete parameter is sent, useful for cleaning the remote directory (when -R is used together -with other flags, it is not). Also see -r +with other flags, it is not). Also see -r

    -r [filename/wildcard]
    @@ -2525,45 +2577,45 @@ with other flags, it is not). Also see -r output files to remote host using scp. This requires that sisurc.yml has been provided with information on hostname and username, and that you have -

    your +

    your

    -28.2 CONFIGURATION +28.2 CONFIGURATION

    [expand  on  the  setting  up  of  an  ssh-agent  /  keychain] -

    29. REMOTE SERVERS +

    29. REMOTE SERVERS

    As SiSU is generally operated using the command line, and works within a Unix type environment, SiSU the program and all documents can just as easily be on a remote server, to which you are logged on using a terminal, and commands and operations would be pretty much the same as -they would be on your local machine. +they would be on your local machine.

    30. QUICKSTART - GETTING STARTED HOWTO - -

    30.1 INSTALLATION + +

    30.1 INSTALLATION

    Installation is currently most straightforward and tested on the Debian platform, as there are packages for the installation -of sisu and all requirements for what it does. +of sisu and all requirements for what it does.

    30.1.1 DEBIAN INSTALLATION

    SiSU is available directly from the Debian Sid and testing archives (and possibly Ubuntu), assuming your /etc/apt/sources.list is set accordingly: -

    +


        aptitude update
         aptitude install sisu-complete
     

    The following /etc/apt/sources.list setting permits the download of additional -markup samples: -

    +markup samples: +


      #/etc/apt/sources.list
         deb http://ftp.fi.debian.org/debian/ unstable main non-free contrib
         deb-src http://ftp.fi.debian.org/debian/ unstable main non-free contrib
       d
     
    -

    The aptitude commands become: -

    +

    The aptitude commands become: +


        aptitude update
         aptitude install sisu-complete sisu-markup-samples
    @@ -2572,308 +2624,308 @@ markup samples:
     
     

    they will be available by adding the following to your /etc/apt/sources.list -

    +


      #/etc/apt/sources.list
         deb http://www.jus.uio.no/sisu/archive unstable main non-free
         deb-src http://www.jus.uio.no/sisu/archive unstable main non-free
     
    -

    repeat the aptitude commands -

    +

    repeat the aptitude commands +


        aptitude update
         aptitude install sisu-complete sisu-markup-samples
     

    Note however that it is not necessary to install sisu-complete if not all components of sisu are to be used. Installing just the package sisu -will provide basic functionality. -

    30.1.2 RPM INSTALLATION +will provide basic functionality. +

    30.1.2 RPM INSTALLATION

    RPMs are provided though untested, they are prepared by running alien against the source -package, and against the debs. -

    They may be downloaded from: +package, and against the debs. +

    They may be downloaded from:

    <http://www.jus.uio.no/sisu/SiSU/download.html#rpm >
    - -

    as root type: + +

    as root type:

    rpm -i [rpm  package  name]
    - -

    30.1.3 INSTALLATION FROM SOURCE + +

    30.1.3 INSTALLATION FROM SOURCE

    To install SiSU from source check information -at: +at:

    <http://www.jus.uio.no/sisu/SiSU/download.html#current >
    - -

    * download the source package -

    * Unpack the source + +

    * download the source package +

    * Unpack the source

    Two alternative modes of installation from source are provided, setup.rb (by Minero Aoki) and a rant(by Stefan Lang) built install file, in either case: the first -steps are the same, download and unpack the source file: +steps are the same, download and unpack the source file:

    For basic use SiSU is only dependent on the programming language in which it is written Ruby , and SiSU will be able to generate html, various XMLs, including ODF (and will also produce LaTeX). Dependencies required for further actions, though it relies on the installation of additional dependencies which the source tarball does not take care of, for things like using a database -(postgresql or sqlite)[^23] or converting LaTeX to pdf. -

    setup.rb +(postgresql or sqlite)[^23] or converting LaTeX to pdf. +

    setup.rb

    This is a standard ruby installer, using setup.rb is a three step process. In -the root directory of the unpacked SiSU as root type: -

    +the root directory of the unpacked SiSU as root type: +


          ruby setup.rb config
           ruby setup.rb setup
           #[and  as  root:]
           ruby setup.rb install
     
    -

    further information on setup.rb is available from: +

    further information on setup.rb is available from:

    <http://i.loveruby.net/en/projects/setup/ >
    - +

    <http://i.loveruby.net/en/projects/setup/doc/usage.html >
    - -

    -

    The root directory of the unpacked SiSU as root type: + +

    +

    The root directory of the unpacked SiSU as root type:

    ruby install base
    - -

    or for a more complete installation: + +

    or for a more complete installation:

    ruby install
    - -

    or + +

    or

    ruby install base
    - +

    This makes use of Rant (by Stefan Lang) and the provided Rantfile. It has been configured to do post installation setup setup configuration and generation of first test file. Note however, that additional external package -dependencies, such as tetex-extra are not taken care of for you. +dependencies, such as tetex-extra are not taken care of for you.

    Further -

    information on +

    information on

    <http://make.rubyforge.org/ >
    - +

    <http://rubyforge.org/frs/?group_id=615 >
    - -

    For a list of alternative actions you may type: + +

    For a list of alternative actions you may type:

    ruby install help
    - +

    ruby install -T
    - -

    30.2 TESTING SISU, GENERATING OUTPUT + +

    30.2 TESTING SISU, GENERATING OUTPUT

    To check which version of sisu -is installed: -

    sisu -v +is installed: +

    sisu -v

    Depending on your mode of installation one or -a number of markup sample files may be found either in the directory: +a number of markup sample files may be found either in the directory:

    - -

    or -

    -

    change directory to the appropriate one: + +

    or +

    +

    change directory to the appropriate one:

    cd /usr/share/doc/sisu/sisu_markup_samples/dfsg -

    30.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF +

    30.2.1 BASIC TEXT, PLAINTEXT, HTML, XML, ODF

    Having moved to the directory that contains the markup samples (see instructions above if necessary), -

    choose a file and run sisu against it +

    choose a file and run sisu against it

    sisu -NhwoabxXyv free_as_in_freedom.rms_and_free_software.sam_williams.sst

    this will generate html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and OpenDocument text -

    30.2.2 LATEX / PDF +

    30.2.2 LATEX / PDF

    Assuming a LaTeX engine such as tetex or texlive is installed with the required modules (done automatically on selection of -sisu-pdf in Debian ) +sisu-pdf in Debian )

    Having moved to the directory that contains the markup samples (see instructions above if necessary), choose a file and run sisu -

    against it +

    against it

    sisu -pv free_as_in_freedom.rms_and_free_software.sam_williams.sst -

    sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst +

    sisu -3 free_as_in_freedom.rms_and_free_software.sam_williams.sst

    should generate most available output formats: html including a concordance file, opendocument text format, plaintext, XHTML and various forms of XML, and -

    OpenDocument text and pdf +

    OpenDocument text and pdf

    30.2.3 RELATIONAL DATABASE - POSTGRESQL, SQLITE

    Relational databases need some setting up - you must have permission to -create the database and write to it when you run sisu. +create the database and write to it when you run sisu.

    Assuming you have -

    the database installed and the requisite permissions +

    the database installed and the requisite permissions

    sisu --sqlite --recreate

    sisu --sqlite -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst -

    sisu --pgsql --recreate +

    sisu --pgsql --recreate

    sisu --pgsql -v --import free_as_in_freedom.rms_and_free_software.sam_williams.sst -

    30.3 GETTING HELP -

    30.3.1 THE MAN PAGES -

    Type: +

    30.3 GETTING HELP +

    30.3.1 THE MAN PAGES +

    Type:

    man sisu
    - +

    The man pages are also available online, though not always kept as up -to date as within the package itself: +to date as within the package itself:

    * sisu.1 <http://www.jus.uio.no/sisu/man/sisu.1 > -[^24] +[^24]

    * sisu.8 <http://www.jus.uio.no/sisu/man/sisu.8 -> [^25] +> [^25]

    * man directory <http://www.jus.uio.no/sisu/man -> [^26] -

    30.3.2 BUILT IN HELP -

    sisu --help +> [^26] +

    30.3.2 BUILT IN HELP +

    sisu --help

    sisu

    -

    - -

    help --env -

    sisu --help --commands -

    sisu --help --markup -

    30.3.3 THE HOME PAGE -

    +

    help --env +

    sisu --help --commands +

    sisu --help --markup +

    30.3.3 THE HOME PAGE +

    <http://www.jus.uio.no/sisu -> +>

    <http://www.jus.uio.no/sisu/SiSU -> +>

    30.4 MARKUP SAMPLES -

    A number of markup samples (along with output) are available off: +

    A number of markup samples (along with output) are available off:

    <http://www.jus.uio.no/sisu/SiSU/examples.html > -

    Additional markup samples are packaged separately in the file: -

    * -

    +

    Additional markup samples are packaged separately in the file: +

    * +

    On Debian they are available in non-free[^27] to include them it is necessary to include non-free in your /etc/apt/source.list or obtain them from the -sisu home site. -

    31. EDITOR FILES, SYNTAX HIGHLIGHTING +sisu home site. +

    31. EDITOR FILES, SYNTAX HIGHLIGHTING

    The directory:

    ./data/sisu/conf/editor-syntax-etc/
    - +

    /usr/share/sisu/conf/editor-syntax-etc
    - -

    contains rudimentary sisu syntax highlighting files for: + +

    contains rudimentary sisu syntax highlighting files for:

    * (g)vim <http://www.vim.org -> +>

    package: sisu-vim
    - -

    status: largely done + +

    status: largely done

    there is a vim syntax highlighting and folds component
    - +

    * gedit <http://www.gnome.org/projects/gedit -> +>

    * gobby <http://gobby.0x539.de/ >

    file: sisu.lang
    - -

    place in: + +

    place in:

    /usr/share/gtksourceview-1.0/language-specs
    - -

    or + +

    or

    ~/.gnome2/gtksourceview-1.0/language-specs
    - +

    status: very basic syntax highlighting
    - +

    comments: this editor features display line wrap and is used by Goby!
    - +

    * nano <http://www.nano-editor.org -> +>

    file: nanorc
    - -

    save as: + +

    save as:

    ~/.nanorc
    - +

    status: basic syntax highlighting
    - +

    comments: assumes dark background; no display line-wrap; does line breaks
    - +

    * diakonos (an editor written in ruby) <http://purepistos.net/diakonos > -

    file: diakonos.conf -

    save as: +

    file: diakonos.conf +

    save as:

    ~/.diakonos/diakonos.conf
    - -

    includes: + +

    includes:

    status: basic syntax highlighting
    - -

    comments: assumes dark background; no display line-wrap + +

    comments: assumes dark background; no display line-wrap

    * kate & kwrite <http://kate.kde.org -> +>

    file: sisu.xml
    - +

    place in:
    - +

    /usr/share/apps/katepart/syntax
    - +

    or
    - +

    ~/.kde/share/apps/katepart/syntax
    - +

    [settings::configure  kate::{highlighting,filetypes}]
    - +

    [tools::highlighting::{markup,scripts}::  .B  SiSU  ]
    - +

    * nedit <http://www.nedit.org -> +>

    file: sisu_nedit.pats
    - +

    nedit -import sisu_nedit.pats
    - +

    status: a very clumsy first attempt [not  really  done]
    - +

    comments: this editor features display line wrap
    - +

    * emacs <http://www.gnu.org/software/emacs/emacs.html -> +>

    files: sisu-mode.el
    - +

    to file ~/.emacs add the following 2 lines:
    - +

    (add-to-list ’load-path
    - +

    (require ’sisu-mode.el)
    - +

    [not  done  /  not  yet  included]
    - +

    * vim & gvim <http://www.vim.org -> +>

    files:
    - +

    package is the most comprehensive sisu syntax highlighting and editor
    environment provided to date (is for vim/ gvim, and is separate from the
    contents of this directory)
    - +

    status: this includes: syntax highlighting; vim folds; some error checking
    - +

    comments: this editor features display line wrap
    - -

    NOTE: + +

    NOTE:

    [  .B  SiSU  parses  files  with  long  lines  or  line  breaks, but,  display  linewrap  (without  line-breaks)  is  a  convenient editor  feature  to  have  for - sisu  markup] -

    32. HOW DOES SISU WORK? + sisu  markup] +

    32. HOW DOES SISU WORK?

    SiSU markup is fairly minimalistic, it consists of: a (largely optional) document header, made up of information about the document (such as when it was published, who authored it, and @@ -2891,12 +2943,12 @@ considerable flexibility in representing documents different ways and for different purposes (e.g. search, document layout, publishing, content certification, concordance etc.), and makes it possible to take advantage of some of the strengths of established ways of representing documents, (or indeed to -create new ones). -

    33. SUMMARY OF FEATURES +create new ones). +

    33. SUMMARY OF FEATURES

    * sparse/minimal markup (clean utf-8 source texts). Documents are prepared in a single UTF-8 file using a minimalistic mnemonic syntax. Typical literature, documents like headers -are optional. +are optional.

    * markup is easily readable/parsable by the human eye, (basic markup is simpler and more sparse than the most basic HTML), [this  may  also  be  converted  to  XML  representations  of  the  same  input/source  document]. @@ -2910,36 +2962,36 @@ may also contain processing instructions. SiSU markup is primarily an abs of document structure and document metadata to permit taking advantage of the basic strengths of existing alternative practical standard ways of representing documents [be  that  paper  publication,  sql  search  etc.] (html, -xml, odf, latex, pdf, sql) +xml, odf, latex, pdf, sql)

    * for output produces reasonably elegant output of established industry and institutionally accepted open standard formats.[3] takes advantage of the different strengths of various standard formats for representing documents, amongst the output formats currently supported -are: +are:

    * html - both as a single scrollable text and a segmented document
    - +

    * xhtml
    - +

    * XML - both in sax and dom style xml structures for further development as
    required
    - +

    * ODF - open document format, the iso standard for document storage
    - +

    * LaTeX - used to generate pdf
    - +

    * pdf (via LaTeX)
    - +

    * sql - population of an sql database, (at the same object level that is
    used to cite text within a document)
    - +

    Also produces: concordance files; document content certificates (md5 or sha256 digests of headings, paragraphs, images etc.) and html manifests (and sitemaps of content). (b) takes advantage of the strengths implicit in these very different output types, (e.g. PDFs produced using typesetting of LaTeX, databases populated with documents at an individual object/paragraph -level, making possible granular search (and related possibilities)) +level, making possible granular search (and related possibilities))

    * ensuring content can be cited in a meaningful way regardless of selected output format. Online publishing (and publishing in multiple document formats) @@ -2950,23 +3002,23 @@ the text within a document, (which can be utilized for citation and by search engines). The outputs share a common numbering system that is meaningful (to man and machine) across all digital outputs whether paper, screen, or database oriented, (pdf, HTML, xml, sqlite, postgresql), this numbering -system can be used to reference content. +system can be used to reference content.

    * Granular search within documents. SQL databases are populated at an object level (roughly headings, paragraphs, verse, tables) and become searchable with that degree of granularity, the output information provides the object/paragraph numbers which are relevant across all generated outputs; it is also possible to look at just the matching paragraphs of the documents in the database; [output  indexing  also  work - well  with  search  indexing tools  like  hyperestraier]. + well  with  search  indexing tools  like  hyperestraier].

    * long term maintainability of document collections in a world of changing formats, having a very sparsely marked-up source document base. there is a considerable degree of future-proofing, output representations are upgradeable (open document text) module in 2006 and in future html5 output sometime in future, without modification of -

    existing prepared texts +

    existing prepared texts

    * SQL search aside, documents are generated as -required and static once generated. +required and static once generated.

    * documents produced are static files, and may be batch processed, this needs to be done only once but may be repeated for various reasons as desired (updated content, addition of new @@ -2974,7 +3026,7 @@ output formats, updated technology document presentations/representations)

    * document source (plaintext utf-8) if shared on the net may be used as -

    input and processed locally to produce the different document outputs +

    input and processed locally to produce the different document outputs

    * document source may be bundled together (automatically) with associated documents (multiple language versions or master document with inclusions) @@ -2987,232 +3039,232 @@ and images and sent as a zip file called a sisupod, if shared on the net

    * for basic document generation, the only software dependency is Ruby , and a few standard Unix tools (this covers plaintext, HTML, XML, ODF, LaTeX). To use a database you of course need that, and to convert the LaTeX -generated to pdf, a latex processor like tetex or texlive. +generated to pdf, a latex processor like tetex or texlive.

    * as a developers -

    tool it is flexible and extensible +

    tool it is flexible and extensible

    Syntax highlighting for SiSU markup -is available for a number of text editors. +is available for a number of text editors.

    SiSU is less about document layout than about finding a way with little markup to be able to construct an abstract representation of a document that makes it possible to produce multiple representations of it which may be rather different from each other and used for different purposes, whether layout and publishing, or -

    search of content +

    search of content

    i.e. to be able to take advantage from this minimal preparation starting point of some of the strengths of rather different established ways of representing documents for different purposes, whether for search (relational database, or indexed flat files generated for that purpose whether of complete documents, or say of files made up of objects), online -viewing (e.g. html, xml, pdf), or paper publication (e.g. pdf)... +viewing (e.g. html, xml, pdf), or paper publication (e.g. pdf)...

    the solution arrived at is by extracting structural information about the document (about headings within the document) and by tracking objects (which are serialized and also given hash values) in the manner described. It makes possible representations that are quite different from those offered at present. For example objects could be saved individually and identified by their hashes, with an index -of how the objects relate to each other to form a document. +of how the objects relate to each other to form a document.

    34. HELP SOURCES - +

    For a summary of alternative ways to get help on SiSU try one of the -following: -

    man page +following: +

    man page

    man sisu_help
    - -

    man2html + +

    man2html

    <http://www.jus.uio.no/sisu/man/sisu_help.1.html >
    - -

    sisu generated output - links to html + +

    sisu generated output - links to html

    <http://sisudoc.org/sisu/sisu_help/index.html >
    - -

    help sources lists + +

    help sources lists

    Alternative sources for this help sources page -listed here: +listed here:

    man sisu_help_sources
    - +

    <http://sisudoc.org/sisu/sisu_help_sources/index.html >
    - -

    34.1 MAN PAGES -

    34.1.1 MAN + +

    34.1 MAN PAGES +

    34.1.1 MAN

    man sisu
    - +

    man 7 sisu_complete
    - +

    man 7 sisu_pdf
    - +

    man 7 sisu_postgresql
    - +

    man 7 sisu_sqlite
    - +

    man sisu_termsheet
    - +

    man sisu_webrick
    - -

    34.2 SISU GENERATED OUTPUT - LINKS TO HTML + +

    34.2 SISU GENERATED OUTPUT - LINKS TO HTML

    Note SiSU documentation is prepared in SiSU and output is available in multiple formats including amongst others html, pdf, and odf which may be also be accessed via the -html pages[^28] -

    34.2.1 WWW.SISUDOC.ORG +html pages[^28] +

    34.2.1 WWW.SISUDOC.ORG

    <http://sisudoc.org/sisu/sisu_manual/index.html >

    <http://sisudoc.org/sisu/sisu_manual/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_commands/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_complete/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_configuration/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_description/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_examples/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_faq/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_filetypes/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_help/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_help_sources/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_howto/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_introduction/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_manual/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_markup/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_output_overview/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_pdf/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_postgresql/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_quickstart/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_remote/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_search/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_skin/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_sqlite/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_syntax_highlighting/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_vim/index.html >
    - +

    <http://sisudoc.org/sisu/sisu_webrick/index.html >
    - -

    34.3 MAN2HTML -

    34.3.1 LOCALLY INSTALLED + +

    34.3 MAN2HTML +

    34.3.1 LOCALLY INSTALLED

    <file:///usr/share/doc/sisu/html/sisu.1.html> -

    <file:///usr/share/doc/sisu/html/sisu_help.1.html> +

    <file:///usr/share/doc/sisu/html/sisu_help.1.html>

    <file:///usr/share/doc/sisu/html/sisu_help_sources.1.html>

    /usr/share/doc/sisu/html/sisu.1.html
    - +

    /usr/share/doc/sisu/html/sisu_pdf.7.html
    - +

    /usr/share/doc/sisu/html/sisu_postgresql.7.html
    - +

    /usr/share/doc/sisu/html/sisu_sqlite.7.html
    - +

    /usr/share/doc/sisu/html/sisu_webrick.1.html
    - -

    34.3.2 WWW.JUS.UIO.NO/SISU + +

    34.3.2 WWW.JUS.UIO.NO/SISU

    <http://www.jus.uio.no/sisu/man/sisu.1.html -> +>

    <http://www.jus.uio.no/sisu/man/sisu.1.html >
    - +

    <http://www.jus.uio.no/sisu/man/sisu_complete.7.html >
    - +

    <http://www.jus.uio.no/sisu/man/sisu_pdf.7.html >
    - +

    <http://www.jus.uio.no/sisu/man/sisu_postgresql.7.html >
    - +

    <http://www.jus.uio.no/sisu/man/sisu_sqlite.7.html >
    - +

    <http://www.jus.uio.no/sisu/man/sisu_webrick.1.html >
    - -

    DOCUMENT INFORMATION (METADATA) -

    METADATA + +

    DOCUMENT INFORMATION (METADATA) +

    METADATA

    Document Manifest @ <http://sisudoc.org/sisu_manual/sisu/sisu_manifest.html > -

    Dublin Core (DC) +

    Dublin Core (DC)

    DC tags included with this document are provided here. -

    DC Title: SiSU - Manual -

    DC Creator: Ralph Amissah -

    DC Rights: 3 +

    DC Title: SiSU - Manual +

    DC Creator: Ralph Amissah +

    DC Rights: 3

    DC Type: -

    information -

    DC Date created: 2002-08-28 -

    DC Date issued: 2002-08-28 +

    information +

    DC Date created: 2002-08-28 +

    DC Date issued: 2002-08-28

    DC -Date available: 2002-08-28 -

    DC Date modified: 2008-05-22 +Date available: 2002-08-28 +

    DC Date modified: 2008-05-22

    DC Date: 2008-05-22 -

    Version Information -

    Sourcefile: sisu.ssm.sst +

    Version Information +

    Sourcefile: sisu.ssm.sst

    Filetype: SiSU text insert -

    0.67 +

    0.67

    Sourcefile Digest, MD5(sisu.ssm.sst)= 7fbab3b7c0fd0ed2e128585c2982c5c8

    Skin_Digest: MD5(skin_sisu_manual.rb)= 072b2584bedea82ea8a416587b9fa244 -

    Generated +

    Generated

    Document (metaverse) last generated: Mon Jul 21 02:54:34

    - -

    0400 2008 -

    Generated by: SiSU 0.68.0 of 2008w29/1 (2008-07-21) +

    0400 2008 +

    Generated by: SiSU 0.68.0 of 2008w29/1 (2008-07-21)

    Ruby version: -ruby 1.8.7 (2008-06-20 patchlevel 22)  [i486-linux] -

    +ruby 1.8.7 (2008-06-20 patchlevel 22)  [i486-linux] +

      .
    1. objects include: headings, paragraphs, verse, tables, images, but not footnotes/endnotes which are @@ -3291,7 +3343,7 @@ being added in future.
    2. .
    3. < http://www.gigalaw.com/articles/ghosh-2000-01-p1.html }~ The current, privately owned software environment, GPL-proponents say, leads to monopoly abuse and stagnation. Strong companies suck all the oxygen out of the marketplace for rival competitors and innovative startups. @@ -221,7 +226,7 @@ If the last two decades have brought dramatic changes to the software marketplac The crowd is filled with visitors who share Stallman's fashion and grooming tastes. Many come bearing laptop computers and cellular modems, all the better to record and transmit Stallman's words to a waiting Internet audience. The gender ratio is roughly 15 males to 1 female, and 1 of the 7 or 8 females in the room comes in bearing a stuffed penguin, the official Linux mascot, while another carries a stuffed teddy bear. -{free_as_in_freedom_01_rms.png 381x321 "Richard Stallman, circa 2000. 'I decided I would develop a free software operating system or die trying ... of old age of course.' Photo courtesy of http://www.stallman.org " }http://www.free-culture.cc/ +{free_as_in_freedom_01_rms.png 381x321 "Richard Stallman, circa 2000. 'I decided I would develop a free software operating system or die trying ... of old age of course.' Photo courtesy of http://www.stallman.org " }http://en.wikipedia.org/wiki/Richard_stallman Agitated, Stallman leaves his post at the front of the room and takes a seat in a front-row chair, tapping a few commands into an already-opened laptop. For the next 10 minutes Stallman is oblivious to the growing number of students, professors, and fans circulating in front of him at the foot of the auditorium stage. @@ -338,6 +343,7 @@ Seth Breidbart, a fellow Columbia Science Honors Program alumnus, offers bolster "It's hard to describe," Breidbart says. "It wasn't like he was unapproachable. He was just very intense. [He was] very knowledgeable but also very hardheaded in some ways." Such descriptions give rise to speculation: are judgment-laden adjectives like "intense" and "hardheaded" simply a way to describe traits that today might be categorized under juvenile behavioral disorder? A December, 2001, Wired magazine article titled "The Geek Syndrome" paints the portrait of several scientifically gifted children diagnosed with high-functioning autism or Asperger Syndrome. In many ways, the parental recollections recorded in the Wired article are eerily similar to the ones offered by Lippman. Even Stallman has indulged in psychiatric revisionism from time to time. During a 2000 profile for the Toronto Star, Stallman described himself to an interviewer as "borderline autistic,"~{ See Judy Steed, Toronto Star, BUSINESS, (October 9, 2000): C03.
      His vision of free software and social cooperation stands in stark contrast to the isolated nature of his private life. A Glenn Gould-like eccentric, the Canadian pianist was similarly brilliant, articulate, and lonely. Stallman considers himself afflicted, to some degree, by autism: a condition that, he says, makes it difficult for him to interact with people. }~ a description that goes a long way toward explaining a lifelong tendency toward social and emotional isolation and the equally lifelong effort to overcome it. +={Asperger Syndrome+1;autism+5} Such speculation benefits from the fast and loose nature of most so-called " behavioral disorders" nowadays, of course. As Steve Silberman, author of " The Geek Syndrome," notes, American psychiatrists have only recently come to accept Asperger Syndrome as a valid umbrella term covering a wide set of behavioral traits. The traits range from poor motor skills and poor socialization to high intelligence and an almost obsessive affinity for numbers, computers, and ordered systems.~{ See Steve Silberman, "The Geek Syndrome," Wired (December, 2001).
      http://www.wired.com/wired/archive/9.12/aspergers_pr.html }~ Reflecting on the broad nature of this umbrella, Stallman says its possible that, if born 40 years later, he might have merited just such a diagnosis. Then again, so would many of his computer-world colleagues. @@ -376,6 +382,7 @@ For all the agony it produced, adolescence would have a encouraging effect on St Outside the home, Stallman saved the jokes for the adults who tended to indulge his gifted nature. One of the first was a summer-camp counselor who handed Stallman a print-out manual for the IBM 7094 computer during his 12th year. To a preteenager fascinated with numbers and science, the gift was a godsend.~{ Stallman, an atheist, would probably quibble with this description. Suffice it to say, it was something Stallman welcomed. See previous note 1: "As soon as I heard about computers, I wanted to see one and play with one." }~ By the end of summer, Stallman was writing out paper programs according to the 7094's internal specifications, anxiously anticipating getting a chance to try them out on a real machine. With the first personal computer still a decade away, Stallman would be forced to wait a few years before getting access to his first computer. His first chance finally came during his junior year of high school. Hired on at the IBM New York Scientific Center, a now-defunct research facility in downtown Manhattan, Stallman spent the summer after high-school graduation writing his first program, a pre-processor for the 7094 written in the programming language PL/I. "I first wrote it in PL/I, then started over in assembler language when the PL/I program was too big to fit in the computer," he recalls. +={assembler language} After that job at the IBM Scientific Center, Stallman had held a laboratory-assistant position in the biology department at Rockefeller University. Although he was already moving toward a career in math or physics, Stallman's analytical mind impressed the lab director enough that a few years after Stallman departed for college, Lippman received an unexpected phone call. "It was the professor at Rockefeller," Lippman says. "He wanted to know how Richard was doing. He was surprised to learn that he was working in computers. He'd always thought Richard had a great future ahead of him as a biologist." @@ -393,7 +400,7 @@ By fall, Stallman was back within the mainstream population of New York City hig By the end of his first semester at Brandeis, things were falling into place. A 96 in English wiped away much of the stigma of the 60 earned 2 years before. For good measure, Stallman backed it up with top marks in American History, Advanced Placement Calculus, and Microbiology. The crowning touch was a perfect 100 in Physics. Though still a social outcast, Stallman finished his 11 months at Brandeis as the fourth-ranked student in a class of 789. -{free_as_in_freedom_02_rms_snr_year_report.png 381x286 "Stallman's senior-year transcript at Louis D. Brandeis H.S., November, 1969. Note turnaround in English class performance. 'He was forced to kowtow to a certain degree,' says his mother, 'but he did it.'" }http://www.free-culture.cc/ +{free_as_in_freedom_02_rms_snr_year_report.png 381x286 "Stallman's senior-year transcript at Louis D. Brandeis H.S., November, 1969. Note turnaround in English class performance. 'He was forced to kowtow to a certain degree,' says his mother, 'but he did it.'" }http://en.wikipedia.org/wiki/Richard_stallman Outside the classroom, Stallman pursued his studies with even more diligence, rushing off to fulfill his laboratory-assistant duties at Rockefeller University during the week and dodging the Vietnam protesters on his way to Saturday school at Columbia. It was there, while the rest of the Science Honors Program students sat around discussing their college choices, that Stallman finally took a moment to participate in the preclass bull session. @@ -494,12 +501,14 @@ For Stallman, the first taste of real computer programming at the IBM New York S Taking the manuals home, Stallman would examine machine specifications, compare them with other machines he already knew, and concoct a trial program, which he would then bring back to the lab along with the borrowed manual. Although some labs balked at the notion of a strange kid coming off the street and working on the lab machinery, most recognized competence when they saw it and let Stallman run the programs he had created. One day, near the end of freshman year, Stallman heard about a special laboratory near MIT. The laboratory was located on the ninth floor an off-campus building in Tech Square, the newly built facility dedicated to advanced research. According to the rumors, the lab itself was dedicated to the cutting-edge science of artificial intelligence and boasted the cutting-edge machines and software programs to match. +={artificial intelligence} Intrigued, Stallman decided to pay a visit. The trip was short, about 2 miles on foot, 10 minutes by train, but as Stallman would soon find out, MIT and Harvard can feel like opposite poles of the same planet. With its maze-like tangle of interconnected office buildings, the Institute's campus offered an aesthetic yin to Harvard's spacious colonial-village yang. The same could be said for the student body, a geeky collection of ex-high school misfits known more for its predilection for pranks than its politically powerful alumni. The yin-yang relationship extended to the AI Lab as well. Unlike Harvard computer labs, there was no grad-student gatekeeper, no clipboard waiting list for terminal access, no explicit atmosphere of "look but don't touch." Instead, Stallman found only a collection of open terminals and robotic arms, presumably the artifacts of some A.I. experiment. +={AI Lab (Artificial Intelligence Laboratory)+40} Although the rumors said anybody could sit down at the terminals, Stallman decided to stick with the original plan. When he encountered a lab employee, he asked if the lab had any spare manuals it could loan to an inquisitive student. "They had some, but a lot of things weren't documented," Stallman recalls. "They were hackers after all." @@ -511,9 +520,10 @@ To get a taste of "bureaucratic and stuffy," Stallman need only visit the comput Stallman quickly learned that the AI Lab's first-come, first-served policy owed much to the efforts of a vigilant few. Many were holdovers from the days of Project MAC, the Department of Defense-funded research program that had given birth to the first time-share operating systems. A few were already legends in the computing world. There was Richard Greenblatt, the lab's in-house Lisp expert and author of MacHack, the computer chess program that had once humbled A.I. critic Hubert Dreyfus. There was Gerald Sussman, original author of the robotic block-stacking program HACKER. And there was Bill Gosper, the in-house math whiz already in the midst of an 18-month hacking bender triggered by the philosophical implications of the computer game LIFE.~{ See Steven Levy, Hackers (Penguin USA [paperback], 1984): 144.
      Levy devotes about five pages to describing Gosper's fascination with LIFE, a math-based software game first created by British mathematician John Conway. I heartily recommend this book as a supplement, perhaps even a prerequisite, to this one. }~ -Members of the tight-knit group called themselves " hackers." Over time, they extended the "hacker" description to Stallman as well. In the process of doing so, they inculcated Stallman in the ethical traditions of the "hacker ethic ." To be a hacker meant more than just writing programs, Stallman learned. It meant writing the best possible programs. It meant sitting at a terminal for 36 hours straight if that's what it took to write the best possible programs. Most importantly, it meant having access to the best possible machines and the most useful information at all times. Hackers spoke openly about changing the world through software, and Stallman learned the instinctual hacker disdain for any obstacle that prevented a hacker from fulfilling this noble cause. Chief among these obstacles were poor software, academic bureaucracy, and selfish behavior. +Members of the tight-knit group called themselves "hackers." Over time, they extended the "hacker" description to Stallman as well. In the process of doing so, they inculcated Stallman in the ethical traditions of the "hacker ethic ." To be a hacker meant more than just writing programs, Stallman learned. It meant writing the best possible programs. It meant sitting at a terminal for 36 hours straight if that's what it took to write the best possible programs. Most importantly, it meant having access to the best possible machines and the most useful information at all times. Hackers spoke openly about changing the world through software, and Stallman learned the instinctual hacker disdain for any obstacle that prevented a hacker from fulfilling this noble cause. Chief among these obstacles were poor software, academic bureaucracy, and selfish behavior. -Stallman also learned the lore, stories of how hackers, when presented with an obstacle, had circumvented it in creative ways. Stallman learned about " lock hacking," the art of breaking into professors' offices to "liberate" sequestered terminals. Unlike their pampered Harvard counterparts, MIT faculty members knew better than to treat the AI Lab's terminal as private property. If a faculty member made the mistake of locking away a terminal for the night, hackers were quick to correct the error. Hackers were equally quick to send a message if the mistake repeated itself. "I was actually shown a cart with a heavy cylinder of metal on it that had been used to break down the door of one professor's office,"~{ Gerald Sussman, an MIT faculty member and hacker whose work at the AI Lab predates Stallman's, disputes this memory. According to Sussman, the hackers never broke any doors to retrieve terminals. }~ Stallman says. +Stallman also learned the lore, stories of how hackers, when presented with an obstacle, had circumvented it in creative ways. Stallman learned about "lock hacking," the art of breaking into professors' offices to "liberate" sequestered terminals. Unlike their pampered Harvard counterparts, MIT faculty members knew better than to treat the AI Lab's terminal as private property. If a faculty member made the mistake of locking away a terminal for the night, hackers were quick to correct the error. Hackers were equally quick to send a message if the mistake repeated itself. "I was actually shown a cart with a heavy cylinder of metal on it that had been used to break down the door of one professor's office,"~{ Gerald Sussman, an MIT faculty member and hacker whose work at the AI Lab predates Stallman's, disputes this memory. According to Sussman, the hackers never broke any doors to retrieve terminals. }~ Stallman says. +={AI Lab (Artificial Intelligence Laboratory):lock hacking at+31} Such methods, while lacking in subtlety, served a purpose. Although professors and administrators outnumbered hackers two-to-one inside the AI Lab, the hacker ethic prevailed. Indeed, by the time of Stallman's arrival at the AI Lab, hackers and the AI Lab administration had coevolved into something of a symbiotic relationship. In exchange for fixing the machines and keeping the software up and running, hackers earned the right to work on favorite pet projects. Often, the pet projects revolved around improving the machines and software programs even further. Like teenage hot-rodders, most hackers viewed tinkering with machines as its own form of entertainment. @@ -596,6 +606,7 @@ To call the Stallman gaze intense is an understatement. Stallman's eyes don't ju Maybe that's why most writers, when describing Stallman, tend to go for the religious angle. In a 1998 Salon.com article titled "The Saint of Free Software," Andrew Leonard describes Stallman's green eyes as "radiating the power of an Old Testament prophet."~{ See Andrew Leonard, "The Saint of Free Software," Salon.com (August 1998).
      http://www.salon.com/21st/feature/1998/08/cov_31feature.html }~ A 1999 Wired magazine article describes the Stallman beard as "Rasputin-like,"~{ See Leander Kahney, "Linux's Forgotten Man," Wired News (March 5, 1999).
      http://www.wired.com/news/print/0,1294,18291,00.html }~ while a London Guardian profile describes the Stallman smile as the smile of "a disciple seeing Jesus."~{ See "Programmer on moral high ground; Free software is a moral issue for Richard Stallman believes in freedom and free software." London Guardian (November 6, 1999).
      These are just a small sampling of the religious comparisons. To date, the most extreme comparison has to go to Linus Torvalds, who, in his autobiography-see Linus Torvalds and David Diamond, Just For Fun: The Story of an Accidentaly Revolutionary (HarperCollins Publishers, Inc., 2001): 58-writes "Richard Stallman is the God of Free Software."
      Honorable mention goes to Larry Lessig, who, in a footnote description of Stallman in his book-see Larry Lessig, The Future of Ideas (Random House, 2001): 270-likens Stallman to Moses:
      _1 ... as with Moses, it was another leader, Linus Torvalds, who finally carried the movement into the promised land by facilitating the development of the final part of the OS puzzle. Like Moses, too, Stallman is both respected and reviled by allies within the movement. He is [an] unforgiving, and hence for many inspiring, leader of a critically important aspect of modern culture. I have deep respect for the principle and commitment of this extraordinary individual, though I also have great respect for those who are courageous enough to question his thinking and then sustain his wrath.
      In a final interview with Stallman, I asked him his thoughts about the religious comparisons. "Some people do compare me with an Old Testament prophent, and the reason is Old Testament prophets said certain social practices were wrong. They wouldn't compromise on moral issues. They couldn't be bought off, and they were usually treated with contempt." }~ Such analogies serve a purpose, but they ultimately fall short. That's because they fail to take into account the vulnerable side of the Stallman persona. Watch the Stallman gaze for an extended period of time, and you will begin to notice a subtle change. What appears at first to be an attempt to intimidate or hypnotize reveals itself upon second and third viewing as a frustrated attempt to build and maintain contact. If, as Stallman himself has suspected from time to time, his personality is the product of autism or Asperger Syndrome, his eyes certainly confirm the diagnosis. Even at their most high-beam level of intensity, they have a tendency to grow cloudy and distant, like the eyes of a wounded animal preparing to give up the ghost. +={Asperger Syndrome;autism} My own first encounter with the legendary Stallman gaze dates back to the March, 1999, LinuxWorld Convention and Expo in San Jose, California. Billed as a "coming out party" for the Linux software community, the convention also stands out as the event that reintroduced Stallman to the technology media. Determined to push for his proper share of credit, Stallman used the event to instruct spectators and reporters alike on the history of the GNU Project and the project's overt political objectives. @@ -616,6 +627,7 @@ Maybe that's why, when LinuxWorld follows up its first two shows with a third Li My second encounter with Stallman and his trademark gaze comes shortly after that third LinuxWorld show. Hearing that Stallman is going to be in Silicon Valley, I set up a lunch interview in Palo Alto, California. The meeting place seems ironic, not only because of the recent no-show but also because of the overall backdrop. Outside of Redmond, Washington, few cities offer a more direct testament to the economic value of proprietary software. Curious to see how Stallman, a man who has spent the better part of his life railing against our culture's predilection toward greed and selfishness, is coping in a city where even garage-sized bungalows run in the half-million-dollar price range, I make the drive down from Oakland. I follow the directions Stallman has given me, until I reach the headquarters of Art.net, a nonprofit "virtual artists collective." Located in a hedge-shrouded house in the northern corner of the city, the Art.net headquarters are refreshingly run-down. Suddenly, the idea of Stallman lurking in the heart of Silicon Valley doesn't seem so strange after all. +={Art.net} I find Stallman sitting in a darkened room, tapping away on his gray laptop computer. He looks up as soon as I enter the room, giving me a full blast of his 200-watt gaze. When he offers a soothing "Hello," I offer a return greeting. Before the words come out, however, his eyes have already shifted back to the laptop screen. @@ -780,6 +792,7 @@ The waiter, uncomprehending or fooled by the look of the bill, smiles and scurri 1~ Chapter 6 - The Emacs Commune The AI Lab of the 1970s was by all accounts a special place. Cutting-edge projects and top-flight researchers gave it an esteemed position in the world of computer science. The internal hacker culture and its anarchic policies lent a rebellious mystique as well. Only later, when many of the lab's scientists and software superstars had departed, would hackers fully realize the unique and ephemeral world they had once inhabited. +={AI Lab (Artificial Intelligence Laboratory)+17} "It was a bit like the Garden of Eden," says Stallman, summing up the lab and its software-sharing ethos in a 1998 Forbes article. "It hadn't occurred to us not to cooperate."~{ See Josh McHugh, "For the Love of Hacking," Forbes (August 10, 1998).
      http://www.forbes.com/forbes/1998/0810/6203094a.html }~ @@ -874,6 +887,7 @@ Although Stallman had been powerless to head off Reid's sale, he did possess the Over time, Emacs became a sales tool for the hacker ethic. The flexibility Stallman and built into the software not only encouraged collaboration, it demanded it. Users who didn't keep abreast of the latest developments in Emacs evolution or didn't contribute their contributions back to Stallman ran the risk of missing out on the latest breakthroughs. And the breakthroughs were many. Twenty years later, users had modified Emacs for so many different uses-using it as a spreadsheet, calculator, database, and web browser-that later Emacs developers adopted an overflowing sink to represent its versatile functionality. "That's the idea that we wanted to convey," says Stallman. "The amount of stuff it has contained within it is both wonderful and awful at the same time." Stallman's AI Lab contemporaries are more charitable. Hal Abelson, an MIT grad student who worked with Stallman during the 1970s and would later assist Stallman as a charter boardmember of the Free Software Foundation, describes Emacs as "an absolutely brilliant creation." In giving programmers a way to add new software libraries and features without messing up the system, Abelson says, Stallman paved the way for future large-scale collaborative software projects. "Its structure was robust enough that you'd have people all over the world who were loosely collaborating [and] contributing to it," Abelson says. "I don't know if that had been done before."~{ In writing this chapter, I've elected to focus more on the social significance of Emacs than the software significance. To read more about the software side, I recommend Stallman's 1979 memo. I particularly recommend the section titled "Research Through Development of Installed Tools" (#SEC27). Not only is it accessible to the nontechnical reader, it also sheds light on how closely intertwined Stallman's political philosophies are with his software-design philosophies. A sample excerpt follows:
      _1 EMACS could not have been reached by a process of careful design, because such processes arrive only at goals which are visible at the outset, and whose desirability is established on the bottom line at the outset. Neither I nor anyone else visualized an extensible editor until I had made one, nor appreciated its value until he had experienced it. EMACS exists because I felt free to make individually useful small improvements on a path whose end was not in sight. }~ +={Abelson, Hal} Guy Steele expresses similar admiration. Currently a research scientist for Sun Microsystems, he remembers Stallman primarily as a "brilliant programmer with the ability to generate large quantities of relatively bug-free code." Although their personalities didn't exactly mesh, Steele and Stallman collaborated long enough for Steele to get a glimpse of Stallman's intense coding style. He recalls a notable episode in the late 1970s when the two programmers banded together to write the editor's "pretty print" feature. Originally conceived by Steele, pretty print was another keystroke-triggerd feature that reformatted Emacs' source code so that it was both more readable and took up less space, further bolstering the program's WYSIWIG qualities. The feature was strategic enough to attract Stallman's active interest, and it wasn't long before Steele wrote that he and Stallman were planning an improved version. @@ -898,10 +912,13 @@ Anticipating a skeptical response on some readers' part, the author made sure to _1 I am Richard Stallman, inventor of the original much-imitated EMACS editor, now at the Artificial Intelligence Lab at MIT. I have worked extensively on compilers, editors, debuggers, command interpreters, the Incompatible Timesharing System and the Lisp Machine operating system. I pioneered terminal-independent display support in ITS. In addition I have implemented one crashproof file system and two window systems for Lisp machines. ^44^ As fate would have it, Stallman's fanciful GNU Project missed its Thanksgiving launch date. By January, 1984, however, Stallman made good on his promise and fully immersed himself in the world of Unix software development. For a software architect raised on ITS, it was like designing suburban shopping malls instead of Moorish palaces. Even so, building a Unix-like operating system had its hidden advantages. ITS had been powerful, but it also possessed an Achilles' heel: MIT hackers had designed it to take specific advantage of the DEC-built PDP line. When AI Lab administrators elected to phase out the lab's powerful PDP-10 machine in the early 1980s, the operating system that hackers once likened to a vibrant city became an instant ghost town. Unix, on the other hand, was designed for mobility and long-term survival. Originally developed by junior scientists at AT&T, the program had slipped out under corporate-management radar, finding a happy home in the cash-strapped world of academic computer systems. With fewer resources than their MIT brethren, Unix developers had customized the software to ride atop a motley assortment of hardware systems: everything from the 16-bit PDP-11-a machine considered fit for only small tasks by most AI Lab hackers-to 32-bit mainframes such as the VAX 11/780. By 1983, a few companies, most notably Sun Microsystems, were even going so far as to develop a new generation of microcomputers, dubbed "workstations," to take advantage of the increasingly ubiquitous operating system. +={AT&T} To facilitate this process, the developers in charge of designing the dominant Unix strains made sure to keep an extra layer of abstraction between the software and the machine. Instead of tailoring the operating system to take advantage of a specific machine's resources-as the AI Lab hackers had done with ITS and the PDP-10-Unix developers favored a more generic, off-the-rack approach. Focusing more on the interlocking standards and specifications that held the operating system's many subcomponents together, rather than the actual components themselves, they created a system that could be quickly modified to suit the tastes of any machine. If a user quibbled with a certain portion, the standards made it possible to pull out an individual subcomponent and either fix it or replace it with something better. Simply put, what the Unix approach lacked in terms of style or aesthetics, it more than made up for in terms of flexibility and economy, hence its rapid adoption.~{ See Marshall Kirk McKusick, "Twenty Years of Berkeley Unix," Open Sources (O'Reilly & Associates, Inc., 1999): 38. }~ +={abstraction:designing Unix} Stallman's decision to start developing the GNU system was triggered by the end of the ITS system that the AI Lab hackers had nurtured for so long. The demise of ITS had been a traumatic blow to Stallman. Coming on the heels of the Xerox laser printer episode, it offered further evidence that the AI Lab hacker culture was losing its immunity to business practices in the outside world. +={AI Lab (Artificial Intelligence Laboratory):ITS demise+3} Like the software code that composed it, the roots of ITS' demise stretched way back. Defense spending, long a major font for computer-science research, had dried up during the post-Vietnam years. In a desperate quest for new funds, laboratories and universities turned to the private sector. In the case of the AI Lab, winning over private investors was an easy sell. Home to some of the most ambitious computer-science projects of the post-war era, the lab became a quick incubator of technology. Indeed, by 1980, most of the lab's staff, including many hackers, were dividing its time between Institute and commercial projects. @@ -922,6 +939,7 @@ Cadging passwords and deliberately crashing the system in order to glean evidenc "There has been another attempt to seize power," Stallman wrote. "So far, the aristocratic forces have been defeated." To protect his identity, Stallman signed the message "Radio Free OZ." The disguise was a thin one at best. By 1982, Stallman's aversion to passwords and secrecy had become so well known that users outside the AI Laboratory were using his account as a stepping stone to the ARPAnet, the research-funded computer network that would serve as a foundation for today's Internet. One such "tourist" during the early 1980s was Don Hopkins, a California programmer who learned through the hacking grapevine that all an outsider needed to do to gain access to MIT's vaunted ITS system was to log in under the initials RMS and enter the same three-letter monogram when the system requested a password. +={ARPAnet+2} "I'm eternally grateful that MIT let me and many other people use their computers for free," says Hopkins. "It meant a lot to many people." @@ -930,12 +948,16 @@ This so-called "tourist" policy, which had been openly tolerated by MIT manageme "[When] passwords first appeared at the MIT AI Lab I [decided] to follow my belief that there should be no passwords," Stallman would later say. "Because I don't believe that it's really desirable to have security on a computer, I shouldn't be willing to help uphold the security regime." ^46^ Stallman's refusal to bow before the great and powerful Oz symbolized the growing tension between hackers and AI Lab management during the early 1980s. This tension paled in comparison to the conflict that raged within the hacker community itself. By the time the KL-10 arrived, the hacker community had already divided into two camps. The first centered around a software company called Symbolics, Inc. The second centered around Symbolics chief rival, Lisp Machines, Inc. (LMI). Both companies were in a race to market the Lisp Machine, a device built to take full advantage of the Lisp programming language. +={Symbolics+15} Created by artificial-intelligence research pioneer John McCarthy, a MIT artificial-intelligence researcher during the late 1950s, Lisp is an elegant language well-suited for programs charged with heavy-duty sorting and processing. The language's name is a shortened version of LISt Processing. Following McCarthy's departure to the Stanford Artificial Intelligence Laboratory, MIT hackers refined the language into a local dialect dubbed MACLISP. The "MAC" stood for Project MAC, the DARPA-funded research project that gave birth to the AI Lab and the Laboratory for Computer Science. Led by AI Lab arch-hacker Richard Greenblatt, AI Lab programmers during the 1970s built up an entire Lisp-based operating system, dubbed the Lisp Machine operating system. By 1980, the Lisp Machine project had generated two commercial spin-offs. Symbolics was headed by Russell Noftsker, a former AI Lab administrator, and Lisp Machines, Inc., was headed by Greenblatt. The Lisp Machine software was hacker-built, meaning it was owned by MIT but available for anyone to copy as per hacker custom. Such a system limited the marketing advantage of any company hoping to license the software from MIT and market it as unique. To secure an advantage, and to bolster the aspects of the operating system that customers might consider attractive, the companies recruited various AI Lab hackers and set them working on various components of the Lisp Machine operating system outside the auspices of the AI Lab. The most aggressive in this strategy was Symbolics. By the end of 1980, the company had hired 14 AI Lab staffers as part-time consultants to develop its version of the Lisp Machine. Apart from Stallman, the rest signed on to help LMI.~{ See H. P. Newquist, The Brain Makers: Genius, Ego, and Greed in the Quest for Machines that Think (Sams Publishing, 1994): 172. }~ +={AI Lab (Artificial Intelligence Laboratory):Symbolics and+10} + +% Symbolics AI Lab longer range marked At first, Stallman accepted both companies' attempt to commercialize the Lisp machine, even though it meant more work for him. Both licensed the Lisp Machine OS source code from MIT, and it was Stallman's job to update the lab's own Lisp Machine to keep pace with the latest innovations. Although Symbolics' license with MIT gave Stallman the right to review, but not copy, Symbolics' source code, Stallman says a "gentleman's agreement" between Symbolics management and the AI Lab made it possible to borrow attractive snippets in traditional hacker fashion. @@ -968,6 +990,7 @@ Stallman would have little opportunity to mourn. The Lisp Machine, despite all t Riding atop this microprocessor wave were hundreds-thousands-of commercial software programs, each protected by a patchwork of user licenses and nondisclosure agreements that made it impossible for hackers to review or share source code. The licenses were crude and ill-fitting, but by 1983 they had become strong enough to satisfy the courts and scare away would-be interlopers. Software, once a form of garnish most hardware companies gave away to make their expensive computer systems more flavorful, was quickly becoming the main dish. In their increasing hunger for new games and features, users were putting aside the traditional demand to review the recipe after every meal. Nowhere was this state of affairs more evident than in the realm of personal computer systems. Companies such as Apple Computer and Commodore were minting fresh millionaires selling machines with built-in operating systems. Unaware of the hacker culture and its distaste for binary-only software, many of these users saw little need to protest when these companies failed to attach the accompanying source-code files. A few anarchic adherents of the hacker ethic helped propel that ethic into this new marketplace, but for the most part, the marketplace rewarded the programmers speedy enough to write new programs and savvy enough to copyright them as legally protected works. +={Apple Computers} One of the most notorious of these programmers was Bill Gates, a Harvard dropout two years Stallman's junior. Although Stallman didn't know it at the time, seven years before sending out his message to the n et.unix-wizards newsgroup, Gates, a budding entrepreneur and general partner with the Albuquerque-based software firm Micro-Soft, later spelled as Microsoft, had sent out his own open letter to the software-developer community. Written in response to the PC users copying Micro-Soft's software programs, Gates' " Open Letter to Hobbyists" had excoriated the notion of communal software development. @@ -1032,6 +1055,7 @@ Forced to watch his work sink into the mire while his erstwhile employer struggl 1~ Chapter 8 - St. Ignucius The Maui High Performance Computing Center is located in a single-story building in the dusty red hills just above the town of Kihei. Framed by million-dollar views and the multimillion dollar real estate of the Silversword Golf Course, the center seems like the ultimate scientific boondoggle. Far from the boxy, sterile confines of Tech Square or even the sprawling research metropolises of Argonne, Illinois and Los Alamos, New Mexico, the MHPCC seems like the kind of place where scientists spend more time on their tans than their post-doctoral research projects. +={Argonne (Illinois)} The image is only half true. Although researchers at the MHPCC do take advantage of the local recreational opportunities, they also take their work seriously. According to Top500.org, a web site that tracks the most powerful supercomputers in the world, the IBM SP Power3 supercomputer housed within the MHPCC clocks in at 837 billion floating-point operations per second, making it one of 25 most powerful computers in the world. Co-owned and operated by the University of Hawaii and the U.S. Air Force, the machine divides its computer cycles between the number crunching tasks associated with military logistics and high-temperature physics research. @@ -1093,7 +1117,7 @@ As if to drive home this message, Stallman punctuates his speech with an unusual "I am St. Ignucius of the Church of Emacs," says Stallman, raising his right hand in mock-blessing. "I bless your computer, my child." -{free_as_in_freedom_03_rms_st_ignucius.png 188x209 "Stallman dressed as St. Ignucius. Photo by Wouter van Oortmerssen." }http://www.free-culture.cc/ +{free_as_in_freedom_03_rms_st_ignucius.png 188x209 "Stallman dressed as St. Ignucius. Photo by Wouter van Oortmerssen." }http://en.wikipedia.org/wiki/Richard_stallman The laughter turns into full-blown applause after a few seconds. As audience members clap, the computer disk on Stallman's head catches the glare of an overhead light, eliciting a perfect halo effect. In the blink of an eye, Stallman goes from awkward haole to Russian religious icon. @@ -1221,12 +1245,14 @@ The German sociologist Max Weber once proposed that all great religions are buil While not religious per se, the GNU GPL certainly qualifies as an interesting example of this "routinization" process at work in the modern, decentralized world of software development. Since its unveiling, programmers and companies who have otherwise expressed little loyalty or allegiance to Stallman have willingly accepted the GPL bargain at face value. A few have even accepted the GPL as a preemptive protective mechanism for their own software programs. Even those who reject the GPL contract as too compulsory, still credit it as influential. One hacker falling into this latter group was Keith Bostic, a University of California employee at the time of the GPL 1.0 release. Bostic's department, the Computer Systems Research Group (SRG), had been involved in Unix development since the late 1970s and was responsible for many key parts of Unix, including the TCP/IP networking protocol, the cornerstone of modern Internet communications. By the late 1980s, AT&T, the original owner of the Unix brand name, began to focus on commercializing Unix and began looking to the Berkeley Software Distribution, or BSD, the academic version of Unix developed by Bostic and his Berkeley peers, as a key source of commercial technology. +={AT&T+1} Although the Berkeley BSD source code was shared among researchers and commercial programmers with a source-code license, this commercialization presented a problem. The Berkeley code was intermixed with proprietary AT&T code. As a result, Berkeley distributions were available only to institutions that already had a Unix source license from AT&T. As AT&T raised its license fees, this arrangement, which had at first seemed innocuous, became increasingly burdensome. Hired in 1986, Bostic had taken on the personal project of porting BSD over to the Digital Equipment Corporation's PDP-11 computer. It was during this period, Bostic says, that he came into close interaction with Stallman during Stallman's occasional forays out to the west coast. "I remember vividly arguing copyright with Stallman while he sat at borrowed workstations at CSRG," says Bostic. "We'd go to dinner afterward and continue arguing about copyright over dinner." The arguments eventually took hold, although not in the way Stallman would have liked. In June, 1989, Berkeley separated its networking code from the rest of the AT&T-owned operating system and distributed it under a University of California license. The contract terms were liberal. All a licensee had to do was give credit to the university in advertisements touting derivative programs.~{ The University of California's "obnoxious advertising clause" would later prove to be a problem. Looking for a less restrictive alternative to the GPL, some hackers used the University of California, replacing "University of California" with the name of their own instution. The result: free software programs that borrowed from dozens of other programs would have to cite dozens of institutions in advertisements. In 1999, after a decade of lobbying on Stallman's part, the University of California agreed to drop this clause.
      See "The BSD License Problem" at http://www.gnu.org/philosophy/bsd.html. }~ In contrast to the GPL, proprietary offshoots were permissible. Only one problem hampered the license's rapid adoption: the BSD Networking release wasn't a complete operating system. People could study the code, but it could only be run in conjunction with other proprietary-licensed code. +={AT&T+1} Over the next few years, Bostic and other University of California employees worked to replace the missing components and turn BSD into a complete, freely redistributable operating system. Although delayed by a legal challenge from Unix Systems Laboratories-the AT&T spin-off that retained ownership of the Unix brand name-the effort would finally bear fruit in the early 1990s. Even before then, however, many of the Berkeley utilities would make their way into Stallman's GNU Project. @@ -1269,6 +1295,7 @@ According to Stallman, improving software programs was secondary to building the Nevertheless, as GNU tools made their mark in the late 1980s, Stallman's AI Lab-honed reputation for design fastidiousness soon became legendary throughout the entire software-development community. Jeremy Allison, a Sun user during the late 1980s and programmer destined to run his own free software project, Samba, in the 1990s, recalls that reputation with a laugh. During the late 1980s, Allison began using Emacs. Inspired by the program's community-development model, Allison says he sent in a snippet of source code only to have it rejected by Stallman. +={Allison, Jeramy+1} "It was like the Onion headline," Allison says. "`Child's prayers to God answered: No.'" @@ -1276,7 +1303,8 @@ Stallman's growing stature as a software programmer, however, was balanced by hi A review of GNU Project "GNUsletters" of the late 1980s reflects the management tension. In January, 1987, Stallman announced to the world that the GNU Project was working to overhaul TRIX, a Unix kernel developed at MIT. A year later, in February of 1988, the GNU Project announced that it had shifted its attentions to Mach, a lightweight "micro-kernel" developed at Carnegie Mellon. All told, however, official GNU Project kernel development wouldn't commence until 1990.~{ See "HURD History."
      http://www.gnu.org/software/hurd/history.html }~ -The delays in kernel development were just one of many concerns weighing on Stallman during this period. In 1989, Lotus Development Corporation filed suit against rival software company, Paperback Software International, for copying menu commands in Lotus' popular 1-2-3 Spreadsheet program. Lotus' suit, coupled with the Apple -Microsoft "look and feel" battle, provided a troublesome backdrop for the GNU Project. Although both suits fell outside the scope of the GNU Project, both revolved around operating systems and software applications developed for the personal computer, not Unix-compatible hardware systems-they threatened to impose a chilling effect on the entire culture of software development. Determined to do something, Stallman recruited a few programmer friends and composed a magazine ad blasting the lawsuits. He then followed up the ad by helping to organize a group to protest the corporations filing the suit. Calling itself the League of Programming Freedom, the group held protests outside the offices of Lotus, Inc. and the Boston courtroom hosting the Lotus trial. +The delays in kernel development were just one of many concerns weighing on Stallman during this period. In 1989, Lotus Development Corporation filed suit against rival software company, Paperback Software International, for copying menu commands in Lotus' popular 1-2-3 Spreadsheet program. Lotus' suit, coupled with the Apple-Microsoft "look and feel" battle, provided a troublesome backdrop for the GNU Project. Although both suits fell outside the scope of the GNU Project, both revolved around operating systems and software applications developed for the personal computer, not Unix-compatible hardware systems-they threatened to impose a chilling effect on the entire culture of software development. Determined to do something, Stallman recruited a few programmer friends and composed a magazine ad blasting the lawsuits. He then followed up the ad by helping to organize a group to protest the corporations filing the suit. Calling itself the League of Programming Freedom, the group held protests outside the offices of Lotus, Inc. and the Boston courtroom hosting the Lotus trial. +={Apple Computers} The protests were notable.~{ According to a League of Programming Freedom Press, the protests were notable for featuring the first hexadecimal protest chant:
      1-2-3-4, toss the lawyers out the door;
      5-6-7-8, innovate don't litigate;
      9-A-B-C, 1-2-3 is not for me;
      D-E-F-O, look and feel have got to go
      http://lpf.ai.mit.edu/Links/prep.ai.mit.edu/demo.final.release }~ They document the evolving nature of software industry. Applications had quietly replaced operating systems as the primary corporate battleground. In its unfulfilled quest to build a free software operating system, the GNU Project seemed hopelessly behind the times. Indeed, the very fact that Stallman had felt it necessary to put together an entirely new group dedicated to battling the "look and feel" lawsuits reinforced that obsolescence in the eyes of some observers. @@ -1469,6 +1497,7 @@ Summarized Raymond, "I think Linus's cleverest and most consequential hack was n In summarizing the secrets of Torvalds' managerial success, Raymond himself had pulled off a coup. One of the audience members at the Linux Kongress was Tim O'Reilly, publisher of O'Reilly & Associates, a company specializing in software manuals and software-related books (and the publisher of this book). After hearing Raymond's Kongress speech, O'Reilly promptly invited Raymond to deliver it again at the company's inaugural Perl Conference later that year in Monterey, California. Although the conference was supposed to focus on Perl, a scripting language created by Unix hacker Larry Wall, O'Reilly assured Raymond that the conference would address other free software technologies. Given the growing commercial interest in Linux and Apache, a popular free software web server, O'Reilly hoped to use the event to publicize the role of free software in creating the entire infrastructure of the Internet. From web-friendly languages such as Perl and Python to back-room programs such as BIND (the Berkeley Internet Naming Daemon), a software tool that lets users replace arcane IP numbers with the easy-to-remember domain-name addresses (e.g., amazon.com), and sendmail, the most popular mail program on the Internet, free software had become an emergent phenomenon. Like a colony of ants creating a beautiful nest one grain of sand at a time, the only thing missing was the communal self-awareness. O'Reilly saw Raymond's speech as a good way to inspire that self-awareness, to drive home the point that free software development didn't start and end with the GNU Project. Programming languages, such as Perl and Python, and Internet software, such as BIND, sendmail, and Apache, demonstrated that free software was already ubiquitous and influential. He also assured Raymond an even warmer reception than the one at Linux Kongress. +={Apache web server} O'Reilly was right. "This time, I got the standing ovation before the speech," says Raymond, laughing. @@ -1477,8 +1506,10 @@ As predicted, the audience was stocked not only with hackers, but with other peo Intrigued by Raymond's speech and anxious to win back lost market share, Netscape executives took the message back to corporate headquarters. A few months later, in January, 1998, the company announced its plan to publish the source code of its flagship Navigator web browser in the hopes of enlisting hacker support in future development. When Netscape CEO Jim Barksdale cited Raymond's "Cathedral and the Bazaar" essay as a major influence upon the company's decision, the company instantly elevated Raymond to the level of hacker celebrity. Determined not to squander the opportunity, Raymond traveled west to deliver interviews, advise Netscape executives, and take part in the eventual party celebrating the publication of Netscape Navigator's source code. The code name for Navigator's source code was "Mozilla": a reference both to the program's gargantuan size-30 million lines of code-and to its heritage. Developed as a proprietary offshoot of Mosaic, the web browser created by Marc Andreessen at the University of Illinois, Mozilla was proof, yet again, that when it came to building new programs, most programmers preferred to borrow on older, modifiable programs. +={Andreessen, Marc} While in California, Raymond also managed to squeeze in a visit to VA Research, a Santa Clara-based company selling workstations with the GNU/Linux operating system preinstalled. Convened by Raymond, the meeting was small. The invite list included VA founder Larry Augustin, a few VA employees, and Christine Peterson, president of the Foresight Institute, a Silicon Valley think tank specializing in nanotechnology. +={Augustin, Larry} "The meeting's agenda boiled down to one item: how to take advantage of Netscape's decision so that other companies might follow suit?" Raymond doesn't recall the conversation that took place, but he does remember the first complaint addressed. Despite the best efforts of Stallman and other hackers to remind people that the word "free" in free software stood for freedom and not price, the message still wasn't getting through. Most business executives, upon hearing the term for the first time, interpreted the word as synonymous with "zero cost," tuning out any follow up messages in short order. Until hackers found a way to get past this cognitive dissonance, the free software movement faced an uphill climb, even after Netscape. @@ -1519,6 +1550,7 @@ Summing up his position at the 1999 LinuxWorld Convention and Expo, an event bil "Because we've shown how much we can do, we don't have to be desperate to work with companies or compromise our goals," Stallman said during a panel discussion. "Let them offer and we'll accept. We don't have to change what we're doing to get them to help us. You can take a single step towards a goal, then another and then more and more and you'll actually reach your goal. Or, you can take a half measure that means you don't ever take another step and you'll never get there." Even before the LinuxWorld show, however, Stallman was showing an increased willingness to alienate his more conciliatory peers. A few months after the Freeware Summit, O'Reilly hosted its second annual Perl Conference. This time around, Stallman was in attendance. During a panel discussion lauding IBM's decision to employ the free software Apache web server in its commercial offerings, Stallman, taking advantage of an audience microphone, disrupted the proceedings with a tirade against panelist John Ousterhout, creator of the Tcl scripting language. Stallman branded Ousterhout a "parasite" on the free software community for marketing a proprietary version of Tcl via Ousterhout's startup company, Scriptics. "I don't think Scriptics is necessary for the continued existence of Tcl," Stallman said to hisses from the fellow audience members. ^98^ +={Apache web server} "It was a pretty ugly scene," recalls Prime Time Freeware's Rich Morin. "John's done some pretty respectable things: Tcl, Tk, Sprite. He's a real contributor." @@ -1530,6 +1562,7 @@ http://www.opensource.org/docs/definition.html }~ Perens would later resign from the OSI, expressing regret that the organization had set itself up in opposition to Stallman and the FSF. Still, looking back on the need for a free software definition outside the Free Software Foundation's auspices, Perens understands why other hackers might still feel the need for distance. "I really like and admire Richard," says Perens. "I do think Richard would do his job better if Richard had more balance. That includes going away from free software for a couple of months." Stallman's monomaniacal energies would do little to counteract the public-relations momentum of open source proponents. In August of 1998, when chip-maker Intel purchased a stake in GNU/Linux vendor Red Hat, an accompanying New York Times article described the company as the product of a movement "known alternatively as free software and open source."~{ See Amy Harmon, "For Sale: Free Operating System," New York Times (September 28, 1998).
      http://www.nytimes.com/library/tech/98/09/biztech/articles/28linux.html }~ Six months later, a John Markoff article on Apple Computer was proclaiming the company's adoption of the "open source" Apache server in the article headline.~{ See John Markoff, "Apple Adopts `Open Source' for its Server Computers," New York Times (March 17, 1999).
      http://www.nytimes.com/library/tech/99/03/biztech/articles/17apple.html }~ +={Apache web server;Apple Computers:open source software and} Such momentum would coincide with the growing momentum of companies that actively embraced the "open source" term. By August of 1999, Red Hat, a company that now eagerly billed itself as "open source," was selling shares on Nasdaq. In December, VA Linux-formerly VA Research-was floating its own IPO to historical effect. Opening at $30 per share, the company's stock price exploded past the $300 mark in initial trading only to settle back down to the $239 level. Shareholders lucky enough to get in at the bottom and stay until the end experienced a 698% increase in paper wealth, a Nasdaq record. @@ -1702,6 +1735,7 @@ Moglen says that moment, more than any other, drove home the elemental simplicit Writing the biography of a living person is a bit like producing a play. The drama in front of the curtain often pales in comparison to the drama backstage. In The Autobiography of Malcolm X, Alex Haley gives readers a rare glimpse of that backstage drama. Stepping out of the ghostwriter role, Haley delivers the book's epilogue in his own voice. The epilogue explains how a freelance reporter originally dismissed as a "tool" and "spy" by the Nation of Islam spokesperson managed to work through personal and political barriers to get Malcolm X's life story on paper. +={Autobiography of Malcolm X, The (Haley)+1} While I hesitate to compare this book with The Autobiography of Malcolm X, I do owe a debt of gratitude to Haley for his candid epilogue. Over the last 12 months, it has served as a sort of instruction manual on how to deal with a biographical subject who has built an entire career on being disagreeable. From the outset, I envisioned closing this biography with a similar epilogue, both as an homage to Haley and as a way to let readers know how this book came to be. @@ -1775,6 +1809,7 @@ I made a few more suggestions with little effect. About the only thing I could g Before I signed off, Stallman suggested I tell the publisher that I'd promised Stallman that the work would be free. I told Stallman I couldn't agree to that statement but that I did view the book as unfinishable without his cooperation. Seemingly satisfied, Stallman hung up with his usual sign-off line: "Happy hacking." Henning and I met with Tracy the next day. Tracy said her company was willing to publish copyable excerpts in a unencrypted format but would limit the excerpts to 500 words. Henning informed her that this wouldn't be enough for me to get around my ethical obligation to Stallman. Tracy mentioned her own company's contractual obligation to online vendors such as Amazon.com. Even if the company decided to open up its e-book content this one time, it faced the risk of its partners calling it a breach of contract. Barring a change of heart in the executive suite or on the part of Stallman, the decision was up to me. I could use the interviews and go against my earlier agreement with Stallman, or I could plead journalistic ethics and back out of the verbal agreement to do the book. +={Amazon.com} Following the meeting, my agent and I relocated to a pub on Third Ave. I used his cell phone to call Stallman, leaving a message when nobody answered. Henning left for a moment, giving me time to collect my thoughts. When he returned, he was holding up the cell phone. @@ -1870,7 +1905,7 @@ Afterwards, when the dinner was complete and Sarah had departed, Stallman seemed Before parting, Stallman handed me his "pleasure card," a business card listing Stallman's address, phone number, and favorite pastimes ("sharing good books, good food and exotic music and dance") so that I might set up a final interview. -{free_as_in_freedom_04_rms_pleasure_card.png 355x207 "Stallman's 'pleasure' card, handed to me the night of our dinner." }http://www.free-culture.cc/ +{free_as_in_freedom_04_rms_pleasure_card.png 355x207 "Stallman's 'pleasure' card, handed to me the night of our dinner." }http://en.wikipedia.org/wiki/Richard_stallman The next day, over another meal of dim sum, Stallman seemed even more lovestruck than the night before. Recalling his debates with Currier House dorm maters over the benefits and drawbacks of an immortality serum, Stallman expressed hope that scientists might some day come up with the key to immortality. "Now that I'm finally starting to have happiness in my life, I want to have more," he said. @@ -1898,7 +1933,8 @@ A similar situation surrounds the terms "free software" and "open source." Again To understand the full meaning of the word " hacker," it helps to examine the word's etymology over the years. -The New Hacker Dictionary, an online compendium of software-programmer jargon, officially lists nine different connotations of the word "hack" and a similar number for "hacker." Then again, the same publication also includes an accompanying essay that quotes Phil Agre, an MIT hacker who warns readers not to be fooled by the word's perceived flexibility. "Hack has only one meaning," argues Agre. "An extremely subtle and profound one which defies articulation." +/{The New Hacker Dictionary}/, an online compendium of software-programmer jargon, officially lists nine different connotations of the word "hack" and a similar number for "hacker." Then again, the same publication also includes an accompanying essay that quotes Phil Agre, an MIT hacker who warns readers not to be fooled by the word's perceived flexibility. "Hack has only one meaning," argues Agre. "An extremely subtle and profound one which defies articulation." +={Agre, Phil} Regardless of the width or narrowness of the definition, most modern hackers trace the word back to MIT, where the term bubbled up as popular item of student jargon in the early 1950s. In 1990 the MIT Museum put together a journal documenting the hacking phenomenon. According to the journal, students who attended the institute during the fifties used the word "hack" the way a modern student might use the word "goof." Hanging a jalopy out a dormitory window was a "hack," but anything harsh or malicious-e.g., egging a rival dorm's windows or defacing a campus statue-fell outside the bounds. Implicit within the definition of "hack" was a spirit of harmless, creative fun. @@ -1921,6 +1957,7 @@ It is a testament to the original computer hackers' prodigious skill that later As the definition tightened, "computer" hacking acquired additional semantic overtones. To be a hacker, a person had to do more than write interesting software; a person had to belong to the hacker "culture" and honor its traditions the same way a medieval wine maker might pledge membership to a vintners' guild. The social structure wasn't as rigidly outlined as that of a guild, but hackers at elite institutions such as MIT, Stanford, and Carnegie Mellon began to speak openly of a "hacker ethic": the yet-unwritten rules that governed a hacker's day-to-day behavior. In the 1984 book Hackers, author Steven Levy, after much research and consultation, codified the hacker ethic as five core hacker tenets. In many ways, the core tenets listed by Levy continue to define the culture of computer hacking. Still, the guild-like image of the hacker community was undermined by the overwhelmingly populist bias of the software industry. By the early 1980s, computers were popping up everywhere, and programmers who once would have had to travel to top-rank institutions or businesses just to gain access to a machine suddenly had the ability to rub elbows with major-league hackers via the ARPAnet. The more these programmers rubbed elbows, the more they began to appropriate the anarchic philosophies of the hacker culture in places like MIT. Lost within the cultural transfer, however, was the native MIT cultural taboo against malicious behavior. As younger programmers began employing their computer skills to harmful ends-creating and disseminating computer viruses, breaking into military computer systems, deliberately causing machines such as MIT Oz, a popular ARPAnet gateway, to crash-the term "hacker" acquired a punk, nihilistic edge. When police and businesses began tracing computer-related crimes back to a few renegade programmers who cited convenient portions of the hacking ethic in defense of their activities, the word "hacker" began appearing in newspapers and magazine stories in a negative light. Although books like Hackers did much to document the original spirit of exploration that gave rise to the hacking culture, for most news reporters, "computer hacker" became a synonym for "electronic burglar." +={ARPAnet} Although hackers have railed against this perceived misusage for nearly two decades, the term's rebellious connotations dating back to the 1950s make it hard to discern the 15-year-old writing software programs that circumvent modern encryption programs from the 1960s college student, picking locks and battering down doors to gain access to the lone, office computer terminal. One person's creative subversion of authority is another person's security headache, after all. Even so, the central taboo against malicious or deliberately harmful behavior remains strong enough that most hackers prefer to use the term " cracker"-i.e., a person who deliberately cracks a computer security system to steal or vandalize data-to describe the subset of hackers who apply their computing skills maliciously. diff --git a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst index 32659adf..09a8f427 100644 --- a/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst +++ b/data/doc/sisu/sisu_markup_samples/sisu_manual/sisu_markup.sst @@ -39,7 +39,7 @@ { SiSU help }http://www.jus.uio.no/sisu/sisu_manual/sisu_help/ { SiSU help sources }http://www.jus.uio.no/sisu/sisu_manual/sisu_help_sources/ -% @prefix: +% @prefix: :A~? @title @creator @@ -1057,6 +1057,70 @@ code{ }code +2~ Book index + +To make an index append to paragraph the book index term relates to it, using an equal sign and curly braces. + +Currently two levels are provided, a main term and if needed a sub-term. Sub-terms are separated from the main term by a colon. + +code{ + + Paragraph containing main term and sub-term. + ={Main term:sub-term} + +}code + +The index syntax starts on a new line, but there should not be an empty line between paragraph and index markup. + +The structure of the resulting index would be: + +code{ + + Main term, 1 + sub-term, 1 + +}code + +Several terms may relate to a paragraph, they are separated by a semicolon. If the term refers to more than one paragraph, indicate the number of paragraphs. + +code{ + + Paragraph containing main term, second term and sub-term. + ={first term; second term: sub-term} + +}code + +The structure of the resulting index would be: + +code{ + + First term, 1, + Second term, 1, + sub-term, 1 + +}code + +If multiple sub-terms appear under one paragraph, they are separated under the main term heading from each other by a pipe symbol. + +code{ + + Paragraph containing main term, second term and sub-term. + ={Main term:sub-term+1|second sub-term + + A paragraph that continues discussion of the first sub-term + +}code + +The plus one in the example provided indicates the first sub-term spans one additional paragraph. The logical structure of the resulting index would be: + +code{ + + Main term, 1, + sub-term, 1-3, + second sub-term, 1, + +}code + 1~ Composite documents markup It is possible to build a document by creating a master document that requires other documents. The documents required may be complete documents that could be generated independently, or they could be markup snippets, prepared so as to be easily available to be placed within another text. If the calling document is a master document (built from other documents), it should be named with the suffix *{.ssm}* Within this document you would provide information on the other documents that should be included within the text. These may be other documents that would be processed in a regular way, or markup bits prepared only for inclusion within a master document *{.sst}* regular markup file, or *{.ssi}* (insert/information) A secondary file of the composite document is built prior to processing with the same prefix and the suffix *{._sst}* @@ -1143,7 +1207,7 @@ and code{ -~[* my note ]~ or ~[+ another note ]~ +~[* my note ]~ or ~[+ another note ]~ }code diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index a5806d06..c2bba846 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -288,8 +288,7 @@ module SiSU_book_index path="#{@env.path.output}/#{@md.fnb}" Dir.mkdir(path) unless FileTest.directory?(path) html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w') - puts "#{path}/#{@md.fn[:book_index]}" - #html_file(the_idx) + #puts "#{path}/#{@md.fn[:book_index]}" html_idx.each {|x| html_index_file << x } html_index_file.close end diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 796c3939..a280a8c8 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -63,18 +63,28 @@ module SiSU_HTML_seg require "#{SiSU_lib}/html" require "#{SiSU_lib}/html_promo" class Seg_output - def initialize(outputfile,seg,minitoc,type='') - @output_seg_file,@seg,@minitoc,@type=outputfile,seg,minitoc,type + def initialize(md,outputfile,seg,minitoc,type='') + @md,@output_seg_file,@seg,@minitoc,@type=md,outputfile,seg,minitoc,type end def output #CONSIDER - if @seg[:title] =~/\S/ #kludge (for exception file better.ways, how ironic) get a real ruby test, e.g. test that not array or... + if @seg[:title] =~/\S/ filename_seg=[] filename_seg << @seg[:title] << @seg[:tocband_banner] if @type =~/endnote/ -#p @seg[:headers] #FIX endnote header + @seg[:headers]=[] + format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) + @seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator) + txt_obj={:txt =>'Endnotes',:ocn_display =>''} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) + @seg[:headers] << format_seg.title_header1 filename_seg << @seg[:header_endnotes] << @minitoc << @seg[:headers] << %{\n
      \n} << @seg[:endnote_all] << '
      ' # << '
    ' elsif @type =~/idx/ -#p @seg[:headers] #FIX inserted index header + @seg[:headers]=[] + format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) + @seg[:headers] << format_head_seg.title_banner(@md.title,@md.subtitle,@dc_creator) + txt_obj={:txt =>'Index',:ocn_display =>''} + format_seg=SiSU_HTML_Format::Format_seg.new(@md,txt_obj) + @seg[:headers] << format_seg.title_header1 filename_seg << @seg[:header_idx] << @minitoc << @seg[:headers] << %{\n
    \n} << @seg[:idx] << '
    ' # << '
    ' else filename_seg << @minitoc << @seg[:headers] << @seg[:main] << "\n
    \n" @@ -191,11 +201,11 @@ module SiSU_HTML_seg segfilename="#{@md.dir_out}/#{@md.fnl[:pre]}#{@@seg_name_html[tracking-1]}#{@md.fnl[:mid]}#@h_sfx#{@md.fnl[:post]}" @output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] if @@seg_name_html[tracking-1] !~/endnotes|idx/ - Seg_output.new(@output_seg_file,@@seg,@minitoc).output + Seg_output.new(@md,@output_seg_file,@@seg,@minitoc).output elsif @@seg_name_html[tracking-1] =~/endnotes/ - Seg_output.new(@output_seg_file,@@seg,@minitoc,'endnotes').output + Seg_output.new(@md,@output_seg_file,@@seg,@minitoc,'endnotes').output elsif @@seg_name_html[tracking-1] =~/idx/ - Seg_output.new(@output_seg_file,@@seg,@minitoc,'idx').output + Seg_output.new(@md,@output_seg_file,@@seg,@minitoc,'idx').output else p 'check' end Seg.new.reinitialise diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 597099ed..ef9f6bab 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -266,6 +266,7 @@ WOK table_message='[table omitted, see other document formats]' fix=[] data.each do |para| + para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove para.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#@br#{table_message}") para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb index 3edf67e4..3ff5652c 100644 --- a/lib/sisu/v0/texinfo.rb +++ b/lib/sisu/v0/texinfo.rb @@ -267,6 +267,7 @@ module SiSU_TexInfo @submenu,@subsubmenu={},{} data.each do |para| para.gsub!(/\s*<:name#example>\s*/,' ') + para.gsub!(/#{Mx[:id_o]}~0;0:0;x\d+#{Mx[:id_c]}/,'') # if book index? remove if para =~ /^#{Mx[:lv_o]}[1-3]:\S*?#{Mx[:lv_c]}\s*(.+?)\s*$/ txt_obj={:txt =>$1} toc=SiSU_Texinfo_format::Texinfo.new(@md,txt_obj) diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 58a057d8..5c2b7ec5 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -1100,16 +1100,22 @@ WOK #string.gsub!(/<=lt>/,'\<') #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') - string.gsub!(/((?:\\href|\\url)\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + while string =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') + end string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') #string.gsub!(/<=caret>/,'\^{}') string.gsub!(/<=exclaim>/,'\Verbatim{!}') + string.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text string.gsub!(/<=hash>/,'{\#}') #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') #string.gsub!(/<=slash>/,'{\slash}') string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 + while string =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') + end string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') string.gsub!(/<=slash>/,'{/}') @@ -1202,7 +1208,8 @@ WOK elsif string=~/#{Mx[:gr_o]}code-end#{Mx[:gr_c]}/; @@flag_code=false end if @@flag_code; string.gsub!(/&/,'{\\\&}') - else string.gsub!(/(\s+&\s+)/,' and ') + else string.gsub!(/&/,'<=amp>') + #else string.gsub!(/(\s+&\s+)/,' and ') end string.gsub!(/§/u,'\S') #latex: space between next character not preserved? #string.gsub!(/§ /,'\S ') string.gsub!(/£/u,'\pounds') @@ -1271,16 +1278,22 @@ WOK #string.gsub!(/<=lt>/,'\<') #string.gsub!(/<=gt>/,'\>') string.gsub!(/<=underscore>/,'\_') - string.gsub!(/((?:\\href|\\url)?\{http:\/\/\S+?)(?:(?:<=tilde>)(\S+))+\}/,'\1\~\2}') #tildes in urls \href treated differently from text + while string =~/(http:\/\/\S+?)(?:<=tilde>\S+)+/ #tilde in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=tilde>(\S+))+/,'\1~\2') + end string.gsub!(/<=tilde>/,'{$\sim$}') string.gsub!(/<=pipe>/,'{\textbar}') string.gsub!(/<=caret>/,'{\^{~}}') #string.gsub!(/<=caret>/,'\^{}') string.gsub!(/<=exclaim>/,'\Verbatim{!}') + string.gsub!(/(http:\/\/\S+?)(?:(?:<=hash>)(\S+))+/,'\1#\2') #hash in urls \href treated differently from text string.gsub!(/<=hash>/,'{\#}') #string.gsub!(/<=hash>/,'{\UseTextSymbol{OT1}{#}}') #string.gsub!(/<=slash>/,'{\slash}') string.gsub!(/<=hardspace>/,'{~}') #changed ... 2005 + while string =~/(http:\/\/\S+?)(?:<=amp>\S+)+/ #amp in urls \href treated differently from text + string.gsub!(/(http:\/\/\S+?)(?:<=amp>(\S+))+/,'\1&\2') + end string.gsub!(/<=amp>/,'{\\\&}') #changed ... 2005 #string.gsub!(/<=amp>/,'{\UseTextSymbol{OT1}{&}}') string.gsub!(/<=slash>/,'{/}') diff --git a/man/man1/sisu.1 b/man/man1/sisu.1 index fe745b87..e8d68e2d 100644 --- a/man/man1/sisu.1 +++ b/man/man1/sisu.1 @@ -2212,6 +2212,87 @@ some \ later \ time] death.\"\' .fi +.SH +9.7 BOOK INDEX + +.BR +To make an index append to paragraph the book index term relates to it, using +an equal sign and curly braces. + +.BR +Currently two levels are provided, a main term and if needed a sub\-term. +Sub\-terms are separated from the main term by a colon. + + +.nf + Paragraph containing main term and sub\-term. +.BR + ={Main term:sub\-term} +.fi + +.BR +The index syntax starts on a new line, but there should not be an empty line +between paragraph and index markup. + +.BR +The structure of the resulting index would be: + + +.nf + Main term, 1 +.BR + sub\-term, 1 +.fi + +.BR +Several terms may relate to a paragraph, they are separated by a semicolon. If +the term refers to more than one paragraph, indicate the number of paragraphs. + + +.nf + Paragraph containing main term, second term and sub\-term. +.BR + ={first term; second term: sub\-term} +.fi + +.BR +The structure of the resulting index would be: + + +.nf + First term, 1, +.BR + Second term, 1, +.BR + sub\-term, 1 +.fi + +.BR +If multiple sub\-terms appear under one paragraph, they are separated under the +main term heading from each other by a pipe symbol. + + +.nf + Paragraph containing main term, second term and sub\-term. +.BR + ={Main term:sub\-term+1|second sub\-term +.BR + A paragraph that continues discussion of the first sub\-term +.fi + +.BR +The plus one in the example provided indicates the first sub\-term spans one +additional paragraph. The logical structure of the resulting index would be: + + +.nf + Main term, 1, +.BR + sub\-term, 1\-3, +.BR + second sub\-term, 1, +.fi + .SH 10. COMPOSITE DOCUMENTS MARKUP .BR -- cgit v1.2.3 From a4bc8604439cb6c2e30542e37ea83a5f858fbc3a Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 15 Sep 2008 22:03:15 -0400 Subject: changelog date, touch --- CHANGELOG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 1aa748d4..1cfaf8a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,7 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-09-10:36/3) +%% sisu_0.69.0.orig.tar.gz (2008-09-15:37/1) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc -- cgit v1.2.3 From f555e0777bb4408e2e380150f28f3d433cb66d66 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 16 Sep 2008 00:35:57 -0400 Subject: fixes: alphabet list (concordance, dal_idx), and file types (dal_expand_insertions) --- CHANGELOG | 2 +- lib/sisu/v0/concordance.rb | 7 ++++-- lib/sisu/v0/dal.rb | 45 ------------------------------------ lib/sisu/v0/dal_expand_insertions.rb | 45 ++++++++++++++++++++++++++++++++++++ lib/sisu/v0/dal_idx.rb | 7 ++++-- 5 files changed, 56 insertions(+), 50 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1cfaf8a1..663cb8fd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,7 @@ Reverse Chronological: %% STABLE MANIFEST -%% sisu_0.69.0.orig.tar.gz (2008-09-15:37/1) +%% sisu_0.69.0.orig.tar.gz (2008-09-16:37/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.69.0.orig.tar.gz sisu_0.69.0.orig.tar.gz sisu_0.69.0-1.dsc diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index dd4411ac..babc6655 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -326,8 +326,11 @@ WOK f=/^(\S)/.match(word)[1] if letter < f.upcase while letter < f.upcase - letter=alph.shift - @file_concordance << %{\n
    \n

    #{letter}

    } + if alph.length > 0 + letter=alph.shift + @file_concordance << %{\n
    \n

    #{letter}

    } + else break + end end end keyword=SiSU_Concordance::Source::Word.new(word,@freq[word]).html diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index c01c2d0a..18e2f8dd 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -265,51 +265,6 @@ module SiSU_DAL outputdata end protected - def output_filetypes_in_cmd(cmd_shortcut,source=nil) - #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used - cf_defaults=SiSU_Env::Info_processing_flag.new - cmd_list=case cmd_shortcut.inspect - when /0/; cf_defaults.cf_0 - when /1/; cf_defaults.cf_1 - when /2/; cf_defaults.cf_2 - when /3/; cf_defaults.cf_3 - when /4/; cf_defaults.cf_4 - when /5/; cf_defaults.cf_5 - end - file_type_names={} - file_type_names[:gen],file_type_names[:src]=[],[] - file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html' - end - file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html'] - end - file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf'] - end - #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1' - #end - file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt' - end - file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml' - end - file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml' - end - file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml' - end - file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt' - end - file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt' - end - file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html' - end - file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt' - end - file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source - end - file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip" - end - file_type_names[:gen]=file_type_names[:gen].flatten - file_type_names[:src]=file_type_names[:src].flatten - file_type_names - end end end __END__ diff --git a/lib/sisu/v0/dal_expand_insertions.rb b/lib/sisu/v0/dal_expand_insertions.rb index 1ab0c03b..17362092 100644 --- a/lib/sisu/v0/dal_expand_insertions.rb +++ b/lib/sisu/v0/dal_expand_insertions.rb @@ -64,6 +64,51 @@ module SiSU_insertions def initialize(data) @data=data end + def output_filetypes_in_cmd(cmd_shortcut,source=nil) + #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used + cf_defaults=SiSU_Env::Info_processing_flag.new + cmd_list=case cmd_shortcut.inspect + when /0/; cf_defaults.cf_0 + when /1/; cf_defaults.cf_1 + when /2/; cf_defaults.cf_2 + when /3/; cf_defaults.cf_3 + when /4/; cf_defaults.cf_4 + when /5/; cf_defaults.cf_5 + end + file_type_names={} + file_type_names[:gen],file_type_names[:src]=[],[] + file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html' + end + file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html'] + end + file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf'] + end + #file_type_names[:gen] <<= if cmd_list =~ /i/; 'manpage.1' + #end + file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt' + end + file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml' + end + file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml' + end + file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml' + end + file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt' + end + file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt' + end + file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html' + end + file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt' + end + file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source + end + file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip" + end + file_type_names[:gen]=file_type_names[:gen].flatten + file_type_names[:src]=file_type_names[:src].flatten + file_type_names + end def expand_insertions? data=@data tuned_file,tuned_file_tmp=[],[] diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index c2bba846..d7d5223e 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -181,8 +181,11 @@ module SiSU_book_index f=/^(\S)/.match(x)[1] if letter < f while letter < f - letter=alph.shift - @idx[:html] << %{\n
    \n

    #{letter}

    } + if alph.length > 0 + letter=alph.shift + @idx[:html] << %{\n
    \n

    #{letter}

    } + else break + end end end @idx[:sst] << %{\n\n#{Mx[:fa_bold_o]}#{x},#{Mx[:fa_bold_c]} } -- cgit v1.2.3

    #{@translate.filename}

    #{@translate.description}