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 --- CHANGELOG | 15 ++++++++++----- 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 + 8 files changed, 24 insertions(+), 15 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 47a68840..4dd3eccb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,9 +21,12 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.61.0.orig.tar.gz document, (rather than just e.g. the document title) [affects document objects and numbering where used, hence version number bump] - * html, pdf, text object switch off @markup: no_ocn (or command line flag - --no-ocn), in html objects are still named, (i.e. will still work with - searches though the relevance of the numbers returned is obscured) + * html, pdf, switch text object numbering off, may be set in: (a) document + header, @markup: no_ocn; (b) skin (for documents sharing that skin) "def + ocn_display_off" and set to true; or (c) as a processing flag "sisu -hpv + --no-ocn [filename]". NOTE, now in html objects are still named, (i.e. will + still work with searches though the relevance of the numbers returned is + obscured) * shared markup source, composite documents, look to processing directory for both text (share source) and binary (sisupod (make)) @@ -35,8 +38,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.61.0.orig.tar.gz dynamic building of some documents) * sysenv (default) replaced (obsoleted) -A with -a - * sisu manual, download info, change links to source to archive, rather than - transient repo + * sisu manual, manpage, download info, change links to source to archive, + rather than transient repo + + * special character exceptions, some fixes %% sisu_0.60.1.orig.tar.gz (2007-10-07:40/7) http://www.jus.uio.no/sisu/pkg/src/sisu_0.60.1.orig.tar.gz 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