From 3bf42456e099d1be3c3f2966a560d12762e755e0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 25 Sep 2010 21:42:00 -0400 Subject: texinfo_format, texinfo output broken, fix (Closes #598063) --- lib/sisu/v2/texinfo_format.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/texinfo_format.rb b/lib/sisu/v2/texinfo_format.rb index 53918e26..9e8afb10 100644 --- a/lib/sisu/v2/texinfo_format.rb +++ b/lib/sisu/v2/texinfo_format.rb @@ -175,7 +175,7 @@ WOK end if defined? @md.classify.subject \ and @md.classify.subject=~/\S+/ - subject=spec_char(@md.subject) + subject=spec_char(@md.classify.subject) end if defined? @md.notes.description \ and @md.notes.description=~/\S+/ @@ -240,6 +240,8 @@ WOK end if defined? @md.rights.all \ and @md.rights.all=~/\S+/ + rights=spec_char(@md.rights.all) + end rights=spec_char(@md.rights.all) full_title="Title: #{full_title}\n\n" if full_title #dc author="Author: #{author}\n\n" if author #dc -- cgit v1.2.3 From a69174130de52fa28b02ace087c03d7ec7553b54 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 25 Sep 2010 22:56:31 -0400 Subject: texinfo ocn decoration a hash (instead of angle braces) (+changelog) --- lib/sisu/v2/texinfo.rb | 4 ++-- lib/sisu/v2/texinfo_format.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/texinfo.rb b/lib/sisu/v2/texinfo.rb index 871a2b3e..bcff4915 100644 --- a/lib/sisu/v2/texinfo.rb +++ b/lib/sisu/v2/texinfo.rb @@ -315,8 +315,8 @@ module SiSU_TexInfo dob.obj=nil else if dob.is=='para' \ - and dob.obj !~/<#{dob.ocn}>/ - dob.obj="#{dob.obj} <#{dob.ocn}>" + and dob.obj !~/##{dob.ocn}/ + dob.obj="#{dob.obj} ##{dob.ocn}" end end end diff --git a/lib/sisu/v2/texinfo_format.rb b/lib/sisu/v2/texinfo_format.rb index 9e8afb10..a17fdb65 100644 --- a/lib/sisu/v2/texinfo_format.rb +++ b/lib/sisu/v2/texinfo_format.rb @@ -295,8 +295,8 @@ WOK end def clean(dob) if dob.is=='heading' \ - and dob.obj !~/<#{dob.ocn}>/ - dob.obj="#{dob.obj} <#{dob.ocn}>" + and dob.obj !~/##{dob.ocn}/ + dob.obj="#{dob.obj} ##{dob.ocn}" end dob.obj.gsub!(/<:#>/,'') dob.obj.strip! @@ -559,8 +559,8 @@ WOK end def clean(dob,txt) if dob.is=='heading' \ - and txt !~/<#{dob.ocn}>/ - txt="#{dob.obj} <#{dob.ocn}>" + and txt !~/##{dob.ocn}/ + txt="#{dob.obj} ##{dob.ocn}" end txt.gsub!(/<:#>/,'') txt.strip! -- cgit v1.2.3 From 6132f2f25a43d19c142360ecf8999a6fe43a360c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 25 Sep 2010 23:03:51 -0400 Subject: texinfo, urls cleaned & with angle bracket decoration (+changelog) --- lib/sisu/v2/texinfo_format.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/texinfo_format.rb b/lib/sisu/v2/texinfo_format.rb index a17fdb65..5e1d8af4 100644 --- a/lib/sisu/v2/texinfo_format.rb +++ b/lib/sisu/v2/texinfo_format.rb @@ -384,6 +384,7 @@ WOK txt.gsub!(/\^/,'\\wedge ') txt.gsub!(/(\$)/,"\\$") txt.gsub!(/\~/,'\\~') + txt.gsub!(/#{Mx[:url_o]}(https?:\S+?)#{Mx[:url_c]}/,'<\1>') txt.gsub!(/#{Mx[:url_o]}_(https?:\S+?)#{Mx[:url_c]}/,'\1') txt.gsub!(/§/i,'\S') txt.gsub!(/£/i,'\pounds') -- cgit v1.2.3 From bbc1ea81d8c93ac58329fa52236000824f490793 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 27 Sep 2010 22:51:48 -0400 Subject: texpdf, provide line-break-points for long directory names (+changelog) (requested fix) --- lib/sisu/v2/texpdf_format.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 41802557..895fd8d8 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -963,6 +963,16 @@ WOK para_array=[] str=if word word.each do |w| # _ - / # | : ! ^ ~ + if w !~/http:/ \ + and w=~/\/\S+?\// \ + and w.length > 6 + w.gsub!(/([_.\/])/,'\1\-') + #elsif w !~/http:/ \ + #and w=~/([_,.;:\/|=])/ \ + #and w.length > 10 + # w.gsub!(/([_,.;:\/|=])/,'\1\-') + # w.gsub!(/(--)(\S{4,})/,'\1\-\2') + end w.gsub!(/#{Mx[:gl_o]}#lt#{Mx[:gl_c]}/,'<'); w.gsub!(/#{Mx[:gl_o]}#gt#{Mx[:gl_c]}/,'>') w.gsub!(/[\\]?~/,'<=tilde>') w.gsub!(/[#{Mx[:br_line]}#{Mx[:br_paragraph]}]/,' \newline ') #watch -- cgit v1.2.3 From 5b92d55aad5ab4c2812c36b407d0b6458ee4de45 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 27 Sep 2010 23:23:47 -0400 Subject: texpdf, a5, increase headheight (+changelog) --- lib/sisu/v2/texpdf_format.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 895fd8d8..ea34a390 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -751,7 +751,7 @@ WOK when /a5/i d[:papertype],d[:fontsize]='a5paper','11pt' d[:oddsidemargin],d[:evensidemargin],d[:topmargin]='-4mm','-4mm','-36pt' - d[:headheight],d[:headsep],d[:columnsep]='8pt','12pt','' + d[:headheight],d[:headsep],d[:columnsep]='11pt','12pt','' d[:marginparsep],d[:marginparwidth]='4mm','6mm' d[:textheight],d[:textwidth]=@tx.a5.portrait.h,@tx.a5.portrait.w else #default currently A4 -- cgit v1.2.3 From af86517f935c73e4e90b42387cf4c1bc1b083df3 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Oct 2010 08:48:59 -0400 Subject: share_src, remove repetition, redundancy --- lib/sisu/v2/share_src.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/share_src.rb b/lib/sisu/v2/share_src.rb index 5c5576f3..900e78ff 100644 --- a/lib/sisu/v2/share_src.rb +++ b/lib/sisu/v2/share_src.rb @@ -76,7 +76,6 @@ module SiSU_Markup : SiSU_Screen::Ansi.new(@opt.cmd,'Share Document Source!',@opt.fns).green_title_hi SiSU_Screen::Ansi.new(@opt.cmd,"Copy sisu markup file to output directory","#{@opt.fns} -> #{@output_path}").warn if @opt.cmd =~/[MVv]/ end - mkdir_p("#{@env.path.output}/src") unless FileTest.directory?("#{@env.path.output}/src") mkdir_p(@output_path) unless FileTest.directory?(@output_path) if FileTest.directory?(@output_path) unless @opt.fns =~/\.ssm$/; cp(@opt.fns,@output_path) -- cgit v1.2.3 From 0addde5564bebd6bfd47ab8111dfb97cd598e5c5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Oct 2010 08:50:21 -0400 Subject: hub, removed commented out option (git), (already enabled elsewhere) --- lib/sisu/v2/hub.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/hub.rb b/lib/sisu/v2/hub.rb index 68ff6fcb..85009d75 100644 --- a/lib/sisu/v2/hub.rb +++ b/lib/sisu/v2/hub.rb @@ -131,7 +131,6 @@ module SiSU when /^digests$/; SiSU_Digest_view::Source.new(@opt).read # -N when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k when /^plaintext$/; SiSU_Plaintext::Source.new(@opt).read # -t -a - #when /^git$/; SiSU_Git::Source.new(@opt).read # -g #when /^wikispeak$/; SiSU_Wikispeak::Source.new(@opt).read # -g when /^epub$/; SiSU_EPUB::Source.new(@opt).read # -e when /^odf$/; SiSU_ODF::Source.new(@opt).read # -o -- cgit v1.2.3 From 2fa09eb0bfb6243b1ef1fdec1eaf0873ef13b0e9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Oct 2010 08:50:54 -0400 Subject: param, a few fixes (checks, aliases, typo) --- lib/sisu/v2/param.rb | 46 ++++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 18 deletions(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index bdd5c2e4..b44a5b8e 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -410,7 +410,7 @@ module SiSU_Param l,n=Db[:col_info_note],'rights.copyright.photographs' validate_length(s,l,n) end - def digitiztion + def digitization s=(@h['digitization'] ? @h['digitization'] : nil) l,n=Db[:col_info_note],'rights.copyright.digitization' validate_length(s,l,n) @@ -638,20 +638,28 @@ module SiSU_Param def bold m=@h['bold'] x=(m=~/\/i$/)? 'i' : '' - m.gsub!(/^\/(.+?)\/i?/,'\1') - m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - rgx='\b(' + m + ')\b' - y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) - { :str =>'\b(?:' + m + ')\b', :regx => y } + z=if m + m.gsub!(/^\/(.+?)\/i?/,'\1') + m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + rgx='\b(' + m + ')\b' + y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) + { :str =>'\b(?:' + m + ')\b', :regx => y } + else nil + end + z end def italics m=@h['italics'] x=((m=~/\/i$/) ? 'i' : '') - m.gsub!(/^\/(.+?)\/i?/,'\1') - m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided - rgx='\b(' + m + ')\b' - y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) - { :str =>'\b(?:' + m + ')\b', :regx => y } + z=if m + m.gsub!(/^\/(.+?)\/i?/,'\1') + m.gsub!(/\(/,'(?:') # avoid need to escape use of brackets within regex provided + rgx='\b(' + m + ')\b' + y=((x =~/i/) ? (/#{rgx}/i) : (/#{rgx}/)) + { :str =>'\b(?:' + m + ')\b', :regx => y } + else nil + end + z end def emphasis if @h['emphasis'] =~/bold/; 'bold' @@ -783,9 +791,9 @@ module SiSU_Param @doc={ :lv=>[] } @doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','','' @@publisher='SiSU scribe' - attr_accessor :cmd,:make,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original_publication,:original_publication_date,:original_publication_nationality,:original_publication_institution,:writing_focus,:audio,:daisy + attr_accessor :cmd,:make,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:markup_version,:markup_declared,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:lang,:en,:notes,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy def initialize(fns_array,opt) - @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original_publication_details=@original_publication=@original_publication_date=@original_publication_nationality=@original_publication_institution=@writing_focus=@audio=nil + @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@lang=@en=@notes=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=nil @data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data @flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=false,false,false,false,false,false,false @seg_autoname_safe=true @@ -936,6 +944,7 @@ module SiSU_Param @classify=Md.new($1.strip,@opt,@env).classify when /^@publisher:\s+(.+)/m @publisher=Md.new($1.strip,@opt,@env).current_publisher + @current_publisher=@publisher when /^@original:(.+)/m @original=Md.new($1.strip,@opt,@env).original @source=@original.source @@ -985,16 +994,17 @@ module SiSU_Param when /^@links:\s+(.+?)\Z/m #% processing doc_links=Md.new($1.strip,@opt,@env).links count=1 - @lnk=[] + @links=[] doc_links.each do |doc_link| if doc_link=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ - @lnk[count]={} - @lnk[count][:say],@lnk[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] + @links[count]={} + @links[count][:say],@links[count][:url]=/\{\s*(.+?)\s*\}((?:(?:https?|file|ftp):\/|\.\.)\/\S+)/im.match(doc_link)[1,2] count +=1 end end - when /^@notes?:\s(.+)/ #% metainfo - Md.new($1.strip,@opt,@env).notes + @lnk=@links + when /^@notes?:\s(.+)\Z/m #% metainfo + @notes=Md.new($1.strip,@opt,@env).notes when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing end @lv1 ||=/^1~/ -- cgit v1.2.3 From ff6ec4b4667896da74375793bf402821f2c11df5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Oct 2010 08:51:32 -0400 Subject: manifest, typo fix --- lib/sisu/v2/manifest.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/manifest.rb b/lib/sisu/v2/manifest.rb index 6954fc6a..82756e67 100644 --- a/lib/sisu/v2/manifest.rb +++ b/lib/sisu/v2/manifest.rb @@ -472,7 +472,7 @@ module SiSU_Manifest end if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ - id,info=@translate.comments,@md.notes.comments + id,info=@translate.comments,@md.notes.comment metadata(id,info) end if defined? @md.classify.loc \ -- cgit v1.2.3 From fa30536190f5698b4da3d2e478e00778b94688b5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 1 Oct 2010 08:52:09 -0400 Subject: shared_metadata, odt fix breakage where angle brackets used in metadata headers; & a typo fix * odt protect against breakage from angle brackets in metadata headers (requested fix) --- lib/sisu/v2/shared_metadata.rb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/sisu') diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb index cd46bd1d..69a92070 100644 --- a/lib/sisu/v2/shared_metadata.rb +++ b/lib/sisu/v2/shared_metadata.rb @@ -192,7 +192,7 @@ module Metadata end if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ - @tag,@inf,@class=tr.comments,@md.notes.comments,'ext' + @tag,@inf,@class=tr.comments,@md.notes.comment,'ext' meta << self.meta_para end if defined? @md.notes.prefix_a \ @@ -474,13 +474,19 @@ WOK def meta_para url_brace=SiSU_Viz::Skin.new.url_decoration if @inf.class==String - @inf.gsub!(/
/,'
') + @inf.gsub!(//,'>') + @inf.gsub!(/<br(?: \/)?>/,'
') @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, '\1\2') #special case \{ e.g. \}http://url - @inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, - %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + 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 + else + @inf.gsub!(/(https?:\/\/\S+)/, + %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) #http ftp matches with decoration + end @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 end @@ -672,7 +678,7 @@ WOK end if defined? @md.notes.comment \ and @md.notes.comment=~/\S+/ - tag,inf=tr.comments,@md.notes.comments + tag,inf=tr.comments,@md.notes.comment meta << meta_para(tag,inf) end if defined? @md.notes.prefix_a \ -- cgit v1.2.3