metanorma / pubid-iso

Implementation of ISO pubid
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Slash added without stage abbreviation #146

Closed andrew2net closed 1 year ago

andrew2net commented 1 year ago

It seems for some harmonized codes (95.99 in this case) abbreviation isn't rendered but a slash is added.

> pubid = Pubid::Iso::Identifier.parse_from_title("ISO 19115-1:2014 Geographic information \u2014 Metadata \u2014 Part 1: Fundamentals")
#<Pubid::Iso::Identifier:0x00007fd47443fa58 @publisher="ISO", @number="19115"@4, @year=2014, @part="1">

> pubid.to_s
"ISO 19115-1:2014"

> pubid.stage = Pubid::Iso::Stage.new(harmonized_code: "95.99")
#<Pubid::Iso::Stage:0x00007fd4772456c8 @abbr=nil, @harmonized_code=#<Pubid::Iso::HarmonizedStageCode:0x00007fd477245560 @substage="99", @stage="95">>

> pubid.to_s
"ISO/ 19115-1:2014"
ronaldtse commented 1 year ago

Thanks @andrew2net , this is a bug indeed.

ronaldtse commented 1 year ago

This is fixed.

irb(main):007:0> pubid = Pubid::Iso::Identifier.parse_from_title("ISO 19115-1:2014 Geographic information \u2014 Metadata \u2014 Part 1: Fundamentals")
=> #<Pubid::Iso::Identifier::InternationalStandard:0x000000010935b178 @number="19115"@4, @part="1", @publisher="ISO", @year=2014>
irb(main):008:0> pubid.to_s
=> "ISO 19115-1:2014"
irb(main):009:0> pubid.stage = Pubid::Iso::Stage.new(harmonized_code: "95.99")
irb(main):010:0> pubid.to_s
=> "ISO 19115-1:2014"
irb(main):011:0>