From 6e2061aa6dfe53a930825ab0d6b7f6194d0c04e6 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 2 Dec 2013 23:24:39 -0500 Subject: v5: xmlns xlink using xl --- lib/sisu/v5/epub.rb | 4 ++-- lib/sisu/v5/odf.rb | 44 ++++++++++++++++++------------------- lib/sisu/v5/odf_format.rb | 6 ++--- lib/sisu/v5/relaxng.rb | 50 +++++++++++++++++++++--------------------- lib/sisu/v5/shared_metadata.rb | 10 ++++----- lib/sisu/v5/shared_xml.rb | 24 ++++++++++---------- 6 files changed, 69 insertions(+), 69 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/epub.rb b/lib/sisu/v5/epub.rb index 37ab535b..969debe2 100644 --- a/lib/sisu/v5/epub.rb +++ b/lib/sisu/v5/epub.rb @@ -728,8 +728,8 @@ module SiSU_EPUB
- - + +
diff --git a/lib/sisu/v5/odf.rb b/lib/sisu/v5/odf.rb index 2bc7de01..3e83e1cf 100644 --- a/lib/sisu/v5/odf.rb +++ b/lib/sisu/v5/odf.rb @@ -176,8 +176,8 @@ module SiSU_ODF end def odf_tail manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" - @@odf[:tail] << %{Available document outputs:
<#{manifest}>
} - @@odf[:tail] << %{\nSiSU: <www.jus.uio.no/sisu> and <www.sisudoc.org>} + @@odf[:tail] << %{Available document outputs:
<#{manifest}>
} + @@odf[:tail] << %{\nSiSU: <www.jus.uio.no/sisu> and <www.sisudoc.org>} @@odf[:tail] << "\n" end def set_bookmark_tag(dob) @@ -266,7 +266,7 @@ module SiSU_ODF and h.to_s =~/\d/ \ and w.to_s =~/\d/ @@img_count +=1 - %{#{c}} #anchor-type: as-char or paragraph or char or ... + %{#{c}} #anchor-type: as-char or paragraph or char or ... else %{[image omitted]} end end @@ -296,13 +296,13 @@ module SiSU_ODF map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map t=case url when /^https?:/ - %{#{txt.strip}#{trail}} + %{#{txt.strip}#{trail}} when /^:/ # site same document collection html link url=url.gsub(/^:/,"#{@env.url.root}/") - %{#{txt.strip}#{trail}} + %{#{txt.strip}#{trail}} when /^\.\.\// # site same document collection html link url=url.gsub(/^\.\.\//,"#{@env.url.root}/") - %{#{txt.strip}#{trail}} + %{#{txt.strip}#{trail}} else # document internal link if map_nametags[url] \ and map_nametags[url][:segname] @@ -310,7 +310,7 @@ module SiSU_ODF end t=map_nametags[url] \ && map_nametags[url][:segname] \ - ? %{#{txt.strip}#{trail}} + ? %{#{txt.strip}#{trail}} : %{#{txt.strip}#{trail}} end t @@ -365,11 +365,11 @@ module SiSU_ODF def normal(dob,p_num) #P1 - P3 dob=footnote(dob) dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '\1'). #http ftp matches escaped, no decoration + '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration dob.obj= if dob.is==:para \ and dob.indent.to_s =~/[0-9]/ \ and dob.indent == dob.hang @@ -386,7 +386,7 @@ module SiSU_ODF end def footnote_urls(str) str=str.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) str=text_link(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/ str=text_link_relative(str) if str =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ str @@ -455,15 +455,15 @@ module SiSU_ODF def group(dob,p_num) #P4 #same as verse parray=[] dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '\1'). #http ftp matches escaped, no decoration + '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i| set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : '' parablock=group_clean(parablock) - parablock=parablock.gsub(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,''). + parablock=parablock.gsub(/<text:a xl:type="simple" xl:href="(.+?)">/m,''). gsub(/<(\/text:a)>/,'<\1>'). gsub(/<(text:note text:id=.+?)>/,'<\1>'). gsub(/<(text:p text:style-name="Footnote")>/,'<\1>'). @@ -479,15 +479,15 @@ module SiSU_ODF def block(dob,p_num) #P4 #same as verse parray=[] dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '\1'). #http ftp matches escaped, no decoration + '\1'). #http ftp matches escaped, no decoration gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}) #http ftp matches with decoration dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i| set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : '' parablock=group_clean(parablock) - parablock=parablock.gsub(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,''). + parablock=parablock.gsub(/<text:a xl:type="simple" xl:href="(.+?)">/m,''). gsub(/<(\/text:a)>/,'<\1>'). gsub(/<(text:note text:id=.+?)>/,'<\1>'). gsub(/<(text:p text:style-name="Footnote")>/,'<\1>'). @@ -509,7 +509,7 @@ module SiSU_ODF parablock=group_clean(parablock) parablock=parablock.gsub(/^\s*$/,'
'). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '\1') #http ftp matches escaped, no decoration + '\1') #http ftp matches escaped, no decoration parray << %{#{set_ref}#{parablock}} if parablock =~/\S+/ end dob.obj=parray.join \ @@ -642,7 +642,7 @@ module SiSU_ODF gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'') if dob.is==:para \ and dob.bullet_ - dob.obj=' ' + + dob.obj=' ' + dob.obj end dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/,'
'). @@ -731,7 +731,7 @@ WOK end x=< - + #{table} diff --git a/lib/sisu/v5/odf_format.rb b/lib/sisu/v5/odf_format.rb index 3d40f943..587c9fd0 100644 --- a/lib/sisu/v5/odf_format.rb +++ b/lib/sisu/v5/odf_format.rb @@ -322,7 +322,7 @@ WOK def meta_xml x=< - + #{@generator} #{@md.generated} @@ -338,7 +338,7 @@ WOK def settings_xml x=< - + 0 @@ -441,7 +441,7 @@ WOK def styles_xml x=< - + diff --git a/lib/sisu/v5/relaxng.rb b/lib/sisu/v5/relaxng.rb index 39d6bde9..f6426f54 100644 --- a/lib/sisu/v5/relaxng.rb +++ b/lib/sisu/v5/relaxng.rb @@ -500,7 +500,7 @@ RELAXNG @relaxng =<\1
'). #http ftp matches escaped, no decoration + '\1'). #http ftp matches escaped, no decoration gsub(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - '\1\2') #special case \{ e.g. \}http://url + '\1\2') #special case \{ e.g. \}http://url @inf=if @inf =~/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/ @inf.gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration else @inf.gsub(/(https?:\/\/[^<>()'"\s]+)/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration end @inf=@inf.gsub(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol + %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end <#{@tag.capitalize}: #{@inf} diff --git a/lib/sisu/v5/shared_xml.rb b/lib/sisu/v5/shared_xml.rb index af9b0992..76b5374b 100644 --- a/lib/sisu/v5/shared_xml.rb +++ b/lib/sisu/v5/shared_xml.rb @@ -381,25 +381,25 @@ module SiSU_XML_Munge gsub(/<[-~]#>/,''). gsub(/href="#{Xx[:segment]}/m,'href="'). gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\.\.\/\S+?)#{Mx[:rel_c]}/, - '\1'). + '\1'). gsub(/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{Mx[:rel_c]}]+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}:(\S+?)#{Mx[:rel_c]}/, - '\1'). + '\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}(\S+?)#{Mx[:rel_c]}/, - '\1'). + '\1'). gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{[\\1] \\4}). + %{[\\1] \\4}). gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{\\1}). + %{\\1}). gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))[ ]+(\d+)x(\d+)(\s+[^}]+)?#{Mx[:lnk_c]}image/, - %{[\\1] \\4}). + %{[\\1] \\4}). gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}[ ]*(\S+?\.(?:jpg|png|gif))([ ]+[^}]+)?#{Mx[:lnk_c]}image/, - %{\\1}). + %{\\1}). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - '\1'). #watch, compare html_tune + '\1'). #watch, compare html_tune gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). + %{#{@brace_url.xml_open}\\1#{@brace_url.xml_close}}). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, - '\1') #escaped urls not linked, deal with later + '\1') #escaped urls not linked, deal with later else dob.obj=dob.obj.gsub(//m,'>') end @@ -455,7 +455,7 @@ module SiSU_XML_Munge def markup_group(dob='') dob.obj=dob.obj.gsub(//,'>'). gsub(/<:?br(?:\s+\/)?>/,'
'). - gsub(/<(link xmlns:xlink=".+?")>/,'<\1>'). + gsub(/<(link xmlns:xl=".+?")>/,'<\1>'). gsub(/<(\/link)>/,'<\1>'). gsub(/<(\/?en)>/,'<\1>') dob @@ -463,7 +463,7 @@ module SiSU_XML_Munge def markup_block(dob='') dob.obj=dob.obj.gsub(//,'>'). gsub(/<:?br(?:\s+\/)?>/,'
'). - gsub(/<(link xmlns:xlink=".+?")>/,'<\1>'). + gsub(/<(link xmlns:xl=".+?")>/,'<\1>'). gsub(/<(\/link)>/,'<\1>'). gsub(/<(\/?en)>/,'<\1>') dob -- cgit v1.2.3