diff options
Diffstat (limited to 'lib/sisu/v5/html_format.rb')
-rw-r--r-- | lib/sisu/v5/html_format.rb | 25 |
1 files changed, 16 insertions, 9 deletions
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? - %{<label class="ocn_off"> </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"> </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+"> <sup>\d+<\/sup> /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 |