Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Sep 25, 2022
1 parent e3091e2 commit 8779ad4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions lib/relaton/render/general/render.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ def root_initalize(opt)
def i18n_initialize(opt)
@lang = opt["language"]
@script = opt["script"]
@locale = opt["locale"]
@i18n = opt["i18n"] ||
i18n_klass(opt["language"], opt["script"], opt["i18nhash"])
i18n_klass(language: @lang, script: @script, locale: @locale,
i18nhash: opt["i18nhash"])
@edition_ordinal = opt["edition_ordinal"] || @i18n.edition_ordinal
@edition = opt["edition"] || @i18n.edition
@date = opt["date"] || @i18n.get["date_formats"] ||
{ "month_year" => "yMMMM",
"day_month_year" => "to_long_s",
{ "month_year" => "yMMMM", "day_month_year" => "to_long_s",
"date_time" => "to_long_s" }
end

Expand Down Expand Up @@ -99,8 +100,9 @@ def default_template
"{{creatornames}}. {{title}}. {{date}}."
end

def i18n_klass(lang = "en", script = "Latn", i18nhash = nil)
::IsoDoc::RelatonRenderI18n.new(lang, script, i18nhash: i18nhash)
def i18n_klass(language: "en", script: "Latn", locale: nil, i18nhash: nil)
::IsoDoc::RelatonRenderI18n.new(language, script, locale: locale,
i18nhash: i18nhash)
end

def render(bib, embedded: false)
Expand Down
2 changes: 1 addition & 1 deletion relaton-render.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "simplecov"

spec.add_dependency "isodoc-i18n"
spec.add_dependency "isodoc-i18n", "~> 1.1.0"
spec.add_dependency "liquid", "~> 4"
spec.add_dependency "nokogiri"
spec.add_dependency "relaton-bib", ">= 1.13.0"
Expand Down
2 changes: 1 addition & 1 deletion spec/i18n_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

it "renders incollection, two authors, with French internationalisation" do
output = <<~OUTPUT
<formattedref>RAMSEY, J. K. et W. C. MCGREW. Object play in great apes: Studies in nature and captivity. Dans: PELLEGRINI, Anthony D. et Peter Kenneth SMITH (éd.): <em>The nature of play: Great apes and humans</em> [electronic resource, 8vo]. 3e édition. New York, NY: Guilford Press. 2005. p. 89–112. [vu: 3 septembre 2019].</formattedref>
<formattedref>RAMSEY, J. K. et W. C. MCGREW. Object play in great apes : Studies in nature and captivity. Dans : PELLEGRINI, Anthony D. et Peter Kenneth SMITH (éd.): <em>The nature of play : Great apes and humans</em> [electronic resource, 8vo]. 3e édition. New York, NY : Guilford Press. 2005. p. 89–112. [vu : 3 septembre 2019].</formattedref>
OUTPUT
p = Relaton::Render::General.new(language: "fr")
expect(HTMLEntities.new.decode(p.render(input)))
Expand Down

0 comments on commit 8779ad4

Please sign in to comment.