aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/html_minitoc.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-07-30 21:30:36 -0400
committerRalph Amissah <ralph@amissah.com>2013-07-30 21:30:39 -0400
commit3e58296fa7761edaa59f807d4f8e87987ea8e921 (patch)
treed93286de4e7cba8462a71fa013d223cf84413e88 /lib/sisu/v5/html_minitoc.rb
parentv5: output structure by, add monolingual alt for :filetype & :filename, step 1 (diff)
v5: output structure by, monolingual alternative for :filetype or :filename
* filename without language code, if document is in default language * set a default language, 'en' or as specified * set in rc file or from command line instruction * command line e.g. sisu -hv --monolingual --by-filename sisu_markup.sst sisu -3v --monolingual --by-filetype sisu_manual.ssm * sisurc.yml lingual: 'mono' | 'multi' lingual: 'mono' * note: output by :filetype is roughly equivalent to what monolingual output by :language would be * allow command line setting of default language using language code --default-language='en' --default-lang-en if used together with --monolingual and --by-filetype or --by-filename the selected default language document will not have a language code in the output filename
Diffstat (limited to 'lib/sisu/v5/html_minitoc.rb')
-rw-r--r--lib/sisu/v5/html_minitoc.rb31
1 files changed, 25 insertions, 6 deletions
diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb
index 99f11d87..fcbffc73 100644
--- a/lib/sisu/v5/html_minitoc.rb
+++ b/lib/sisu/v5/html_minitoc.rb
@@ -153,14 +153,23 @@
txt=@data
unless txt =~/~metadata/
if txt.ln ==4
- seg_link=%{ <a href="#{txt.name}#{@md.lang_code_insert}#{Sfx[:html]}" target="_top">
+ fnh={
+ fn: txt.name,
+ lng: @md.lang_code_insert
+ }
+ f=@md.file.base_filename.html_seg(fnh)
+ seg_link=%{ <a href="#{f}" target="_top">
#{txt.obj}
</a> }
@@seg_url=txt.name
elsif txt.obj =~/\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+/
- seg_link=txt.obj.gsub(/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/,
- %{<a href="\\2#{@md.lang_code_insert}#{Sfx[:html]}" } +
- %{target="_top">\\1 \\2</a> })
+ fn,hd=/^(\d+.\d+.\d+.\d+|\d+.\d+.\d+|\d+.\d+|\d+)(.*)/.match(dob.obj)[1,2]
+ fnh={
+ fn: fn,
+ lng: @md.lang_code_insert
+ }
+ f=@md.file.base_filename.html_seg(fnh)
+ seg_link=%{<a href="#{f}" target="_top">#{fn} #{hd}</a> }
end
txt_obj={ txt: seg_link }
format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj)
@@ -175,7 +184,12 @@
&& txt.ocn !=0
txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
end
- lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}">
+ fnh={
+ fn: @@seg_url,
+ lng: @md.lang_code_insert
+ }
+ f=@md.file.base_filename.html_seg(fnh)
+ lnk_n_txt=%{ <a href="#{f}##{txt.ocn}">
#{txt.obj}
</a>}
txt_obj={ txt: lnk_n_txt }
@@ -190,7 +204,12 @@
&& txt.ocn !=0
txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1')
end
- lnk_n_txt=%{ <a href="#{@@seg_url}#{@md.lang_code_insert}#{Sfx[:html]}##{txt.ocn}">
+ fnh={
+ fn: @@seg_url,
+ lng: @md.lang_code_insert
+ }
+ f=@md.file.base_filename.html_seg(fnh)
+ lnk_n_txt=%{ <a href="#{f}##{txt.ocn}">
#{txt.obj}
</a>}
txt_obj={ txt: lnk_n_txt }