Skip to content

Commit

Permalink
Merge pull request #411 from metanorma/fix/fonts-manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis authored Aug 13, 2024
2 parents f17fe59 + 483ae4c commit 00fbded
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
3 changes: 3 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gem "metanorma-generic", git: "https://github.com/metanorma/metanorma-generic", branch: "fix/customize_filepaths"
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "main"

17 changes: 8 additions & 9 deletions lib/isodoc/bipm/pdf_convert.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
require "isodoc"
require "metanorma-generic"
require_relative "base_convert"

module IsoDoc
module BIPM
# A {Converter} implementation that generates PDF HTML output, and a
# document schema encapsulation of the document for validation
class PdfConvert < IsoDoc::XslfoPdfConvert
class PdfConvert < IsoDoc::Generic::PdfConvert
def initialize(options)
@libdir = File.dirname(__FILE__)
super
end

def configuration
Metanorma::BIPM.configuration
@libdir = File.dirname(__FILE__)
end

def pdf_stylesheet(docxml)
docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))
&.value == "JCGM" and
&.value == "JCGM" and
return "jcgm.standard.xsl"

doctype = @doctype
Expand All @@ -37,6 +33,9 @@ def pdf_options(docxml)
end
super
end

include Init
include BaseConvert
end
end
end
2 changes: 1 addition & 1 deletion metanorma-bipm.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")

spec.add_dependency "metanorma-generic", "~> 2.6.2"
spec.add_dependency "metanorma-generic", "~> 2.7.0"
spec.add_dependency "metanorma-iso", "~> 2.8.0"

spec.add_development_dependency "debug"
Expand Down
24 changes: 15 additions & 9 deletions spec/isodoc/html_convert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@
</body>
OUTPUT
stripped_presxml =
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert.new(presxml_options)
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true)))
stripped_html = Xml::C14n.format(strip_guid(IsoDoc::BIPM::HtmlConvert.new({})
.convert("test", presxml, true)
Expand Down Expand Up @@ -247,7 +248,8 @@
OUTPUT

stripped_presxml =
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert.new(presxml_options)
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true)
.gsub(%r{<localized-strings>.*</localized-strings>}m, "")))
stripped_html = Xml::C14n.format(strip_guid(IsoDoc::BIPM::HtmlConvert.new({})
Expand Down Expand Up @@ -362,7 +364,8 @@
OUTPUT

stripped_presxml =
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert.new(presxml_options)
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true)
.gsub(%r{<localized-strings>.*</localized-strings>}m, "")))
stripped_html = Xml::C14n.format(strip_guid(IsoDoc::BIPM::HtmlConvert.new({})
Expand All @@ -388,8 +391,8 @@
</bipm-standard>
OUTPUT

expect(Xml::C14n.format(strip_guid(Asciidoctor.convert(input, backend: :bipm,
header_footer: true))))
expect(Xml::C14n.format(strip_guid(Asciidoctor
.convert(input, backend: :bipm, header_footer: true))))
.to be_equivalent_to output
html = File.read("test.html", encoding: "utf-8")
expect(html).to match(%r{jquery\.min\.js})
Expand Down Expand Up @@ -796,7 +799,8 @@
OUTPUT

stripped_html =
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert.new(presxml_options)
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true)
.gsub(%r{<localized-strings>.*</localized-strings>}m, "")))
expect(stripped_html).to(be_equivalent_to(presxml))
Expand Down Expand Up @@ -1014,7 +1018,8 @@
HTML

stripped_html =
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert.new(presxml_options)
Xml::C14n.format(strip_guid(IsoDoc::BIPM::PresentationXMLConvert
.new(presxml_options)
.convert("test", input, true)
.gsub(%r{<localized-strings>.*</localized-strings>}m, "")))
expect(stripped_html).to(be_equivalent_to(Xml::C14n.format(presxml)))
Expand Down Expand Up @@ -1089,7 +1094,7 @@
INPUT

output = <<~OUTPUT
<body lang="EN-US" link="blue" vlink="#954F72" xml:lang="EN-US" class="container">
<body lang="EN-US" link="blue" vlink="#954F72" xml:lang="EN-US" class="container">
<div class="title-section">
<p> </p>
</div>
Expand Down Expand Up @@ -1176,7 +1181,8 @@
expect(Xml::C14n.format(strip_guid(IsoDoc::BIPM::HtmlConvert.new({})
.convert("test", input, true)
.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*}m, "</body>")))).to be_equivalent_to Xml::C14n.format(output)
.gsub(%r{</body>.*}m, "</body>"))))
.to be_equivalent_to Xml::C14n.format(output)
end

it "generates an index in English" do
Expand Down
2 changes: 1 addition & 1 deletion spec/isodoc/metadata_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "spec_helper"

gem_lib = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "lib"))
logoloc = File.join(gem_lib, "metanorma", "..", "..", "lib", "isodoc", "bipm",
logoloc = File.join(gem_lib, "isodoc", "bipm",
"html")
logoloc1 = File.join(gem_lib, "isodoc", "bipm", "html")

Expand Down

0 comments on commit 00fbded

Please sign in to comment.