Skip to content

Commit

Permalink
Merge pull request #957 from metanorma/fix/i18nyaml_path
Browse files Browse the repository at this point in the history
relative path fix for i18nyaml attribute: https://github.com/metanorm…
  • Loading branch information
opoudjis authored Jan 9, 2025
2 parents 635a5fc + 0de9b8d commit 963ed1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
10 changes: 6 additions & 4 deletions lib/metanorma/standoc/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Base
def init(node)
init_vars
init_misc(node)
init_processing(node)
init_processing(node) # feeds init_i18n
init_log(node)
init_image(node)
init_reqt(node)
Expand Down Expand Up @@ -39,12 +39,13 @@ def init_misc(node)
@embed_hdr = node.attr("embed_hdr")
@embed_id = node.attr("embed_id")
@document_scheme = document_scheme(node)
@xrefstyle = node.attr("xrefstyle")
@source_linenums = node.attr("source-linenums-option") == "true"
@default_doctype = "standard"
end

def init_processing(node)
@localdir = Metanorma::Utils::localdir(node)
@xrefstyle = node.attr("xrefstyle")
@novalid = node.attr("novalid")
@smartquotes = node.attr("smartquotes") != "false"
@sourcecode_markup_start = node.attr("sourcecode-markup-start") || "{{{"
Expand Down Expand Up @@ -100,7 +101,6 @@ def init_output(node)
File.basename(node.attr("docfile"))&.gsub(/\.adoc$/, "")
else ""
end
@localdir = Metanorma::Utils::localdir(node)
@output_dir = outputdir node
end

Expand All @@ -109,7 +109,9 @@ def init_i18n(node)
@script = node.attr("script") ||
Metanorma::Utils.default_script(node.attr("language"))
@locale = node.attr("locale")
@isodoc = isodoc(@lang, @script, @locale, node.attr("i18nyaml"))
i18nyaml = node.attr("i18nyaml")
i18nyaml &&= File.join(@localdir, i18nyaml)
@isodoc = isodoc(@lang, @script, @locale, i18nyaml)
@i18n = @isodoc.i18n
end

Expand Down
8 changes: 6 additions & 2 deletions lib/metanorma/standoc/render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ module Metanorma
module Standoc
module Base
def html_extract_attributes(node)
i18nyaml = node.attr("i18nyaml")
i18nyaml &&= File.join(@localdir, i18nyaml)
{
script: node.attr("script"),
bodyfont: node.attr("body-font"),
headerfont: node.attr("header-font"),
monospacefont: node.attr("monospace-font"),
i18nyaml: node.attr("i18nyaml"),
i18nyaml: i18nyaml,
scope: node.attr("scope"),
htmlstylesheet: node.attr("htmlstylesheet"),
htmlstylesheet_override: node.attr("htmlstylesheet-override"),
Expand Down Expand Up @@ -48,12 +50,14 @@ def pdf_converter(node)
end

def doc_extract_attributes(node)
i18nyaml = node.attr("i18nyaml")
i18nyaml &&= File.join(@localdir, i18nyaml)
attrs = {
script: node.attr("script"),
bodyfont: node.attr("body-font"),
headerfont: node.attr("header-font"),
monospacefont: node.attr("monospace-font"),
i18nyaml: node.attr("i18nyaml"),
i18nyaml: i18nyaml,
scope: node.attr("scope"),
wordstylesheet: node.attr("wordstylesheet"),
wordstylesheet_override: node.attr("wordstylesheet-override"),
Expand Down

0 comments on commit 963ed1f

Please sign in to comment.