diff options
-rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 38 | ||||
-rw-r--r-- | data/sisu/v3/v/version.yml | 6 | ||||
-rw-r--r-- | lib/sisu/v3/concordance.rb | 13 | ||||
-rw-r--r-- | lib/sisu/v3/dal_expand_insertions.rb | 284 | ||||
-rw-r--r-- | lib/sisu/v3/defaults.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3/epub.rb | 75 | ||||
-rw-r--r-- | lib/sisu/v3/epub_format.rb | 63 | ||||
-rw-r--r-- | lib/sisu/v3/epub_segments.rb | 70 | ||||
-rw-r--r-- | lib/sisu/v3/html_format.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3/i18n.rb | 34 | ||||
-rw-r--r-- | lib/sisu/v3/param.rb | 39 | ||||
-rw-r--r-- | lib/sisu/v3/sysenv.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v3/texinfo_format.rb | 1 |
13 files changed, 495 insertions, 150 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index c4898e76..4b8a22ce 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,12 +13,40 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch +%% 3.0.16.orig.tar.gz (2011-08-18:33/4) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.16-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.16.orig.tar.xz + sisu_3.0.16.orig.tar.xz + sisu_3.0.16-1.dsc + sisu_3.0.16-1.debian.tar.gz + + * epub tuning + * include levels A - C as individual sections + (xhtml file with consistent opf & ncx) + * sync ncx with sisu internal structural logic + (correct depth, include level A, place sisu toc) + + * dal, sisu document links (multiple output versions) shortcut, fix + * links to multiple versions internal documents based on shortcut notation, + e.g. + { "Viral Spiral", David Bollier [3sS]}viral_spiral.david_bollier.sst + resulting in all versions of the document that would be generated by + running the command sisu3 -3sS viral_spiral.david_bollier.sst + * added possibility to specify language where language directory structure + is used for source documents + { "Viral Spiral", David Bollier [3sS]}en/viral_spiral.david_bollier.sst + + * concordance, i18n, start adding alternative language alphabets + (Danish, Norwegian, Swedish) + %% 3.0.15.orig.tar.gz (2011-08-08:32/1) -http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.15-1 -http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.15.orig.tar.gz - sisu_3.0.15.orig.tar.gz - sisu_3.0.15-1.dsc - sisu_3.0.15-1.debian.tar.gz +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.0.15-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.15.orig.tar.xz + 36ad1980667223719c800d291a6b988813b81700fcba21417060c87cf0dd6f60 1173288 sisu_3.0.15.orig.tar.xz + 412679d72af88b82def32dd4875aa7f8bf25ea1327bb88d85da85c2be13b2d03 1223 sisu_3.0.15-1.dsc + aa2eb7866f8928e98ad496013f56455a4097c788d7f17a9fde8c514bc304834f 286687 sisu_3.0.15-1.debian.tar.gz + + * switched sisu tarball compression to xz (from gz) * options, default action on running "sisu3 [filename.sst]", fix diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index fbbfbfff..ce5605f8 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 3.0.15-beta-rb1.9.2p180 -:date_stamp: 2011w32/1 -:date: "2011-08-08" +:version: 3.0.16-beta-rb1.9.2p180 +:date_stamp: 2011w33/4 +:date: "2011-08-18" :project: SiSU diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index 2c1c9ddf..f8118cd0 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -173,6 +173,8 @@ WOK end end class Words + require_relative 'i18n' # i18n.rb + include SiSU_i18n require_relative 'defaults' # defaults.rb include SiSU_Viz require_relative 'html_format' # html_format.rb @@ -198,7 +200,9 @@ WOK @rxp_excluded1=/#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|#{@dp}|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!! @rgx_splitlist=%r{[—.,;:#{Mx[:nbsp]}-]}mi - @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|\w+|[a-zA-Z]+}mi + @alph=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_arrays + @alphlst=SiSU_i18n::Alphabet.new(@md.opt.lng).hash_strings + @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[#{@alphlst[:l]}#{@alphlst[:u]}0-9"\s]{2,12}#{Mx[:fa_bold_c]}|(?:https?|file)://\S+|<\S+?>|[#{@alphlst[:l]}#{@alphlst[:u]}]+|\w+}mi rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error end end @@ -244,6 +248,11 @@ WOK line.obj.gsub!(/#{@rxp_excluded1}/,' ') line.obj=line.obj.split(@rgx_splitlist).join(' ') #%take in word or other match for word in line.obj.scan(@rgx_scanlist) #%take in word or other match + if word =~ /^([#{@alphlst[:l]}])/ + firstletter=$1 + flu=firstletter.tr(@alphlst[:l],@alphlst[:u]) + word.gsub!(/^#{firstletter}/,flu ) + end word.gsub!(/#{Mx[:lnk_o]}|#{Mx[:lnk_c]}|#{Mx[:url_o]}|#{Mx[:url_c]}/,'') word.gsub!(/#{Mx[:fa_o]}\S+?#{Mx[:fa_o_c]}/,'') word.gsub!(/#{Mx[:fa_c_o]}\S+?#{Mx[:fa_c]}/,'') @@ -310,8 +319,8 @@ WOK head.gsub!(/#{Xx[:html_relative2]}/m,@file.path_rel_links.html_seg_2) head.gsub!(/#{Xx[:html_relative1]}/m,@file.path_rel_links.html_seg_1) @file_concordance << head - alph=%W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z] @file_concordance << '<p>' + alph=@alph[:u] alph.each {|x| @file_concordance << %{<a href="##{x}">#{x}</a>, }} @file_concordance << '</p>' letter=alph.shift diff --git a/lib/sisu/v3/dal_expand_insertions.rb b/lib/sisu/v3/dal_expand_insertions.rb index e6b586aa..cef75432 100644 --- a/lib/sisu/v3/dal_expand_insertions.rb +++ b/lib/sisu/v3/dal_expand_insertions.rb @@ -61,7 +61,7 @@ module SiSU_insertions def initialize(md,data) @md,@data=md,data end - def output_filetypes_in_cmd(cmd_shortcut,source=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used + def output_filetypes_in_cmd(cmd_shortcut,lnk=nil) #make list of file types in shortcut command (as configured), e.g. when sisu -3 is used cf_defaults=SiSU_Env::Info_processing_flag.new cmd_list=case cmd_shortcut.inspect when /0/; cf_defaults.cf_0 @@ -73,80 +73,274 @@ module SiSU_insertions end file_type_names={} file_type_names[:gen],file_type_names[:src]=[],[] - file_type_names[:gen] <<= if cmd_list =~ /y/; 'sisu_manifest.html' + file_type_names[:gen] <<= if cmd_list =~ /y/; "~^ { document manifest }#{lnk[:manifest]}" end - file_type_names[:gen] <<= if cmd_list =~ /h/; ['toc.html', 'doc.html'] + file_type_names[:gen] <<= if cmd_list =~ /h/; [" { html, segmented text }#{lnk[:html_toc]}"," { html, scroll, document in one }#{lnk[:html_doc]}"] end - file_type_names[:gen] <<= if cmd_list =~ /e/; ['.epub'] + file_type_names[:gen] <<= if cmd_list =~ /e/; [" { epub }#{lnk[:epub]}"] end - file_type_names[:gen] <<= if cmd_list =~ /p/; ['landscape.pdf', 'portrait.pdf'] + file_type_names[:gen] <<= if cmd_list =~ /p/; [" { pdf, landscape }#{lnk[:pdf_landscape]}"," { pdf, portrait }#{lnk[:pdf_portrait]}"] end - file_type_names[:gen] <<= if cmd_list =~ /o/; 'opendocument.odt' + file_type_names[:gen] <<= if cmd_list =~ /o/; " { odf:odt, open document text }#{lnk[:odt]}" end - file_type_names[:gen] <<= if cmd_list =~ /b/; 'scroll.xhtml' + file_type_names[:gen] <<= if cmd_list =~ /b/; " { xhtml scroll }#{lnk[:xhtml]}" end - file_type_names[:gen] <<= if cmd_list =~ /x/; 'sax.xml' + file_type_names[:gen] <<= if cmd_list =~ /x/; " { xml, sax }#{lnk[:xml_sax]}" end - file_type_names[:gen] <<= if cmd_list =~ /X/; 'dom.xml' + file_type_names[:gen] <<= if cmd_list =~ /X/; " { xml, dom }#{lnk[:xml_dom]}" end - file_type_names[:gen] <<= if cmd_list =~ /a/; 'plain.txt' + file_type_names[:gen] <<= if cmd_list =~ /a/; " { plain text utf-8 }#{lnk[:txt]}" end file_type_names[:gen] <<= if cmd_list =~ /g/; 'wiki.txt' end - file_type_names[:gen] <<= if cmd_list =~ /w/; 'concordance.html' + file_type_names[:gen] <<= if cmd_list =~ /w/; " { concordance }#{lnk[:html_concordance]}" end - file_type_names[:gen] <<= if cmd_list =~ /N/; 'digest.txt' + file_type_names[:gen] <<= if cmd_list =~ /N/; " { dcc, document content certificate (digests) }#{lnk[:digest]}" end - file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; source + file_type_names[:src] <<= if source and cmd_shortcut =~ /s/; " { markup source text }#{lnk[:source]}" end - file_type_names[:src] <<= if cmd_shortcut =~ /S/; "#{source}.zip" + file_type_names[:src] <<= if cmd_shortcut =~ /S/; " { markup source (zipped) pod }#{lnk[:sisupod]}" end file_type_names[:gen]=file_type_names[:gen].flatten file_type_names[:src]=file_type_names[:src].flatten file_type_names end + def by_language(linked_doc,lng,src=nil) + @linked_doc,@lng,@src=linked_doc,lng,src + @base_path="#{@md.file.output_path.base.url}/#{@lng}" + def manifest + "#{@base_path}/manifest/#{@linked_doc}.html" + end + def html_toc + "#{@base_path}/html/#{@linked_doc}.html" + end + def html_doc + "#{@base_path}/html/#{@linked_doc}.html" + end + def html_concordance + "#{@base_path}/html/#{@linked_doc}.html" + end + def epub + "#{@base_path}/epub/#{@linked_doc}.epub" + end + def pdf_landscape + "#{@base_path}/pdf/#{@linked_doc}.pdf" + end + def pdf_portrait + "#{@base_path}/pdf/#{@linked_doc}.pdf" + end + def odt + "#{@base_path}/odt/#{@linked_doc}.odt" + end + def xhtml + "#{@base_path}/xhtml/#{@linked_doc}.xhtml" + end + def xml_sax + "#{@base_path}/xml/#{@linked_doc}.xml" + end + def xml_dom + "#{@base_path}/xml/#{@linked_doc}.xml" + end + def txt + "#{@base_path}/txt/#{@linked_doc}.txt" + end + def digest + "#{@base_path}/digest/#{@linked_doc}.txt" + end + def source + "#{@base_path}/src/#{@src}" + end + def sisupod + "#{@base_path}/pod/#{@src}.zip" + end + self + end + def by_filetype(linked_doc,lng,src=nil) + @linked_doc,@lng,@src=linked_doc,lng,src + @base_path="#{@md.file.output_path.base.url}" + def manifest + "#{@base_path}/manifest/#{@linked_doc}.#{@lng}.html" + end + def html_toc + "#{@base_path}/html/#{@linked_doc}.#{@lng}.html" + end + def html_doc + "#{@base_path}/html/#{@linked_doc}.#{@lng}.html" + end + def html_concordance + "#{@base_path}/html/#{@linked_doc}.#{@lng}.html" + end + def epub + "#{@base_path}/epub/#{@linked_doc}.#{@lng}.epub" + end + def pdf_landscape + "#{@base_path}/pdf/#{@linked_doc}.#{@lng}.pdf" + end + def pdf_portrait + "#{@base_path}/pdf/#{@linked_doc}.#{@lng}.pdf" + end + def odt + "#{@base_path}/odt/#{@linked_doc}.#{@lng}.odt" + end + def xhtml + "#{@base_path}/xhtml/#{@linked_doc}.#{@lng}.xhtml" + end + def xml_sax + "#{@base_path}/xml_sax/#{@linked_doc}.#{@lng}.xml" + end + def xml_dom + "#{@base_path}/xml_dom/#{@linked_doc}.#{@lng}.xml" + end + def txt + "#{@base_path}/txt/#{@linked_doc}.#{@lng}.txt" + end + def digest + "#{@base_path}/digest/#{@linked_doc}.#{@lng}.txt" + end + def source + "#{@base_path}/src/#{@src}" + end + def sisupod + "#{@base_path}/pod/#{@src}.zip" + end + self + end + def by_filename(linked_doc,lng,src=nil) + @linked_doc,@lng,@src=linked_doc,lng,src + @base_path="#{@md.file.output_path.base.url}/#{@linked_doc}" + def manifest + "#{@base_path}/sisu_manifest.#{@lng}.html" + end + def html_toc + "#{@base_path}/toc.#{@lng}.html" + end + def html_doc + "#{@base_path}/scroll.#{@lng}.html" + end + def html_concordance + "#{@base_path}/concordance.#{@lng}.html" + end + def epub + "#{@base_path}/epub/#{@linked_doc}.#{@lng}.epub" + end + def pdf_landscape + "#{@base_path}/landscape.#{@lng}.a4.pdf" + end + def pdf_portrait + "#{@base_path}/portrait.#{@lng}.a4.pdf" + end + def odt + "#{@base_path}/opendocument.#{@lng}.odt" + end + def xhtml + "#{@base_path}/scroll.#{@lng}.xhtml" + end + def xml_sax + "#{@base_path}/scroll.#{@lng}.sax.xml" + end + def xml_dom + "#{@base_path}/scroll.#{@lng}.dom.xml" + end + def txt + "#{@base_path}/plain.#{@lng}.txt" + end + def digest + "#{@base_path}/digest.#{@lng}.txt" + end + def source + "#{@base_path}/#{@src}" + end + def sisupod + "#{@base_path}/#{@src}.zip" + end + self + end def expand_insertions? data=@data tuned_file,tuned_file_tmp=[],[] data.each do |para| if para !~/^%+\s/ \ and para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/ - txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil + txt,cmd,source,linked_doc,note,manifest=nil,nil,nil,nil,nil,nil @u=SiSU_Env::Info_env.new.url + pre=txt=cmd=source=linked_doc=note='' if defined? @u.remote - if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m - pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6 - elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/ - pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5 + if /(?<pre>.+?)\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para + pre.strip! + elsif /\{(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}(?<source>(?<linked_doc>\S+?)\.ss[tm]\b)(?<note>.*)/m =~ para + end + if linked_doc =~ /(\S+?)\/(\S+)/ + linked_doc,linked_doc_lang=$1,$2 + else + linked_doc,linked_doc_lang=linked_doc,@md.opt.lng_base end - manifest="#{pre}{#{txt} }#{@u.remote}/#{url_dir}/toc.html#{note}\n\n" else puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" - if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ - txt,cmd,url_dir,note=$1,$2,$3,$4 - manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n" + if /\{(?:~\^\s+)?(?<txt>.+?)\s\[(?<cmd>\d[sS]*)\]\}\.\.\/(?<linked_doc>\S+?)\/(?<note>\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/ =~ para end end - tuned_file_tmp << manifest - output_filetypes=output_filetypes_in_cmd(cmd,source) + lnk={} + case @md.opt.dir_structure_by + when /language/ + lnk={ + manifest: by_language(linked_doc,linked_doc_lang).manifest, + html_toc: by_language(linked_doc,linked_doc_lang).html_toc, + html_doc: by_language(linked_doc,linked_doc_lang).html_doc, + epub: by_language(linked_doc,linked_doc_lang).epub, + pdf_landscape: by_language(linked_doc,linked_doc_lang).pdf_landscape, + pdf_portrait: by_language(linked_doc,linked_doc_lang).pdf_landscape, + odt: by_language(linked_doc,linked_doc_lang).odt, + xhtml: by_language(linked_doc,linked_doc_lang).xhtml, + xml_sax: by_language(linked_doc,linked_doc_lang).xml_sax, + xml_dom: by_language(linked_doc,linked_doc_lang).xml_dom, + txt: by_language(linked_doc,linked_doc_lang).txt, + html_concordance: by_language(linked_doc,linked_doc_lang).html_concordance, + digest: by_language(linked_doc,linked_doc_lang).digest, + sisupod: by_language(linked_doc,linked_doc_lang,source).sisupod, + source: by_language(linked_doc,linked_doc_lang,source).source, + } + when /filetype/ + lnk={ + manifest: by_filetype(linked_doc,linked_doc_lang).manifest, + html_toc: by_filetype(linked_doc,linked_doc_lang).html_toc, + html_doc: by_filetype(linked_doc,linked_doc_lang).html_doc, + epub: by_filetype(linked_doc,linked_doc_lang).epub, + pdf_landscape: by_filetype(linked_doc,linked_doc_lang).pdf_landscape, + pdf_portrait: by_filetype(linked_doc,linked_doc_lang).pdf_landscape, + odt: by_filetype(linked_doc,linked_doc_lang).odt, + xhtml: by_filetype(linked_doc,linked_doc_lang).xhtml, + xml_sax: by_filetype(linked_doc,linked_doc_lang).xml_sax, + xml_dom: by_filetype(linked_doc,linked_doc_lang).xml_dom, + txt: by_filetype(linked_doc,linked_doc_lang).txt, + html_concordance: by_filetype(linked_doc,linked_doc_lang).html_concordance, + digest: by_filetype(linked_doc,linked_doc_lang).digest, + sisupod: by_filetype(linked_doc,linked_doc_lang,source).sisupod, + source: by_filetype(linked_doc,linked_doc_lang,source).source, + } + else + lnk={ + manifest: by_filename(linked_doc,linked_doc_lang).manifest, + html_toc: by_filename(linked_doc,linked_doc_lang).html_toc, + html_doc: by_filename(linked_doc,linked_doc_lang).html_doc, + epub: by_filename(linked_doc,linked_doc_lang).epub, + pdf_landscape: by_filename(linked_doc,linked_doc_lang).pdf_landscape, + pdf_portrait: by_filename(linked_doc,linked_doc_lang).pdf_landscape, + odt: by_filename(linked_doc,linked_doc_lang).odt, + xhtml: by_filename(linked_doc,linked_doc_lang).xhtml, + xml_sax: by_filename(linked_doc,linked_doc_lang).xml_sax, + xml_dom: by_filename(linked_doc,linked_doc_lang).xml_dom, + txt: by_filename(linked_doc,linked_doc_lang).txt, + html_concordance: by_filename(linked_doc,linked_doc_lang).html_concordance, + digest: by_filename(linked_doc,linked_doc_lang).digest, + sisupod: by_filename(linked_doc,linked_doc_lang,source).sisupod, + source: by_filename(linked_doc,linked_doc_lang,source).source, + } + end + linked_title="#{pre}{#{txt} }#{lnk[:manifest]}#{note}\n\n" + tuned_file_tmp << linked_title + output_filetypes=output_filetypes_in_cmd(cmd,lnk) output_filetypes[:gen].each do |o_f| - describe = case o_f - when /sisu_manifest.html/; "~^ { document manifest }#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" - when /toc.html/; " { html, segmented text }#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_segtoc}" - when /doc.html/; " { html, scroll, document in one }#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}" - when /\.epub/; " { epub }#{@md.file.output_path.epub.url}/#{@md.file.base_filename.epub}" - when /landscape.pdf/; " { pdf, landscape }#{@md.file.output_path.pdf.url}/#{@md.file.base_filename.pdf_l_a4}" #chose a default pdf - when /portrait.pdf/; " { pdf, portrait }#{@md.file.output_path.pdf.url}/#{@md.file.base_filename.pdf_p_a4}" #chose a default pdf - when /opendocument.odt/; " { odf:odt, open document text }#{@md.file.output_path.odt.url}/#{@md.file.base_filename.odt}" - when /scroll.xhtml/; " { xhtml scroll }#{@md.file.output_path.xhtml.url}/#{@md.file.base_filename.xhtml}" - when /sax.xml/; " { xml, sax }#{@md.file.output_path.xml_sax.url}/#{@md.file.base_filename.xml_sax}" - when /dom.xml/; " { xml, dom }#{@md.file.output_path.xml_dom.url}/#{@md.file.base_filename.xml_dom}" - when /plain.txt/; " { plain text utf-8 }#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}" - #when /manpage.1/; " man, 1" - when /concordance.html/; " { concordance }#{@md.file.output_path.html_concordance.url}/#{@md.file.base_filename.html_concordance}" - when /digest.txt/; " { dcc, document content certificate (digests) }#{@md.file.output_path.hash_digest.url}/#{@md.file.base_filename.hash_digest}" - else nil - end + describe = o_f if describe tuned_file_tmp << if @u.remote #to double space <:br> at beginning of entry "#{Mx[:nbsp]*4} #{describe} " @@ -156,11 +350,7 @@ module SiSU_insertions end end output_filetypes[:src].each do |o_f| - describe=case o_f - when /#{source}\.zip/; " { markup source (zipped) pod }#{@md.file.output_path.sisupod.url}/#{@md.file.base_filename.sisupod}" - when /#{source}/; " { markup source text }#{@md.file.output_path.src.url}/#{@md.file.base_filename.src}" - else nil - end + describe = o_f if describe tuned_file_tmp << if @u.remote "#{Mx[:nbsp]*4} #{describe} " diff --git a/lib/sisu/v3/defaults.rb b/lib/sisu/v3/defaults.rb index 0ef81402..97c2b263 100644 --- a/lib/sisu/v3/defaults.rb +++ b/lib/sisu/v3/defaults.rb @@ -546,7 +546,7 @@ module SiSU_Viz %{"#{color_white}"} end def color_body - %{\n<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">\n} + %{<body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en">} end def color_font_face #was font WATCH "#{color_black}" diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index 83a0a795..e2d65111 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -85,9 +85,9 @@ module SiSU_EPUB @env=@particulars.env loc=@env.path.url.output_tell unless @opt.cmd =~/q/ - tool=if @opt.cmd =~/[MVvz]/; "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" - else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" - end + tool=(@opt.cmd =~/[MVvz]/) \ + ? "#{@env.program.epub_viewer} #{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" \ + : "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" @opt.cmd=~/[MVvz]/ \ ? SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_hi_blue \ : SiSU_Screen::Ansi.new(@opt.cmd,'EPUB',tool).green_title_hi @@ -199,7 +199,8 @@ module SiSU_EPUB @@firstseg=nil @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] } md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[] - @nav_no=1 + @nav_no=0 + @s_a_no,@s_b_no,@s_c_no=0,0,0 @@toc[:ncx] << @epub.toc_ncx.open #epub ncx navmap @@toc[:ncx] << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close @@toc[:ncx] << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author @@ -207,7 +208,6 @@ module SiSU_EPUB @@toc[:opf] << @epub.metadata_opf.package_open @@toc[:opf] << @epub.metadata_opf.metadata @@toc[:opf] << @epub.metadata_opf.manifest_open - @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc @@toc[:seg] << %{<div class="content">\n<div class="substance">} @@toc[:scr] << %{<div class="content">\n<div class="substance">} md_opf_a_content << @epub.metadata_opf.manifest_content_sisu_toc @@ -216,43 +216,68 @@ module SiSU_EPUB @ncxo=[nil,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] + @level_a_first_occurrence=true @data.each do |dob| if dob.is=='heading' \ or dob.is=='heading_insert' dob_toc=dob.dup toc=case dob_toc.ln when 1 + @s_a_no +=1 + name_s_a='section_a' + @s_a_no.to_s + @nav_no+=1 + @nav_no2=@nav_no + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] + @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,false,false,false + @epub.sections(dob_toc,name_s_a) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc + if @level_a_first_occurrence + @nav_no+=1 + @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc + @level_a_first_occurrence=false + end + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_a) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_a) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_a) Toc.new(@md,dob_toc).level_1 when 2 + @s_b_no +=1 + name_s_b='section_b' + @s_b_no.to_s @nav_no+=1 @nav_no2=@nav_no - @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[4] - @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[3] - @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[2] - @ncxo[2],@ncxo[3],@ncxo[4]=false,false,false - @dob_toc2=dob_toc - @ncxo[2]=true + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] + @ncxo[2],@ncxo[3],@ncxo[4]=true,false,false + @epub.sections(dob_toc,name_s_b) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_b) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_b) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_b) Toc.new(@md,dob_toc).level_2 when 3 + @s_c_no +=1 + name_s_c='section_c' + @s_c_no.to_s @nav_no+=1 @nav_no3=@nav_no - @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[4] - @ncx_cls << @epub.toc_ncx.navpoint_close if @ncxo[3] - @ncxo[3],@ncxo[4]=false,false - @dob_toc3=dob_toc - @ncxo[3]=true + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] + @ncxo[3],@ncxo[4]=true,false + @epub.sections(dob_toc,name_s_c) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_c) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_c) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_c) Toc.new(@md,dob_toc).level_3 when 4 - @@toc[:ncx] << @ncx_cls if @ncx_cls.length > 0 @ncx_cls=[] - @@toc[:ncx] << @epub.toc_ncx.navpoint_top3(@dob_toc2,@nav_no2,dob_toc.name) if @dob_toc2 #epub ncx navmap - @@toc[:ncx] << @epub.toc_ncx.navpoint_top3(@dob_toc3,@nav_no3,dob_toc.name) if @dob_toc3 #epub ncx navmap - @dob_toc2,@dob_toc3=nil,nil @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] - @ncxo[4]=false - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc #epub ncx navmap @ncxo[4]=true + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc) md_opf_a_spine << @epub.metadata_opf.spine(dob_toc) md_opf_a_guide << @epub.metadata_opf.guide(dob_toc) @@ -499,8 +524,10 @@ module SiSU_EPUB dochead.gsub!(/toc\.(html)/,'doc.\1') #kludge toc_shared << dochead #<< ads.div.major segtoc << format_head_toc.head #<< ads.div.major - toc_shared << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript - segtoc << format_head_toc.toc_head_escript if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript + if SiSU_EPUB_Format::Head_toc.method_defined? :toc_head_escript + toc_shared << format_head_toc.toc_head_escript + segtoc << format_head_toc.toc_head_escript + end if defined? @md.rights.all \ and @md.rights.all rights=format_head_toc.rights.all diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 6afae58b..1de067e4 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1322,6 +1322,32 @@ WOK </container> WOK end + def sections(dob,name) + filename="#{name}#{Sfx[:epub_xhtml]}" + dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}" + segfilename="#{dir_epub_cont}/#{filename}" + output_epub_cont_seg=File.new(segfilename,'w') + output_epub_cont_seg << %{#{doc_type} +<head> + <title> + #{dob.obj} - + #{@md.html_title} + </title> +<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> +#{@css.xhtml_epub} +</head> +#{@vz.color_body} +<div class="content"> +<div class="substance"> + <label class="ocn"><a href="#o8" class="lnkocn">8</a></label> + <h1 class="norm" id="o8"> + #{dob.obj} + </h1> +</div> +</body> +</html>} +output_epub_cont_seg.close + end def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map def structure open @@ -1354,7 +1380,7 @@ WOK WOK end def head - depth=@md.lvs[2] + @md.lvs[3] + @md.lvs[4] + depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] <<WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> @@ -1404,19 +1430,8 @@ WOK </navPoint> WOK end - def navpoint(dob,no) - id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ - ? '' \ - : "-#{no}" - <<WOK - <navPoint id="navpoint#{id_u}" playOrder="#{no}"> - <navLabel> - <text>#{dob.obj}</text> - </navLabel> - <content src="#{dob.name}#{Sfx[:epub_xhtml]}" /> -WOK - end - def navpoint_top3(dob,no,name) + def navpoint(dob,no,name=nil) + name=name ? name : dob.name id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' \ : "-#{no}" @@ -1609,11 +1624,12 @@ WOK <item id="index" href="index.xhtml" media-type="application/xhtml+xml" /> WOK end - def manifest_content(dob) + def manifest_content(dob,name=nil) + name=name ? name : dob.name <<WOK - <item id="#{dob.name}" href="#{dob.name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> + <item id="#{name}" href="#{name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK - end + end def manifest_images(imgs) imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png'] images=[" <!-- Images -->\n"] @@ -1642,9 +1658,10 @@ WOK <itemref idref="index" linear="yes" /> WOK end - def spine(dob) + def spine(dob,name=nil) + name=name ? name : dob.name <<WOK - <itemref idref="#{dob.name}" linear="yes" /> + <itemref idref="#{name}" linear="yes" /> WOK end def spine_close @@ -1663,9 +1680,10 @@ WOK <reference type="index" href="index#{Sfx[:epub_xhtml]}" /> WOK end - def guide(dob) + def guide(dob,name=nil) + name=name ? name : dob.name <<WOK - <reference type="text" href="#{dob.name}#{Sfx[:epub_xhtml]}" /> + <reference type="text" href="#{name}#{Sfx[:epub_xhtml]}" /> WOK end def guide_close @@ -2091,8 +2109,7 @@ WOK <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> #{@css.xhtml_epub} </head> -#{@vz.color_body} -#{@vz.js_top}} +#{@vz.color_body}} end def toc_metadata @metalink=%{./#{@md.fn[:metadata]}} diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 23af70f7..f110dfe4 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -168,7 +168,8 @@ WOK @@seg[:heading_idx]='' end data.each do |dob| - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==4 @@seg_name << dob.name seg_name=dob.name @@ -193,7 +194,8 @@ WOK # # end # #end #end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==4 if dob.ocn==0 @@heading4=dob.obj @@ -201,23 +203,27 @@ WOK end @@is4=newfile=1 end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==3 @@heading3=dob.obj @@is4,@@is3=0,1 end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==2 @@heading2=dob.obj @@is4,@@is3,@@is2=0,0,1 end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==1 @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end if (@@is1 && !@@is2 && !@@is3 && !@@is4) - if not (dob.is=='heading' or dob.is=='heading_insert') \ + if not (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==1 head1=$_ #; check end @@ -227,7 +233,8 @@ WOK if newfile==1 \ or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==4 if tracking != 0 Seg.new(@md).tail @@ -266,8 +273,13 @@ WOK end tracking=tracking+1 end - @@get_hash_to=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name - @@get_hash_fn=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ + and dob.ln==4 \ + and dob.name + @@get_hash_to=dob.name + @@get_hash_fn=dob.name + end if dob.obj.class==String markup(dob) elsif dob.obj.class==Array @@ -288,9 +300,9 @@ WOK format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) if dob.is=='heading' \ and dob.ln =~/^[1-6]/ - if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next - else @@seg[:dot_nav]=format_head_seg.dot_control_pre - end + @@seg[:dot_nav]= (@@tracker < @@seg_total-1) \ + ? format_head_seg.dot_control_pre_next \ + : format_head_seg.dot_control_pre end @@seg[:title]=format_head_seg.head end @@ -298,9 +310,9 @@ WOK clean=/<!.*?!>|<:.*?>$/ format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) if @@tracker < @@seg_total-1 - if @@tracker==0; @@segtocband=format_head_seg.toc_next2 #if format_head_seg.toc_next2 - else @@segtocband=format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2 - end + @@segtocband=(@@tracker==0) \ + ? format_head_seg.toc_next2 \ + : format_head_seg.toc_pre_next2 else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 end @p_num ||= '' @@ -377,11 +389,9 @@ WOK and dob.indent =~/[0-9]/ \ and dob.hang =~/[0-9]/ if dob.bullet_ - if dob.indent =~/[1-9]/ - sto.format('li',"i#{dob.indent}") - else - sto.format('li','bullet') - end + (dob.indent =~/[1-9]/) \ + ? sto.format('li',"i#{dob.indent}") \ + : sto.format('li','bullet') elsif dob.indent == dob.hang sto.format('p',"i#{dob.indent}") elsif dob.indent != dob.hang @@ -409,12 +419,15 @@ WOK and (not dob.ocn or dob.ocn.to_s.empty?) format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) end - if (dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert' \ + || dob.is=='para') \ and dob.note_ #dob.obj =~/<a href="#note_ref\d+"> <sup id=/ #endnote- note- format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) dob.obj=format_seg.no_paranum end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==4 @@seg[:main] << %{\n<div class="content">\n} @@seg[:main] << dob_xhtml @@ -453,7 +466,8 @@ WOK data.each do |dob| dob.obj.gsub!(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln.to_s =~/^[1234]/ \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@ -461,7 +475,8 @@ WOK @@seg_endnotes_array=[] if dob.ln==4 @@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/ end - if (dob.is=='heading' or dob.is=='heading_insert') \ + if (dob.is=='heading' \ + || dob.is=='heading_insert') \ and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs @@seg_subtoc[@@fn]=@@seg_subtoc_array @@seg_subtoc_array=[] @@ -469,10 +484,9 @@ WOK and dob.obj @@fn=dob.name else - if dob.name =~/\S+/ - @@fn=dob.name - else @@fn='' - end + @@fn=(dob.name =~/\S+/) \ + ? dob.name \ + : '' end end end diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb index e89b5c43..8558cf1e 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -994,7 +994,7 @@ WOK if defined? dob.tags \ and dob.tags.length > 0 # insert tags "hypertargets" dob.tags.each do |t| - tags=tags +%{<a name="#{t}" />} + tags=tags +%{<a name="#{t}" ></a>} end end tags diff --git a/lib/sisu/v3/i18n.rb b/lib/sisu/v3/i18n.rb index 0666cede..00fe7101 100644 --- a/lib/sisu/v3/i18n.rb +++ b/lib/sisu/v3/i18n.rb @@ -189,6 +189,40 @@ module SiSU_i18n self end end + class Alphabet + def initialize(lng_code) + @lng_code=lng_code + end + def hash_arrays + @alph=case @lng_code + when /en/ #english + { + u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z], + l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z] + } + when /da|no|nn/ #danish, norwegian + { + u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Æ Ø], + l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å æ ø] + #u: %W[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Æ Ø Å], + #l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z æ ø å] + } + when /sv/ #swedish + { + u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Å Ä Ö], + l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z å ä ö] + } + else #english default + { + u: %w[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z], + l: %w[a b c d e f g h i j k l m n o p q r s t u v w x y z] + } + end + end + def hash_strings + { u: hash_arrays[:u].join, l: hash_arrays[:l].join } + end + end end __END__ Language Lists diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index c33bab75..58d3aba9 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -1150,18 +1150,45 @@ module SiSU_Param @lv5 ||=/^5~/ @lv6 ||=/^6~/ else #% * + l_0=l_1=l_2=l_3=l_4=l_5='' + if defined? @make.headings[0] + l_0=if defined? @make.headings[0][0] \ + and @make.headings[0][0] =~/\S+/ + "|^#{@make.headings[0][0]}" + end + l_1=if defined? @make.headings[0][1] \ + and @make.headings[0][1] =~/\S+/ + "|^#{@make.headings[0][1]}" + end + l_2=if defined? @make.headings[0][2] \ + and @make.headings[0][2] =~/\S+/ + "|^#{@make.headings[0][2]}" + end + l_3=if defined? @make.headings[0][3] \ + and @make.headings[0][3] =~/\S+/ + "|^#{@make.headings[0][3]}" + end + l_4=if defined? @make.headings[0][4] \ + and @make.headings[0][4] =~/\S+/ + "|^#{@make.headings[0][4]}" + end + l_5=if defined? @make.headings[0][5] \ + and @make.headings[0][5] =~/\S+/ + "|^#{@make.headings[0][5]}" + end + end case para - when /^:?A~/ + when /^:?A~#{l_0}/ @lvs[1]=1 - when /^:?B~/ + when /^:?B~#{l_1}/ @lvs[2]=1 - when /^:?C~/ + when /^:?C~#{l_2}/ @lvs[3]=1 - when /^1~/ + when /^1~#{l_3}/ @lvs[4]=1 - when /^2~/ + when /^2~#{l_4}/ @lvs[5]=1 - when /^3~/ + when /^3~#{l_5}/ @lvs[6]=1 end if para =~ /^:A~/ #% processing diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 80069f9d..f5d14583 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -690,16 +690,16 @@ module SiSU_Env program='createdb' db_name="#{Db[:name_prefix]}#{dbname_stub}" program_ref="\n\t\tcreatedb dbname #{db_name} #for postgresql database creation" - if program_found?(program); system("createdb #{dbname_name}") - else puts "\tWARN: #{program} is not available #{program_ref}" #if @cmd =~/v/ - end + (program_found?(program)) \ + ? system("#{program} #{dbname_name}") \ + : (puts "\tWARN: #{program} is not available #{program_ref}") end def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" - if program_found?(program); system("trang #{@input} #{@output}") - else puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/ - end + (program_found?(program)) \ + ? system("#{program} #{@input} #{@output}") \ + : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) end def qrencode #qrcode - for generating QR code program='qrencode' @@ -729,9 +729,9 @@ module SiSU_Env def well_formed? #tidy - check for well formed xml xhtml etc. program=@prog.tidy program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" - if program_found?(program); system("#{@prog.tidy} -xml #{@input} > #{@output}") - else puts "\tWARN: #{program} is not installed #{program_ref}" - end + (program_found?(program)) \ + ? system("#{@prog.tidy} -xml #{@input} > #{@output}") \ + : (puts "\tWARN: #{program} is not installed #{program_ref}") end def tex2pdf_engine prog=['xetex','xelatex','pdflatex','pdfetex','pdftex'] diff --git a/lib/sisu/v3/texinfo_format.rb b/lib/sisu/v3/texinfo_format.rb index cd98754a..959cbf64 100644 --- a/lib/sisu/v3/texinfo_format.rb +++ b/lib/sisu/v3/texinfo_format.rb @@ -394,7 +394,6 @@ WOK txt.gsub!(/ø/,'\o'); txt.gsub!(/Ø/,'\O') txt.gsub!(/<a href=".+?">/i,' ') txt.gsub!(/<\/a>/i,' ') - txt.gsub!(/<:ee>/i,'') txt.gsub!(/<!>/i,' ') txt.gsub!(/#{Mx[:br_paragrph]}/i,'') #watch txt.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*') |