From 3804f096e2dd3c82ace274463df6b9b0767fbb60 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 7 Oct 2007 14:09:03 +0100 Subject: cleaning, and make sure in xml   rather than   is used --- CHANGELOG | 2 ++ lib/sisu/v0/html_segments.rb | 10 +++------- lib/sisu/v0/html_tune.rb | 7 +++---- lib/sisu/v0/shared_html_lite.rb | 10 ++++------ lib/sisu/v0/shared_xml.rb | 26 +++++++------------------- lib/sisu/v0/texpdf_format.rb | 7 +------ lib/sisu/v0/xhtml.rb | 19 ------------------- lib/sisu/v0/xml.rb | 21 --------------------- 8 files changed, 20 insertions(+), 82 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1fb7284b..732a1076 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_0.60.1.orig.tar.gz * html, where no ocn selected, keep ocn id, just remove visible reference to ocn, as search result links will continue to function + * xml, make sure   is used instead of   + * sisu_manual, link to markup and book examples updated/corrected %% sisu_0.60.0.orig.tar.gz (2007-10-03:40/3) diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index fe2966df..18ed11ec 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -178,10 +178,10 @@ module SiSU_HTML_seg markup(pg) end end - Seg.new(para,@md).txt + #Seg.new(para,@md).txt if testforartnum[tracking-1] =~/endnote/ if printed_endnote_seg == 'n' - Seg.new(para,@md).endnote + #Seg.new(para,@md).endnote printed_endnote_seg='y' end end @@ -344,15 +344,11 @@ module SiSU_HTML_seg end end end - def txt - end - def endnote - end def tail format_head_seg=SiSU_HTML_Format_type::Head_seg.new(@md) if @md.flag_auto_endnotes @@seg[:tail] << format_head_seg.endnote_mark - @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments||@|EXTRACTION OF ENDNOTES| + @@seg[:tail] << @@seg_endnotes[@@get_hash_fn] #endnotes deposited at end of individual segments ||@|EXTRACTION OF ENDNOTES| end @@seg[:tail] << '
 
' ads=SiSU_HTML_promo::Ad.new(@md) diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 0b861526..b98f19d8 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -278,7 +278,7 @@ module SiSU_Tune end word end - @words + @words=@words.join(' ') end def url_markup data=@data @@ -306,9 +306,8 @@ module SiSU_Tune end if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) - word_mode=urls(@word_mode) - words=word_mode.join(' ') - para.gsub!(/.+/,words) + words=urls(@word_mode) + para.gsub!(/.+/m,words) end if (para !~/^0~|^<:code>/) para.gsub!(/\\copyright/i,%{©}) diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index f258f0a9..85368a28 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -93,7 +93,7 @@ module SiSU_Format_Shared else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures d='' end - case m + word=case m when /\.png|\.jpg|\.gif|c=|\d+x\d+/ w,h=/(\d+)x(\d+)/.match(m).captures if m =~/\d+x\d+/ w=%{width="#{w}"} if w @@ -117,20 +117,18 @@ module SiSU_Format_Shared #ins=%{#{link} [link]#{d}} word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins) end - word else word end word end - @words + @words=@words.join(' ') end def markup(para) if para !~/^<:code>/ if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) - word_mode=urls(wm) - words=word_mode.join(' ') - para.gsub!(/.+/,words) + words=urls(wm) + para.gsub!(/.+/m,words) end 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 diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 135f368e..4b9ccb12 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -355,22 +355,18 @@ module SiSU_XML_munge para.gsub!(/<0;\w\d+;[um]\d+><#@dp:#@dp>/,'') if para !~/^<:code>/ #embeds a red-bullet image --> - #para.gsub!(/^(<:i[1-9]>\s*_\*)\s+/,'\1 * ') - #para.gsub!(/^_\*\s+/,'* ') para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))\s+(\d+)x(\d+)(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1[\\2] \\5}) para.gsub!(/(^|\s)\{\s*(\S+?\.(?:jpg|png|gif))(\s+[^}]+)?\}(https?:\/\/\S+)/,%{\\1\\2}) para.gsub!(/(^|\s)\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?=\s|$))/, '\1\2\4') #watch, compare html_tune - #para.gsub!(/\B\{([^}]+)\}(https?:\/\/[^"><]+?)([,.:;"><]?(?:\s|$))/, - # '\1\3') #watch, compare html_tune para.gsub!(/(^|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) - #para.gsub!(/\b((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/, #also works - #%{#{@url_brace.xml_open}\\1#{@url_brace.xml_close}\\2}) para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #escaped urls not linked, deal with later - #para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3') #escaped urls not linked, deal with later - para.gsub!(/ /,' ') #clean - else para.gsub!(/_/m,'>') #code-block: angle brackets special characters + para.gsub!(/ /,' ') + #para.gsub!(/ /,' ') #clean + else + para.gsub!(/_/m,'>') #code-block: angle brackets special characters + para.gsub!(/ /,' ') end para end @@ -386,7 +382,8 @@ module SiSU_XML_munge para.gsub!(/&([^;]{1,5})/,'&\1') #sort, rough estimate, revisit #WATCH found in node not sax para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/, "#{@dir.url.images_local}\/\\1") - para.gsub!(/ /,' ') + para.gsub!(/ /,' ') + #para.gsub!(/ /,' ') #clean wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para @@ -412,15 +409,6 @@ module SiSU_XML_tags #Format if @md.dc_title # DublinCore 1 - title @rdf_title=%{ dc.title="#{seg_name}#{@md.dc_title}"\n} @dc_title=%{ \n} - #if @md.subtitle - # @rdf_title=%{ dc.title="#{seg_name}#{@md.title} - #{@md.subtitle}"\n} - # @title=%{\n} - #else - # @rdf_title=%{ dc.title="#{seg_name}#{@md.title}"\n} - # @title=%{\n} - #end end if @md.dc_creator # DublinCore 2 - creator/author (author) @rdf_creator=%{ dc.creator="#{@md.dc_creator}"\n} diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb index 55f1e19a..51681ce7 100644 --- a/lib/sisu/v0/texpdf_format.rb +++ b/lib/sisu/v0/texpdf_format.rb @@ -798,9 +798,6 @@ WOK if word =~/\\\{(.+?)\\\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/ r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ d=/\\\{.+?\\?\}(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?([;.,]?(?:\s|$))/.match(word).captures.to_s -# if word =~/\\\{(.+?)\\\}((?:https?|file|ftp)\S+?)([;.,]?(?:\s|$))/ -# r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+?)(?:[;.,]?(?:\s|$)|(?:\s|$))/ -# d=/\\\{.+?\\?\}(?:https?|file|ftp):\S+?([;.,]?(?:\s|$))/.match(word).captures.to_s else r=%r/\\\{(.+?)\\?\}((?:https?|file|ftp):\S+)/ d='' @@ -820,8 +817,6 @@ WOK when /a5/; @tx.a5 else @tx.a4 end - ##dm=SiSU_Env::Get_init.instance.tex(@md.papersize).dimensions #test! - #dm=SiSU_Viz::TeX.new(@md.papersize).dimensions width=if orientation =~/portrait/ #value is not currently passed width=if width.to_i > dm.portrait.img_px; dm.portrait.img_px else width @@ -875,7 +870,7 @@ WOK @words.join end def http(orientation) - wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) #first match of interest others passed through + wm=@string.dup.scan(/\\\{.+?\\\}(?:(?:https?|file|ftp):\S+|image)|\w+\s*|./m) @string=SiSU_TeX_Pdf::Format_text_object.new(@md,wm).http_word_mode(orientation) end def language diff --git a/lib/sisu/v0/xhtml.rb b/lib/sisu/v0/xhtml.rb index 1d7d63d1..6b91f34f 100644 --- a/lib/sisu/v0/xhtml.rb +++ b/lib/sisu/v0/xhtml.rb @@ -190,25 +190,6 @@ WOK else '' end end - def xml_structure_ee(para='',lv='',ocn='',hname='') #embedded endnotes - lv=lv.to_i - n=lv - 1 - n3=lv + 2 - lv=nil if lv == 0 - embedded_endnotes(para) - if para[@regx] - paragraph="#{para[@regx,2]}" - util=SiSU_text_utils::Wrap.new(paragraph,70) - wrapped=util.line_wrap - end - @@xml[:body] << "#{@tab*0}" << "\n" if para[@regx] - @@xml[:body] << "#{@tab*1}#{para[@regx,3]}" << "\n" if para[@regx,3] - @@xml[:body] << if lv; %{#{@tab*1}#{wrapped}\n} << "\n" - else %{#{@tab*1}#{wrapped}\n} # main text, contents, body KEEP - end - ##@@xml[:body] << "#{@tab*1}#{para[@regx,2]}\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP - @@xml[:body] << "#{@tab*0}" << "\n" if para[@regx] - end def xml_structure(para='',lv='',ocn='',hname='',type='norm') #extracted endnotes lv=lv.to_i n=lv - 1 diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index 2dd25491..b230ec9f 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -214,26 +214,6 @@ WOK end @@xml[:sc]=sc end - def xml_structure_ee(para='',lv='',ocn='',hname='') #embedded endnotes - lv=lv.to_i - n=lv - 1 - n3=lv + 2 - lv=nil if lv == 0 - embedded_endnotes(para) - if para[@regx] - paragraph="#{para[@regx,2]}" - util=SiSU_text_utils::Wrap.new(paragraph,70) - wrapped=util.line_wrap - end - @@xml[:body] << "#{@tab*0}" << "\n" if para[@regx] - @@xml[:body] << "#{@tab*1}#{para[@regx,3]}" << "\n" if para[@regx,3] - @@xml[:body] << if lv; %{#{@tab*1}#{wrapped}\n} << "\n" - else %{#{@tab*1}#{wrapped}\n} # main text, contents, body KEEP - end - #@@xml[:body] << "#{@tab*1}#{wrapped}\n" # main text, contents, body KEEP - ##@@xml[:body] << "#{@tab*1}#{para[@regx,2]}\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP - @@xml[:body] << "#{@tab*0}" << "\n" if para[@regx] - end def xml_structure(para='',lv='',ocn='',hname='',type='norm') #extracted endnotes lv=lv.to_i n=lv - 1 @@ -249,7 +229,6 @@ WOK @@xml[:body] << if para[@regx,3]; %{#{@tab*0}} << "\n" else "#{@tab*0}" << "\n" if para[@regx] end - #@@xml[:body] << "#{@tab*1}#{lv}" << "\n" if lv @@xml[:body] << "#{@tab*1}#{para[@regx,3]}" << "\n" if para[@regx,3] @@xml[:body] << if lv; %{#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} << "\n" else %{#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} # main text, contents, body KEEP -- cgit v1.2.3