From 151f10430123b4999de4e511cdba34b4ff1d6a0b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 00:18:44 -0500 Subject: v5 v6: html, cleaning, minor --- lib/sisu/v5/html_format.rb | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'lib/sisu/v5/html_format.rb') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 3b15502f..96567de5 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -271,24 +271,6 @@ module SiSU_HTML_Format else '' end end - def pdf #retired 2.7.9 - pdf=if @md.programs[:pdf] \ - and @cf_defaults.cf_0 =~/p/ - %{ - - - #{@vz.nav_txt_pdf_portrait} - - - - - #{@vz.nav_txt_pdf_landscape} - - -} - else '' - end - end end class XML end @@ -648,8 +630,6 @@ WOK def initialize(md) super(md) end - def title_banner(title,subtitle,creator) - end def dot_control_pre_next pre="#{@seg_name_html[@seg_name_html_tracker-1]}#{@md.lang_code_insert}#{Sfx[:html]}" up=@toc -- cgit v1.2.3 From 07ce34456d7df7ae1b91710463d7e21cf54f7dc4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 00:39:18 -0500 Subject: v5 v6: html, name tag related (output "cleaning") --- lib/sisu/v5/html_format.rb | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'lib/sisu/v5/html_format.rb') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 96567de5..0dc65a06 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -874,6 +874,7 @@ WOK attr_accessor :md,:t_o,:txt,:ocn,:format,:table,:link,:linkname,:paranum,:p_num,:headname,:banner,:url def initialize(md,t_o) @md,@t_o=md,t_o + @make=SiSU_Env::ProcessingSettings.new(@md) if t_o.is_a?(Hash) @txt =t_o[:txt] || nil @ocn =t_o[:ocn] || nil @@ -897,19 +898,19 @@ WOK p caller end end - @headnamed= (@headname ? %{} : nil) + @headnamed=(@headname ? %{} : nil) if @txt and not @txt.empty? @txt=@txt.gsub(/#{Mx[:mk_o]}[-~]##{Mx[:mk_c]}/,'') end @p_num=ParagraphNumber.new(@md,@ocn) @vz=SiSU_Viz::Defaults.new - @make=SiSU_Env::ProcessingSettings.new(@md) end def nametags_scroll(dob) tags='' if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| + t=t.gsub(/[^a-z0-9._-]/,'') #use for all html tags? consider limiting to strict? or implementing earlier tags=tags << %{} end end @@ -920,7 +921,16 @@ WOK if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| - tags=tags << %{} + t=t.gsub(/[^a-z0-9._-]/,'') #use for all html tags? consider limiting to strict? or implementing earlier + if @make.build.html_strict? + tags=(t =~/^[#{Mx[:ocn_id_char]}]?[0-9.]+$/) \ + ? tags #check what can be sorted in ao + : (tags << %{}) + else + tags=(t =~/^[#{Mx[:ocn_id_char]}][0-9.]+$/) \ + ? tags #check what can be sorted in ao + : (tags << %{}) + end end end tags @@ -929,8 +939,8 @@ WOK hn=if @t_o.is ==:heading \ and not @t_o.name.empty? #determine use hn=(@t_o.is ==:heading) \ - ? (%{}) - : (%{}) + ? (%{}) + : (%{}) else nil end hn @@ -1017,7 +1027,7 @@ WOK
#{@p_num.ocn_display} <#{tag} class="#{attrib}" #{@p_num.id}>#{@p_num.name} - #{@named}#{@txt} + #{@named}#{@txt}
} @@ -1131,8 +1141,6 @@ WOK #{@vz.table_close}} end def bold_heading - @txt=@txt.gsub(/[1-9]~(\S+)/,''). - gsub(/[1-9]~/,'') %{

#{@txt}

-- cgit v1.2.3 From a151893efedaebc26d26a8f8611fb688a6de6d4f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 00:56:10 -0500 Subject: v5 v6: ocn: strict html; turn on/off rules for txt & odf --- lib/sisu/v5/html_format.rb | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'lib/sisu/v5/html_format.rb') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 0dc65a06..e0be4f8a 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -66,30 +66,36 @@ module SiSU_HTML_Format def initialize(md,ocn) @md,@ocn=md,ocn.to_s @ocn ||='' + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier + @make=SiSU_Env::ProcessingSettings.new(@md) end def ocn_display - make=SiSU_Env::ProcessingSettings.new(@md) - if make.build.ocn? - ocn_class='ocn' + if @make.build.ocn? if @ocn.to_i==0 \ or @ocn.empty? - %{} + '' else + name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"} @ocn.gsub(/^(\d+|)$/, - %{}) + %{}) end else - %{} + '' end end def name - (@ocn==nil || @ocn.empty?) ? '' : %{} + if @make.build.html_strict? \ + or @ocn==(nil || @ocn.empty?) + '' + else + %{} + end end def id #w3c? "tidy" complains about numbers as identifiers ! annoying (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"} end def goto - (@ocn==nil || @ocn.empty?) ? '' : %{} + (@ocn==nil || @ocn.empty?) ? '' : %{} end end class HeadInformation @@ -1233,6 +1239,7 @@ WOK end def subtoc_lev(tag,attrib) @txt=clean(@txt) + @ocn_html_identifier=SiSU_Env::ProcessingSettings.new(@md).ocn_html_identifier txt=if @txt \ and @txt =~/<\/?i>|/mi @txt.gsub(/<\/?i>|/mi,'') #removes name markers from subtoc, go directly to substantive text @@ -1246,7 +1253,7 @@ WOK gsub(/ \d+<\/sup> /m,'') end %{<#{tag} class="#{attrib}"> - #{txt} #{note} + #{txt} #{note} } end def subtoc_lev5 -- cgit v1.2.3 From 99c5b5d56f8785ee9ec2cc991c55a8a2eb6524bb Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 01:02:31 -0500 Subject: v5 v6: html, endnote name and nameref make compliant (epub use same) --- lib/sisu/v5/html_format.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/sisu/v5/html_format.rb') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index e0be4f8a..a933d091 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -1248,7 +1248,7 @@ WOK note='' if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end note=$1 - note=note.gsub(/[\n\s]+/m,' ') + note=note.gsub(/[\s]+/m,' ') txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). gsub(/ \d+<\/sup> /m,'') end -- cgit v1.2.3 From d79d6050ce31f7d8d65a87be4008e11fae368770 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 5 Feb 2014 01:09:02 -0500 Subject: v5 v6: html, (output) cleaning --- lib/sisu/v5/html_format.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/sisu/v5/html_format.rb') diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index a933d091..e244bbb8 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -502,7 +502,8 @@ WOK end def rights def all - rights=@md.rights.all.gsub(/^\s*Copyright\s+\(C\)/,'Copyright © ') + rights=SiSU_HTML_Tune::CleanHTML.new(@md.rights.all).clean_for_html + rights=rights.gsub(/^\s*Copyright\s+\(C\)/,'Copyright © ') %{

Rights: #{rights}

} end @@ -977,7 +978,9 @@ WOK end def para_form_css(tag,attrib) # regular paragraphs shaped here ul=ulc='' - ul,ulc="

    \n ","\n
" if @tag =~/li/ + if tag =~/li/ + ul,ulc="
    \n ","\n
" + end %{
#{@p_num.ocn_display} @@ -1250,7 +1253,7 @@ WOK note=$1 note=note.gsub(/[\s]+/m,' ') txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' '). - gsub(/ \d+<\/sup> /m,'') + gsub(/ \d+<\/sup> /m,'') end %{<#{tag} class="#{attrib}"> #{txt} #{note} -- cgit v1.2.3