aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v0/dal.rb2
-rw-r--r--lib/sisu/v0/html_format.rb6
-rw-r--r--lib/sisu/v0/html_tune.rb2
-rw-r--r--lib/sisu/v0/manpage.rb4
-rw-r--r--lib/sisu/v0/odf.rb7
-rw-r--r--lib/sisu/v0/plaintext.rb4
-rw-r--r--lib/sisu/v0/shared_html_lite.rb2
-rw-r--r--lib/sisu/v0/shared_xml.rb4
-rw-r--r--lib/sisu/v0/texpdf.rb16
-rw-r--r--lib/sisu/v0/texpdf_format.rb1
-rw-r--r--lib/sisu/v0/xml.rb1
-rw-r--r--lib/sisu/v0/xml_dom.rb2
12 files changed, 36 insertions, 15 deletions
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'
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+|)$/,
%{ <p class="#{ocn_class}">
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!(/<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,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;') #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!(/&#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>/
- para.gsub!(/_</,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters
+ if para =~/<:code>/ #code-block: angle brackets special characters
+ para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>')
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 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,'&lt;'); para.gsub!(/_>/m,'&gt;') #code-block: angle brackets special characters
- #para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
+ if para =~/<:code>/ #code-block: angle brackets special characters
+ para.gsub!(/(?=^|[^}])_</m,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&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 c308dfb2..361624e1 100644
--- a/lib/sisu/v0/plaintext.rb
+++ b/lib/sisu/v0/plaintext.rb
@@ -335,8 +335,8 @@ WOK
para.gsub!(/&#169;/,'©')
end
if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/
- if para =~/<:code>/
- para.gsub!(/_</,'<'); para.gsub!(/_>/m,'>') #code-block: angle brackets special characters
+ if para =~/<:code>/ #code-block: angle brackets special characters
+ para.gsub!(/(?=^|[^}])_</m,'<'); para.gsub!(/(?=^|[^}])_>/m,'>')
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 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|$))/,'<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,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;') #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!(/&nbsp;/,'&#160;')
#para.gsub!(/&nbsp;/,' ') #clean
else
- para.gsub!(/_</m,'&lt;'); para.gsub!(/_>/m,'&gt;') #code-block: angle brackets special characters
+ para.gsub!(/(?=^|[^}])_</m,'&lt;'); para.gsub!(/(?=^|[^}])_>/m,'&gt;') #code-block: angle brackets special characters
para.gsub!(/&nbsp;/,'&#160;')
end
para
@@ -391,7 +391,7 @@ module SiSU_XML_munge
def markup_group(para='')
para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
para.gsub!(/&lt;:?br(?:\s+\/)?&gt;/,'<br />')
- para.gsub!(/&lt;(link xmlns:xlink=".+?)"&gt;/,'<"\1">')
+ para.gsub!(/&lt;(link xmlns:xlink=".+?")&gt;/,'<\1>')
para.gsub!(/&lt;(\/link)&gt;/,'<\1>')
para.gsub!(/&lt;(\/?en)&gt;/,'<\1>')
para
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\}|<EOF>/ #catch <!TZ!>
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
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>(.+?)<\/i>/,'\emph{\1}')
@string.gsub!(/<italic>(.+?)<\/italic>/,'\emph{\1}')
@string.gsub!(/<u>(.+?)<\/u>/,'\uline{\1}') # ulem
+ @string.gsub!(/<cite>(.+?)<\/cite>/,"``\\1''") # quote
@string.gsub!(/<ins>(.+?)<\/ins>/,'\uline{\1}') # ulem
@string.gsub!(/<del>(.+?)<\/del>/,'\sout{\1}') # ulem
@string.gsub!(/<sub>(.+?)<\/sub>/,"\$_{\\textrm{\\1}}\$")
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/,'&#160;&#160;')
para.strip!
@@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
@@xml[:body] << %{#{@tab*1}<ocn>#{ocn}</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*&lt;#@dp&gt;\}~/m,
+ '<endnote><number>\1</number><note>\2</note></endnote> ')
para.strip!
@@xml[:body] << %{#{@tab*6}<object id="#{ocn}">} << "\n"
@@xml[:body] << %{#{@tab*7}<ocn>#{ocn}</ocn>} << "\n"