Class: IsoDoc::PdfConvert
- Defined in:
- lib/isodoc/pdf_convert.rb
Constant Summary
Constants included from HtmlFunction::Html
HtmlFunction::Html::MATHJAX, HtmlFunction::Html::MATHJAX_ADDR
Constants included from HtmlFunction::Comments
HtmlFunction::Comments::COMMENT_IN_COMMENT_LIST, HtmlFunction::Comments::COMMENT_TARGET_XREFS
Constants included from Function::XrefSectGen
Function::XrefSectGen::SUBCLAUSES
Constants included from Function::XrefGen
Function::XrefGen::CHILD_EXAMPLES_XPATH, Function::XrefGen::CHILD_NOTES_XPATH, Function::XrefGen::CHILD_SECTIONS, Function::XrefGen::FIRST_LVL_REQ, Function::XrefGen::SECTIONS_XPATH
Constants included from Function::Utils
Function::Utils::CLAUSE_ANCESTOR, Function::Utils::DOCTYPE_HDR, Function::Utils::NOKOHEAD, Function::Utils::NOTE_CONTAINER_ANCESTOR
Constants included from Function::Table
Constants included from Function::Section
Function::Section::MIDDLE_CLAUSE, Function::Section::TERM_CLAUSE
Constants included from Function::References
Function::References::BIBLIOGRAPHY_XPATH, Function::References::ISO_PUBLISHER_XPATH
Constants included from Function::Lists
Constants included from Function::Cleanup
Function::Cleanup::FIGURE_WITH_FOOTNOTES
Constants included from Function::Blocks
Function::Blocks::EXAMPLE_TBL_ATTR, Function::Blocks::EXAMPLE_TD_ATTR
Instance Attribute Summary
Attributes inherited from Convert
Instance Method Summary collapse
- #convert(filename, file = nil, debug = false) ⇒ Object
-
#initialize(options) ⇒ PdfConvert
constructor
A new instance of PdfConvert.
- #tmpimagedir_suffix ⇒ Object
- #xref_parse(node, out) ⇒ Object
Methods included from HtmlFunction::Html
#authority_cleanup, #authority_cleanup1, #datauri, #footnote_backlinks, #footnote_format, #googlefonts, #html5, #html_button, #html_cleanup, #html_cover, #html_footnote_filter, #html_head, #html_intro, #html_main, #html_preface, #html_toc, #html_toc_entry, #htmlstyle, #htmlstylesheet, #image_suffix, #inject_script, #make_body1, #make_body2, #make_body3, #mathjax, #move_image1, #move_images, #postprocess, #script_cdata, #sourcecode_highlighter, #sourcecode_parse, #sourcecodelang, #term_header, #toHTML, #toclevel, #toclevel_classes, #update_footnote_filter
Methods included from HtmlFunction::Footnotes
#footnote_parse, #footnotes, #get_table_ancestor_id, #make_footnote, #make_generic_footnote_text, #make_table_footnote_link, #make_table_footnote_target, #make_table_footnote_text, #table_footnote_parse
Methods included from HtmlFunction::Comments
#comment_attributes, #comment_cleanup, #comment_link_attrs, #comments, #embed_comment_in_comment_list, #get_comments_from_text, #in_comment, #insert_comment_cont, #make_comment_link, #make_comment_target, #make_comment_text, #move_comment_link_to_from, #move_comment_link_to_from1, #reorder_comments_by_comment_link, #review_note_parse, #skip_comment_wrap, #wrap_comment_cont
Methods inherited from Convert
#convert1, #convert_init, #default_file_locations, #default_fonts, #extract_fonts, #generate_css, #html_doc_path, #metadata_init, #populate_css
Methods included from ClassUtils
Methods included from Function::XrefSectGen
#annex_name_lbl, #annex_names, #annex_names1, #back_anchor_names, #clause_names, #initial_anchor_names, #middle_section_asset_names, #preface_clause_name, #preface_names, #preface_names1, #section_names, #section_names1
Methods included from Function::XrefGen
#anchor, #anchor_names, #anchor_struct, #anchor_struct_label, #anchor_struct_xref, #example_anchor_names, #get_anchors, #hierarchical_asset_names, #hierarchical_figure_names, #hierarchical_formula_names, #hierarchical_permission_names, #hierarchical_table_names, #hierfigsep, #hiersep, #list_anchor_names, #list_item_anchor_names, #note_anchor_names, #sequential_asset_names, #sequential_figure_names, #sequential_formula_names, #sequential_permission_names, #sequential_permission_names1, #sequential_permission_names2, #sequential_table_names, #termexample_anchor_names, #termnote_anchor_names, #termnote_label
Methods included from Function::Utils
#attr_code, #date_range, #empty2nil, #extract_delims, #from_xhtml, #get_clause_id, #get_note_container_id, #header_strip, #image_localfile, #insert_tab, #labelled_ancestor, #liquid, #noko, #ns, #populate_template, #save_dataimage, #sentence_join, #to_xhtml, #to_xhtml_fragment
Methods included from Function::ToWordHtml
#body_attr, #boilerplate, #define_head, #in_sourcecode, #info, #init_file, #make_body, #make_body1, #make_body2, #make_body3, #middle, #middle_title, #note?, #parse, #rel_tmpimagedir, #set_termdomain, #tmpimagedir
Methods included from Function::Terms
#admitted_term_parse, #definition_parse, #deprecated_term_parse, #modification_parse, #para_then_remainder, #term_parse, #termdef_parse, #termdocsource_parse, #termnote_parse, #termref_parse
Methods included from Function::Table
#make_table_attr, #make_tr_attr, #table_parse, #table_title_parse, #tbody_parse, #tcaption, #tfoot_parse, #thead_parse, #tr_parse
Methods included from Function::Section
#abstract, #acknowledgements, #annex, #annex_name, #clause, #clause_name, #clause_parse, #clause_parse_title, #clausedelim, #clausedelimspace, #copyright_parse, #feedback_parse, #foreword, #inline_header_title, #introduction, #legal_parse, #license_parse, #preface, #scope, #symbols_abbrevs, #symbols_parse, #terms_defs, #terms_defs_title, #terms_parse
Methods included from Function::References
#bibitem_ref_code, #biblio_list, #bibliography, #bibliography_parse, #date_note_process, #docid_l10n, #docid_prefix, #format_ref, #implicit_reference, #is_standard, #iso_bibitem_entry_attrs, #iso_title, #nonstd_bibitem, #norm_ref, #omit_docid_prefix, #prefix_bracketed_ref, #ref_entry_code, #reference_format, #reference_names, #render_identifier, #std_bibitem_entry
Methods included from Function::Lists
#dl_attr, #dl_parse, #dt_dd?, #dt_parse, #li_parse, #ol_depth, #ol_parse, #ol_style, #ul_parse
Methods included from Function::Inline
#anchor_linkend, #bookmark_parse, #br_parse, #callout_parse, #concept_parse, #em_parse, #eref_localities, #eref_parse, #error_parse, #get_linkend, #hr_parse, #image_parse, #image_title_parse, #index_parse, #keyword_parse, #link_parse, #page_break, #pagebreak_parse, #prefix_container, #section_break, #smallcap_parse, #stem_parse, #strike_parse, #strong_parse, #sub_parse, #sup_parse, #termrefelem_parse, #text_parse, #tt_parse
Methods included from Function::I18n
#eref_localities1, #eref_localities1_zh, #i18n_init, l10n, #load_yaml
Methods included from Function::Cleanup
#admonition_cleanup, #cleanup, #example_cleanup, #figure_aside_process, #figure_cleanup, #figure_get_or_make_dl, #footnote_cleanup, #footnote_reference_format, #inline_header_cleanup, #merge_fnref_into_fn_text, #new_fullcolspan_row, #remove_bottom_border, #symbols_cleanup, #table_cleanup, #table_footnote_cleanup, #table_footnote_reference_format, #table_get_or_make_tfoot, #table_note_cleanup, #textcleanup
Methods included from Function::Blocks
#admonition_class, #admonition_name, #admonition_name_parse, #admonition_parse, #annotation_parse, #example_div_parse, #example_label, #example_parse, #example_table_attr, #example_table_parse, #figure_key, #figure_name_parse, #figure_parse, #formula_parse, #formula_parse1, #formula_where, #note_label, #note_p_parse, #note_parse, #note_parse1, #para_attrs, #para_class, #para_parse, #permission_parse, #pre_parse, #pseudocode_parse, #quote_attribution, #quote_parse, #recommendation_attributes, #recommendation_attributes1, #recommendation_labels, #recommendation_name, #recommendation_parse, #reqt_metadata_node, #requirement_component_parse, #requirement_parse, #requirement_skip_parse, #sourcecode_name_parse, #sourcecode_parse
Constructor Details
#initialize(options) ⇒ PdfConvert
Returns a new instance of PdfConvert.
13 14 15 16 17 18 19 |
# File 'lib/isodoc/pdf_convert.rb', line 13 def initialize() @standardstylesheet = nil super @scripts = @scripts_pdf if @scripts_pdf @maxwidth = 500 @maxheight = 800 end |
Instance Method Details
#convert(filename, file = nil, debug = false) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/isodoc/pdf_convert.rb', line 25 def convert(filename, file = nil, debug = false) file = File.read(filename, encoding: "utf-8") if file.nil? @openmathdelim, @closemathdelim = extract_delims(file) docxml, outname_html, dir = convert_init(file, filename, debug) result = convert1(docxml, filename, dir) return result if debug postprocess(result, filename, dir) FileUtils.rm_rf dir ::Metanorma::Output::Pdf.new.convert("#{filename}.html", outname_html + ".pdf") FileUtils.rm_rf ["#{filename}.html", tmpimagedir] end |
#tmpimagedir_suffix ⇒ Object
21 22 23 |
# File 'lib/isodoc/pdf_convert.rb', line 21 def tmpimagedir_suffix "_pdfimages" end |
#xref_parse(node, out) ⇒ Object
37 38 39 40 41 |
# File 'lib/isodoc/pdf_convert.rb', line 37 def xref_parse(node, out) target = /#/.match(node["target"]) ? node["target"].sub(/#/, ".pdf#") : "##{node["target"]}" out.a(**{ "href": target }) { |l| l << get_linkend(node) } end |