From c6090f3f0277ba4fe62841a39c0f0fde2cd8c5bc Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Oct 2007 20:27:00 +0100 Subject: for html and latex/pdf permit switch off of object numbering display from within skins --- lib/sisu/v0/html_format.rb | 6 +++++- lib/sisu/v0/texpdf.rb | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index e1109a6a..090c779a 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -63,9 +63,13 @@ module SiSU_HTML_Format @md=md @paranum=paranum[/(\d+)/m,1] @paranum ||='' + vz=SiSU_Env::Get_init.instance.skin + @skin_no_ocn=if defined? vz.ocn_display_off and vz.ocn_display_off == true; true + else false + end end def ocn_display - if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/ + if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/ or @skin_no_ocn ocn_class='ocn_off' @paranum.gsub(/^(\d+|)$/, %{

diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index be8c973e..4b4613b0 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -240,6 +240,10 @@ module SiSU_TeX @tex=SiSU_TeX_Pdf::Use_TeX.new(@md,@orientation) @vz=SiSU_Env::Get_init.instance.skin @dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern + vz=SiSU_Env::Get_init.instance.skin + @skin_no_ocn=if defined? vz.ocn_display_off and vz.ocn_display_off == true; true + else false + end end def songsheet begin @@ -268,7 +272,11 @@ module SiSU_TeX if @md.flag_tables data=tables(data) end - data=number_paras(data) if @md.markup.inspect !~/no_ocn/ and @md.mod.inspect !~/--no-ocn/ #check + ocn=if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/ or @skin_no_ocn + false + else true + end + data=number_paras(data,ocn) data=markup(data) output(data) rescue; SiSU_Errors::Info_error.new($!,$@,@md.fns,@md.cmd).error @@ -554,13 +562,15 @@ WOK end @tex_file << "\n\\end{document}" end - def number_paras(data) + def number_paras(data,ocn) @tex_file=[] data.each do |para| if para =~/<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ and para !~/\\end\{longtable\}|/ #catch m=/(.+?)<\\~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/m parablock=para[m,1] - paranum=para[m,2] + paranum=if ocn; para[m,2] + else '' + end do_duo=SiSU_TeX_Pdf::Format_text_object.new(@md,parablock,paranum) para=do_duo.para_num if parablock elsif para =~/^<~\d+;(?:[oh]|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/ #2005 this is added for tables, rationalise -- cgit v1.2.3 From 01f5d52b9af88378d49af20ade8dc6d8d0573830 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Oct 2007 20:28:10 +0100 Subject: available outputs shortcut display, description of odf:odt expanded --- lib/sisu/v0/dal.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 8e514725..132da336 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -385,7 +385,7 @@ module SiSU_DAL when /doc.html/; ' html, scroll, document in one' when /landscape.pdf/; ' pdf, landscape' when /portrait.pdf/; ' pdf, portrait' - when /opendocument.odt/; ' open document' + when /opendocument.odt/; ' odf:odt, open document text' when /scroll.xhtml/; ' xhtml scroll' when /sax.xml/; ' xml, sax' when /dom.xml/; ' xml, dom' -- cgit v1.2.3 From b05af2073ff99a2aa218e452afec41907a240dc3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Oct 2007 20:29:42 +0100 Subject: xml dom extract footnote from grouped text --- lib/sisu/v0/xml.rb | 1 + lib/sisu/v0/xml_dom.rb | 2 ++ 2 files changed, 3 insertions(+) (limited to 'lib') diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index d6db3ca7..e739bf59 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -256,6 +256,7 @@ WOK def poem_structure(para='',ocn='') para.gsub!(/<:verse(?:-end)?>/,'') para=@trans.markup_group(para) + #para.gsub!(/\s\s/,'  ') para.strip! @@xml[:body] << %{#{@tab*0}} << "\n" @@xml[:body] << %{#{@tab*1}#{ocn}} << "\n" diff --git a/lib/sisu/v0/xml_dom.rb b/lib/sisu/v0/xml_dom.rb index 83b15dc8..14cc162f 100644 --- a/lib/sisu/v0/xml_dom.rb +++ b/lib/sisu/v0/xml_dom.rb @@ -287,6 +287,8 @@ WOK def group_structure(para='',ocn='') para.gsub!(/<:group(?:-end)?>/,'') para=@trans.markup_group(para) + para.gsub!(/~\{(\d+)\s+(.+?)\s*<#@dp>\}~/m, + '\1\2 ') para.strip! @@xml[:body] << %{#{@tab*6}} << "\n" @@xml[:body] << %{#{@tab*7}#{ocn}} << "\n" -- cgit v1.2.3 From 6acc0270d1323cbdfd4a7c89377cdb7604895d63 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Oct 2007 20:30:33 +0100 Subject: special character exceptions, some fixes, primarily underscore --- lib/sisu/v0/html_tune.rb | 2 +- lib/sisu/v0/manpage.rb | 4 ++-- lib/sisu/v0/odf.rb | 7 +++++-- lib/sisu/v0/plaintext.rb | 4 ++-- lib/sisu/v0/shared_html_lite.rb | 2 +- lib/sisu/v0/shared_xml.rb | 4 ++-- lib/sisu/v0/texpdf_format.rb | 1 + 7 files changed, 14 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index b98f19d8..82183a02 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -333,7 +333,7 @@ module SiSU_Tune end para.gsub!(//m,'>') #code-block: angle brackets special characters + else para.gsub!(/(?=^|[^}])_/m,'>') #code-block: angle brackets special characters end @tuned_file << para end diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb index 304bcda1..10480b90 100644 --- a/lib/sisu/v0/manpage.rb +++ b/lib/sisu/v0/manpage.rb @@ -338,8 +338,8 @@ WOK para.gsub!(/-/,'\-') #manpages use this para.gsub!(/~/,'~') if para #manpages use this if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/ - if para =~/<:code>/ - para.gsub!(/_/m,'>') #code-block: angle brackets special characters + if para =~/<:code>/ #code-block: angle brackets special characters + para.gsub!(/(?=^|[^}])_/m,'>') end para.gsub!(//,"\n\n.P\n\n") # watch para.gsub!(/<:(?:group|verse|alt)(?:\\-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 610a51aa..171372a9 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -473,8 +473,11 @@ module SiSU_ODF para=para_array.join(' ') para=para.strip end - para.gsub!(/_/m,'>') #code-block: angle brackets special characters - #para.gsub!(//,'>') + if para =~/<:code>/ #code-block: angle brackets special characters + para.gsub!(/(?=^|[^}])_/m,'>') + end + ##para.gsub!(/_/m,'\1>') #code-block: angle brackets special characters + #para.gsub!(/_/m,'>') #code-block: angle brackets special characters para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') # bullet_09.png #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') #bullet #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used diff --git a/lib/sisu/v0/plaintext.rb b/lib/sisu/v0/plaintext.rb index c308dfb2..361624e1 100644 --- a/lib/sisu/v0/plaintext.rb +++ b/lib/sisu/v0/plaintext.rb @@ -335,8 +335,8 @@ WOK para.gsub!(/©/,'©') end if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/ - if para =~/<:code>/ - para.gsub!(/_/m,'>') #code-block: angle brackets special characters + if para =~/<:code>/ #code-block: angle brackets special characters + para.gsub!(/(?=^|[^}])_/m,'>') end para.gsub!(//,"\n") # watch para.gsub!(/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/,'') diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 85368a28..d63f4cef 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -133,7 +133,7 @@ module SiSU_Format_Shared 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)((?: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,'>') #code-block: angle brackets special characters + else para.gsub!(/(?=^|[^}])_/m,'>') #code-block: angle brackets special characters end para end diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index da1891e5..62e8b5ca 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -365,7 +365,7 @@ module SiSU_XML_munge para.gsub!(/ /,' ') #para.gsub!(/ /,' ') #clean else - para.gsub!(/_/m,'>') #code-block: angle brackets special characters + para.gsub!(/(?=^|[^}])_/m,'>') #code-block: angle brackets special characters para.gsub!(/ /,' ') end para @@ -391,7 +391,7 @@ module SiSU_XML_munge def markup_group(para='') para.gsub!(//,'>') para.gsub!(/<:?br(?:\s+\/)?>/,'
') - para.gsub!(/<(link xmlns:xlink=".+?)">/,'<"\1">') + para.gsub!(/<(link xmlns:xlink=".+?")>/,'<\1>') para.gsub!(/<(\/link)>/,'<\1>') para.gsub!(/<(\/?en)>/,'<\1>') para diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index bf93ce9c..7798e886 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -519,6 +519,7 @@ WOK @string.gsub!(/(.+?)<\/i>/,'\emph{\1}') @string.gsub!(/(.+?)<\/italic>/,'\emph{\1}') @string.gsub!(/(.+?)<\/u>/,'\uline{\1}') # ulem + @string.gsub!(/(.+?)<\/cite>/,"``\\1''") # quote @string.gsub!(/(.+?)<\/ins>/,'\uline{\1}') # ulem @string.gsub!(/(.+?)<\/del>/,'\sout{\1}') # ulem @string.gsub!(/(.+?)<\/sub>/,"\$_{\\textrm{\\1}}\$") -- cgit v1.2.3