diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-02-01 16:55:53 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-02-01 16:55:53 -0500 |
commit | 704af1677c2904d0ccdff9fe75ed030ce6f060c8 (patch) | |
tree | 01298810b5b8b91031583e989fa774e4e000bfc7 /lib/sisu/v2 | |
parent | debian/changelog 2.7.9-1 (diff) | |
parent | v3 introduced as development branch, invoked using "sisu --v3 [instructions] (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v2')
-rw-r--r-- | lib/sisu/v2/constants.rb | 1 | ||||
-rw-r--r-- | lib/sisu/v2/dal_doc_str.rb | 8 | ||||
-rw-r--r-- | lib/sisu/v2/dal_syntax.rb | 19 | ||||
-rw-r--r-- | lib/sisu/v2/defaults.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v2/epub_format.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v2/epub_segments.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v2/html_format.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v2/html_scroll.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v2/html_segments.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v2/odf.rb | 21 | ||||
-rw-r--r-- | lib/sisu/v2/odf_format.rb | 14 | ||||
-rw-r--r-- | lib/sisu/v2/plaintext.rb | 12 | ||||
-rw-r--r-- | lib/sisu/v2/texpdf.rb | 6 |
13 files changed, 68 insertions, 35 deletions
diff --git a/lib/sisu/v2/constants.rb b/lib/sisu/v2/constants.rb index 9367e9cd..6c949d53 100644 --- a/lib/sisu/v2/constants.rb +++ b/lib/sisu/v2/constants.rb @@ -93,6 +93,7 @@ Mx[:nbsp]= '░' #'▭ ' Mx[:br_line]= '▌' #lB ▌ 9612 #'┘' #'¶' Mx[:br_paragraph]= '█' #FB █ 9608 # PP ∥ 8741 #'▐' #'┘' #'¶' #FB █ 9608 lB ▌ 9612 RB ▐ 9616 Mx[:br_nl]= '』' # '┘' +Mx[:obj_ln_sep]= 'obj_ln_sep'; Hx[:obj_ln_sep]= {:obj=>Mx[:obj_ln_sep]} # line sep Mx[:br_page]= 'break_page'; Hx[:br_page]= {:obj=>Mx[:br_page]} # newpage Mx[:br_page_new]= 'break_page_new'; Hx[:br_page_new]= {:obj=>Mx[:br_page_new]} # clearpage Mx[:br_endnotes]= "#{Mx[:mk_o]}ENDNOTES#{Mx[:mk_c]}" diff --git a/lib/sisu/v2/dal_doc_str.rb b/lib/sisu/v2/dal_doc_str.rb index f1282df2..bca3cf7d 100644 --- a/lib/sisu/v2/dal_doc_str.rb +++ b/lib/sisu/v2/dal_doc_str.rb @@ -182,11 +182,13 @@ module SiSU_document_structure_extract SiSU_document_structure::Object_para.new.paragraph(h) else nil end - when /^(?:<?:p[bn]>?)\s*$/ - if t_o =~/^(?:<?:pn>?)\s*$/ + when /^<?:p[bn]>?\s*$/ + if t_o =~/^<?:pn>?\s*$/ SiSU_document_structure::Object_layout.new.break(Hx[:br_page_new]) else SiSU_document_structure::Object_layout.new.break(Hx[:br_page]) end + when /^<?:(?:ols|---)>?\s*$/ + SiSU_document_structure::Object_layout.new.break(Hx[:obj_ln_sep]) else #paragraph image=image_test(t_o) note=endnote_test?(t_o) @@ -784,7 +786,7 @@ module SiSU_document_structure_extract @o_array=[] node=ocn=ocn_dv=ocn_sp=ocnh=ocnh1=ocnh2=ocnh3=ocnh4=ocnh5=ocnh6=ocno=ocnp=ocnt=ocnc=ocng=ocni=ocnm=ocnu=ocnk=nm=0 # h heading, o other, t table, g group, i image node_count_flag=false - regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}/i #ocn here # added with Tune.code #¡ + regex_exclude_ocn_and_node = /#{Rx[:meta]}|^@\S+?:\s|^4~endnotes|^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^\^~ |<:e[:_]\d+?>|^<:\#|<:- |<[:!]!4|<hr width|#{Mx[:br_endnotes]}/i #ocn here # added with Tune.code #¡ parent=node1=node2=node3=node4=node5=node6=nil data.each do |dob| h={} diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 0422d7b3..47c7f8d0 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -249,30 +249,12 @@ module SiSU_Syntax "\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}") #cite /blockquote? dob.obj.gsub!(/(^|[^\\])\^\{(.+?)\}\^/m, "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|\(|\>|\S)9\{(.+?)\}9/m, - "\\1#{Mx[:fa_superscript_o]}\\2#{Mx[:fa_superscript_c]}") #superscript dob.obj.gsub!(/(^|[^\\]),\{(.+?)\},/m, "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)6\{(.+?)\}6/m, - "\\1#{Mx[:fa_subscript_o]}\\2#{Mx[:fa_subscript_c]}") #subscript dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\+\{(.+?)\}\+/m, "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)v\{(.+?)\}v/m, - "\\1#{Mx[:fa_insert_o]}\\2#{Mx[:fa_insert_c]}") #inserted text dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)-\{(.+?)\}-/m, "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #strikethrough - deleted text - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)x\{(.+?)\}x/m, - "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}") #deleted text - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+|['"]|#{Mx[:nbsp]}|#{Mx[:fa_o_c]}|#{Mx[:fa_c]}|\(|\>)\*(\S+?)\*/, - "\\1#{@emph[:o]}\\2#{@emph[:c]}") #emphasise single word, watch - dob.obj.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 - dob.obj.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 - dob.obj.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)) - dob.obj.gsub!(/(^|#{Mx[:gl_c]}|\s+)-([^{]\S+?)-( |$)/, - "\\1#{Mx[:fa_strike_o]}\\2#{Mx[:fa_strike_c]}\\3") #underscore single word, watch dob.obj.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 dob @@ -395,7 +377,6 @@ module SiSU_Syntax dob.obj.gsub!(/(^|[#{Mx[:gl_c]}#{Mx[:lnk_c]}#{Mx[:en_a_o]}#{Mx[:en_b_o]}(\s])(_(?:https?|ftp):\/\/\S+?\.[^>< ]+?)([,.;'"]?)(?=[\s#{Mx[:en_a_c]}#{Mx[:en_b_c]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:br_nl]}]|$)/m, %{\\1#{Mx[:url_o]}\\2#{Mx[:url_c]}\\3}) end - dob.obj.gsub!(/<:?p([nb])>/,"#{Mx[:fa_o]}p\\1#{Mx[:fa_c]}") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') dob=fontface(dob) dob.obj.gsub!(/<[:e]\s+(.+?)!?>/, "#{Mx[:en_a_o]}\\1#{Mx[:en_a_c]}") #not tested diff --git a/lib/sisu/v2/defaults.rb b/lib/sisu/v2/defaults.rb index a5305e4d..2c3cf207 100644 --- a/lib/sisu/v2/defaults.rb +++ b/lib/sisu/v2/defaults.rb @@ -1980,7 +1980,7 @@ outputs include: plaintext, html, XHTML, XML, ODF (OpenDocument), EPUB, LaTeX, P </div> <div id="column_center"> <p class="bold"> -SiSU Short Description +SiSU Short Description </p> <p> SiSU is a comprehensive future-proofing electronic document management system. Built-in search capabilities allow you to search across multiple documents and highlight matches in an easy-to-follow format. Paragraph numbering system allows you to cite your electronic documents in a consistent manner across multiple file formats. Multiple format outputs allow you to display your documents in plain text, PDF (portrait and horizontal), OpenDocument format, HTML, or e-book reading format (EPUB). Word mapping allows you to easily create word indexes for your documents. Future-proofing flexibility allows you to quickly adapt your documents to newer output formats as needed. All these and many other features are achieved with little or no additional work on your documents - by marking up the documents with a super simplistic markup language, leaving the SiSU engine to handle the heavy-lifting processing. diff --git a/lib/sisu/v2/epub_format.rb b/lib/sisu/v2/epub_format.rb index e016b011..5b452f83 100644 --- a/lib/sisu/v2/epub_format.rb +++ b/lib/sisu/v2/epub_format.rb @@ -1744,6 +1744,11 @@ WOK end para_form_css('p','norm') end + def break + @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />') + @txt.gsub!(/#{Mx[:obj_ln_sep]}/,'<hr style="width:30%" /><br />') + para_form_css('p','norm') + end def format(tag,attrib) para_form_css(tag,attrib) end diff --git a/lib/sisu/v2/epub_segments.rb b/lib/sisu/v2/epub_segments.rb index 4edcc93b..a09aebe3 100644 --- a/lib/sisu/v2/epub_segments.rb +++ b/lib/sisu/v2/epub_segments.rb @@ -357,7 +357,6 @@ WOK end def markup(dob) @debug=[] - dob.obj.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'') format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) if dob.is =~/(?:heading|para)/ #extend as necessary FIX @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn) @@ -392,6 +391,8 @@ WOK sto.code elsif dob.is=='table' sto.table + elsif dob.is=='break' + sto.break end if @md.flag_separate_endnotes # may need to revisit, check dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type diff --git a/lib/sisu/v2/html_format.rb b/lib/sisu/v2/html_format.rb index 8074a7ee..a59f82ac 100644 --- a/lib/sisu/v2/html_format.rb +++ b/lib/sisu/v2/html_format.rb @@ -299,7 +299,7 @@ WOK #{@vz.banner_band} </td> <td width="75%" align="center"> - #{doc_types} + #{doc_types} </td> <td width="5%" align="right"> #{firstseg} @@ -1023,6 +1023,11 @@ WOK end para_form_css('p','norm') end + def break + @txt.gsub!(/#{Mx[:br_page_new]}|#{Mx[:br_page]}/,'<hr /><br />') + @txt.gsub!(/#{Mx[:obj_ln_sep]}/,'<hr style="width:30%" /><br />') + para_form_css('p','norm') + end def format(tag,attrib) para_form_css(tag,attrib) end diff --git a/lib/sisu/v2/html_scroll.rb b/lib/sisu/v2/html_scroll.rb index 049eb922..bc6b4812 100644 --- a/lib/sisu/v2/html_scroll.rb +++ b/lib/sisu/v2/html_scroll.rb @@ -174,6 +174,8 @@ module SiSU_HTML_scroll sto.code elsif dob.is=='table' sto.table + elsif dob.is=='break' + sto.break end if dob =~/<a name="n\d+">/ \ and dob =~/^(?:\^~\d+\s|<!e[:_]\d+!>)/ # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though diff --git a/lib/sisu/v2/html_segments.rb b/lib/sisu/v2/html_segments.rb index a516d809..c1649a88 100644 --- a/lib/sisu/v2/html_segments.rb +++ b/lib/sisu/v2/html_segments.rb @@ -357,7 +357,6 @@ module SiSU_HTML_seg end def markup(dob) @debug=[] - dob.obj.gsub!(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'') format_head_seg=SiSU_HTML_Format::Head_seg.new(@md) if dob.is !~/meta/ if dob.is =~/(?:heading|para)/ #extend as necessary FIX @@ -398,6 +397,8 @@ module SiSU_HTML_seg sto.code elsif dob.is=='table' sto.table + elsif dob.is=='break' + sto.break end if @md.flag_separate_endnotes dob.obj.gsub!(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index 769870eb..2e2a88b4 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -411,6 +411,18 @@ module SiSU_ODF end dob end + def obj_break(dob) + if dob.is =='break' + br=SiSU_ODF_format::Format_obj_break.new(@md,dob) + if dob.obj==Mx[:br_page] \ + or dob.obj==Mx[:br_page_new] + dob=br.br_page + elsif dob.obj==Mx[:obj_ln_sep] + dob=br.obj_sep + end + end + dob + end def odf_structure(md,dob) @md,@dob=md,dob dob=if dob.is !='code' @@ -431,6 +443,8 @@ module SiSU_ODF @@odf[:body] << code(dob).obj << @br*2 elsif dob.is=='table' #elsif dob.obj =~ /<!Th?¡/u @@odf[:body] << table(dob).obj << @br*2 + elsif dob.is=='break' + @@odf[:body] << obj_break(dob).obj << @br*2 else @@odf[:body] << normal(dob).obj << @br*2 # main text, contents, body KEEP end @@ -492,8 +506,6 @@ module SiSU_ODF dob.obj end dob.obj.gsub!(/#{Mx[:br_line]}/,'<br />') - dob.obj.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/, - '<text:p text:style-name="P8"> </text:p>') dob.obj.gsub!(/©/,'©') #too arbitrary dob.obj.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, @@ -517,7 +529,6 @@ module SiSU_ODF dob.obj.gsub!(/\\copy(?:right)?\b/,'©') dob.obj.gsub!(/\\trademark\b|\\tm\b/,'®') dob.obj.gsub!(/\44/,'$') #$ watch - dob.obj.gsub!(/#{Mx[:br_page]}|#{Mx[:br_page_new]}/,'') # remove page breaks dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/,'\1') dob.obj.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links wordlist=dob.obj.scan(/\S+/) @@ -528,7 +539,7 @@ module SiSU_ODF if defined? dob.ocn and dob.ocn =~/\d+/ @p_num=SiSU_ODF_format::Paragraph_number.new(dob.ocn) end - if dob.is=~/heading|para|group|verse|code|table/ # extend, include other types + if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types odf_structure(@md,dob) end dob.obj.gsub!(/<!.+!>/,' ') if dob.obj ## Clean Prepared Text @@ -601,7 +612,7 @@ module SiSU_ODF %{<style:style style:name="T4" style:family="text"><style:text-properties style:text-position="super 58%"/></style:style>#{@br}} + %{<style:style style:name="T5" style:family="text"><style:text-properties style:text-position="sub 58%"/></style:style>#{@br}} + %{<style:style style:name="T6" style:family="text"><style:text-properties style:font-name="Courier 10 Pitch" fo:font-size="12pt"/></style:style>#{@br}} + - %{<style:style style:name="T7" style:family="text"><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>#{@br}} + + %{<style:style style:name="T7" style:family="text"><style:text-properties style:font-name="DejaVu Sans Mono" fo:font-size="10pt" fo:font-weight="normal" fo:background-color="#e6e6e6"/></style:style>#{@br}} + %{<style:style style:name="fr1" style:family="graphic" style:parent-style-name="Graphics"><style:graphic-properties style:wrap="none" style:horizontal-pos="left" style:horizontal-rel="paragraph" style:mirror="none" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:luminance="0%" draw:contrast="0%" draw:red="0%" draw:green="0%" draw:blue="0%" draw:gamma="100%" draw:color-inversion="false" draw:image-opacity="100%" draw:color-mode="standard"/></style:style>#{@br}} + %{<style:style style:name="gr1" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="top" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>#{@br}} + %{<style:style style:name="gr2" style:family="graphic"><style:graphic-properties draw:stroke="none" draw:fill="none" draw:textarea-horizontal-align="center" draw:textarea-vertical-align="middle" draw:color-mode="standard" draw:luminance="0%" draw:contrast="0%" draw:gamma="100%" draw:red="0%" draw:green="0%" draw:blue="0%" fo:clip="rect(0cm 0cm 0cm 0cm)" draw:image-opacity="100%" style:mirror="none" style:run-through="background" style:wrap="none" style:vertical-pos="middle" style:vertical-rel="baseline" style:horizontal-pos="left" style:horizontal-rel="paragraph" draw:wrap-influence-on-position="once-concurrent" style:flow-with-text="false"/></style:style>#{@br}} + diff --git a/lib/sisu/v2/odf_format.rb b/lib/sisu/v2/odf_format.rb index 384b46b7..77b5bbbc 100644 --- a/lib/sisu/v2/odf_format.rb +++ b/lib/sisu/v2/odf_format.rb @@ -197,6 +197,20 @@ module SiSU_ODF_format @dob end end + class Format_obj_break + def initialize(md,t_o) + @md,@t_o=md,t_o + end + def br_page + @t_o.obj='<text:p text:style-name="P8"> </text:p>' + @t_o + end + def obj_sep #center later + sep='--- ' + @t_o.obj=%{<text:p text:style-name="P1">#{sep*20}</text:p>} + @t_o + end + end class XML end end diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb index e919af78..ba146978 100644 --- a/lib/sisu/v2/plaintext.rb +++ b/lib/sisu/v2/plaintext.rb @@ -328,13 +328,12 @@ WOK dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< end - dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") - dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") + dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') wordlist=dob.obj.scan(/\S+/) if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ @@ -350,6 +349,15 @@ WOK or dob.is=='code' \ or dob.is=='table' @plaintext[:body] << dob.obj << @br + elsif dob.is=='break' + sp=' ' + ln='-' + @plaintext[:body] <<=if dob.obj==Mx[:br_page] \ + or dob.obj==Mx[:br_page_new] + "#{@br}#{ln*40}#{@br*2}" + elsif dob.obj ==Mx[:obj_ln_sep] + "#{@br}#{sp*20}* * *#{@br*2}" + end # following empty line (@br) missing, fix end dob='' if (dob.obj =~/<a name="n\d+">/ \ and dob.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index 3a868cd8..a1a2813f 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -72,7 +72,7 @@ module SiSU_TeX @@tex_pattern_margin_number=/\\\\begin\\\{tiny\\\}\\\\hspace\\\{0mm\\\}\\\\end\\\{tiny\\\}\\\{\\\\marginpar.+?\s+/ @@n=@@tableheader=@@rights=nil @@date ||=SiSU_Env::Info_date.new - class Source #Songsheet #<SiSU_Param::MyFiles + class Source require 'pstore' require "#{SiSU_lib}/sysenv" # sysenv.rb include SiSU_Env @@ -146,7 +146,7 @@ module SiSU_TeX end end private - class LaTeX_to_pdf #<Songsheet + class LaTeX_to_pdf require 'fileutils' include FileUtils #::Verbose @@n_lpdf||=0 #change @@ -344,6 +344,7 @@ module SiSU_TeX elsif dob.is =='break' if dob.obj==Mx[:br_page]; dob.tmp='\newpage' elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage' + elsif dob.obj==Mx[:obj_ln_sep]; dob.tmp='\parasep' end elsif dob.is=='comment' \ or dob.is=='meta' @@ -571,6 +572,7 @@ module SiSU_TeX \\definecolor{Light}{gray}{.92} \\newcommand{\\Codeblock}[1]{\\normaltext\\raggedright\\small\\ttfamily\\texbackslash#1} \\newcommand{\\monosp}[1]{\\normaltext\\ttfamily\\texbackslash#1} +\\newcommand{\\parasep}{\\\\ \\begin{center}*\\hspace{2em}*\\hspace{2em}*\\end{center} \\\\} % \\sloppy \\begin{document} WOK |