Class: IsoDoc::Iso::WordConvert

Inherits:
WordConvert show all
Defined in:
lib/isodoc/iso/word_convert.rb

Constant Summary

Constants included from WordFunction::Postprocess

WordFunction::Postprocess::WORD_TOC_PREFACE1, WordFunction::Postprocess::WORD_TOC_SUFFIX1

Constants included from WordFunction::Body

WordFunction::Body::SW1, WordFunction::Body::WORD_DT_ATTRS

Constants included from WordFunction::Comments

WordFunction::Comments::COMMENT_IN_COMMENT_LIST1, WordFunction::Comments::COMMENT_TARGET_XREFS1

Constants included from Function::XrefGen

Function::XrefGen::CHILD_EXAMPLES_XPATH, Function::XrefGen::CHILD_NOTES_XPATH, Function::XrefGen::SECTIONS_XPATH

Constants included from Function::Utils

Function::Utils::CLAUSE_ANCESTOR, Function::Utils::NOKOHEAD, Function::Utils::NOTE_CONTAINER_ANCESTOR

Constants included from Function::Table

Function::Table::SW

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

Function::Lists::OL_STYLE

Constants included from Function::Cleanup

Function::Cleanup::FIGURE_WITH_FOOTNOTES

Constants included from Function::Blocks

Function::Blocks::EXAMPLE_TBL_ATTR

Instance Method Summary collapse

Methods included from WordFunction::Postprocess

#generate_header, #make_WordToC, #postprocess, #toWord, #word_annex_cleanup, #word_cleanup, #word_cover, #word_intro, #word_preface, #word_toc_entry

Methods included from WordFunction::Body

#dl_parse, #dl_parse_notes, #dt_parse, #figure_aside_process, #figure_get_or_make_dl, #insert_tab, #make_body1, #make_body2, #make_body3, #make_tr_attr, #new_fullcolspan_row, #page_break, #para_attrs, #remove_bottom_border, #section_break

Methods included from WordFunction::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 WordFunction::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

#convert, #convert1, #convert_init, #generate_css, #metadata_init

Methods included from ClassUtils

#date_range, #liquid, #ns

Methods included from Function::XrefSectGen

#annex_name_lbl, #annex_names, #annex_names1, #appendix_names, #back_anchor_names, #clause_names, #initial_anchor_names, #introduction_names, #middle_section_asset_names, #section_names, #section_names1

Methods included from Function::XrefGen

#anchor_names, #anchor_struct, #anchor_struct_label, #anchor_struct_xref, #example_anchor_names, #get_anchors, #hierarchical_asset_names, #hierarchical_figure_names, #list_anchor_names, #list_item_anchor_names, #listlabel, #note_anchor_names, #sequential_asset_names, #sequential_figure_names, #termexample_anchor_names, #termnote_anchor_names, #termnote_label

Methods included from Function::Utils

#attr_code, #date_range, #extract_delims, #from_xhtml, #get_clause_id, #get_note_container_id, #header_strip, #insert_tab, #liquid, #noko, #ns, #populate_template, #sentence_join, #to_xhtml, #to_xhtml_fragment

Methods included from Function::ToWordHtml

#bookmark_parse, #define_head, #in_sourcecode, #info, #init_file, #make_body1, #make_body2, #make_body3, #middle, #middle_title, #note?, #parse, #set_termdomain, #smallcap_parse, #text_parse

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, #tfoot_parse, #thead_parse, #tr_parse

Methods included from Function::Section

#annex, #annex_name, #clause, #clause_name, #clause_parse, #clause_parse_title, #external_terms_boilerplate, #foreword, #inline_header_title, #internal_external_terms_boilerplate, #introduction, #scope, #symbols_abbrevs, #symbols_parse, #term_defs_boilerplate, #term_defs_boilerplate_cont, #terms_defs, #terms_defs_title, #terms_parse

Methods included from Function::References

#biblio_list, #bibliography, #bibliography_parse, #date_note_process, #docid_l10n, #format_ref, #iso_bibitem_entry, #iso_bibitem_entry_attrs, #iso_bibitem_ref_code, #iso_title, #noniso_bibitem, #norm_ref, #norm_ref_preface, #prefix_bracketed_ref, #ref_entry_code, #reference_format, #reference_names, #split_bibitems

Methods included from Function::Lists

#dl_parse, #dt_dd?, #dt_parse, #li_parse, #ol_depth, #ol_parse, #ol_style, #ul_parse

Methods included from Function::Inline

#anchor_linkend, #callout_parse, #eref_localities, #eref_parse, #error_parse, #get_linkend, #link_parse, #page_break, #section_break, #stem_parse, #xref_parse

Methods included from Function::I18n

#eref_localities1, #eref_localities1_zh, #i18n_init, l10n

Methods included from Function::Cleanup

#admonition_cleanup, #cleanup, #example_cleanup, #extract_symbols_list, #figure_aside_process, #figure_cleanup, #figure_get_or_make_dl, #footnote_cleanup, #inline_header_cleanup, #merge_fnref_into_fn_text, #new_fullcolspan_row, #remove_bottom_border, #symbol_key, #symbols_cleanup, #table_cleanup, #table_footnote_cleanup, #table_get_or_make_tfoot, #table_note_cleanup

Methods included from Function::Blocks

#admonition_parse, #annotation_parse, #example_div_parse, #example_label, #example_parse, #figure_key, #figure_name_parse, #figure_parse, #formula_parse, #formula_where, #image_parse, #image_title_parse, #note_label, #note_p_parse, #note_parse, #note_parse1, #para_attrs, #para_parse, #quote_attribution, #quote_parse, #sourcecode_name_parse, #sourcecode_parse

Constructor Details

#initialize(options) ⇒ WordConvert

Returns a new instance of WordConvert.



20
21
22
23
24
25
26
27
28
29
# File 'lib/isodoc/iso/word_convert.rb', line 20

def initialize(options)
  super
  @wordstylesheet = generate_css(html_doc_path("wordstyle.scss"), false, default_fonts(options))
  @standardstylesheet = generate_css(html_doc_path("isodoc.scss"), false, default_fonts(options))
  @header = html_doc_path("header.html")
  @wordcoverpage = html_doc_path("word_iso_titlepage.html")
  @wordintropage = html_doc_path("word_iso_intro.html")
  @ulstyle = "l3"
  @olstyle = "l2"
end

Instance Method Details

#colophon(body, docxml) ⇒ Object



46
47
48
49
50
# File 'lib/isodoc/iso/word_convert.rb', line 46

def colophon(body, docxml)
  body.br **{ clear: "all", style: "page-break-before:left;mso-break-type:section-break" }
  body.div **{ class: "colophon" } do |div|
  end
end

#default_fonts(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/isodoc/iso/word_convert.rb', line 5

def default_fonts(options)
  b = options[:bodyfont] ||
    (options[:script] == "Hans" ? '"SimSun",serif' :
     '"Cambria",serif')
  h = options[:headerfont] ||
    (options[:script] == "Hans" ? '"SimHei",sans-serif' :
     '"Cambria",serif')
  m = options[:monospacefont] || '"Courier New",monospace'
  "$bodyfont: #{b};\n$headerfont: #{h};\n$monospacefont: #{m};\n"
end

#html_doc_path(file) ⇒ Object



16
17
18
# File 'lib/isodoc/iso/word_convert.rb', line 16

def html_doc_path(file)
  File.join(File.dirname(__FILE__), File.join("html", file))
end

#implicit_reference(b) ⇒ Object



31
32
33
34
# File 'lib/isodoc/iso/word_convert.rb', line 31

def implicit_reference(b)
  isocode = b.at(ns("./docidentifier")).text
  isocode == "IEV"
end

#make_body(xml, docxml) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/isodoc/iso/word_convert.rb', line 36

def make_body(xml, docxml)
  body_attr = { lang: "EN-US", link: "blue", vlink: "#954F72" }
  xml.body **body_attr do |body|
    make_body1(body, docxml)
    make_body2(body, docxml)
    make_body3(body, docxml)
    colophon(body, docxml)
  end
end