pubid 2.0.0.pre.alpha.8 → 2.0.0.pre.alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/data/bipm/update_codes.yaml +9 -0
- data/data/iec/update_codes.yaml +3 -0
- data/data/ieee/update_codes.yaml +107 -1
- data/data/nist/series.yaml +155 -0
- data/data/nist/update_codes.yaml +8 -0
- data/lib/pubid/adobe/builder.rb +52 -0
- data/lib/pubid/adobe/identifier.rb +49 -0
- data/lib/pubid/adobe/identifiers/publication.rb +31 -0
- data/lib/pubid/adobe/identifiers/tech_note.rb +32 -0
- data/lib/pubid/adobe/identifiers.rb +10 -0
- data/lib/pubid/adobe/parser.rb +128 -0
- data/lib/pubid/adobe/renderer.rb +39 -0
- data/lib/pubid/adobe/urn_generator.rb +42 -0
- data/lib/pubid/adobe/urn_parser.rb +69 -0
- data/lib/pubid/adobe.rb +60 -0
- data/lib/pubid/amca/builder.rb +2 -2
- data/lib/pubid/amca/identifier.rb +1 -3
- data/lib/pubid/amca/identifiers/base.rb +1 -6
- data/lib/pubid/amca/identifiers/interpretation.rb +1 -1
- data/lib/pubid/amca/identifiers/publication.rb +1 -1
- data/lib/pubid/amca/identifiers/standard.rb +1 -1
- data/lib/pubid/amca/identifiers.rb +0 -1
- data/lib/pubid/amca/single_identifier.rb +1 -1
- data/lib/pubid/amca.rb +3 -3
- data/lib/pubid/ashrae/builder.rb +22 -22
- data/lib/pubid/ashrae/identifier.rb +3 -4
- data/lib/pubid/ashrae/identifiers/addenda_package.rb +1 -1
- data/lib/pubid/ashrae/identifiers/addendum.rb +1 -1
- data/lib/pubid/ashrae/identifiers/base.rb +14 -8
- data/lib/pubid/ashrae/identifiers/combined_addenda.rb +1 -1
- data/lib/pubid/ashrae/identifiers.rb +0 -1
- data/lib/pubid/ashrae/parser.rb +14 -9
- data/lib/pubid/ashrae/renderer.rb +19 -19
- data/lib/pubid/ashrae/single_identifier.rb +1 -1
- data/lib/pubid/ashrae/supplement_identifier.rb +6 -6
- data/lib/pubid/ashrae.rb +3 -3
- data/lib/pubid/bipm/builder.rb +107 -0
- data/lib/pubid/bipm/identifier.rb +160 -0
- data/lib/pubid/bipm/identifiers/committee_document.rb +24 -0
- data/lib/pubid/bipm/identifiers/guide.rb +24 -0
- data/lib/pubid/bipm/identifiers/meeting.rb +41 -0
- data/lib/pubid/bipm/identifiers/mep.rb +21 -0
- data/lib/pubid/bipm/identifiers/metrologia_article.rb +24 -0
- data/lib/pubid/bipm/identifiers/si_brochure.rb +20 -0
- data/lib/pubid/bipm/identifiers.rb +15 -0
- data/lib/pubid/bipm/parser.rb +184 -0
- data/lib/pubid/bipm/renderer.rb +110 -0
- data/lib/pubid/bipm/urn_generator.rb +58 -0
- data/lib/pubid/bipm/urn_parser.rb +52 -0
- data/lib/pubid/bipm.rb +86 -0
- data/lib/pubid/bsi/builder.rb +14 -14
- data/lib/pubid/bsi/identifier.rb +0 -1
- data/lib/pubid/bsi/identifiers/addendum_document.rb +2 -2
- data/lib/pubid/bsi/identifiers/amendment.rb +4 -4
- data/lib/pubid/bsi/identifiers/consolidated_identifier.rb +6 -0
- data/lib/pubid/bsi/identifiers/corrigendum.rb +4 -4
- data/lib/pubid/bsi/identifiers/expert_commentary.rb +5 -5
- data/lib/pubid/bsi/identifiers/supplement_document.rb +2 -2
- data/lib/pubid/bsi/identifiers/value_added_publication.rb +6 -6
- data/lib/pubid/bsi/renderer.rb +8 -8
- data/lib/pubid/bsi/single_identifier.rb +48 -0
- data/lib/pubid/builder/base.rb +5 -3
- data/lib/pubid/bundled_identifier.rb +3 -3
- data/lib/pubid/calconnect/builder.rb +38 -0
- data/lib/pubid/calconnect/identifier.rb +117 -0
- data/lib/pubid/calconnect/identifiers/standard.rb +29 -0
- data/lib/pubid/calconnect/identifiers.rb +9 -0
- data/lib/pubid/calconnect/parser.rb +54 -0
- data/lib/pubid/calconnect/renderer.rb +36 -0
- data/lib/pubid/calconnect/urn_generator.rb +33 -0
- data/lib/pubid/calconnect/urn_parser.rb +34 -0
- data/lib/pubid/calconnect.rb +77 -0
- data/lib/pubid/ccsds/builder.rb +1 -1
- data/lib/pubid/ccsds/identifier.rb +1 -1
- data/lib/pubid/ccsds/identifiers/corrigendum.rb +2 -2
- data/lib/pubid/ccsds/supplement_identifier.rb +6 -6
- data/lib/pubid/ccsds/urn_generator.rb +3 -3
- data/lib/pubid/cen_cenelec/builder.rb +46 -12
- data/lib/pubid/cen_cenelec/identifiers/amendment.rb +2 -2
- data/lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb +6 -0
- data/lib/pubid/cen_cenelec/identifiers/corrigendum.rb +2 -2
- data/lib/pubid/cen_cenelec/identifiers/european_norm.rb +60 -3
- data/lib/pubid/cen_cenelec/identifiers/fragment.rb +2 -2
- data/lib/pubid/cen_cenelec/renderer.rb +5 -5
- data/lib/pubid/cen_cenelec/supplement_identifier.rb +5 -5
- data/lib/pubid/cen_cenelec/urn_generator.rb +1 -1
- data/lib/pubid/cen_cenelec.rb +76 -72
- data/lib/pubid/cie/builder.rb +139 -24
- data/lib/pubid/cie/identifier.rb +7 -3
- data/lib/pubid/cie/identifiers/bundle.rb +32 -4
- data/lib/pubid/cie/identifiers/code_attributes.rb +52 -0
- data/lib/pubid/cie/identifiers/conference.rb +9 -4
- data/lib/pubid/cie/identifiers/corrigendum.rb +17 -23
- data/lib/pubid/cie/identifiers/dual_published.rb +4 -4
- data/lib/pubid/cie/identifiers/identical.rb +7 -7
- data/lib/pubid/cie/identifiers/joint_published.rb +8 -8
- data/lib/pubid/cie/identifiers/proceedings.rb +39 -0
- data/lib/pubid/cie/identifiers/standard.rb +33 -7
- data/lib/pubid/cie/identifiers/supplement.rb +24 -22
- data/lib/pubid/cie/identifiers/tutorial_bundle.rb +6 -2
- data/lib/pubid/cie/identifiers.rb +2 -0
- data/lib/pubid/cie/parser.rb +54 -5
- data/lib/pubid/cie/single_identifier.rb +40 -1
- data/lib/pubid/cie/supplement_identifier.rb +29 -16
- data/lib/pubid/cie/urn_generator.rb +11 -8
- data/lib/pubid/cie.rb +0 -1
- data/lib/pubid/components/date.rb +21 -5
- data/lib/pubid/csa/builder.rb +1 -1
- data/lib/pubid/csa/composite_identifier.rb +17 -1
- data/lib/pubid/csa/identifier.rb +48 -3
- data/lib/pubid/csa/identifiers/bundled.rb +6 -0
- data/lib/pubid/csa/identifiers/combined.rb +6 -0
- data/lib/pubid/csa/identifiers/package.rb +2 -2
- data/lib/pubid/csa/parser.rb +6 -6
- data/lib/pubid/csa/wrapper_identifier.rb +17 -0
- data/lib/pubid/doi/builder.rb +18 -0
- data/lib/pubid/doi/identifier.rb +46 -0
- data/lib/pubid/doi/identifiers/resource.rb +30 -0
- data/lib/pubid/doi/identifiers.rb +9 -0
- data/lib/pubid/doi/parser.rb +52 -0
- data/lib/pubid/doi/renderer.rb +13 -0
- data/lib/pubid/doi.rb +55 -0
- data/lib/pubid/easc/builder.rb +55 -0
- data/lib/pubid/easc/identifier.rb +61 -0
- data/lib/pubid/easc/identifiers/pmg.rb +20 -0
- data/lib/pubid/easc/identifiers/rmg.rb +19 -0
- data/lib/pubid/easc/identifiers.rb +10 -0
- data/lib/pubid/easc/parser.rb +80 -0
- data/lib/pubid/easc/renderer.rb +48 -0
- data/lib/pubid/easc/urn_generator.rb +46 -0
- data/lib/pubid/easc/urn_parser.rb +57 -0
- data/lib/pubid/easc.rb +52 -0
- data/lib/pubid/ecma/builder.rb +31 -0
- data/lib/pubid/ecma/identifier.rb +76 -0
- data/lib/pubid/ecma/identifiers/memento.rb +30 -0
- data/lib/pubid/ecma/identifiers/standard.rb +31 -0
- data/lib/pubid/ecma/identifiers/technical_report.rb +31 -0
- data/lib/pubid/ecma/identifiers.rb +11 -0
- data/lib/pubid/ecma/parser.rb +41 -0
- data/lib/pubid/ecma/renderer.rb +46 -0
- data/lib/pubid/ecma/urn_generator.rb +25 -0
- data/lib/pubid/ecma/urn_parser.rb +35 -0
- data/lib/pubid/ecma.rb +67 -0
- data/lib/pubid/etsi/builder.rb +7 -3
- data/lib/pubid/etsi/identifier.rb +1 -3
- data/lib/pubid/etsi/identifiers/base.rb +28 -10
- data/lib/pubid/etsi/identifiers/etsi_standard.rb +128 -4
- data/lib/pubid/etsi/identifiers/supplement_identifier.rb +35 -3
- data/lib/pubid/etsi/identifiers.rb +0 -1
- data/lib/pubid/etsi/parser.rb +8 -2
- data/lib/pubid/etsi/renderer.rb +8 -2
- data/lib/pubid/etsi.rb +5 -5
- data/lib/pubid/export/exporter.rb +2 -1
- data/lib/pubid/export/flavor_exporter.rb +18 -3
- data/lib/pubid/gb/builder.rb +45 -0
- data/lib/pubid/gb/identifier.rb +64 -0
- data/lib/pubid/gb/identifiers/standard.rb +34 -0
- data/lib/pubid/gb/identifiers.rb +9 -0
- data/lib/pubid/gb/parser.rb +63 -0
- data/lib/pubid/gb/renderer.rb +35 -0
- data/lib/pubid/gb.rb +87 -0
- data/lib/pubid/gost/builder.rb +148 -0
- data/lib/pubid/gost/identifier.rb +49 -0
- data/lib/pubid/gost/identifiers/foreign_reference.rb +25 -0
- data/lib/pubid/gost/identifiers/harmonized.rb +39 -0
- data/lib/pubid/gost/identifiers/identical_adoption.rb +39 -0
- data/lib/pubid/gost/identifiers/interstate_standard.rb +20 -0
- data/lib/pubid/gost/identifiers/national_standard.rb +19 -0
- data/lib/pubid/gost/identifiers.rb +13 -0
- data/lib/pubid/gost/parser.rb +97 -0
- data/lib/pubid/gost/renderer.rb +48 -0
- data/lib/pubid/gost/urn_generator.rb +46 -0
- data/lib/pubid/gost/urn_parser.rb +52 -0
- data/lib/pubid/gost.rb +49 -0
- data/lib/pubid/iala/builder.rb +22 -27
- data/lib/pubid/iala/identifier.rb +27 -2
- data/lib/pubid/iala/identifiers/advice.rb +1 -1
- data/lib/pubid/iala/identifiers/annex.rb +10 -10
- data/lib/pubid/iala/identifiers/general_assembly.rb +5 -2
- data/lib/pubid/iala/identifiers/guideline.rb +3 -1
- data/lib/pubid/iala/identifiers/letter.rb +1 -1
- data/lib/pubid/iala/identifiers/manual.rb +3 -1
- data/lib/pubid/iala/identifiers/model_course.rb +3 -1
- data/lib/pubid/iala/identifiers/recommendation.rb +3 -1
- data/lib/pubid/iala/identifiers/report.rb +1 -1
- data/lib/pubid/iala/identifiers/resolution.rb +1 -1
- data/lib/pubid/iala/identifiers/standard.rb +3 -1
- data/lib/pubid/iala/identifiers.rb +0 -1
- data/lib/pubid/iala/renderer.rb +1 -1
- data/lib/pubid/iala/urn_generator.rb +1 -1
- data/lib/pubid/iala/urn_parser.rb +19 -2
- data/lib/pubid/iala.rb +4 -4
- data/lib/pubid/iana/builder.rb +20 -0
- data/lib/pubid/iana/identifier.rb +72 -0
- data/lib/pubid/iana/identifiers/registry.rb +33 -0
- data/lib/pubid/iana/identifiers.rb +9 -0
- data/lib/pubid/iana/parser.rb +38 -0
- data/lib/pubid/iana/renderer.rb +29 -0
- data/lib/pubid/iana/urn_generator.rb +15 -0
- data/lib/pubid/iana/urn_parser.rb +24 -0
- data/lib/pubid/iana.rb +69 -0
- data/lib/pubid/identifier.rb +210 -23
- data/lib/pubid/idf/builder.rb +1 -1
- data/lib/pubid/idf/parser.rb +2 -2
- data/lib/pubid/idf/renderer.rb +1 -1
- data/lib/pubid/idf/supplement_identifier.rb +3 -3
- data/lib/pubid/iec/builder.rb +35 -25
- data/lib/pubid/iec/identifier.rb +47 -2
- data/lib/pubid/iec/identifiers/base.rb +2 -2
- data/lib/pubid/iec/identifiers/consolidated_identifier.rb +6 -0
- data/lib/pubid/iec/identifiers/fragment_identifier.rb +11 -11
- data/lib/pubid/iec/identifiers/international_standard.rb +8 -5
- data/lib/pubid/iec/identifiers/sheet_identifier.rb +12 -12
- data/lib/pubid/iec/identifiers/technical_group.rb +30 -0
- data/lib/pubid/iec/identifiers/technical_report.rb +1 -1
- data/lib/pubid/iec/identifiers/technical_specification.rb +1 -1
- data/lib/pubid/iec/identifiers/vap_identifier.rb +12 -12
- data/lib/pubid/iec/identifiers.rb +1 -0
- data/lib/pubid/iec/parser.rb +51 -10
- data/lib/pubid/iec/renderer.rb +18 -8
- data/lib/pubid/iec/single_identifier.rb +1 -1
- data/lib/pubid/iec/supplement_identifier.rb +32 -19
- data/lib/pubid/iec.rb +1 -6
- data/lib/pubid/ieee/aiee/builder.rb +17 -3
- data/lib/pubid/ieee/aiee/identifier.rb +45 -61
- data/lib/pubid/ieee/builder.rb +341 -68
- data/lib/pubid/ieee/compaction.rb +121 -0
- data/lib/pubid/ieee/components/draft.rb +47 -7
- data/lib/pubid/ieee/identifier.rb +1 -3
- data/lib/pubid/ieee/identifiers/adopted_standard.rb +30 -5
- data/lib/pubid/ieee/identifiers/amendment.rb +40 -0
- data/lib/pubid/ieee/identifiers/base.rb +106 -13
- data/lib/pubid/ieee/identifiers/code_number.rb +82 -0
- data/lib/pubid/ieee/identifiers/conformance_identifier.rb +6 -2
- data/lib/pubid/ieee/identifiers/corrigendum.rb +17 -2
- data/lib/pubid/ieee/identifiers/csa_dual_published.rb +3 -3
- data/lib/pubid/ieee/identifiers/dual_identifier.rb +3 -3
- data/lib/pubid/ieee/identifiers/dual_published.rb +3 -3
- data/lib/pubid/ieee/identifiers/iec_ieee_copublished.rb +102 -5
- data/lib/pubid/ieee/identifiers/interpretation_identifier.rb +2 -1
- data/lib/pubid/ieee/identifiers/joint_development.rb +56 -11
- data/lib/pubid/ieee/identifiers/multi_numbered_identifier.rb +1 -1
- data/lib/pubid/ieee/identifiers/nesc/base.rb +90 -19
- data/lib/pubid/ieee/identifiers/nesc/draft.rb +20 -5
- data/lib/pubid/ieee/identifiers/nesc/edition.rb +32 -0
- data/lib/pubid/ieee/identifiers/nesc/handbook.rb +16 -5
- data/lib/pubid/ieee/identifiers/nesc/redline.rb +11 -2
- data/lib/pubid/ieee/identifiers/nesc/standard.rb +18 -3
- data/lib/pubid/ieee/identifiers/nesc.rb +1 -0
- data/lib/pubid/ieee/identifiers/parenthetical_identifier.rb +3 -3
- data/lib/pubid/ieee/identifiers/project_draft_identifier.rb +14 -6
- data/lib/pubid/ieee/identifiers/redlined_standard.rb +4 -4
- data/lib/pubid/ieee/identifiers/si_standard.rb +4 -1
- data/lib/pubid/ieee/identifiers/standard.rb +4 -1
- data/lib/pubid/ieee/identifiers/supplement_identifier.rb +26 -7
- data/lib/pubid/ieee/identifiers.rb +2 -1
- data/lib/pubid/ieee/ire/builder.rb +7 -6
- data/lib/pubid/ieee/ire/identifier.rb +48 -33
- data/lib/pubid/ieee/nesc/builder.rb +33 -20
- data/lib/pubid/ieee/nesc/parser.rb +15 -14
- data/lib/pubid/ieee/parser.rb +461 -43
- data/lib/pubid/ieee/pre_parser.rb +1 -1
- data/lib/pubid/ieee/renderer.rb +154 -57
- data/lib/pubid/ieee/typed_stages.rb +12 -1
- data/lib/pubid/ieee/urn_generator.rb +3 -5
- data/lib/pubid/ieee.rb +56 -3
- data/lib/pubid/ietf/builder.rb +62 -0
- data/lib/pubid/ietf/identifier.rb +5 -0
- data/lib/pubid/ietf/identifiers/base.rb +75 -0
- data/lib/pubid/ietf/identifiers/bcp.rb +25 -0
- data/lib/pubid/ietf/identifiers/fyi.rb +25 -0
- data/lib/pubid/ietf/identifiers/internet_draft.rb +29 -0
- data/lib/pubid/ietf/identifiers/rfc.rb +25 -0
- data/lib/pubid/ietf/identifiers/std.rb +25 -0
- data/lib/pubid/ietf/identifiers.rb +13 -0
- data/lib/pubid/ietf/parser.rb +43 -0
- data/lib/pubid/ietf/renderer.rb +26 -0
- data/lib/pubid/ietf/urn_generator.rb +23 -0
- data/lib/pubid/ietf/urn_parser.rb +35 -0
- data/lib/pubid/ietf.rb +76 -0
- data/lib/pubid/iho/identifier.rb +1 -3
- data/lib/pubid/iho/identifiers/base.rb +1 -7
- data/lib/pubid/iho/identifiers/bibliographic.rb +1 -1
- data/lib/pubid/iho/identifiers/circular_letter.rb +1 -1
- data/lib/pubid/iho/identifiers/miscellaneous.rb +1 -1
- data/lib/pubid/iho/identifiers/publication.rb +1 -1
- data/lib/pubid/iho/identifiers/standard.rb +1 -1
- data/lib/pubid/iho/identifiers.rb +0 -1
- data/lib/pubid/iho.rb +7 -7
- data/lib/pubid/isbn/builder.rb +44 -0
- data/lib/pubid/isbn/check_digit.rb +53 -0
- data/lib/pubid/isbn/identifier.rb +63 -0
- data/lib/pubid/isbn/identifiers/book.rb +30 -0
- data/lib/pubid/isbn/identifiers.rb +9 -0
- data/lib/pubid/isbn/parser.rb +45 -0
- data/lib/pubid/isbn/renderer.rb +16 -0
- data/lib/pubid/isbn.rb +52 -0
- data/lib/pubid/iso/builder.rb +9 -4
- data/lib/pubid/iso/combined_identifier.rb +2 -2
- data/lib/pubid/iso/identifier.rb +17 -1
- data/lib/pubid/iso/identifiers/directives_supplement.rb +8 -8
- data/lib/pubid/iso/normalizer.rb +2 -2
- data/lib/pubid/iso/parser.rb +16 -12
- data/lib/pubid/iso/supplement_identifier.rb +19 -6
- data/lib/pubid/iso/urn_generator.rb +4 -1
- data/lib/pubid/iso/urn_parser.rb +1 -1
- data/lib/pubid/itu/builder.rb +230 -29
- data/lib/pubid/itu/components/code.rb +48 -5
- data/lib/pubid/itu/components/designation.rb +35 -0
- data/lib/pubid/itu/components.rb +1 -0
- data/lib/pubid/itu/identifier.rb +1 -3
- data/lib/pubid/itu/identifiers/addendum.rb +15 -0
- data/lib/pubid/itu/identifiers/amendment.rb +6 -28
- data/lib/pubid/itu/identifiers/annex.rb +13 -2
- data/lib/pubid/itu/identifiers/annex_of_recommendation.rb +87 -0
- data/lib/pubid/itu/identifiers/appendix_of_recommendation.rb +92 -0
- data/lib/pubid/itu/identifiers/base.rb +341 -23
- data/lib/pubid/itu/identifiers/combined_identifier.rb +99 -23
- data/lib/pubid/itu/identifiers/corrigendum.rb +16 -23
- data/lib/pubid/itu/identifiers/errata.rb +15 -0
- data/lib/pubid/itu/identifiers/handbook.rb +38 -0
- data/lib/pubid/itu/identifiers/question.rb +63 -0
- data/lib/pubid/itu/identifiers/recommendation.rb +3 -2
- data/lib/pubid/itu/identifiers/report.rb +39 -0
- data/lib/pubid/itu/identifiers/special_publication.rb +3 -1
- data/lib/pubid/itu/identifiers/standard_serialization.rb +58 -0
- data/lib/pubid/itu/identifiers/supplement.rb +119 -14
- data/lib/pubid/itu/identifiers.rb +10 -1
- data/lib/pubid/itu/model.rb +1 -1
- data/lib/pubid/itu/parser.rb +480 -26
- data/lib/pubid/itu/urn_generator.rb +36 -6
- data/lib/pubid/itu/urn_parser.rb +8 -0
- data/lib/pubid/itu.rb +11 -3
- data/lib/pubid/jcgm/builder.rb +23 -13
- data/lib/pubid/jcgm/identifiers/amendment.rb +0 -2
- data/lib/pubid/jcgm/identifiers/corrigendum.rb +34 -0
- data/lib/pubid/jcgm/identifiers/gum_guide.rb +3 -3
- data/lib/pubid/jcgm/identifiers/meeting.rb +47 -0
- data/lib/pubid/jcgm/identifiers.rb +2 -0
- data/lib/pubid/jcgm/parser.rb +66 -6
- data/lib/pubid/jcgm/renderer.rb +26 -12
- data/lib/pubid/jcgm/single_identifier.rb +74 -5
- data/lib/pubid/jcgm/supplement_identifier.rb +39 -4
- data/lib/pubid/jcgm/urn_generator.rb +21 -13
- data/lib/pubid/jcgm/urn_parser.rb +15 -3
- data/lib/pubid/jis/identifier.rb +52 -0
- data/lib/pubid/nist/builder.rb +29 -9
- data/lib/pubid/nist/caster.rb +7 -45
- data/lib/pubid/nist/circular_supplement_builder.rb +7 -5
- data/lib/pubid/nist/components/supplement.rb +5 -2
- data/lib/pubid/nist/configuration.rb +7 -1
- data/lib/pubid/nist/identifier.rb +1 -3
- data/lib/pubid/nist/identifiers/base.rb +121 -37
- data/lib/pubid/nist/identifiers/circular.rb +1 -1
- data/lib/pubid/nist/identifiers/commercial_standard.rb +1 -1
- data/lib/pubid/nist/identifiers/commercial_standard_emergency.rb +1 -1
- data/lib/pubid/nist/identifiers/commercial_standards_monthly.rb +1 -1
- data/lib/pubid/nist/identifiers/crpl_report.rb +1 -1
- data/lib/pubid/nist/identifiers/dated_document.rb +1 -1
- data/lib/pubid/nist/identifiers/federal_information_processing_standards.rb +1 -1
- data/lib/pubid/nist/identifiers/grant_contractor_report.rb +1 -1
- data/lib/pubid/nist/identifiers/handbook.rb +1 -1
- data/lib/pubid/nist/identifiers/internal_report.rb +1 -1
- data/lib/pubid/nist/identifiers/letter_circular.rb +1 -1
- data/lib/pubid/nist/identifiers/miscellaneous_publication.rb +1 -1
- data/lib/pubid/nist/identifiers/monograph.rb +1 -1
- data/lib/pubid/nist/identifiers/ncstar.rb +2 -2
- data/lib/pubid/nist/identifiers/nsrds.rb +1 -1
- data/lib/pubid/nist/identifiers/owmwp.rb +1 -1
- data/lib/pubid/nist/identifiers/report.rb +1 -1
- data/lib/pubid/nist/identifiers/special_publication.rb +10 -1
- data/lib/pubid/nist/identifiers/technical_note.rb +1 -1
- data/lib/pubid/nist/identifiers.rb +0 -1
- data/lib/pubid/nist/parser.rb +26 -3
- data/lib/pubid/nist/preprocessor.rb +15 -0
- data/lib/pubid/nist/router.rb +2 -2
- data/lib/pubid/nist/series/ir.rb +0 -3
- data/lib/pubid/nist/supplement_identifier.rb +9 -9
- data/lib/pubid/nist.rb +12 -12
- data/lib/pubid/oasis/builder.rb +77 -0
- data/lib/pubid/oasis/identifier.rb +82 -0
- data/lib/pubid/oasis/identifiers/standard.rb +29 -0
- data/lib/pubid/oasis/identifiers.rb +9 -0
- data/lib/pubid/oasis/parser.rb +34 -0
- data/lib/pubid/oasis/renderer.rb +29 -0
- data/lib/pubid/oasis/urn_generator.rb +25 -0
- data/lib/pubid/oasis/urn_parser.rb +22 -0
- data/lib/pubid/oasis.rb +74 -0
- data/lib/pubid/ogc/builder.rb +33 -0
- data/lib/pubid/ogc/identifier.rb +77 -0
- data/lib/pubid/ogc/identifiers/document.rb +26 -0
- data/lib/pubid/ogc/identifiers.rb +10 -0
- data/lib/pubid/ogc/parser.rb +40 -0
- data/lib/pubid/ogc/renderer.rb +33 -0
- data/lib/pubid/ogc/urn_generator.rb +14 -0
- data/lib/pubid/ogc/urn_parser.rb +22 -0
- data/lib/pubid/ogc.rb +71 -0
- data/lib/pubid/oiml/builder.rb +31 -7
- data/lib/pubid/oiml/identifier.rb +9 -1
- data/lib/pubid/oiml/parser.rb +11 -12
- data/lib/pubid/oiml/renderer.rb +13 -13
- data/lib/pubid/oiml/single_identifier.rb +20 -0
- data/lib/pubid/oiml/supplement_identifier.rb +9 -9
- data/lib/pubid/oiml/urn_parser.rb +23 -6
- data/lib/pubid/oiml.rb +4 -0
- data/lib/pubid/omg/builder.rb +19 -0
- data/lib/pubid/omg/identifier.rb +44 -0
- data/lib/pubid/omg/identifiers/specification.rb +32 -0
- data/lib/pubid/omg/identifiers.rb +9 -0
- data/lib/pubid/omg/parser.rb +40 -0
- data/lib/pubid/omg/renderer.rb +19 -0
- data/lib/pubid/omg.rb +51 -0
- data/lib/pubid/parsers/mr_string.rb +101 -7
- data/lib/pubid/plateau/builder.rb +8 -4
- data/lib/pubid/plateau/identifier.rb +1 -3
- data/lib/pubid/plateau/identifiers/base.rb +1 -6
- data/lib/pubid/plateau/identifiers/handbook.rb +1 -1
- data/lib/pubid/plateau/identifiers/technical_report.rb +1 -1
- data/lib/pubid/plateau/identifiers.rb +0 -1
- data/lib/pubid/plateau/parser.rb +15 -5
- data/lib/pubid/plateau/renderer.rb +1 -1
- data/lib/pubid/plateau/supplement_identifier.rb +11 -11
- data/lib/pubid/plateau.rb +4 -4
- data/lib/pubid/renderers/human_readable.rb +3 -1
- data/lib/pubid/renderers/mr_string.rb +46 -4
- data/lib/pubid/renderers/supplement_renderer.rb +1 -1
- data/lib/pubid/rendering/supplement.rb +4 -4
- data/lib/pubid/sae/builder.rb +1 -1
- data/lib/pubid/sae/identifier.rb +1 -3
- data/lib/pubid/sae/identifiers/base.rb +10 -7
- data/lib/pubid/sae/identifiers.rb +0 -1
- data/lib/pubid/sae.rb +3 -3
- data/lib/pubid/tgpp/builder.rb +41 -0
- data/lib/pubid/tgpp/identifier.rb +91 -0
- data/lib/pubid/tgpp/identifiers/technical_report.rb +32 -0
- data/lib/pubid/tgpp/identifiers/technical_specification.rb +33 -0
- data/lib/pubid/tgpp/identifiers.rb +11 -0
- data/lib/pubid/tgpp/parser.rb +62 -0
- data/lib/pubid/tgpp/renderer.rb +36 -0
- data/lib/pubid/tgpp/urn_generator.rb +20 -0
- data/lib/pubid/tgpp/urn_parser.rb +28 -0
- data/lib/pubid/tgpp.rb +78 -0
- data/lib/pubid/type_resolver.rb +59 -0
- data/lib/pubid/un/builder.rb +42 -0
- data/lib/pubid/un/identifier.rb +37 -0
- data/lib/pubid/un/identifiers/document.rb +24 -0
- data/lib/pubid/un/identifiers.rb +9 -0
- data/lib/pubid/un/parser.rb +25 -0
- data/lib/pubid/un/renderer.rb +11 -0
- data/lib/pubid/un.rb +46 -0
- data/lib/pubid/version.rb +1 -1
- data/lib/pubid/w3c/builder.rb +55 -0
- data/lib/pubid/w3c/identifier.rb +101 -0
- data/lib/pubid/w3c/identifiers/candidate_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/candidate_recommendation_draft.rb +31 -0
- data/lib/pubid/w3c/identifiers/draft_note.rb +31 -0
- data/lib/pubid/w3c/identifiers/note.rb +30 -0
- data/lib/pubid/w3c/identifiers/obsolete_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/proposed_edited_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/proposed_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/standard.rb +12 -0
- data/lib/pubid/w3c/identifiers/superseded_recommendation.rb +31 -0
- data/lib/pubid/w3c/identifiers/working_draft.rb +30 -0
- data/lib/pubid/w3c/identifiers.rb +25 -0
- data/lib/pubid/w3c/parser.rb +43 -0
- data/lib/pubid/w3c/renderer.rb +35 -0
- data/lib/pubid/w3c/urn_generator.rb +18 -0
- data/lib/pubid/w3c/urn_parser.rb +36 -0
- data/lib/pubid/w3c.rb +67 -0
- data/lib/pubid/xsf/builder.rb +17 -0
- data/lib/pubid/xsf/identifier.rb +62 -0
- data/lib/pubid/xsf/identifiers/xep.rb +31 -0
- data/lib/pubid/xsf/identifiers.rb +9 -0
- data/lib/pubid/xsf/parser.rb +25 -0
- data/lib/pubid/xsf/renderer.rb +23 -0
- data/lib/pubid/xsf/urn_generator.rb +13 -0
- data/lib/pubid/xsf/urn_parser.rb +18 -0
- data/lib/pubid/xsf.rb +76 -0
- data/lib/pubid.rb +25 -1
- metadata +205 -4
- data/lib/pubid/cie/components/code.rb +0 -80
- data/lib/pubid/iala/identifiers/base.rb +0 -14
data/lib/pubid/un.rb
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Un
|
|
5
|
+
extend Pubid::PrefixesSupport
|
|
6
|
+
|
|
7
|
+
PREFIXES = ["UN"].freeze
|
|
8
|
+
|
|
9
|
+
autoload :Builder, "#{__dir__}/un/builder"
|
|
10
|
+
autoload :Identifier, "#{__dir__}/un/identifier"
|
|
11
|
+
autoload :Identifiers, "#{__dir__}/un/identifiers"
|
|
12
|
+
autoload :Parser, "#{__dir__}/un/parser"
|
|
13
|
+
autoload :Renderer, "#{__dir__}/un/renderer"
|
|
14
|
+
|
|
15
|
+
def self.parse(identifier)
|
|
16
|
+
Identifier.parse(identifier)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Identifier.format_registry = FormatRegistry.new(parent: Identifier.format_registry)
|
|
20
|
+
Identifier.format_registry.register(:human, renderer: Un::Renderer)
|
|
21
|
+
|
|
22
|
+
def self.identifier_types
|
|
23
|
+
@identifier_types ||= Identifiers.constants
|
|
24
|
+
.filter_map { |c| begin; Identifiers.const_get(c); rescue NameError; nil; end }
|
|
25
|
+
.select { |c| c.is_a?(Class) && c.singleton_methods(false).include?(:type) }
|
|
26
|
+
.select { |c| c.type.is_a?(Hash) }
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.all_typed_stages
|
|
30
|
+
@all_typed_stages ||= identifier_types.flat_map do |klass|
|
|
31
|
+
klass.const_defined?(:TYPED_STAGES) ? klass.const_get(:TYPED_STAGES) : []
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.locate_type(code)
|
|
36
|
+
identifier_types.find { |t| t.type[:key].to_s == code.to_s }
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def self.locate_stage(abbr)
|
|
40
|
+
abbr_str = abbr.to_s.upcase
|
|
41
|
+
all_typed_stages.find { |s| s.abbr.any? { |a| a.to_s.upcase == abbr_str } }
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
Pubid::Registry.register(:un, Pubid::Un)
|
data/lib/pubid/version.rb
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
# Turns the parse tree into a concrete identifier: picks the class from the
|
|
6
|
+
# leading maturity token and splits the captured remainder into code + date.
|
|
7
|
+
class Builder
|
|
8
|
+
# Maturity token -> concrete identifier class name (resolved lazily so the
|
|
9
|
+
# Identifiers namespace need not be loaded at class-definition time).
|
|
10
|
+
TYPE_CLASSES = {
|
|
11
|
+
"NOTE" => "Note",
|
|
12
|
+
"DNOTE" => "DraftNote",
|
|
13
|
+
"WD" => "WorkingDraft",
|
|
14
|
+
"CR" => "CandidateRecommendation",
|
|
15
|
+
"CRD" => "CandidateRecommendationDraft",
|
|
16
|
+
"REC" => "Recommendation",
|
|
17
|
+
"PR" => "ProposedRecommendation",
|
|
18
|
+
"PER" => "ProposedEditedRecommendation",
|
|
19
|
+
"SPSD" => "SupersededRecommendation",
|
|
20
|
+
"OBSL" => "ObsoleteRecommendation",
|
|
21
|
+
}.freeze
|
|
22
|
+
|
|
23
|
+
# A trailing "-<digits>" group is the date only when the digit run is
|
|
24
|
+
# exactly 8 (YYYYMMDD), 6 (legacy YYMMDD) or 4 (legacy MMDD) wide. No real
|
|
25
|
+
# W3C code ends in such a run, so this never mis-splits a code that merely
|
|
26
|
+
# ends in a short digit run (e.g. "url-1", "ATAG10").
|
|
27
|
+
DATE_RE = /\A(.+)-(\d{8}|\d{6}|\d{4})\z/
|
|
28
|
+
|
|
29
|
+
def self.build(parsed_data)
|
|
30
|
+
new.build(parsed_data)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def build(data)
|
|
34
|
+
code, date = split_date(data[:rest].to_s)
|
|
35
|
+
klass_for(data[:type]&.to_s).new(code: code, date: date)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
def klass_for(type)
|
|
41
|
+
name = TYPE_CLASSES[type] || "Standard"
|
|
42
|
+
Identifiers.const_get(name)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @return [Array(String, String|nil)] the code and the optional date
|
|
46
|
+
def split_date(rest)
|
|
47
|
+
if (m = DATE_RE.match(rest))
|
|
48
|
+
[m[1], m[2]]
|
|
49
|
+
else
|
|
50
|
+
[rest, nil]
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
# Base class for every W3C identifier AND the flavor's parse/create entry
|
|
6
|
+
# point. Concrete identifiers under Pubid::W3c::Identifiers descend from
|
|
7
|
+
# this class (one per W3C maturity level), so a parsed W3C id is an
|
|
8
|
+
# instance of Pubid::W3c::Identifier.
|
|
9
|
+
#
|
|
10
|
+
# W3C identifiers are flat: a slug `code`, an optional publication `date`
|
|
11
|
+
# (kept verbatim as a string — width varies: 8-digit YYYYMMDD, or legacy
|
|
12
|
+
# 6-digit YYMMDD / 4-digit MMDD), and a document-type carried by the
|
|
13
|
+
# concrete class (its `type_prefix` returns the printed token, e.g. "WD").
|
|
14
|
+
class Identifier < ::Pubid::Identifier
|
|
15
|
+
# Slug, e.g. "charmod", "css-backgrounds-3", "07-WebData".
|
|
16
|
+
attribute :code, :string
|
|
17
|
+
# Publication date verbatim, or nil. Overrides the base Components::Date
|
|
18
|
+
# attribute with a plain string (same mechanism JIS uses for `number`):
|
|
19
|
+
# W3C dates are opaque digit runs that must round-trip exactly, and are
|
|
20
|
+
# never re-parsed as calendar dates.
|
|
21
|
+
attribute :date, :string
|
|
22
|
+
|
|
23
|
+
# Polymorphic type map for lutaml::Model key_value (de)serialization: maps
|
|
24
|
+
# each subclass's polymorphic_name to its class name so a stored hash
|
|
25
|
+
# rebuilds the correct identifier type via from_hash.
|
|
26
|
+
W3C_TYPE_MAP = {
|
|
27
|
+
"pubid:w3c:standard" => "Pubid::W3c::Identifiers::Standard",
|
|
28
|
+
"pubid:w3c:note" => "Pubid::W3c::Identifiers::Note",
|
|
29
|
+
"pubid:w3c:draft-note" => "Pubid::W3c::Identifiers::DraftNote",
|
|
30
|
+
"pubid:w3c:working-draft" => "Pubid::W3c::Identifiers::WorkingDraft",
|
|
31
|
+
"pubid:w3c:candidate-recommendation" =>
|
|
32
|
+
"Pubid::W3c::Identifiers::CandidateRecommendation",
|
|
33
|
+
"pubid:w3c:candidate-recommendation-draft" =>
|
|
34
|
+
"Pubid::W3c::Identifiers::CandidateRecommendationDraft",
|
|
35
|
+
"pubid:w3c:recommendation" =>
|
|
36
|
+
"Pubid::W3c::Identifiers::Recommendation",
|
|
37
|
+
"pubid:w3c:proposed-recommendation" =>
|
|
38
|
+
"Pubid::W3c::Identifiers::ProposedRecommendation",
|
|
39
|
+
"pubid:w3c:proposed-edited-recommendation" =>
|
|
40
|
+
"Pubid::W3c::Identifiers::ProposedEditedRecommendation",
|
|
41
|
+
"pubid:w3c:superseded-recommendation" =>
|
|
42
|
+
"Pubid::W3c::Identifiers::SupersededRecommendation",
|
|
43
|
+
"pubid:w3c:obsolete-recommendation" =>
|
|
44
|
+
"Pubid::W3c::Identifiers::ObsoleteRecommendation",
|
|
45
|
+
}.freeze
|
|
46
|
+
|
|
47
|
+
key_value do
|
|
48
|
+
map "_type", to: :_type, polymorphic_map: W3C_TYPE_MAP
|
|
49
|
+
map "code", to: :code
|
|
50
|
+
map "date", to: :date
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Publisher is always "W3C". A plain constant (not a `publisher` method)
|
|
54
|
+
# so it doesn't shadow the inherited lutaml `publisher` attribute, which
|
|
55
|
+
# would otherwise fail serialization type validation.
|
|
56
|
+
PUBLISHER = "W3C"
|
|
57
|
+
|
|
58
|
+
# The printed document-type token (e.g. "WD"). nil for the bare-code
|
|
59
|
+
# Standard form; concrete typed subclasses override it.
|
|
60
|
+
def type_prefix
|
|
61
|
+
nil
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
attr_reader :with_publisher
|
|
65
|
+
|
|
66
|
+
# Publication year derived from an 8-digit YYYYMMDD date, else nil. `date`
|
|
67
|
+
# is a plain string here (not a Components::Date), so the inherited
|
|
68
|
+
# `year` — which calls `date&.year` — would break; override it.
|
|
69
|
+
def year
|
|
70
|
+
return nil unless date.is_a?(::String) && date.length == 8
|
|
71
|
+
|
|
72
|
+
date[0, 4]
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def to_s(with_publisher: true, **opts)
|
|
76
|
+
@with_publisher = with_publisher
|
|
77
|
+
render(format: :human, **opts)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# from_hash is the shared polymorphic dispatch on Pubid::Identifier;
|
|
81
|
+
# W3C_TYPE_MAP remains as the key_value polymorphic_map.
|
|
82
|
+
|
|
83
|
+
# Parse a W3C identifier string into an identifier object
|
|
84
|
+
# @param identifier [String] The W3C identifier string to parse
|
|
85
|
+
# @return [Identifier] The appropriate identifier object
|
|
86
|
+
# @raise [RuntimeError] If parsing fails
|
|
87
|
+
def self.parse(identifier)
|
|
88
|
+
# Reject pathological inputs before they reach the parser
|
|
89
|
+
# (CodeQL rb/polynomial-redos barrier — inline .length by design).
|
|
90
|
+
if identifier.length > Pubid::MAX_INPUT_LENGTH
|
|
91
|
+
raise ArgumentError, Pubid::INPUT_TOO_LONG_MESSAGE
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
parsed = Parser.parse(identifier)
|
|
95
|
+
Builder.build(parsed)
|
|
96
|
+
rescue Parslet::ParseFailed => e
|
|
97
|
+
raise "Failed to parse W3C identifier '#{identifier}': #{e.message}"
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Candidate Recommendation. Printed token: "CR".
|
|
7
|
+
# Example: "W3C CR-exi-20091208".
|
|
8
|
+
class CandidateRecommendation < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :cr,
|
|
12
|
+
stage_code: :candidate_recommendation,
|
|
13
|
+
type_code: :cr,
|
|
14
|
+
abbr: ["CR"],
|
|
15
|
+
name: "Candidate Recommendation",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :cr, web: :candidate_recommendation,
|
|
22
|
+
title: "Candidate Recommendation", short: "CR" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"CR"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Candidate Recommendation Draft. Printed token: "CRD".
|
|
7
|
+
# Example: "W3C CRD-accelerometer-20250212".
|
|
8
|
+
class CandidateRecommendationDraft < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :crd,
|
|
12
|
+
stage_code: :candidate_recommendation_draft,
|
|
13
|
+
type_code: :crd,
|
|
14
|
+
abbr: ["CRD"],
|
|
15
|
+
name: "Candidate Recommendation Draft",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :crd, web: :candidate_recommendation_draft,
|
|
22
|
+
title: "Candidate Recommendation Draft", short: "CRD" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"CRD"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# Draft W3C Note. Printed token: "DNOTE".
|
|
7
|
+
# Example: "W3C DNOTE-webcodecs-flac-codec-registration-20240419".
|
|
8
|
+
class DraftNote < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :dnote,
|
|
12
|
+
stage_code: :draft_note,
|
|
13
|
+
type_code: :dnote,
|
|
14
|
+
abbr: ["DNOTE"],
|
|
15
|
+
name: "Draft W3C Note",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :dnote, web: :draft_note, title: "Draft W3C Note",
|
|
22
|
+
short: "DNOTE" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"DNOTE"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Note (formerly Working Group / Interest Group Note).
|
|
7
|
+
# Printed token: "NOTE". Example: "W3C NOTE-xml-names".
|
|
8
|
+
class Note < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :note,
|
|
12
|
+
stage_code: :note,
|
|
13
|
+
type_code: :note,
|
|
14
|
+
abbr: ["NOTE"],
|
|
15
|
+
name: "W3C Note",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :note, web: :note, title: "W3C Note", short: "NOTE" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def type_prefix
|
|
25
|
+
"NOTE"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# Obsolete W3C Recommendation. Printed token: "OBSL".
|
|
7
|
+
# Example: "W3C OBSL-widgets-apis-20181011".
|
|
8
|
+
class ObsoleteRecommendation < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :obsl,
|
|
12
|
+
stage_code: :obsolete_recommendation,
|
|
13
|
+
type_code: :obsl,
|
|
14
|
+
abbr: ["OBSL"],
|
|
15
|
+
name: "Obsolete Recommendation",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :obsl, web: :obsolete_recommendation,
|
|
22
|
+
title: "Obsolete Recommendation", short: "OBSL" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"OBSL"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Proposed Edited Recommendation. Printed token: "PER".
|
|
7
|
+
# Example: "W3C PER-rif-dtb-20121211".
|
|
8
|
+
class ProposedEditedRecommendation < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :per,
|
|
12
|
+
stage_code: :proposed_edited_recommendation,
|
|
13
|
+
type_code: :per,
|
|
14
|
+
abbr: ["PER"],
|
|
15
|
+
name: "Proposed Edited Recommendation",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :per, web: :proposed_edited_recommendation,
|
|
22
|
+
title: "Proposed Edited Recommendation", short: "PER" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"PER"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Proposed Recommendation. Printed token: "PR".
|
|
7
|
+
# Example: "W3C PR-InkML-20110510".
|
|
8
|
+
class ProposedRecommendation < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :pr,
|
|
12
|
+
stage_code: :proposed_recommendation,
|
|
13
|
+
type_code: :pr,
|
|
14
|
+
abbr: ["PR"],
|
|
15
|
+
name: "Proposed Recommendation",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :pr, web: :proposed_recommendation,
|
|
22
|
+
title: "Proposed Recommendation", short: "PR" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"PR"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Recommendation (a published standard). Printed token: "REC".
|
|
7
|
+
# Example: "W3C REC-ATAG10-20000203".
|
|
8
|
+
class Recommendation < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :rec,
|
|
12
|
+
stage_code: :recommendation,
|
|
13
|
+
type_code: :rec,
|
|
14
|
+
abbr: ["REC"],
|
|
15
|
+
name: "Recommendation",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :rec, web: :recommendation, title: "Recommendation",
|
|
22
|
+
short: "REC" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"REC"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# Bare-code W3C reference with no maturity token, e.g. "W3C 2dcontext",
|
|
7
|
+
# "W3C 07-WebData". The default type; carries no `type_prefix`.
|
|
8
|
+
class Standard < Identifier
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# Superseded W3C Recommendation. Printed token: "SPSD".
|
|
7
|
+
# Example: "W3C SPSD-2dcontext-20210128".
|
|
8
|
+
class SupersededRecommendation < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :spsd,
|
|
12
|
+
stage_code: :superseded_recommendation,
|
|
13
|
+
type_code: :spsd,
|
|
14
|
+
abbr: ["SPSD"],
|
|
15
|
+
name: "Superseded Recommendation",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :spsd, web: :superseded_recommendation,
|
|
22
|
+
title: "Superseded Recommendation", short: "SPSD" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def type_prefix
|
|
26
|
+
"SPSD"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
# W3C Working Draft. Printed token: "WD".
|
|
7
|
+
# Example: "W3C WD-charmod-19991129".
|
|
8
|
+
class WorkingDraft < Identifier
|
|
9
|
+
TYPED_STAGES = [
|
|
10
|
+
Pubid::Components::TypedStage.new(
|
|
11
|
+
code: :wd,
|
|
12
|
+
stage_code: :working_draft,
|
|
13
|
+
type_code: :wd,
|
|
14
|
+
abbr: ["WD"],
|
|
15
|
+
name: "Working Draft",
|
|
16
|
+
harmonized_stages: [],
|
|
17
|
+
),
|
|
18
|
+
].freeze
|
|
19
|
+
|
|
20
|
+
def self.type
|
|
21
|
+
{ key: :wd, web: :working_draft, title: "Working Draft", short: "WD" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def type_prefix
|
|
25
|
+
"WD"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
module Identifiers
|
|
6
|
+
autoload :Standard, "#{__dir__}/identifiers/standard"
|
|
7
|
+
autoload :Note, "#{__dir__}/identifiers/note"
|
|
8
|
+
autoload :DraftNote, "#{__dir__}/identifiers/draft_note"
|
|
9
|
+
autoload :WorkingDraft, "#{__dir__}/identifiers/working_draft"
|
|
10
|
+
autoload :CandidateRecommendation,
|
|
11
|
+
"#{__dir__}/identifiers/candidate_recommendation"
|
|
12
|
+
autoload :CandidateRecommendationDraft,
|
|
13
|
+
"#{__dir__}/identifiers/candidate_recommendation_draft"
|
|
14
|
+
autoload :Recommendation, "#{__dir__}/identifiers/recommendation"
|
|
15
|
+
autoload :ProposedRecommendation,
|
|
16
|
+
"#{__dir__}/identifiers/proposed_recommendation"
|
|
17
|
+
autoload :ProposedEditedRecommendation,
|
|
18
|
+
"#{__dir__}/identifiers/proposed_edited_recommendation"
|
|
19
|
+
autoload :SupersededRecommendation,
|
|
20
|
+
"#{__dir__}/identifiers/superseded_recommendation"
|
|
21
|
+
autoload :ObsoleteRecommendation,
|
|
22
|
+
"#{__dir__}/identifiers/obsolete_recommendation"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "parslet"
|
|
4
|
+
|
|
5
|
+
module Pubid
|
|
6
|
+
module W3c
|
|
7
|
+
# Parslet grammar for printed W3C identifiers, e.g.
|
|
8
|
+
# "W3C WD-charmod-19991129" (type + code + date)
|
|
9
|
+
# "W3C NOTE-xml-names" (type + code)
|
|
10
|
+
# "W3C 2dcontext" (bare code)
|
|
11
|
+
#
|
|
12
|
+
# The grammar only splits off the leading maturity token; the code/date
|
|
13
|
+
# boundary is resolved in the Builder, because a PEG `code` rule would
|
|
14
|
+
# greedily consume the trailing date and make a `.maybe` date rule
|
|
15
|
+
# unreliable. This is safe: no real W3C code ends in a same-width (4/6/8)
|
|
16
|
+
# digit run, so the Builder's fixed-width trailing-date test never collides.
|
|
17
|
+
class Parser < Parslet::Parser
|
|
18
|
+
rule(:prefix) { str("W3C") >> str(" ") }
|
|
19
|
+
|
|
20
|
+
# Known W3C maturity tokens. Order matters for shared prefixes: CRD before
|
|
21
|
+
# CR, PER before PR, DNOTE before NOTE.
|
|
22
|
+
rule(:type_token) do
|
|
23
|
+
str("DNOTE") | str("NOTE") | str("WD") | str("CRD") | str("CR") |
|
|
24
|
+
str("REC") | str("PER") | str("PR") | str("SPSD") | str("OBSL")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# A leading token is only a type when immediately followed by "-".
|
|
28
|
+
rule(:type_part) { type_token.as(:type) >> str("-") }
|
|
29
|
+
|
|
30
|
+
# The remainder: code plus an optional trailing date. Captured whole and
|
|
31
|
+
# split in the Builder.
|
|
32
|
+
rule(:rest) { any.repeat(1).as(:rest) }
|
|
33
|
+
|
|
34
|
+
rule(:identifier) { prefix >> type_part.maybe >> rest }
|
|
35
|
+
|
|
36
|
+
rule(:root) { identifier }
|
|
37
|
+
|
|
38
|
+
def self.parse(input)
|
|
39
|
+
new.parse(input)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
# Human-readable renderer for W3C identifiers.
|
|
6
|
+
#
|
|
7
|
+
# Produces strings like:
|
|
8
|
+
# "W3C WD-charmod-19991129"
|
|
9
|
+
# "W3C NOTE-xml-names"
|
|
10
|
+
# "W3C 2dcontext"
|
|
11
|
+
#
|
|
12
|
+
# Registered as the :human format in the W3C format registry and invoked via
|
|
13
|
+
# `render(format: :human)`. When `id.with_publisher == false` the leading
|
|
14
|
+
# "W3C " publisher token is dropped.
|
|
15
|
+
class Renderer < ::Pubid::Renderers::Base
|
|
16
|
+
PUBLISHER = "W3C"
|
|
17
|
+
|
|
18
|
+
def render(context: nil, **opts)
|
|
19
|
+
id = @id
|
|
20
|
+
body = +""
|
|
21
|
+
body << "#{id.type_prefix}-" if id.type_prefix
|
|
22
|
+
body << id.code.to_s
|
|
23
|
+
body << "-#{id.date}" if id.date
|
|
24
|
+
|
|
25
|
+
with_publisher?(id) ? "#{PUBLISHER} #{body}" : body
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def with_publisher?(id)
|
|
31
|
+
id.with_publisher != false
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module W3c
|
|
5
|
+
# Emits `urn:w3c:<type-down>:<code>[:<date>]`, e.g.
|
|
6
|
+
# "W3C WD-charmod-19991129" -> "urn:w3c:wd:charmod:19991129"
|
|
7
|
+
# "W3C 2dcontext" -> "urn:w3c:2dcontext"
|
|
8
|
+
class UrnGenerator < Pubid::UrnGenerator::Base
|
|
9
|
+
def generate
|
|
10
|
+
parts = ["urn", "w3c"]
|
|
11
|
+
parts << identifier.type_prefix.downcase if identifier.type_prefix
|
|
12
|
+
parts << identifier.code.to_s
|
|
13
|
+
parts << identifier.date.to_s if identifier.date
|
|
14
|
+
parts.join(":")
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|