aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v6/html_format.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-02-05 00:56:10 -0500
committerRalph Amissah <ralph@amissah.com>2014-02-05 00:56:10 -0500
commita151893efedaebc26d26a8f8611fb688a6de6d4f (patch)
treee5fbb47d3ce53c363af21f2242aa647d18b12f79 /lib/sisu/v6/html_format.rb
parentv5 v6: options, ocn switch on/off instructions (& defaults for plaintext & odt) (diff)
v5 v6: ocn: strict html; turn on/off rules for txt & odf
Diffstat (limited to 'lib/sisu/v6/html_format.rb')
-rw-r--r--lib/sisu/v6/html_format.rb25
1 files changed, 16 insertions, 9 deletions
diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb
index 18d42e14..ddfaaa70 100644
--- a/lib/sisu/v6/html_format.rb
+++ b/lib/sisu/v6/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?
- %{<label class="ocn_off">&nbsp;</label>}
+ ''
else
+ name=(@make.build.html_strict?) ? '' : %{ name="#{@ocn}"}
@ocn.gsub(/^(\d+|)$/,
- %{<label class="#{ocn_class}"><a name="#{@ocn}" href="##{@ocn}" class="lnk#{ocn_class}">\\1</a></label>})
+ %{<label class="ocn"><a#{name} href="##{@ocn_html_identifier}#{@ocn}" class="lnkocn">\\1</a></label>})
end
else
- %{<label class="ocn_off">&nbsp;</label>}
+ ''
end
end
def name
- (@ocn==nil || @ocn.empty?) ? '' : %{<a name="#{@ocn}"></a>}
+ if @make.build.html_strict? \
+ or @ocn==(nil || @ocn.empty?)
+ ''
+ else
+ %{<a name="#{@ocn}"></a>}
+ 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?) ? '' : %{<a href="##{@ocn}">}
+ (@ocn==nil || @ocn.empty?) ? '' : %{<a href="##{@ocn_html_identifier}#{@ocn}">}
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>|<a\s+name="\S+?">/mi
@txt.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') #removes name markers from subtoc, go directly to substantive text
@@ -1246,7 +1253,7 @@ WOK
gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
end
%{<#{tag} class="#{attrib}">
- <a href="##{@ocn}"><i>#{txt}</i></a> #{note}
+ <a href="##{@ocn_html_identifier}#{@ocn}"><i>#{txt}</i></a> #{note}
</#{tag}>}
end
def subtoc_lev5