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 inherited from Convert
Constants included from Function::Utils
Function::Utils::CLAUSE_ANCESTOR, Function::Utils::DOCTYPE_HDR, Function::Utils::HUGESTRICT, Function::Utils::LABELLED_ANCESTOR_ELEMENTS, Function::Utils::NOTE_CONTAINER_ANCESTOR
Constants included from Function::ToWordHtml
Function::ToWordHtml::TOP_ELEMENTS
Constants included from Function::Table
Constants included from Function::Section
Function::Section::TERM_CLAUSE
Constants included from Function::Lists
Constants included from Function::Inline
Constants included from Function::Cleanup
Function::Cleanup::TABLENOTE_CSS
Constants included from Function::Blocks
Function::Blocks::EXAMPLE_TBL_ATTR, Function::Blocks::EXAMPLE_TD_ATTR
Instance Attribute Summary
Attributes inherited from Convert
#bibrender, #doctype, #i18n, #meta, #options, #reqt_models, #requirements_processor, #tempfile_cache, #wordcoverpage, #wordintropage, #xrefs
Instance Method Summary collapse
- #convert(input_filename, file = nil, debug = false, output_filename = nil) ⇒ 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, #convert1, #coverpage_note_cleanup, #datauri, #footnote_backlinks, #footnote_backlinks1, #footnote_format, #googlefonts, #heading_anchor, #heading_anchors, #html5, #html_button, #html_cleanup, #html_cover, #html_footnote_filter, #html_head, #html_intro, #html_list_clean, #html_main, #html_preface, #html_toc, #html_toc_entries, #html_toc_entries_prep, #html_toc_entry, #html_toc_init, #htmlstyle, #htmlstylesheet, #image_body_parse, #image_suffix, #inject_script, #make_body1, #make_body2, #mathjax, #mathml, #move_image1, #move_images, #postprocess, #preprocess_xslt, #remove_placeholder_paras, #resize_images, #script_cdata, #sourcecode_cleanup, #sourcecode_parse, #table_attrs, #term_header, #toHTML, #toc_exclude_class, #toclevel, #toclevel_classes, #underline_parse, #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
#agency?, #bibrenderer, #convert1, #convert1_namespaces, #convert_i18n_init, #convert_i18n_init1, #convert_init, #convert_scss, #default_file_locations, #default_fonts, #docid_l10n, #docid_prefix, #extract_preprocess_xslt, #fonts_options, #generate_css, #html_doc_path, #i18n_init, #init_arrangement, #init_covers, #init_fonts, #init_i18n, #init_locations, #init_processing, #init_rendering, #init_stylesheets, #init_toc, #l10n, #localpath, #metadata_init, #middle_clause, #omit_docid_prefix, #options_preprocess, #populate_css, #precompiled_style_or_original, #preprocess_xslt, #scss_fontheader, #swap_renderer, #target_pdf, #tmpfilesdir_suffix, #toc_init, #xref_init
Methods included from ClassUtils
#case_strict, #case_strict1, #case_with_markup, #date_range, #liquid, #nearest_block_parent, #ns, #start_of_sentence, #to_xml
Methods included from Function::Utils
#attr_code, #cleanup_entities, #date_range, #emf?, #empty2nil, #eps?, #external_path, #extract_delims, #from_xhtml, #get_clause_id, #get_note_container_id, #header_strip, #header_strip_elem?, #image_localfile, #insert_tab, #labelled_ancestor, #liquid, #noko, #ns, #numeric_escapes, #populate_template, #save_dataimage, #save_svg, #sentence_join, #start_of_sentence, #to_xhtml, #to_xhtml_fragment, #to_xhtml_prep, #to_xml
Methods included from Function::ToWordHtml
#body_attr, #boilerplate, #content, #cross_align, #define_head, #info, #init_dir, #init_file, #make_body, #make_body1, #make_body2, #make_body3, #note?, #parse, #rel_tmpimagedir, #tmpimagedir, #top_element_render
Methods included from Function::Terms
#admitted_term_parse, #definition_parse, #deprecated_term_parse, #modification_parse, #para_then_remainder, #term_parse, #termdef_parse, #termdocsource_parse, #termdomain_parse, #termnote_parse, #termref_parse
Methods included from Function::Table
#colgroup, #make_tr_attr, #make_tr_attr_style, #table_attrs, #table_parse, #table_parse_core, #table_parse_tail, #table_title_parse, #tbody_parse, #tcaption, #tfoot_parse, #thead_parse, #tr_parse
Methods included from Function::Section
#abstract, #acknowledgements, #annex, #annex_attrs, #annex_name, #clause, #clause_attrs, #clause_name, #clause_parse, #clause_parse_subtitle, #clause_parse_title, #clause_parse_title1, #clause_title_depth, #clausedelim, #clausedelimspace, #colophon, #copyright_parse, #executivesummary, #feedback_parse, #foreword, #freestanding_title, #indexsect, #inline_header_title, #introduction, #is_clause?, #legal_parse, #license_parse, #preface, #preface_attrs, #preface_block, #preface_normal, #scope, #single_term_clause?, #symbols_abbrevs, #symbols_parse, #table_of_contents, #terms_defs, #terms_parse, #variant_title
Methods included from Function::References
#bibitem_entry, #biblio_list, #bibliography, #bibliography_parse, #bibliography_xpath, #iso_bibitem_entry_attrs, #norm_ref, #norm_ref_xpath, #reference_format
Methods included from Function::Lists
#dl_attrs, #dl_parse, #dl_parse1, #dl_parse_notes, #dt_dd?, #dt_parse, #li_parse, #list_title_parse, #ol_attrs, #ol_depth, #ol_parse, #ol_style, #ul_attrs, #ul_parse
Methods included from Function::Inline
#add_parse, #asciimath_parse, #author_parse, #bookmark_parse, #br_parse, #callout_parse, #del_parse, #em_parse, #eref_parse, #error_parse, #hr_parse, #image_body_parse, #image_parse, #image_title_parse, #index_parse, #index_xref_parse, #keyword_parse, #latexmath_parse, #link_parse, #location_parse, #mathml_parse, #no_locality_parse, #origin_parse, #page_break, #pagebreak_parse, #rb_parse, #rt_parse, #ruby_parse, #section_break, #smallcap_parse, #span_parse, #stem_parse, #strike_parse, #strong_parse, #sub_parse, #suffix_url, #sup_parse, #termrefelem_parse, #text_parse, #tt_parse, #underline_parse
Methods included from Function::Form
#form_parse, #input_parse, #label_parse, #option_parse, #select_parse, #text_input, #textarea_parse
Methods included from Function::Cleanup
#admonition_cleanup, #cleanup, #example_cleanup, #figure_cleanup, #footnote_cleanup, #footnote_reference_format, #inline_header_cleanup, #merge_fnref_into_fn_text, #new_fullcolspan_row, #passthrough_cleanup, #remove_bottom_border, #symbols_cleanup, #table_cleanup, #table_footnote_cleanup, #table_footnote_cleanup_propagate, #table_footnote_reference_format, #table_get_or_make_tfoot, #table_note_cleanup, #textcleanup
Methods included from Function::Blocks
#admonition_attrs, #admonition_class, #admonition_name, #admonition_name_in_first_para, #admonition_name_para_delim, #admonition_name_parse, #admonition_p_parse, #admonition_parse, #admonition_parse1, #annotation_parse, #attribution_parse, #columnbreak_parse, #cross_align_parse, #div_parse, #example_div_attr, #example_div_parse, #example_label, #example_parse, #example_table_attr, #example_table_parse, #figure_attrs, #figure_name_parse, #figure_parse, #figure_parse1, #formula_attrs, #formula_parse, #formula_parse1, #keep_style, #note_attrs, #note_p_parse, #note_parse, #note_parse1, #para_attrs, #para_class, #para_parse, #passthrough_parse, #permission_parse, #pre_parse, #pseudocode_attrs, #pseudocode_parse, #quote_parse, #recommendation_name, #recommendation_parse, #recommendation_parse1, #reqt_attrs, #requirement_parse, #source_parse, #sourcecode_attrs, #sourcecode_name_parse, #sourcecode_parse, #sourcecode_parse1, #svg_parse, #toc_parse
Constructor Details
#initialize(options) ⇒ PdfConvert
Returns a new instance of PdfConvert.
11 12 13 14 15 16 17 18 19 |
# File 'lib/isodoc/pdf_convert.rb', line 11 def initialize() @standardstylesheet = nil super @format = :pdf @suffix = "pdf" @scripts = @scripts_pdf if @scripts_pdf @maxwidth = 500 @maxheight = 800 end |
Instance Method Details
#convert(input_filename, file = nil, debug = false, output_filename = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/isodoc/pdf_convert.rb', line 25 def convert(input_filename, file = nil, debug = false, output_filename = nil) file = File.read(input_filename, encoding: "utf-8") if file.nil? @openmathdelim, @closemathdelim = extract_delims(file) docxml, filename, dir = convert_init(file, input_filename, debug) result = convert1(docxml, filename, dir) return result if debug postprocess(result, "#{filename}.tmp.html", dir) FileUtils.rm_rf dir ::Metanorma::Output::Pdf.new.convert( "#{filename}.tmp.html", output_filename || "#{filename}.#{@suffix}", ) FileUtils.rm_rf ["#{filename}.tmp.html", tmpimagedir] end |
#tmpimagedir_suffix ⇒ Object
21 22 23 |
# File 'lib/isodoc/pdf_convert.rb', line 21 def tmpimagedir_suffix "_#{SecureRandom.hex(8)}_pdfimages" end |
#xref_parse(node, out) ⇒ Object
41 42 43 |
# File 'lib/isodoc/pdf_convert.rb', line 41 def xref_parse(node, out) out.a(**{ "href": target_pdf(node) }) { |l| l << get_linkend(node) } end |