Skip to content

Commit

Permalink
version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jan 24, 2023
1 parent 6ca2d7b commit 1c8d731
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 48 deletions.
2 changes: 1 addition & 1 deletion lib/metanorma/csa/biblio.rng
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@
<value>commentaryOf</value>
<value>hasCommentary</value>
<value>related</value>
<value>complements</value>
<value>hasComplement</value>
<value>complementOf</value>
<value>obsoletes</value>
<value>obsoletedBy</value>
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/csa/isodoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@
</element>
</define>
<define name="misccontainer">
<element name="misc-container">
<element name="metanorma-extension">
<oneOrMore>
<ref name="AnyElement"/>
</oneOrMore>
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/csa/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module Csa
VERSION = "2.2.2".freeze
VERSION = "2.2.3".freeze
end
end
99 changes: 54 additions & 45 deletions spec/isodoc/csaconvert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RSpec.describe IsoDoc::Csa do
it "processes default metadata" do
csdc = IsoDoc::Csa::HtmlConvert.new({})
docxml, filename, dir = csdc.convert_init(<<~"INPUT", "test", true)
docxml, _filename, _dir = csdc.convert_init(<<~"INPUT", "test", true)
<csa-standard xmlns="https://open.ribose.com/standards/csa">
<bibdata type="standard">
<title language="en" format="plain">Main Title</title>
Expand Down Expand Up @@ -74,47 +74,49 @@
</csa-standard>
INPUT

expect(htmlencode(metadata(csdc.info(docxml, nil)).to_s.gsub(/, :/, ",\n:"))).to be_equivalent_to (<<~OUTPUT)
{:accesseddate=>"XXX",
:agency=>"Ribose",
:authors=>["Fred Nerk", "Julius Caesar"],
:authors_affiliations=>{""=>["Fred Nerk", "Julius Caesar"]},
:circulateddate=>"XXX",
:confirmeddate=>"XXX",
:copieddate=>"XXX",
:createddate=>"XXX",
:docnumber=>"1000(wd)",
:docnumeric=>"1000",
:doctitle=>"Main Title",
:doctype=>"Standard",
:doctype_display=>"Standard",
:docyear=>"2001",
:draft=>"3.4",
:draftinfo=>" (draft 3.4, 2000-01-01)",
:edition=>"2",
:implementeddate=>"XXX",
:issueddate=>"XXX",
:lang=>"en",
:metadata_extensions=>{"doctype"=>"standard", "editorialgroup"=>{"committee_type"=>"A", "committee"=>"TC"}},
:obsoleteddate=>"XXX",
:publisheddate=>"XXX",
:publisher=>"Ribose",
:receiveddate=>"XXX",
:revdate=>"2000-01-01",
:revdate_monthyear=>"January 2000",
:roles_authors_affiliations=>{"editor"=>{""=>["Julius Caesar"]}, "full-author"=>{""=>["Fred Nerk"]}},
:script=>"Latn",
:stage=>"Working Draft",
:stage_display=>"Working Draft",
:stageabbr=>"wd",
:tc=>"TC",
:transmitteddate=>"XXX",
:unchangeddate=>"XXX",
:unpublished=>true,
:updateddate=>"XXX",
:vote_endeddate=>"XXX",
:vote_starteddate=>"XXX"}
OUTPUT
expect(htmlencode(metadata(csdc.info(docxml, nil))
.to_s.gsub(/, :/, ",\n:")))
.to be_equivalent_to (<<~OUTPUT)
{:accesseddate=>"XXX",
:agency=>"Ribose",
:authors=>["Fred Nerk", "Julius Caesar"],
:authors_affiliations=>{""=>["Fred Nerk", "Julius Caesar"]},
:circulateddate=>"XXX",
:confirmeddate=>"XXX",
:copieddate=>"XXX",
:createddate=>"XXX",
:docnumber=>"1000(wd)",
:docnumeric=>"1000",
:doctitle=>"Main Title",
:doctype=>"Standard",
:doctype_display=>"Standard",
:docyear=>"2001",
:draft=>"3.4",
:draftinfo=>" (draft 3.4, 2000-01-01)",
:edition=>"2",
:implementeddate=>"XXX",
:issueddate=>"XXX",
:lang=>"en",
:metadata_extensions=>{"doctype"=>"standard", "editorialgroup"=>{"committee_type"=>"A", "committee"=>"TC"}},
:obsoleteddate=>"XXX",
:publisheddate=>"XXX",
:publisher=>"Ribose",
:receiveddate=>"XXX",
:revdate=>"2000-01-01",
:revdate_monthyear=>"January 2000",
:roles_authors_affiliations=>{"editor"=>{""=>["Julius Caesar"]}, "full-author"=>{""=>["Fred Nerk"]}},
:script=>"Latn",
:stage=>"Working Draft",
:stage_display=>"Working Draft",
:stageabbr=>"wd",
:tc=>"TC",
:transmitteddate=>"XXX",
:unchangeddate=>"XXX",
:unpublished=>true,
:updateddate=>"XXX",
:vote_endeddate=>"XXX",
:vote_starteddate=>"XXX"}
OUTPUT
end

it "processes pre" do
Expand Down Expand Up @@ -204,12 +206,16 @@
</div>
</body>
OUTPUT
expect(xmlpp(IsoDoc::Csa::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
expect(xmlpp(IsoDoc::Csa::HtmlConvert.new({}).convert("test", presxml, true).gsub(/^.*<body/m, "<body").gsub(%r{</body>.*}m, "</body>"))).to be_equivalent_to xmlpp(html)
expect(xmlpp(IsoDoc::Csa::PresentationXMLConvert.new(presxml_options)
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
expect(xmlpp(IsoDoc::Csa::HtmlConvert.new({})
.convert("test", presxml, true)
.gsub(/^.*<body/m, "<body")
.gsub(%r{</body>.*}m, "</body>"))).to be_equivalent_to xmlpp(html)
end

it "processes section names" do
expect(xmlpp(IsoDoc::Csa::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
input = <<~INPUT
<csa-standard xmlns="http://riboseinc.com/isoxml">
<preface>
<foreword obligation="informative">
Expand Down Expand Up @@ -276,6 +282,7 @@
</bibliography>
</csa-standard>
INPUT
output = <<~OUTPUT
<csa-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<preface>
<foreword obligation="informative" displayorder="1">
Expand Down Expand Up @@ -340,6 +347,8 @@
</bibliography>
</csa-standard>
OUTPUT
expect(xmlpp(IsoDoc::Csa::PresentationXMLConvert.new(presxml_options)
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
end

it "injects JS into blank html" do
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def metadata(xml)
end
end

def presxml_options
{ semanticxmlinsert: "false" }
end

def htmlencode(xml)
HTMLEntities.new.encode(xml, :hexadecimal).gsub(/&#x3e;/, ">").gsub(/&#xa;/, "\n")
.gsub(/&#x22;/, '"').gsub(/&#x3c;/, "<").gsub(/&#x26;/, "&").gsub(/&#x27;/, "'")
Expand Down

0 comments on commit 1c8d731

Please sign in to comment.