lib/isodoc/ieee/word_authority.rb in metanorma-ieee-1.1.2 vs lib/isodoc/ieee/word_authority.rb in metanorma-ieee-1.1.3

- old
+ new

@@ -69,33 +69,32 @@ BREAK def officemember_style(docxml) docxml.xpath("//p[@type = 'officemember' or @type = 'officeorgmember']") .each do |p| - p["class"] = "IEEEStdsNamesList" + p["class"] = stylesmap[:nameslist] end docxml.xpath("//p[@type = 'emeritus_sign']").each do |p| p["class"] = "IEEEStdsParaMemEmeritus" end end def officeorgrep_style(docxml) docxml.xpath("//p[@type = 'officeorgrepmemberhdr']").each do |p| - p["class"] = "IEEEStdsNamesList" + p["class"] = stylesmap[:nameslist] p["style"] = "margin-bottom:6.0pt;tab-stops:right 432.0pt;" end docxml.xpath("//p[@type = 'officeorgrepmember']").each do |p| - p["class"] = "IEEEStdsNamesList" + p["class"] = stylesmap[:nameslist] p["style"] = "margin-top:6.0pt;tab-stops:right dotted 432.0pt;" end end def three_column_officemembers(div) - return unless div - + div or return ret = three_column_officemembers_split(div) three_column_officemembers_render(div, ret) end def three_column_officemembers_split(div) @@ -126,10 +125,11 @@ end t.replace(t.at(".//tbody").elements) end end + # STYLE def feedback_table1(trow) trow.name = "p" trow["class"] = "IEEEStdsCRTextReg" trow.xpath("./td").each do |td| td.next_element and td << "<span style='mso-tab-count:1'> </span>" @@ -147,10 +147,11 @@ end feedback_style1(div, i) end end + # STYLE def feedback_style1(div, idx) div.xpath(".//p").each_with_index do |p, j| p["class"] = idx == 4 ? "IEEEStdsCRTextItal" : "IEEEStdsCRTextReg" j.zero? && idx.zero? and p.children.first.previous = @@ -158,22 +159,22 @@ end end def authority_cleanup1(docxml, klass) dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']") - auth = docxml.at("//div[@id = 'boilerplate-#{klass}' "\ + auth = docxml.at("//div[@id = 'boilerplate-#{klass}' " \ "or @class = 'boilerplate-#{klass}']") auth&.xpath(".//h1[not(text())] | .//h2[not(text())]")&.each(&:remove) authority_cleanup_hdr(auth) dest and auth and dest.replace(auth.remove) end def authority_cleanup_hdr(auth) (1..2).each do |i| auth&.xpath(".//h#{i}")&.each do |h| h.name = "p" - h["class"] = "IEEEStdsLevel#{i}frontmatter" + h["class"] = "level#{i}frontmatter" end end end def abstract_cleanup(docxml) @@ -189,22 +190,22 @@ end def abstract_cleanup1(source, dest) source.elements.reject { |e| %w(h1 h2).include?(e.name) }.each do |e| e1 = e.dup - e1.xpath(".//p").each do |p| + e1.xpath("self::p | .//p").each do |p| + p["class"] = stylesmap[:abstract] p["style"] ||= "" - p["style"] = 'font-family: "Arial", sans-serif;' + p["style"] + p["style"] = "font-family: 'Arial', sans-serif;#{p['style']}" end - %w(ul ol).include?(e1.name) or e1["class"] = "IEEEStdsAbstractBody" - dest << e1 + dest and dest << e1 end end def abstract_header(dest) dest.elements.first.children.first.previous = - "<span class='IEEEStdsAbstractHeader'><span lang='EN-US'>"\ + "<span class='IEEEStdsAbstractHeader'><span lang='EN-US'>" \ "Abstract:</span></span> " end def introduction_cleanup(docxml) dest = docxml.at("div[@id = 'introduction-destination']") or return @@ -219,10 +220,10 @@ docxml = intro.document intro.previous_element.remove dest.replace(intro.remove) i = docxml.at("//h1[@class = 'IntroTitle']") if i.next_element.name == "div" && - i.next_element["class"] == "IEEEStdsIntroduction" + i.next_element["class"] == stylesmap[:intro] i.next_element.name = "p" end end end end