aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-10-13 11:26:57 +0100
committerRalph Amissah <ralph@amissah.com>2007-10-13 11:26:57 +0100
commit48f576604b229255e221cdcd587f532b2bd014d6 (patch)
tree3ca4f9edb43c7e99c6dc02884a3295f1e72ff9cc
parentsisu manual download page, clean (diff)
underscore exception requires additional tweaking of regexes, solution not optimal (sisu_markup as basic test)
-rw-r--r--lib/sisu/v0/html_tune.rb4
-rw-r--r--lib/sisu/v0/manpage.rb4
-rw-r--r--lib/sisu/v0/odf.rb5
-rw-r--r--lib/sisu/v0/plaintext.rb3
-rw-r--r--lib/sisu/v0/shared_html_lite.rb4
-rw-r--r--lib/sisu/v0/shared_xml.rb3
6 files changed, 15 insertions, 8 deletions
diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb
index 82183a02..ab37abb2 100644
--- a/lib/sisu/v0/html_tune.rb
+++ b/lib/sisu/v0/html_tune.rb
@@ -333,7 +333,9 @@ module SiSU_Tune
end
para.gsub!(/<a href="\.\.\//,%{<a href="#{@vz.url_site}/})
end
- else para.gsub!(/(?=^|[^}])_</m,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;') #code-block: angle brackets special characters
+ else
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
end
@tuned_file << para
end
diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb
index 10480b90..8de98bde 100644
--- a/lib/sisu/v0/manpage.rb
+++ b/lib/sisu/v0/manpage.rb
@@ -339,7 +339,9 @@ WOK
para.gsub!(/&#126;/,'~') 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>/ #code-block: angle brackets special characters
- para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>')
+ para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
+ para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ #para.gsub!(/(?![}])_([<>])/m,'\1') # _> _< }_<
end
para.gsub!(/<br(?: \/)?>/,"\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 171372a9..4884c33a 100644
--- a/lib/sisu/v0/odf.rb
+++ b/lib/sisu/v0/odf.rb
@@ -474,10 +474,9 @@ module SiSU_ODF
para=para.strip
end
if para =~/<:code>/ #code-block: angle brackets special characters
- para.gsub!(/(?=^|[^}])_</m,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;')
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
end
- ##para.gsub!(/_</m,'&lt;'); para.gsub!(/([^_])_>/m,'\1&gt;') #code-block: angle brackets special characters
- #para.gsub!(/_</m,'&lt;'); para.gsub!(/_>/m,'&gt;') #code-block: angle brackets special characters
para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ') # bullet_09.png
#para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1<text:span text:style-name="T6">●</text:span> ') #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 361624e1..d6284613 100644
--- a/lib/sisu/v0/plaintext.rb
+++ b/lib/sisu/v0/plaintext.rb
@@ -336,7 +336,8 @@ WOK
end
if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/
if para =~/<:code>/ #code-block: angle brackets special characters
- para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>')
+ para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
+ para.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
end
para.gsub!(/<br(?: \/)?>/,"\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 d63f4cef..730bf00d 100644
--- a/lib/sisu/v0/shared_html_lite.rb
+++ b/lib/sisu/v0/shared_html_lite.rb
@@ -133,7 +133,9 @@ module SiSU_Format_Shared
para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration
para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url
para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
- else para.gsub!(/(?=^|[^}])_</m,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;') #code-block: angle brackets special characters
+ else
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
end
para
end
diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb
index 62e8b5ca..7f9cdc83 100644
--- a/lib/sisu/v0/shared_xml.rb
+++ b/lib/sisu/v0/shared_xml.rb
@@ -365,7 +365,8 @@ module SiSU_XML_munge
para.gsub!(/&nbsp;/,'&#160;')
#para.gsub!(/&nbsp;/,' ') #clean
else
- para.gsub!(/(?=^|[^}])_</m,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;') #code-block: angle brackets special characters
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;') #code-block: angle brackets special characters
+ para.gsub!(/(^|[^}])_</m,'\1&lt;'); para.gsub!(/(^|[^}])_>/m,'\1&gt;')
para.gsub!(/&nbsp;/,'&#160;')
end
para