Class: Asciidoctor::Standoc::Converter
- Inherits:
-
Object
- Object
- Asciidoctor::Standoc::Converter
- Includes:
- Converter, Base, Blocks, Cleanup, Front, Inline, Lists, Refs, Section, Table, Utils, Validate, Writer
- Defined in:
- lib/asciidoctor/standoc/converter.rb
Overview
A Converter implementation that generates Standoc output, and a document schema encapsulation of the document for validation
Constant Summary
Constants included from Validate
Constants included from Cleanup
Asciidoctor::Standoc::Cleanup::ABBRnoSYM, Asciidoctor::Standoc::Cleanup::ELEMS_ALLOW_NOTES, Asciidoctor::Standoc::Cleanup::IDREF, Asciidoctor::Standoc::Cleanup::ISO_PUBLISHER_XPATH, Asciidoctor::Standoc::Cleanup::LOCALITY_RE, Asciidoctor::Standoc::Cleanup::LOCALITY_REGEX_STR, Asciidoctor::Standoc::Cleanup::MATHML_NS, Asciidoctor::Standoc::Cleanup::NAMECHAR, Asciidoctor::Standoc::Cleanup::NAMESTARTCHAR, Asciidoctor::Standoc::Cleanup::NORM_REF, Asciidoctor::Standoc::Cleanup::NO_SYMABBR, Asciidoctor::Standoc::Cleanup::SYMABBR, Asciidoctor::Standoc::Cleanup::SYMnoABBR, Asciidoctor::Standoc::Cleanup::TERM_CLAUSE, Asciidoctor::Standoc::Cleanup::TEXT_ELEMS
Constants included from Utils
Utils::NOKOHEAD, Utils::SUBCLAUSE_XPATH
Constants included from Refs
Refs::ISO_REF, Refs::ISO_REF_ALL_PARTS, Refs::ISO_REF_NO_YEAR, Refs::MALFORMED_REF, Refs::NON_ISO_REF
Constants included from Base
Base::TERM_REFERENCE_RE, Base::TERM_REFERENCE_RE_STR, Base::XML_NAMESPACE, Base::XML_ROOT_TAG
Class Attribute Summary collapse
-
._file ⇒ Object
Returns the value of attribute _file.
Class Method Summary collapse
Instance Method Summary collapse
- #flavor_name ⇒ Object
- #fonts_manifest ⇒ Object
-
#html_doc_path(file) ⇒ Object
path to isodoc assets in child gems.
-
#initialize(backend, opts) ⇒ Converter
constructor
A new instance of Converter.
- #install_fonts(options = {}) ⇒ Object
Methods included from Validate
#asset_style, #asset_title_style, #content_validate, #formattedstr_strip, #hanging_para_style, #iev_validate, #init_iev, #repeat_id_validate, #repeat_id_validate1, #schema_validate, #section_validate, #sourcecode_style, #style_warning, #validate
Methods included from Cleanup
#add_to_hash, #align_callouts_to_annotations, #anchor_cleanup, #anchor_cleanup1, #asciimath2mathml, #bibabstract_location, #bibdata_anchor_cleanup, #bibdata_cleanup, #bibdata_docidentifier_cleanup, #bibitem_cleanup, #biblio_cleanup, #biblio_nested, #biblio_renumber, #biblio_reorder, #biblio_reorder1, #boilerplate, #boilerplate_cleanup, #boilerplate_file, #boilerplate_isodoc, #bookmark_cleanup, #bpart_cleanup, #callout_cleanup, #change_clauses, #clausebefore_cleanup, #cleanup, #concept_cleanup, #concept_eref_cleanup, #concept_termbase_cleanup, #concept_xref_cleanup, #create_amend, #create_amend1, #create_amend2, #dd_bib_extract, #dl1_table_cleanup, #dl2_table_cleanup, #dl_bib_extract, #docid_prefix, #docidentifier_cleanup, #element_name_cleanup, #empty_element_cleanup, #empty_text_before_first_element, #external_terms_boilerplate, #extract_from_p, #extract_localities, #extract_localities1, #extract_notes_from_biblio, #extract_symbols_list, #fetch_local_bibitem, #fetch_termbase, #figure_cleanup, #figure_dl_cleanup1, #figure_dl_cleanup2, #figure_footnote_cleanup, #fold_notes_into_biblio, #footnote_block_cleanup, #footnote_cleanup, #footnote_content, #format_ref, #formula_cleanup, #formula_cleanup_where1, #formula_cleanup_where2, #get_or_make_title, #grkletters, #header_rows_cleanup, #img_cleanup, #initial_boilerplate, #inject_id, #insert_thead, #internal_external_terms_boilerplate, #link_callouts_to_annotations, #link_unwrap, #make_abstract, #make_annexes, #make_bibliography, #make_preface, #mathml_cleanup, #mathml_italicise, #mathml_mi_italics, #mathml_namespace, #mathml_preserve_space, #maxlevel, #merge_annotations_into_sourcecode, #mi_italicise?, #move_attrs_to_amend, #move_clauses_into_preface, #norm_ref_preface, #normref_cleanup, #note_cleanup, #notes_table_cleanup, #obligations_cleanup, #obligations_cleanup_info, #obligations_cleanup_inherit, #obligations_cleanup_norm, #omit_docid_prefix, #origin_cleanup, #other_footnote_renumber, #other_footnote_renumber1, #p_unwrap, #para_cleanup, #preface_clausebefore_cleanup, #quotesource_cleanup, #read_local_bibitem, #ref_cleanup, #ref_dl_cleanup, #reference_names, #replace_title, #requirement_cleanup, #requirement_cleanup1, #requirement_descriptions, #requirement_inherit, #script_cleanup, #section_names_refs_cleanup, #section_names_terms_cleanup, #sections_clausebefore_cleanup, #sections_cleanup, #sections_level_cleanup, #sections_names_cleanup, #sections_order_cleanup, #smartquotes_cleanup, #sort_biblio, #strip_initial_space, #subfigure_cleanup, #symbol_key, #symbols_cleanup, #table_cleanup, #table_footnote_renumber, #table_footnote_renumber1, #term_children_cleanup, #term_defs_boilerplate, #term_defs_boilerplate_cont, #termdef_boilerplate_cleanup, #termdef_cleanup, #termdef_from_termbase, #termdef_stem_cleanup, #termdef_subclause_cleanup, #termdef_unnest_cleanup, #termdefinition_cleanup, #termdocsource_cleanup, #termdomain1_cleanup, #termdomain_cleanup, #termnote_example_cleanup, #textcleanup, #title_footnote_move, #to_ncname, #to_xreftarget, #tq, #validate_ref_dl, #variant_cleanup, #xml_unescape_mathml, #xref_cleanup, #xref_to_eref, #xreftarget_cleanup
Methods included from Utils
anchor_or_uuid, asciidoc_sub, #attr_code, #convert, #datauri2mime, #datauri2mime1, #document_ns_attributes, endash_date, flatten_rawtext, flatten_rawtext_lines, #isodoc, localdir, #noko, reqt_subpart, set_nested_value, smartformat, #wrap_in_para
Methods included from Table
Methods included from Section
#abstract_parse, #acknowledgements_parse, #annex_parse, #bibitem_parse, #bibliography_parse, #clause_parse, #emend_biblio, #fetch_ref, #foreword_parse, #global_ievcache_name, #in_biblio?, #in_norm_ref?, #in_terms?, #init_bib_caches, #init_iev_caches, #introduction_parse, #local_ievcache_name, #nonterm_symbols_parse, #nonterm_term_def_subclause_parse, #norm_ref_parse, #preamble, #reference, #scope_parse, #section, #section_attributes, #sectiontype, #sectiontype1, #sectiontype_streamline, #set_obligation, #smart_render_xml, #symbols_attrs, #symbols_parse, #term_def_parse, #term_def_subclause_parse, #term_def_subclause_parse1
Methods included from Blocks
#admonition, #admonition_attrs, #example, #example_attrs, #example_proper, #figure_attrs, #figure_title, #formula_attrs, #id_attr, #id_unnum_attrs, #image, #keep_attrs, #listing, #listing_attrs, #literal, #literal_attrs, #note, #note_attrs, #open, #para_attrs, #paragraph, #pass, #pseudocode_example, #quote, #quote_attribution, #quote_attrs, #req_classif_parse, #reqt_attrs, #reqt_subpart_attrs, #requirement, #requirement_classification, #requirement_subpart, #sidebar, #sidebar_attrs, #stem, #term_example, #termnote, #termnote_attrs, #todo, #todo_attrs
Methods included from Inline
#datauri, #image_attributes, #inline_anchor, #inline_anchor_bibref, #inline_anchor_link, #inline_anchor_ref, #inline_anchor_xref, #inline_anchor_xref_attrs, #inline_break, #inline_callout, #inline_footnote, #inline_image, #inline_indexterm, #inline_quoted, #latex_parse, #page_break, #refid?, #stem_parse, #thematic_break, #xml_encode
Methods included from Refs
#analyse_ref_code, #analyse_ref_nofetch, #analyse_ref_numeric, #analyse_ref_repo_path, #conditional_date, #docid, #docnumber, #id_and_year, #iso_publisher, #isorefmatches, #isorefmatches2, #isorefmatches2_1, #isorefmatches3, #isorefmatches3_1, #isorefrender1, #mn_code, #norm_year, #plaintxt, #ref_attributes, #ref_normalise, #ref_normalise_no_format, #reference1, #reference1_matches, #refitem, #refitem1, #refitem_render, #refitem_render1, #set_date_range, #use_my_anchor
Methods included from Lists
#colist, #dd, #dl_attrs, #dlist, #dt, #li, #ol_attrs, #olist, #olist_style, #ul_attrs, #ul_li, #ul_li_attrs, #ulist
Methods included from Front
#committee_component, #csv_split, #datetypes, #default_publisher, #metadata, #metadata_author, #metadata_committee, #metadata_copyright, #metadata_date, #metadata_date1, #metadata_doctype, #metadata_ext, #metadata_getrelation, #metadata_ics, #metadata_id, #metadata_keywords, #metadata_language, #metadata_note, #metadata_other_id, #metadata_publisher, #metadata_relations, #metadata_script, #metadata_series, #metadata_source, #metadata_status, #metadata_version, #org_abbrev, #org_address, #organization, #person_affiliation, #person_name, #personal_author, #personal_author1, #personal_contact, #personal_role, #relation_normalise, #relaton_relation_descriptions, #relaton_relations, #title, #title_english, #title_otherlangs
Methods included from Base
#add_term_source, #clean_exit, #content, #default_fonts, #doc_converter, #doc_extract_attributes, #doctype, #document, #draft?, #extract_termsource_refs, #front, #html_converter, #html_extract_attributes, #init, #makexml, #makexml1, #middle, #outputs, #presentation_xml_converter, #skip, #term_source_attrs, #termsource, #version, #xml_namespace, #xml_root_tag
Constructor Details
#initialize(backend, opts) ⇒ Converter
Returns a new instance of Converter.
70 71 72 73 74 75 76 77 |
# File 'lib/asciidoctor/standoc/converter.rb', line 70 def initialize(backend, opts) super basebackend "html" outfilesuffix ".xml" @libdir = File.dirname(self.class::_file || __FILE__) install_fonts(opts) end |
Class Attribute Details
._file ⇒ Object
Returns the value of attribute _file.
80 81 82 |
# File 'lib/asciidoctor/standoc/converter.rb', line 80 def _file @_file end |
Class Method Details
.inherited(k) ⇒ Object
83 84 85 |
# File 'lib/asciidoctor/standoc/converter.rb', line 83 def self.inherited(k) k._file = caller_locations.first.absolute_path end |
Instance Method Details
#flavor_name ⇒ Object
92 93 94 |
# File 'lib/asciidoctor/standoc/converter.rb', line 92 def flavor_name self.class.name.split("::")&.[](-2).downcase end |
#fonts_manifest ⇒ Object
96 97 98 |
# File 'lib/asciidoctor/standoc/converter.rb', line 96 def fonts_manifest File.(File.join(@libdir, "../../metanorma/", flavor_name, "fonts_manifest.yaml")) end |
#html_doc_path(file) ⇒ Object
path to isodoc assets in child gems
88 89 90 |
# File 'lib/asciidoctor/standoc/converter.rb', line 88 def html_doc_path(file) File.join(@libdir, "../../isodoc/html", file) end |
#install_fonts(options = {}) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/asciidoctor/standoc/converter.rb', line 100 def install_fonts(={}) if [:no_install_fonts] Metanorma::Util.log("[fontist] Skip font installation because" \ " --no-install-fonts argument passed", :debug) return end if fonts_manifest.nil? || !File.exist?(fonts_manifest) Metanorma::Util.log("[fontist] Skip font installation because" \ " font manifest file doesn't exists/defined", :debug) return end begin Fontist::Manifest::Install.call( fonts_manifest, confirmation: [:agree_to_terms] ? "yes" : "no" ) rescue Fontist::Errors::LicensingError if ![:agree_to_terms] Metanorma::Util.log("[fontist] --agree-to-terms option missing." \ " You must accept font licenses to install fonts.", :debug) elsif [:continue_without_fonts] Metanorma::Util.log("[fontist] Processing will continue without" \ " fonts installed", :debug) else Metanorma::Util.log("[fontist] Aborting without proper fonts" \ " installed", :fatal) end rescue Fontist::Errors::NonSupportedFontError flavor = flavor_name || "cli" Metanorma::Util.log("[fontist] '#{font}' font is not supported. " \ "Please go to github.com/metanorma/metanorma-#{flavor}/issues" \ " to report this issue.", :info) end end |