aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/hub.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-05-25 10:01:43 -0400
committerRalph Amissah <ralph@amissah.com>2014-05-25 10:01:43 -0400
commit16c30474f06ed3774ad524a38b55b7840de057d0 (patch)
tree03f20a30c1853b3d5cb893556aa633be2407a4d8 /lib/sisu/v5/hub.rb
parentv5 v6: version & changelog (& rakefile) (diff)
v5: merge v6 to v5, version bump to 5.4.*, reason adds structure checksisu_5.4.0
* ao, document structure check, stop processing on major error (with error message & text at location of failure) [reason for version bump the addition of structure check] * utils, add ok code marker * ao, heading with no ocn, distinguish ~# from -# * ~# is general & means no ocn (for any object to which it is applied) * -# is relevant only for 1~ dummy headings & instructs that they should be removed from output where possible * applied so far to pdf, odt & plaintext * ao_images, reduce warnings when ruby RMagic absent as program used directly * reduced dependency on ruby RMagic library (as some time way back had issues) * ao, document markup structure check, skip processing file on major error * with error message & text at location of failure * texpdf, urls in creator cause breakage * texpdf, mailto markup links set for normal text objects * texpdf, '&' in heading breaks toc (now removed from toc (not heading)), bug * revisit, bug * texpdf, for urls switch to sans serif (small fontsize) * instead of typewriter, latex default * texpdf, pdf colored hyperlinks configurable * --pdf-hyperlinks-color --pdf-hyperlinks-no-color or --pdf-hyperlinks-monochrome * ['default']['pdf_hyperlinks']='color' (other options switch hyperlink color off 'no-color' 'color-off' 'monochrome') * texpdf, pdf default font size configurable (cli & sisurc.yml) (no fractions) * --pdf-fontsize-12 --pdf-fontsize-8 * default: texpdf_fontsize: 12 * texpdf, headings and table of contents representation * fixes 1~ and 2~ result in the same formatting 1~ 2~ & 3~ now differentiated, see discussion in sisu.org under #744383 * fixes :A smaller formatted than :B A~ B~ C~ now the same size, see discussion in sisu.org under #744383 * :B and :C result in the same formatting, issue explained see sisu.org * texpdf, (internal coding) fontface, rename texpdf_font texpdf_fontface * texpdf, (internal coding) use symbols to identify page orientation * param, metadata rights, line-breaks instead of semicolons separating rights * fixes remove trailing semicolon after :copyright: * digests sha512 option implemented * options sha512 sha256 md5 * command line --sha512 * rcconf.yml ['defsault']['digest'] = sha512 * xml object citation numbering (docbook fictionbook)
Diffstat (limited to 'lib/sisu/v5/hub.rb')
-rw-r--r--lib/sisu/v5/hub.rb226
1 files changed, 123 insertions, 103 deletions
diff --git a/lib/sisu/v5/hub.rb b/lib/sisu/v5/hub.rb
index 8a430e71..152de391 100644
--- a/lib/sisu/v5/hub.rb
+++ b/lib/sisu/v5/hub.rb
@@ -264,12 +264,26 @@ module SiSU
@msg,@msgs='',nil
@tell=lambda { SiSU_Screen::Ansi.new(@opt.cmd,@msg,"#{@msgs.inspect if @msgs}") }
end
+ def remove_skipped_files_if_any_from_processing_files_array
+ if @remove_faulty_markup_files_array.length > 0
+ @opt.files = (@opt.files - @remove_faulty_markup_files_array)
+ end
+ end
+ def print_error_message_if_files_skipped
+ if @remove_faulty_markup_files_array.length > 0
+ puts '---'
+ STDERR.puts 'ERROR with file(s), did not process: ' + @remove_faulty_markup_files_array.join(',')
+ end
+ end
def do_loops
+ @remove_faulty_markup_files_array=[]
if @opt.act[:zap][:set]==:on #% --zap, -Z
do_loop_files_on_given_option_pre
end
do_each_file_loop_options
+ remove_skipped_files_if_any_from_processing_files_array
do_loop_files_on_given_option_post
+ print_error_message_if_files_skipped
end
def do_each_file_loop_options
@opt.files.each_with_index do |fno,i|
@@ -290,6 +304,7 @@ module SiSU
end
@env=SiSU_Env::InfoEnv.new(@opt.fns)
if @opt.act[:ao][:set]==:on #% --ao --dal, -m
+ $process_document = :ok
unless @opt.act[:po4a][:set]==:on # --po4a, -P
if @opt.fno =~ /\.ssm$/
require_relative 'composite' # composite.rb #pre-processing
@@ -299,112 +314,117 @@ module SiSU
SiSU_AO::Source.new(@opt).read
end
end
- if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
- require_relative 'qrcode' # qrcode.rb
- SiSU_QRcode::Source.new(@opt).read
- end
- if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
- require_relative 'digests' # digests.rb
- SiSU_DigestView::Source.new(@opt).read
- end
- if @opt.act[:txt][:set]==:on #% --txt, -t -a
- require_relative 'txt_plain' # txt_plain.rb
- SiSU_Txt_Plain::Source.new(@opt).read
- end
- if @opt.act[:txt_textile][:set]==:on #% --textile
- require_relative 'txt_textile' # txt_textile.rb
- SiSU_Txt_Textile::Source.new(@opt).read
- end
- if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
- require_relative 'txt_asciidoc' # txt_asciidoc.rb
- SiSU_Txt_AsciiDoc::Source.new(@opt).read
- end
- if @opt.act[:txt_markdown][:set]==:on #% --markdown
- require_relative 'txt_markdown' # txt_markdown.rb
- SiSU_Txt_Markdown::Source.new(@opt).read
- end
- if @opt.act[:txt_rst][:set]==:on #% --rst, --rest
- require_relative 'txt_rst' # txt_rst.rb
- SiSU_Txt_rST::Source.new(@opt).read
- end
- if @opt.act[:html][:set]==:on #% --html, -h -H
- require_relative 'html' # html.rb
- SiSU_HTML::Source.new(@opt).read
- else
- if @opt.act[:html_seg][:set]==:on #% --html-seg (-h -H)
- require_relative 'html' # html.rb
- SiSU_HTML::Source.new(@opt).read
+ if $process_document == :ok
+ if @opt.act[:qrcode][:set]==:on #% --qrcode, -Q
+ require_relative 'qrcode' # qrcode.rb
+ SiSU_QRcode::Source.new(@opt).read
+ end
+ if @opt.act[:hash_digests][:set]==:on #% --hash-digests, -N digest tree
+ require_relative 'digests' # digests.rb
+ SiSU_DigestView::Source.new(@opt).read
end
- if @opt.act[:html_scroll][:set]==:on #% --html-scroll (-h -H)
- require_relative 'html' # html.rb
+ if @opt.act[:txt][:set]==:on #% --txt, -t -a
+ require_relative 'txt_plain' # txt_plain.rb
+ SiSU_Txt_Plain::Source.new(@opt).read
+ end
+ if @opt.act[:txt_textile][:set]==:on #% --textile
+ require_relative 'txt_textile' # txt_textile.rb
+ SiSU_Txt_Textile::Source.new(@opt).read
+ end
+ if @opt.act[:txt_asciidoc][:set]==:on #% --asciidoc
+ require_relative 'txt_asciidoc' # txt_asciidoc.rb
+ SiSU_Txt_AsciiDoc::Source.new(@opt).read
+ end
+ if @opt.act[:txt_markdown][:set]==:on #% --markdown
+ require_relative 'txt_markdown' # txt_markdown.rb
+ SiSU_Txt_Markdown::Source.new(@opt).read
+ end
+ if @opt.act[:txt_rst][:set]==:on #% --rst, --rest
+ require_relative 'txt_rst' # txt_rst.rb
+ SiSU_Txt_rST::Source.new(@opt).read
+ end
+ if @opt.act[:html][:set]==:on #% --html, -h -H
+ require_relative 'html' # html.rb
SiSU_HTML::Source.new(@opt).read
+ else
+ if @opt.act[:html_seg][:set]==:on #% --html-seg (-h -H)
+ require_relative 'html' # html.rb
+ SiSU_HTML::Source.new(@opt).read
+ end
+ if @opt.act[:html_scroll][:set]==:on #% --html-scroll (-h -H)
+ require_relative 'html' # html.rb
+ SiSU_HTML::Source.new(@opt).read
+ end
end
- end
- if @opt.act[:concordance][:set]==:on #% --concordance, -w
- require_relative 'concordance' # concordance.rb
- SiSU_Concordance::Source.new(@opt).read
- end
- if @opt.act[:epub][:set]==:on #% --epub, -e
- require_relative 'xhtml_epub2' # xhtml_epub2.rb
- SiSU_XHTML_EPUB2::Source.new(@opt).read
- end
- if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
- require_relative 'xml_odf_odt' # xml_odf_odt.rb
- SiSU_XML_ODF_ODT::Source.new(@opt).read
- end
- if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
- require_relative 'xhtml' # xhtml.rb
- SiSU_XHTML::Source.new(@opt).read
- end
- if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
- require_relative 'xml_scaffold_structure_sisu' # xml_scaffold_structure_sisu.rb
- SiSU_XML_Scaffold_Structure_Sisu::Source.new(@opt).read
- end
- if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse
- require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb
- SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read
- end
- if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook
- require_relative 'xml_docbook5' # xml_docbook5.rb
- SiSU_XML_Docbook_Book::Source.new(@opt).read
- end
- if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook
- require_relative 'xml_fictionbook2' # xml_fictionbook2.rb
- SiSU_XML_Fictionbook::Source.new(@opt).read
- end
- if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
- require_relative 'xml_sax' # xml_sax.rb
- SiSU_XML_SAX::Source.new(@opt).read
- end
- if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
- require_relative 'xml_dom' # xml_dom.rb
- SiSU_XML_DOM::Source.new(@opt).read
- end
- if @opt.act[:pdf][:set]==:on \
- or @opt.act[:pdf_p][:set]==:on \
- or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
- require_relative 'texpdf' # texpdf.rb
- SiSU_TeX::Source.new(@opt).read
- end
- if @opt.act[:manpage][:set]==:on #% --manpage, -i
- require_relative 'manpage' # manpage.rb
- SiSU_Manpage::Source.new(@opt).read
- end
- if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
- require_relative 'texinfo' # texinfo.rb
- SiSU_TexInfo::Source.new(@opt).read
- end
- if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d DB sqlite
- require_relative 'dbi_discrete' # dbi_discrete.rb
- SiSU_DBI_Discrete::SQL.new(@opt).build
- end
- if @opt.act[:manifest][:set]==:on #% --manifest, -y
- require_relative 'manifest' # manifest.rb
- ((@opt.act[:sisupod][:set]==:on \
- || @opt.act[:share_source][:set]==:on) \
- && @opt.files.length < 2 ) \
- ? nil
- : SiSU_Manifest::Source.new(@opt).read
+ if @opt.act[:concordance][:set]==:on #% --concordance, -w
+ require_relative 'concordance' # concordance.rb
+ SiSU_Concordance::Source.new(@opt).read
+ end
+ if @opt.act[:epub][:set]==:on #% --epub, -e
+ require_relative 'xhtml_epub2' # xhtml_epub2.rb
+ SiSU_XHTML_EPUB2::Source.new(@opt).read
+ end
+ if @opt.act[:odt][:set]==:on #% --odt, -o opendocument
+ require_relative 'xml_odf_odt' # xml_odf_odt.rb
+ SiSU_XML_ODF_ODT::Source.new(@opt).read
+ end
+ if @opt.act[:xhtml][:set]==:on #% --xhtml, -b xhtml
+ require_relative 'xhtml' # xhtml.rb
+ SiSU_XHTML::Source.new(@opt).read
+ end
+ if @opt.act[:xml_scaffold_structure_sisu][:set]==:on #% --xml-scaffold --xml-scaffold-sisu
+ require_relative 'xml_scaffold_structure_sisu' # xml_scaffold_structure_sisu.rb
+ SiSU_XML_Scaffold_Structure_Sisu::Source.new(@opt).read
+ end
+ if @opt.act[:xml_scaffold_structure_collapse][:set]==:on #% --xml-scaffold-collapse
+ require_relative 'xml_scaffold_structure_collapsed' # xml_scaffold_structure_collapsed.rb
+ SiSU_XML_Scaffold_Structure_Collapse::Source.new(@opt).read
+ end
+ if @opt.act[:xml_docbook_book][:set]==:on #% --xml-docbook
+ require_relative 'xml_docbook5' # xml_docbook5.rb
+ SiSU_XML_Docbook_Book::Source.new(@opt).read
+ end
+ if @opt.act[:xml_fictionbook][:set]==:on #% --xml-fictionbook
+ require_relative 'xml_fictionbook2' # xml_fictionbook2.rb
+ SiSU_XML_Fictionbook::Source.new(@opt).read
+ end
+ if @opt.act[:xml_sax][:set]==:on #% --xml-sax, -x xml sax type
+ require_relative 'xml_sax' # xml_sax.rb
+ SiSU_XML_SAX::Source.new(@opt).read
+ end
+ if @opt.act[:xml_dom][:set]==:on #% --xml-dom, -X xml dom type
+ require_relative 'xml_dom' # xml_dom.rb
+ SiSU_XML_DOM::Source.new(@opt).read
+ end
+ if @opt.act[:pdf][:set]==:on \
+ or @opt.act[:pdf_p][:set]==:on \
+ or @opt.act[:pdf_l][:set]==:on #% --pdf-l --pdf, -p latex/ texpdf
+ require_relative 'texpdf' # texpdf.rb
+ SiSU_TeX::Source.new(@opt).read
+ end
+ if @opt.act[:manpage][:set]==:on #% --manpage, -i
+ require_relative 'manpage' # manpage.rb
+ SiSU_Manpage::Source.new(@opt).read
+ end
+ if @opt.act[:texinfo][:set]==:on #% --texinfo, -I
+ require_relative 'texinfo' # texinfo.rb
+ SiSU_TexInfo::Source.new(@opt).read
+ end
+ if @opt.act[:sqlite_discrete][:set]==:on #% --sqlite, -d DB sqlite
+ require_relative 'dbi_discrete' # dbi_discrete.rb
+ SiSU_DBI_Discrete::SQL.new(@opt).build
+ end
+ if @opt.act[:manifest][:set]==:on #% --manifest, -y
+ require_relative 'manifest' # manifest.rb
+ ((@opt.act[:sisupod][:set]==:on \
+ || @opt.act[:share_source][:set]==:on) \
+ && @opt.files.length < 2 ) \
+ ? nil
+ : SiSU_Manifest::Source.new(@opt).read
+ end
+ else
+ @remove_faulty_markup_files_array << fno
+ $process_document=:ok
end
end
end