pubid 2.0.0.alpha.10 → 2.0.0.pre.alpha.1
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/README.adoc +51 -54
- data/data/iec/update_codes.yaml +0 -3
- data/data/ieee/update_codes.yaml +1 -107
- data/data/nist/update_codes.yaml +0 -35
- data/lib/pubid/amca/builder.rb +6 -6
- data/lib/pubid/amca/identifier.rb +16 -2
- data/lib/pubid/amca/identifiers/base.rb +46 -74
- data/lib/pubid/amca/identifiers/interpretation.rb +30 -17
- data/lib/pubid/amca/identifiers/publication.rb +27 -14
- data/lib/pubid/amca/identifiers/standard.rb +5 -3
- data/lib/pubid/amca/identifiers.rb +1 -0
- data/lib/pubid/amca/parser.rb +1 -1
- data/lib/pubid/amca/scheme.rb +16 -0
- data/lib/pubid/amca/single_identifier.rb +24 -1
- data/lib/pubid/amca/urn_generator.rb +3 -4
- data/lib/pubid/amca.rb +3 -50
- data/lib/pubid/ansi/builder.rb +5 -7
- data/lib/pubid/ansi/identifier.rb +1 -19
- data/lib/pubid/ansi/identifiers/american_national_standard.rb +1 -2
- data/lib/pubid/ansi/identifiers/standard.rb +3 -2
- data/lib/pubid/ansi/parser.rb +1 -1
- data/lib/pubid/ansi/scheme.rb +15 -0
- data/lib/pubid/ansi/single_identifier.rb +31 -2
- data/lib/pubid/ansi/urn_generator.rb +38 -3
- data/lib/pubid/ansi.rb +6 -47
- data/lib/pubid/api/builder.rb +72 -45
- data/lib/pubid/api/identifier.rb +9 -30
- data/lib/pubid/api/identifiers/base.rb +14 -2
- data/lib/pubid/api/identifiers/bulletin.rb +2 -0
- data/lib/pubid/api/identifiers/continuous_operations_standard.rb +2 -0
- data/lib/pubid/api/identifiers/mpms.rb +28 -10
- data/lib/pubid/api/identifiers/publication.rb +2 -0
- data/lib/pubid/api/identifiers/recommended_practice.rb +2 -0
- data/lib/pubid/api/identifiers/specification.rb +2 -0
- data/lib/pubid/api/identifiers/standard.rb +2 -0
- data/lib/pubid/api/identifiers/technical_report.rb +2 -0
- data/lib/pubid/api/identifiers/typeless_standard.rb +16 -0
- data/lib/pubid/api/parser.rb +1 -1
- data/lib/pubid/api/scheme.rb +66 -0
- data/lib/pubid/api/single_identifier.rb +32 -10
- data/lib/pubid/api/urn_generator.rb +18 -0
- data/lib/pubid/api.rb +5 -56
- data/lib/pubid/ashrae/builder.rb +35 -56
- data/lib/pubid/ashrae/identifier.rb +16 -6
- data/lib/pubid/ashrae/identifiers/addenda_package.rb +11 -7
- data/lib/pubid/ashrae/identifiers/addendum.rb +20 -9
- data/lib/pubid/ashrae/identifiers/base.rb +15 -111
- data/lib/pubid/ashrae/identifiers/combined_addenda.rb +16 -8
- data/lib/pubid/ashrae/identifiers/errata.rb +10 -9
- data/lib/pubid/ashrae/identifiers/guideline.rb +0 -3
- data/lib/pubid/ashrae/identifiers/interpretation.rb +10 -16
- data/lib/pubid/ashrae/identifiers/standard.rb +0 -3
- data/lib/pubid/ashrae/identifiers.rb +1 -0
- data/lib/pubid/ashrae/parser.rb +16 -40
- data/lib/pubid/ashrae/scheme.rb +53 -0
- data/lib/pubid/ashrae/single_identifier.rb +14 -1
- data/lib/pubid/ashrae/supplement_identifier.rb +6 -21
- data/lib/pubid/ashrae/urn_generator.rb +10 -8
- data/lib/pubid/ashrae.rb +2 -58
- data/lib/pubid/asme/builder.rb +2 -11
- data/lib/pubid/asme/components/code.rb +2 -10
- data/lib/pubid/asme/identifier.rb +0 -9
- data/lib/pubid/asme/identifiers/base.rb +60 -0
- data/lib/pubid/asme/identifiers/standard.rb +2 -86
- data/lib/pubid/asme/parser.rb +1 -1
- data/lib/pubid/asme/scheme.rb +37 -0
- data/lib/pubid/asme/single_identifier.rb +2 -11
- data/lib/pubid/asme/urn_generator.rb +2 -2
- data/lib/pubid/asme.rb +1 -47
- data/lib/pubid/astm/builder.rb +3 -10
- data/lib/pubid/astm/components/code.rb +0 -9
- data/lib/pubid/astm/identifier.rb +0 -9
- data/lib/pubid/astm/identifiers/adjunct.rb +9 -16
- data/lib/pubid/astm/identifiers/data_series.rb +14 -2
- data/lib/pubid/astm/identifiers/iso_dual_published.rb +34 -25
- data/lib/pubid/astm/identifiers/manual.rb +25 -8
- data/lib/pubid/astm/identifiers/monograph.rb +14 -2
- data/lib/pubid/astm/identifiers/research_report.rb +5 -8
- data/lib/pubid/astm/identifiers/standard.rb +37 -8
- data/lib/pubid/astm/identifiers/technical_report.rb +13 -2
- data/lib/pubid/astm/identifiers/work_in_progress.rb +10 -1
- data/lib/pubid/astm/parser.rb +1 -1
- data/lib/pubid/astm/scheme.rb +55 -0
- data/lib/pubid/astm/single_identifier.rb +10 -32
- data/lib/pubid/astm/urn_generator.rb +5 -7
- data/lib/pubid/astm.rb +27 -44
- data/lib/pubid/bsi/builder.rb +107 -119
- data/lib/pubid/bsi/identifier.rb +25 -4
- data/lib/pubid/bsi/identifiers/addendum_document.rb +37 -3
- data/lib/pubid/bsi/identifiers/adopted_european_norm.rb +47 -19
- data/lib/pubid/bsi/identifiers/adopted_international_standard.rb +39 -8
- data/lib/pubid/bsi/identifiers/aerospace_standard.rb +55 -2
- data/lib/pubid/bsi/identifiers/amendment.rb +22 -30
- data/lib/pubid/bsi/identifiers/base.rb +11 -0
- data/lib/pubid/bsi/identifiers/british_industrial_practice.rb +7 -1
- data/lib/pubid/bsi/identifiers/british_standard.rb +1 -2
- data/lib/pubid/bsi/identifiers/bundled_identifier.rb +87 -13
- data/lib/pubid/bsi/identifiers/committee_document.rb +17 -10
- data/lib/pubid/bsi/identifiers/consolidated_identifier.rb +87 -19
- data/lib/pubid/bsi/identifiers/corrigendum.rb +10 -26
- data/lib/pubid/bsi/identifiers/detailed_specification.rb +36 -0
- data/lib/pubid/bsi/identifiers/disc.rb +29 -0
- data/lib/pubid/bsi/identifiers/draft_document.rb +46 -2
- data/lib/pubid/bsi/identifiers/electronic_book.rb +38 -2
- data/lib/pubid/bsi/identifiers/expert_commentary.rb +21 -10
- data/lib/pubid/bsi/identifiers/explanatory_supplement.rb +47 -0
- data/lib/pubid/bsi/identifiers/flex.rb +34 -3
- data/lib/pubid/bsi/identifiers/handbook.rb +17 -1
- data/lib/pubid/bsi/identifiers/index.rb +32 -0
- data/lib/pubid/bsi/identifiers/method.rb +41 -0
- data/lib/pubid/bsi/identifiers/national_annex.rb +29 -4
- data/lib/pubid/bsi/identifiers/practice_guide.rb +7 -1
- data/lib/pubid/bsi/identifiers/publicly_available_specification.rb +54 -2
- data/lib/pubid/bsi/identifiers/published_document.rb +54 -2
- data/lib/pubid/bsi/identifiers/section.rb +30 -0
- data/lib/pubid/bsi/identifiers/set.rb +20 -14
- data/lib/pubid/bsi/identifiers/standalone_amendment.rb +10 -10
- data/lib/pubid/bsi/identifiers/supplement_document.rb +25 -3
- data/lib/pubid/bsi/identifiers/supplementary_index.rb +46 -0
- data/lib/pubid/bsi/identifiers/technical_specification.rb +47 -2
- data/lib/pubid/bsi/identifiers/test_method.rb +32 -0
- data/lib/pubid/bsi/identifiers/value_added_publication.rb +22 -7
- data/lib/pubid/bsi/identifiers.rb +1 -0
- data/lib/pubid/bsi/parser.rb +6 -20
- data/lib/pubid/bsi/scheme.rb +243 -0
- data/lib/pubid/bsi/single_identifier.rb +82 -94
- data/lib/pubid/bsi/urn_generator.rb +5 -13
- data/lib/pubid/bsi.rb +2 -252
- data/lib/pubid/builder/base.rb +13 -62
- data/lib/pubid/bundled_identifier.rb +10 -18
- data/lib/pubid/ccsds/builder.rb +4 -5
- data/lib/pubid/ccsds/identifier.rb +3 -63
- data/lib/pubid/ccsds/identifiers/base.rb +51 -14
- data/lib/pubid/ccsds/identifiers/corrigendum.rb +8 -9
- data/lib/pubid/ccsds/parser.rb +3 -5
- data/lib/pubid/ccsds/scheme.rb +57 -0
- data/lib/pubid/ccsds/single_identifier.rb +3 -6
- data/lib/pubid/ccsds/supplement_identifier.rb +13 -17
- data/lib/pubid/ccsds/urn_generator.rb +6 -6
- data/lib/pubid/ccsds.rb +1 -44
- data/lib/pubid/cen_cenelec/builder.rb +29 -61
- data/lib/pubid/cen_cenelec/identifier.rb +5 -28
- data/lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb +4 -9
- data/lib/pubid/cen_cenelec/identifiers/amendment.rb +12 -2
- data/lib/pubid/cen_cenelec/identifiers/base.rb +46 -5
- data/lib/pubid/cen_cenelec/identifiers/cen_report.rb +1 -2
- data/lib/pubid/cen_cenelec/identifiers/cen_workshop_agreement.rb +1 -2
- data/lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb +27 -6
- data/lib/pubid/cen_cenelec/identifiers/corrigendum.rb +17 -2
- data/lib/pubid/cen_cenelec/identifiers/european_norm.rb +4 -62
- data/lib/pubid/cen_cenelec/identifiers/european_prestandard.rb +7 -20
- data/lib/pubid/cen_cenelec/identifiers/european_specification.rb +1 -2
- data/lib/pubid/cen_cenelec/identifiers/fragment.rb +6 -2
- data/lib/pubid/cen_cenelec/identifiers/harmonization_document.rb +1 -2
- data/lib/pubid/cen_cenelec/identifiers/technical_report.rb +1 -2
- data/lib/pubid/cen_cenelec/identifiers/technical_specification.rb +1 -2
- data/lib/pubid/cen_cenelec/parser.rb +1 -1
- data/lib/pubid/cen_cenelec/scheme.rb +164 -0
- data/lib/pubid/cen_cenelec/single_identifier.rb +91 -10
- data/lib/pubid/cen_cenelec/supplement_identifier.rb +7 -6
- data/lib/pubid/cen_cenelec/urn_generator.rb +7 -7
- data/lib/pubid/cen_cenelec.rb +1 -188
- data/lib/pubid/cie/builder.rb +24 -149
- data/lib/pubid/cie/components/code.rb +72 -0
- data/lib/pubid/cie/identifier.rb +5 -20
- data/lib/pubid/cie/identifiers/bundle.rb +5 -35
- data/lib/pubid/cie/identifiers/conference.rb +6 -11
- data/lib/pubid/cie/identifiers/corrigendum.rb +23 -17
- data/lib/pubid/cie/identifiers/dual_published.rb +6 -6
- data/lib/pubid/cie/identifiers/identical.rb +9 -9
- data/lib/pubid/cie/identifiers/joint_published.rb +10 -10
- data/lib/pubid/cie/identifiers/standard.rb +8 -43
- data/lib/pubid/cie/identifiers/supplement.rb +25 -27
- data/lib/pubid/cie/identifiers/tutorial_bundle.rb +3 -7
- data/lib/pubid/cie/identifiers.rb +0 -2
- data/lib/pubid/cie/parser.rb +6 -55
- data/lib/pubid/cie/scheme.rb +64 -0
- data/lib/pubid/cie/single_identifier.rb +5 -44
- data/lib/pubid/cie/supplement_identifier.rb +16 -29
- data/lib/pubid/cie/urn_generator.rb +8 -11
- data/lib/pubid/cie.rb +2 -57
- data/lib/pubid/components/code.rb +8 -22
- data/lib/pubid/components/date.rb +18 -41
- data/lib/pubid/components/edition.rb +6 -9
- data/lib/pubid/components/language.rb +4 -6
- data/lib/pubid/components/locality.rb +1 -10
- data/lib/pubid/components/publisher.rb +6 -9
- data/lib/pubid/components/stage.rb +14 -5
- data/lib/pubid/components/type.rb +15 -5
- data/lib/pubid/components/typed_stage.rb +8 -11
- data/lib/pubid/components.rb +0 -4
- data/lib/pubid/core/update_codes.rb +7 -28
- data/lib/pubid/csa/builder.rb +48 -48
- data/lib/pubid/csa/composite_identifier.rb +7 -18
- data/lib/pubid/csa/identifier.rb +78 -191
- data/lib/pubid/csa/identifiers/base.rb +123 -0
- data/lib/pubid/csa/identifiers/bundled.rb +9 -25
- data/lib/pubid/csa/identifiers/canadian_adopted.rb +13 -13
- data/lib/pubid/csa/identifiers/cec.rb +103 -40
- data/lib/pubid/csa/identifiers/combined.rb +69 -97
- data/lib/pubid/csa/identifiers/csa_adopted.rb +4 -4
- data/lib/pubid/csa/identifiers/package.rb +4 -4
- data/lib/pubid/csa/identifiers/series.rb +104 -0
- data/lib/pubid/csa/parser.rb +8 -12
- data/lib/pubid/csa/scheme.rb +44 -0
- data/lib/pubid/csa/single_identifier.rb +5 -94
- data/lib/pubid/csa/urn_generator.rb +2 -9
- data/lib/pubid/csa/wrapper_identifier.rb +10 -43
- data/lib/pubid/csa.rb +1 -56
- data/lib/pubid/etsi/builder.rb +4 -13
- data/lib/pubid/etsi/components/code.rb +9 -10
- data/lib/pubid/etsi/components/version.rb +5 -0
- data/lib/pubid/etsi/identifier.rb +12 -2
- data/lib/pubid/etsi/identifiers/base.rb +24 -60
- data/lib/pubid/etsi/identifiers/etsi_standard.rb +4 -207
- data/lib/pubid/etsi/identifiers/supplement_identifier.rb +14 -46
- data/lib/pubid/etsi/identifiers.rb +1 -0
- data/lib/pubid/etsi/parser.rb +3 -9
- data/lib/pubid/etsi/scheme.rb +42 -0
- data/lib/pubid/etsi.rb +2 -52
- data/lib/pubid/export/data_class_exporter.rb +59 -0
- data/lib/pubid/export/exporter.rb +47 -6
- data/lib/pubid/export/flavor_exporter.rb +276 -124
- data/lib/pubid/export/ieee_exporter.rb +78 -0
- data/lib/pubid/export/itu_exporter.rb +66 -0
- data/lib/pubid/export/nist_exporter.rb +64 -0
- data/lib/pubid/export/registry_exporter.rb +90 -0
- data/lib/pubid/export/scheme_exporter.rb +70 -0
- data/lib/pubid/export.rb +6 -0
- data/lib/pubid/identifier.rb +37 -920
- data/lib/pubid/identifier_metadata.rb +1 -1
- data/lib/pubid/identifier_registry.rb +198 -0
- data/lib/pubid/idf/builder.rb +7 -7
- data/lib/pubid/idf/identifier.rb +13 -23
- data/lib/pubid/idf/identifiers/amendment.rb +1 -2
- data/lib/pubid/idf/identifiers/corrigendum.rb +1 -2
- data/lib/pubid/idf/identifiers/international_standard.rb +1 -2
- data/lib/pubid/idf/identifiers/reviewed_method.rb +1 -2
- data/lib/pubid/idf/parser.rb +5 -6
- data/lib/pubid/idf/scheme.rb +61 -0
- data/lib/pubid/idf/supplement_identifier.rb +13 -5
- data/lib/pubid/idf/urn_generator.rb +39 -4
- data/lib/pubid/idf.rb +1 -65
- data/lib/pubid/iec/builder.rb +91 -92
- data/lib/pubid/iec/components/code.rb +32 -9
- data/lib/pubid/iec/components/publisher.rb +1 -1
- data/lib/pubid/iec/identifier.rb +8 -328
- data/lib/pubid/iec/identifiers/amendment.rb +5 -8
- data/lib/pubid/iec/identifiers/base.rb +31 -7
- data/lib/pubid/iec/identifiers/component_specification.rb +13 -3
- data/lib/pubid/iec/identifiers/conformity_assessment.rb +12 -1
- data/lib/pubid/iec/identifiers/consolidated_identifier.rb +30 -29
- data/lib/pubid/iec/identifiers/corrigendum.rb +5 -4
- data/lib/pubid/iec/identifiers/fragment_identifier.rb +36 -43
- data/lib/pubid/iec/identifiers/guide.rb +18 -0
- data/lib/pubid/iec/identifiers/international_standard.rb +9 -24
- data/lib/pubid/iec/identifiers/interpretation_sheet.rb +3 -2
- data/lib/pubid/iec/identifiers/operational_document.rb +13 -3
- data/lib/pubid/iec/identifiers/publicly_available_specification.rb +15 -2
- data/lib/pubid/iec/identifiers/sheet_identifier.rb +24 -26
- data/lib/pubid/iec/identifiers/societal_technology_trend_report.rb +13 -3
- data/lib/pubid/iec/identifiers/systems_reference_document.rb +13 -2
- data/lib/pubid/iec/identifiers/technical_report.rb +21 -3
- data/lib/pubid/iec/identifiers/technical_specification.rb +21 -3
- data/lib/pubid/iec/identifiers/technology_report.rb +12 -1
- data/lib/pubid/iec/identifiers/test_report_form.rb +46 -3
- data/lib/pubid/iec/identifiers/vap_identifier.rb +34 -33
- data/lib/pubid/iec/identifiers/white_paper.rb +13 -3
- data/lib/pubid/iec/identifiers/working_document.rb +60 -26
- data/lib/pubid/iec/parser.rb +42 -73
- data/lib/pubid/iec/scheme.rb +71 -0
- data/lib/pubid/iec/single_identifier.rb +23 -15
- data/lib/pubid/iec/supplement_identifier.rb +67 -84
- data/lib/pubid/iec/urn_generator.rb +143 -195
- data/lib/pubid/iec/urn_parser.rb +246 -85
- data/lib/pubid/iec.rb +66 -45
- data/lib/pubid/ieee/aiee/builder.rb +3 -17
- data/lib/pubid/ieee/aiee/identifier.rb +62 -46
- data/lib/pubid/ieee/aiee/parser.rb +1 -1
- data/lib/pubid/ieee/builder.rb +81 -398
- data/lib/pubid/ieee/components/code.rb +0 -8
- data/lib/pubid/ieee/components/draft.rb +0 -54
- data/lib/pubid/ieee/components/relationship.rb +149 -5
- data/lib/pubid/ieee/identifier.rb +11 -3
- data/lib/pubid/ieee/identifiers/adopted_standard.rb +14 -62
- data/lib/pubid/ieee/identifiers/base.rb +547 -340
- data/lib/pubid/ieee/identifiers/conformance_identifier.rb +12 -6
- data/lib/pubid/ieee/identifiers/corrigendum.rb +12 -15
- data/lib/pubid/ieee/identifiers/csa_dual_published.rb +13 -24
- data/lib/pubid/ieee/identifiers/dual_identifier.rb +7 -3
- data/lib/pubid/ieee/identifiers/dual_published.rb +7 -58
- data/lib/pubid/ieee/identifiers/iec_ieee_copublished.rb +11 -99
- data/lib/pubid/ieee/identifiers/interpretation_identifier.rb +11 -25
- data/lib/pubid/ieee/identifiers/joint_development.rb +15 -66
- data/lib/pubid/ieee/identifiers/multi_numbered_identifier.rb +24 -58
- data/lib/pubid/ieee/identifiers/nesc/base.rb +19 -90
- data/lib/pubid/ieee/identifiers/nesc/draft.rb +5 -20
- data/lib/pubid/ieee/identifiers/nesc/handbook.rb +5 -16
- data/lib/pubid/ieee/identifiers/nesc/redline.rb +2 -11
- data/lib/pubid/ieee/identifiers/nesc/standard.rb +3 -18
- data/lib/pubid/ieee/identifiers/nesc.rb +0 -1
- data/lib/pubid/ieee/identifiers/parenthetical_identifier.rb +9 -3
- data/lib/pubid/ieee/identifiers/project_draft_identifier.rb +6 -29
- data/lib/pubid/ieee/identifiers/redlined_standard.rb +11 -4
- data/lib/pubid/ieee/identifiers/si_standard.rb +39 -4
- data/lib/pubid/ieee/identifiers/standard.rb +2 -5
- data/lib/pubid/ieee/identifiers/supplement_identifier.rb +7 -26
- data/lib/pubid/ieee/identifiers.rb +1 -2
- data/lib/pubid/ieee/ire/builder.rb +6 -7
- data/lib/pubid/ieee/ire/identifier.rb +33 -48
- data/lib/pubid/ieee/ire/parser.rb +1 -1
- data/lib/pubid/ieee/nesc/builder.rb +20 -33
- data/lib/pubid/ieee/nesc/parser.rb +15 -16
- data/lib/pubid/ieee/parser.rb +44 -462
- data/lib/pubid/ieee/scheme.rb +90 -0
- data/lib/pubid/ieee/typed_stages.rb +1 -12
- data/lib/pubid/ieee/urn_generator.rb +8 -35
- data/lib/pubid/ieee.rb +2 -133
- data/lib/pubid/ieee_debug.rb +1 -0
- data/lib/pubid/iho/builder.rb +2 -2
- data/lib/pubid/iho/identifier.rb +17 -5
- data/lib/pubid/iho/identifiers/base.rb +30 -64
- data/lib/pubid/iho/identifiers/bibliographic.rb +5 -1
- data/lib/pubid/iho/identifiers/circular_letter.rb +5 -1
- data/lib/pubid/iho/identifiers/miscellaneous.rb +5 -1
- data/lib/pubid/iho/identifiers/publication.rb +5 -1
- data/lib/pubid/iho/identifiers/standard.rb +5 -1
- data/lib/pubid/iho/identifiers.rb +1 -0
- data/lib/pubid/iho/parser.rb +4 -4
- data/lib/pubid/iho/scheme.rb +29 -0
- data/lib/pubid/iho/urn_generator.rb +3 -3
- data/lib/pubid/iho.rb +3 -59
- data/lib/pubid/iso/builder.rb +57 -68
- data/lib/pubid/iso/bundled_identifier.rb +3 -56
- data/lib/pubid/iso/combined_identifier.rb +4 -6
- data/lib/pubid/iso/components/code.rb +19 -7
- data/lib/pubid/iso/components/publisher.rb +8 -10
- data/lib/pubid/iso/components.rb +4 -2
- data/lib/pubid/iso/identifier.rb +11 -260
- data/lib/pubid/iso/identifiers/addendum.rb +6 -9
- data/lib/pubid/iso/identifiers/amendment.rb +4 -8
- data/lib/pubid/iso/identifiers/base.rb +115 -0
- data/lib/pubid/iso/identifiers/corrigendum.rb +4 -4
- data/lib/pubid/iso/identifiers/data.rb +1 -0
- data/lib/pubid/iso/identifiers/directives.rb +2 -8
- data/lib/pubid/iso/identifiers/directives_supplement.rb +26 -55
- data/lib/pubid/iso/identifiers/extract.rb +2 -2
- data/lib/pubid/iso/identifiers/guide.rb +1 -0
- data/lib/pubid/iso/identifiers/international_standard.rb +4 -4
- data/lib/pubid/iso/identifiers/international_standardized_profile.rb +4 -4
- data/lib/pubid/iso/identifiers/international_workshop_agreement.rb +4 -10
- data/lib/pubid/iso/identifiers/pas.rb +2 -2
- data/lib/pubid/iso/identifiers/recommendation.rb +2 -2
- data/lib/pubid/iso/identifiers/supplement.rb +3 -11
- data/lib/pubid/iso/identifiers/tc_document.rb +15 -44
- data/lib/pubid/iso/identifiers/technical_report.rb +4 -4
- data/lib/pubid/iso/identifiers/technical_specification.rb +2 -2
- data/lib/pubid/iso/identifiers/technology_trends_assessments.rb +2 -2
- data/lib/pubid/iso/identifiers.rb +1 -0
- data/lib/pubid/iso/parser.rb +19 -43
- data/lib/pubid/iso/scheme.rb +187 -0
- data/lib/pubid/iso/single_identifier.rb +7 -6
- data/lib/pubid/iso/supplement_identifier.rb +3 -29
- data/lib/pubid/iso/urn_generator.rb +177 -78
- data/lib/pubid/iso/urn_parser.rb +10 -29
- data/lib/pubid/iso.rb +2 -188
- data/lib/pubid/itu/builder.rb +41 -230
- data/lib/pubid/itu/components/code.rb +12 -57
- data/lib/pubid/itu/components/sector.rb +4 -15
- data/lib/pubid/itu/components/series.rb +4 -0
- data/lib/pubid/itu/identifier.rb +51 -2
- data/lib/pubid/itu/identifiers/amendment.rb +31 -7
- data/lib/pubid/itu/identifiers/annex.rb +4 -13
- data/lib/pubid/itu/identifiers/base.rb +128 -456
- data/lib/pubid/itu/identifiers/combined_identifier.rb +25 -99
- data/lib/pubid/itu/identifiers/corrigendum.rb +25 -16
- data/lib/pubid/itu/identifiers/recommendation.rb +4 -3
- data/lib/pubid/itu/identifiers/special_publication.rb +3 -3
- data/lib/pubid/itu/identifiers/supplement.rb +16 -119
- data/lib/pubid/itu/identifiers.rb +1 -10
- data/lib/pubid/itu/model.rb +1 -1
- data/lib/pubid/itu/parser.rb +27 -481
- data/lib/pubid/itu/scheme.rb +174 -0
- data/lib/pubid/itu/urn_generator.rb +6 -36
- data/lib/pubid/itu.rb +2 -58
- data/lib/pubid/jcgm/builder.rb +19 -37
- data/lib/pubid/jcgm/identifier.rb +0 -10
- data/lib/pubid/jcgm/identifiers/amendment.rb +11 -0
- data/lib/pubid/jcgm/identifiers/gum_guide.rb +15 -3
- data/lib/pubid/jcgm/identifiers.rb +0 -2
- data/lib/pubid/jcgm/parser.rb +7 -74
- data/lib/pubid/jcgm/scheme.rb +60 -0
- data/lib/pubid/jcgm/single_identifier.rb +14 -84
- data/lib/pubid/jcgm/supplement_identifier.rb +4 -39
- data/lib/pubid/jcgm/urn_generator.rb +19 -25
- data/lib/pubid/jcgm.rb +2 -57
- data/lib/pubid/jis/builder.rb +52 -44
- data/lib/pubid/jis/components/code.rb +59 -0
- data/lib/pubid/{astm → jis}/components.rb +1 -1
- data/lib/pubid/jis/identifier.rb +5 -181
- data/lib/pubid/jis/identifiers/amendment.rb +1 -1
- data/lib/pubid/jis/identifiers/base.rb +72 -0
- data/lib/pubid/jis/identifiers/standard.rb +1 -2
- data/lib/pubid/jis/identifiers/technical_report.rb +1 -2
- data/lib/pubid/jis/identifiers/technical_specification.rb +1 -2
- data/lib/pubid/jis/identifiers.rb +1 -1
- data/lib/pubid/jis/parser.rb +6 -32
- data/lib/pubid/jis/scheme.rb +49 -0
- data/lib/pubid/jis/single_identifier.rb +12 -6
- data/lib/pubid/jis/supplement_identifier.rb +14 -17
- data/lib/pubid/jis.rb +2 -48
- data/lib/pubid/nist/builder.rb +1765 -146
- data/lib/pubid/nist/components/code.rb +20 -9
- data/lib/pubid/nist/components/edition.rb +0 -16
- data/lib/pubid/nist/components/publisher.rb +24 -0
- data/lib/pubid/nist/components/supplement.rb +21 -91
- data/lib/pubid/nist/components.rb +1 -0
- data/lib/pubid/nist/configuration.rb +2 -12
- data/lib/pubid/nist/identifiers/base.rb +417 -662
- data/lib/pubid/nist/identifiers/circular.rb +5 -17
- data/lib/pubid/nist/identifiers/circular_supplement.rb +6 -16
- data/lib/pubid/nist/identifiers/commercial_standard.rb +2 -3
- data/lib/pubid/nist/identifiers/commercial_standard_emergency.rb +5 -7
- data/lib/pubid/nist/identifiers/commercial_standards_monthly.rb +5 -18
- data/lib/pubid/nist/identifiers/crpl_report.rb +13 -16
- data/lib/pubid/nist/identifiers/federal_information_processing_standards.rb +17 -18
- data/lib/pubid/nist/identifiers/grant_contractor_report.rb +2 -3
- data/lib/pubid/nist/identifiers/handbook.rb +4 -12
- data/lib/pubid/nist/identifiers/internal_report.rb +7 -15
- data/lib/pubid/nist/identifiers/letter_circular.rb +2 -3
- data/lib/pubid/nist/identifiers/miscellaneous_publication.rb +11 -20
- data/lib/pubid/nist/identifiers/monograph.rb +11 -22
- 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 +10 -19
- data/lib/pubid/nist/identifiers/special_publication.rb +2 -12
- data/lib/pubid/nist/identifiers/technical_note.rb +3 -4
- data/lib/pubid/nist/identifiers.rb +1 -1
- data/lib/pubid/nist/parser.rb +429 -97
- data/lib/pubid/nist/scheme.rb +199 -0
- data/lib/pubid/nist/supplement_identifier.rb +34 -35
- data/lib/pubid/nist/urn_generator.rb +8 -14
- data/lib/pubid/nist.rb +5 -107
- data/lib/pubid/oiml/builder.rb +10 -91
- data/lib/pubid/oiml/components/code.rb +0 -17
- data/lib/pubid/oiml/identifier.rb +0 -53
- data/lib/pubid/oiml/identifiers/annex.rb +46 -13
- data/lib/pubid/oiml/identifiers/base.rb +36 -0
- data/lib/pubid/oiml/identifiers/basic_publication.rb +0 -2
- data/lib/pubid/oiml/identifiers/document.rb +0 -2
- data/lib/pubid/oiml/identifiers/expert_report.rb +0 -2
- data/lib/pubid/oiml/identifiers/guide.rb +0 -2
- data/lib/pubid/oiml/identifiers/recommendation.rb +0 -2
- data/lib/pubid/oiml/identifiers/seminar_report.rb +0 -2
- data/lib/pubid/oiml/identifiers/vocabulary.rb +0 -2
- data/lib/pubid/oiml/identifiers.rb +1 -3
- data/lib/pubid/oiml/parser.rb +17 -118
- data/lib/pubid/oiml/scheme.rb +46 -0
- data/lib/pubid/oiml/single_identifier.rb +43 -66
- data/lib/pubid/oiml/supplement_identifier.rb +17 -62
- data/lib/pubid/oiml/urn_generator.rb +8 -22
- data/lib/pubid/oiml.rb +1 -56
- data/lib/pubid/parser.rb +0 -1
- data/lib/pubid/parsers/mr_string.rb +7 -120
- data/lib/pubid/plateau/builder.rb +4 -8
- data/lib/pubid/plateau/identifiers/base.rb +36 -40
- data/lib/pubid/plateau/identifiers/handbook.rb +7 -1
- data/lib/pubid/plateau/identifiers/technical_report.rb +5 -1
- data/lib/pubid/plateau/identifiers.rb +1 -0
- data/lib/pubid/plateau/parser.rb +6 -16
- data/lib/pubid/plateau/scheme.rb +45 -0
- data/lib/pubid/plateau/supplement_identifier.rb +15 -11
- data/lib/pubid/plateau.rb +1 -58
- data/lib/pubid/renderers/base.rb +0 -47
- data/lib/pubid/renderers/directives_renderer.rb +14 -27
- data/lib/pubid/renderers/guide_renderer.rb +1 -7
- data/lib/pubid/renderers/human_readable.rb +9 -34
- data/lib/pubid/renderers/iwa_renderer.rb +1 -5
- data/lib/pubid/renderers/mr_string.rb +6 -54
- data/lib/pubid/renderers/supplement_renderer.rb +2 -5
- data/lib/pubid/renderers.rb +0 -1
- data/lib/pubid/rendering/base.rb +73 -0
- data/lib/pubid/rendering/common.rb +211 -0
- data/lib/pubid/rendering/context.rb +21 -33
- data/lib/pubid/rendering/format.rb +25 -0
- data/lib/pubid/rendering/numbering.rb +7 -25
- data/lib/pubid/rendering/supplement.rb +4 -4
- data/lib/pubid/rendering.rb +3 -0
- data/lib/pubid/sae/builder.rb +1 -1
- data/lib/pubid/sae/components/date.rb +0 -8
- data/lib/pubid/sae/components/type.rb +1 -5
- data/lib/pubid/sae/identifier.rb +12 -2
- data/lib/pubid/sae/identifiers/base.rb +28 -33
- data/lib/pubid/sae/identifiers.rb +1 -0
- data/lib/pubid/sae/parser.rb +1 -1
- data/lib/pubid/sae/scheme.rb +47 -0
- data/lib/pubid/sae/urn_generator.rb +10 -2
- data/lib/pubid/sae.rb +2 -49
- data/lib/pubid/scheme.rb +207 -0
- data/lib/pubid/urn_generator/base.rb +12 -12
- data/lib/pubid/version.rb +1 -1
- data/lib/pubid.rb +10 -424
- data/lib/tasks/export.rake +5 -6
- data/lib/tasks/website-data.json +1796 -1854
- metadata +45 -307
- data/data/bipm/update_codes.yaml +0 -9
- data/data/nist/series.yaml +0 -155
- data/lib/pubid/adobe/builder.rb +0 -52
- data/lib/pubid/adobe/identifier.rb +0 -47
- data/lib/pubid/adobe/identifiers/publication.rb +0 -31
- data/lib/pubid/adobe/identifiers/tech_note.rb +0 -32
- data/lib/pubid/adobe/identifiers.rb +0 -10
- data/lib/pubid/adobe/parser.rb +0 -136
- data/lib/pubid/adobe/renderer.rb +0 -39
- data/lib/pubid/adobe/urn_generator.rb +0 -42
- data/lib/pubid/adobe/urn_parser.rb +0 -69
- data/lib/pubid/adobe.rb +0 -60
- data/lib/pubid/amca/renderer.rb +0 -82
- data/lib/pubid/amca/urn_parser.rb +0 -28
- data/lib/pubid/ansi/renderer.rb +0 -53
- data/lib/pubid/ansi/urn_parser.rb +0 -23
- data/lib/pubid/api/identifiers.rb +0 -18
- data/lib/pubid/api/renderer.rb +0 -98
- data/lib/pubid/api/urn_parser.rb +0 -35
- data/lib/pubid/ashrae/renderer.rb +0 -117
- data/lib/pubid/ashrae/urn_parser.rb +0 -27
- data/lib/pubid/asme/renderer.rb +0 -66
- data/lib/pubid/asme/urn_parser.rb +0 -31
- data/lib/pubid/astm/identifiers/code_number.rb +0 -81
- data/lib/pubid/astm/identifiers.rb +0 -19
- data/lib/pubid/astm/renderer.rb +0 -172
- data/lib/pubid/astm/urn_parser.rb +0 -30
- data/lib/pubid/bipm/builder.rb +0 -163
- data/lib/pubid/bipm/identifier.rb +0 -285
- data/lib/pubid/bipm/identifiers/committee_document.rb +0 -36
- data/lib/pubid/bipm/identifiers/guide.rb +0 -35
- data/lib/pubid/bipm/identifiers/meeting.rb +0 -53
- data/lib/pubid/bipm/identifiers/mep.rb +0 -33
- data/lib/pubid/bipm/identifiers/metrologia_article.rb +0 -48
- data/lib/pubid/bipm/identifiers/si_brochure.rb +0 -33
- data/lib/pubid/bipm/identifiers.rb +0 -15
- data/lib/pubid/bipm/parser.rb +0 -237
- data/lib/pubid/bipm/renderer.rb +0 -118
- data/lib/pubid/bipm/urn_generator.rb +0 -58
- data/lib/pubid/bipm/urn_parser.rb +0 -60
- data/lib/pubid/bipm.rb +0 -91
- data/lib/pubid/bsi/renderer.rb +0 -1064
- data/lib/pubid/bsi/urn_parser.rb +0 -52
- data/lib/pubid/calconnect/builder.rb +0 -38
- data/lib/pubid/calconnect/identifier.rb +0 -121
- data/lib/pubid/calconnect/identifiers/standard.rb +0 -29
- data/lib/pubid/calconnect/identifiers.rb +0 -9
- data/lib/pubid/calconnect/parser.rb +0 -54
- data/lib/pubid/calconnect/renderer.rb +0 -36
- data/lib/pubid/calconnect/urn_generator.rb +0 -33
- data/lib/pubid/calconnect/urn_parser.rb +0 -34
- data/lib/pubid/calconnect.rb +0 -82
- data/lib/pubid/ccsds/urn_parser.rb +0 -20
- data/lib/pubid/cen_cenelec/renderer.rb +0 -261
- data/lib/pubid/cen_cenelec/urn_parser.rb +0 -28
- data/lib/pubid/cie/identifiers/code_attributes.rb +0 -52
- data/lib/pubid/cie/identifiers/proceedings.rb +0 -41
- data/lib/pubid/cie/urn_parser.rb +0 -28
- data/lib/pubid/components/adoption.rb +0 -104
- data/lib/pubid/components/iteration.rb +0 -32
- data/lib/pubid/components/relationship.rb +0 -151
- data/lib/pubid/components/supplement.rb +0 -184
- data/lib/pubid/csa/renderer.rb +0 -300
- data/lib/pubid/csa/urn_parser.rb +0 -33
- data/lib/pubid/doi/builder.rb +0 -18
- data/lib/pubid/doi/identifier.rb +0 -49
- data/lib/pubid/doi/identifiers/resource.rb +0 -30
- data/lib/pubid/doi/identifiers.rb +0 -9
- data/lib/pubid/doi/parser.rb +0 -52
- data/lib/pubid/doi/renderer.rb +0 -13
- data/lib/pubid/doi.rb +0 -55
- data/lib/pubid/easc/builder.rb +0 -55
- data/lib/pubid/easc/identifier.rb +0 -59
- data/lib/pubid/easc/identifiers/pmg.rb +0 -20
- data/lib/pubid/easc/identifiers/rmg.rb +0 -19
- data/lib/pubid/easc/identifiers.rb +0 -10
- data/lib/pubid/easc/parser.rb +0 -88
- data/lib/pubid/easc/renderer.rb +0 -48
- data/lib/pubid/easc/urn_generator.rb +0 -46
- data/lib/pubid/easc/urn_parser.rb +0 -57
- data/lib/pubid/easc.rb +0 -52
- data/lib/pubid/ecma/builder.rb +0 -45
- data/lib/pubid/ecma/identifier.rb +0 -147
- data/lib/pubid/ecma/identifiers/memento.rb +0 -30
- data/lib/pubid/ecma/identifiers/standard.rb +0 -31
- data/lib/pubid/ecma/identifiers/technical_report.rb +0 -31
- data/lib/pubid/ecma/identifiers.rb +0 -11
- data/lib/pubid/ecma/parser.rb +0 -76
- data/lib/pubid/ecma/renderer.rb +0 -67
- data/lib/pubid/ecma/urn_generator.rb +0 -46
- data/lib/pubid/ecma/urn_parser.rb +0 -51
- data/lib/pubid/ecma.rb +0 -67
- data/lib/pubid/errors.rb +0 -79
- data/lib/pubid/etsi/renderer.rb +0 -48
- data/lib/pubid/etsi/urn_parser.rb +0 -34
- data/lib/pubid/gb/builder.rb +0 -45
- data/lib/pubid/gb/identifier.rb +0 -67
- data/lib/pubid/gb/identifiers/standard.rb +0 -34
- data/lib/pubid/gb/identifiers.rb +0 -9
- data/lib/pubid/gb/parser.rb +0 -63
- data/lib/pubid/gb/renderer.rb +0 -35
- data/lib/pubid/gb.rb +0 -87
- data/lib/pubid/gost/builder.rb +0 -148
- data/lib/pubid/gost/identifier.rb +0 -47
- data/lib/pubid/gost/identifiers/foreign_reference.rb +0 -25
- data/lib/pubid/gost/identifiers/harmonized.rb +0 -39
- data/lib/pubid/gost/identifiers/identical_adoption.rb +0 -39
- data/lib/pubid/gost/identifiers/interstate_standard.rb +0 -20
- data/lib/pubid/gost/identifiers/national_standard.rb +0 -19
- data/lib/pubid/gost/identifiers.rb +0 -13
- data/lib/pubid/gost/parser.rb +0 -105
- data/lib/pubid/gost/renderer.rb +0 -48
- data/lib/pubid/gost/urn_generator.rb +0 -46
- data/lib/pubid/gost/urn_parser.rb +0 -52
- data/lib/pubid/gost.rb +0 -49
- data/lib/pubid/iala/builder.rb +0 -102
- data/lib/pubid/iala/identifier.rb +0 -90
- data/lib/pubid/iala/identifiers/advice.rb +0 -15
- data/lib/pubid/iala/identifiers/annex.rb +0 -57
- data/lib/pubid/iala/identifiers/general_assembly.rb +0 -19
- data/lib/pubid/iala/identifiers/guideline.rb +0 -17
- data/lib/pubid/iala/identifiers/letter.rb +0 -16
- data/lib/pubid/iala/identifiers/manual.rb +0 -18
- data/lib/pubid/iala/identifiers/model_course.rb +0 -17
- data/lib/pubid/iala/identifiers/recommendation.rb +0 -17
- data/lib/pubid/iala/identifiers/report.rb +0 -16
- data/lib/pubid/iala/identifiers/resolution.rb +0 -16
- data/lib/pubid/iala/identifiers/standard.rb +0 -17
- data/lib/pubid/iala/identifiers.rb +0 -19
- data/lib/pubid/iala/parser.rb +0 -138
- data/lib/pubid/iala/renderer.rb +0 -36
- data/lib/pubid/iala/urn_generator.rb +0 -49
- data/lib/pubid/iala/urn_parser.rb +0 -67
- data/lib/pubid/iala.rb +0 -71
- data/lib/pubid/iana/builder.rb +0 -22
- data/lib/pubid/iana/identifier.rb +0 -140
- data/lib/pubid/iana/identifiers/registry.rb +0 -69
- data/lib/pubid/iana/identifiers.rb +0 -9
- data/lib/pubid/iana/parser.rb +0 -38
- data/lib/pubid/iana/renderer.rb +0 -32
- data/lib/pubid/iana/urn_generator.rb +0 -19
- data/lib/pubid/iana/urn_parser.rb +0 -24
- data/lib/pubid/iana.rb +0 -69
- data/lib/pubid/idf/renderer.rb +0 -84
- data/lib/pubid/idf/urn_parser.rb +0 -25
- data/lib/pubid/iec/components.rb +0 -14
- data/lib/pubid/iec/identifiers/technical_group.rb +0 -30
- data/lib/pubid/iec/identifiers.rb +0 -31
- data/lib/pubid/iec/renderer.rb +0 -267
- data/lib/pubid/ieee/compaction.rb +0 -121
- data/lib/pubid/ieee/identifiers/amendment.rb +0 -40
- data/lib/pubid/ieee/identifiers/code_number.rb +0 -82
- data/lib/pubid/ieee/identifiers/nesc/edition.rb +0 -32
- data/lib/pubid/ieee/pre_parser.rb +0 -301
- data/lib/pubid/ieee/renderer.rb +0 -408
- data/lib/pubid/ieee/urn_parser.rb +0 -34
- data/lib/pubid/ietf/builder.rb +0 -78
- data/lib/pubid/ietf/identifier.rb +0 -5
- data/lib/pubid/ietf/identifiers/base.rb +0 -72
- data/lib/pubid/ietf/identifiers/bcp.rb +0 -36
- data/lib/pubid/ietf/identifiers/fyi.rb +0 -36
- data/lib/pubid/ietf/identifiers/internet_draft.rb +0 -45
- data/lib/pubid/ietf/identifiers/rfc.rb +0 -27
- data/lib/pubid/ietf/identifiers/serialization.rb +0 -51
- data/lib/pubid/ietf/identifiers/std.rb +0 -36
- data/lib/pubid/ietf/identifiers.rb +0 -14
- data/lib/pubid/ietf/parser.rb +0 -61
- data/lib/pubid/ietf/renderer.rb +0 -64
- data/lib/pubid/ietf/urn_generator.rb +0 -37
- data/lib/pubid/ietf/urn_parser.rb +0 -43
- data/lib/pubid/ietf.rb +0 -85
- data/lib/pubid/iho/renderer.rb +0 -30
- data/lib/pubid/iho/urn_parser.rb +0 -58
- data/lib/pubid/isbn/builder.rb +0 -44
- data/lib/pubid/isbn/check_digit.rb +0 -53
- data/lib/pubid/isbn/identifier.rb +0 -81
- data/lib/pubid/isbn/identifiers/book.rb +0 -30
- data/lib/pubid/isbn/identifiers.rb +0 -9
- data/lib/pubid/isbn/parser.rb +0 -45
- data/lib/pubid/isbn/renderer.rb +0 -16
- data/lib/pubid/isbn.rb +0 -52
- data/lib/pubid/iso/normalizer.rb +0 -89
- data/lib/pubid/itu/components/designation.rb +0 -35
- data/lib/pubid/itu/components.rb +0 -12
- data/lib/pubid/itu/identifiers/addendum.rb +0 -15
- data/lib/pubid/itu/identifiers/annex_of_recommendation.rb +0 -87
- data/lib/pubid/itu/identifiers/appendix_of_recommendation.rb +0 -92
- data/lib/pubid/itu/identifiers/errata.rb +0 -15
- data/lib/pubid/itu/identifiers/handbook.rb +0 -38
- data/lib/pubid/itu/identifiers/question.rb +0 -63
- data/lib/pubid/itu/identifiers/report.rb +0 -39
- data/lib/pubid/itu/identifiers/standard_serialization.rb +0 -58
- data/lib/pubid/itu/urn_parser.rb +0 -31
- data/lib/pubid/jcgm/identifiers/corrigendum.rb +0 -34
- data/lib/pubid/jcgm/identifiers/meeting.rb +0 -47
- data/lib/pubid/jcgm/renderer.rb +0 -89
- data/lib/pubid/jcgm/urn_parser.rb +0 -177
- data/lib/pubid/jis/identifiers/corrigendum.rb +0 -16
- data/lib/pubid/jis/renderer.rb +0 -69
- data/lib/pubid/jis/urn_parser.rb +0 -23
- data/lib/pubid/nist/caster.rb +0 -1234
- data/lib/pubid/nist/circular_supplement_builder.rb +0 -293
- data/lib/pubid/nist/identifier.rb +0 -8
- data/lib/pubid/nist/identifiers/dated_document.rb +0 -49
- data/lib/pubid/nist/parser_output_normalizer.rb +0 -233
- data/lib/pubid/nist/preprocessor.rb +0 -443
- data/lib/pubid/nist/renderer.rb +0 -43
- data/lib/pubid/nist/router.rb +0 -149
- data/lib/pubid/nist/series/base.rb +0 -58
- data/lib/pubid/nist/series/crpl.rb +0 -13
- data/lib/pubid/nist/series/fips.rb +0 -14
- data/lib/pubid/nist/series/ir.rb +0 -57
- data/lib/pubid/nist/series/letter_preserving.rb +0 -15
- data/lib/pubid/nist/series/mono.rb +0 -19
- data/lib/pubid/nist/series/ncstar.rb +0 -20
- data/lib/pubid/nist/series.rb +0 -49
- data/lib/pubid/nist/urn_parser.rb +0 -67
- data/lib/pubid/oasis/builder.rb +0 -79
- data/lib/pubid/oasis/identifier.rb +0 -160
- data/lib/pubid/oasis/identifiers/standard.rb +0 -29
- data/lib/pubid/oasis/identifiers.rb +0 -9
- data/lib/pubid/oasis/parser.rb +0 -34
- data/lib/pubid/oasis/renderer.rb +0 -29
- data/lib/pubid/oasis/urn_generator.rb +0 -25
- data/lib/pubid/oasis/urn_parser.rb +0 -22
- data/lib/pubid/oasis.rb +0 -79
- data/lib/pubid/ogc/builder.rb +0 -33
- data/lib/pubid/ogc/identifier.rb +0 -81
- data/lib/pubid/ogc/identifiers/document.rb +0 -26
- data/lib/pubid/ogc/identifiers.rb +0 -10
- data/lib/pubid/ogc/parser.rb +0 -40
- data/lib/pubid/ogc/renderer.rb +0 -33
- data/lib/pubid/ogc/urn_generator.rb +0 -14
- data/lib/pubid/ogc/urn_parser.rb +0 -22
- data/lib/pubid/ogc.rb +0 -71
- data/lib/pubid/oiml/identifiers/bulletin.rb +0 -137
- data/lib/pubid/oiml/identifiers/code_number.rb +0 -90
- data/lib/pubid/oiml/identifiers/errata.rb +0 -15
- data/lib/pubid/oiml/renderer.rb +0 -232
- data/lib/pubid/oiml/urn_parser.rb +0 -39
- data/lib/pubid/omg/builder.rb +0 -19
- data/lib/pubid/omg/identifier.rb +0 -47
- data/lib/pubid/omg/identifiers/specification.rb +0 -32
- data/lib/pubid/omg/identifiers.rb +0 -9
- data/lib/pubid/omg/parser.rb +0 -40
- data/lib/pubid/omg/renderer.rb +0 -19
- data/lib/pubid/omg.rb +0 -51
- data/lib/pubid/parser/grammar.rb +0 -74
- data/lib/pubid/plateau/identifier.rb +0 -4
- data/lib/pubid/plateau/renderer.rb +0 -51
- data/lib/pubid/plateau/urn_parser.rb +0 -43
- data/lib/pubid/prefixes_support.rb +0 -51
- data/lib/pubid/renderers/annotator.rb +0 -233
- data/lib/pubid/sae/renderer.rb +0 -36
- data/lib/pubid/sae/urn_parser.rb +0 -36
- data/lib/pubid/tgpp/builder.rb +0 -41
- data/lib/pubid/tgpp/identifier.rb +0 -107
- data/lib/pubid/tgpp/identifiers/technical_report.rb +0 -32
- data/lib/pubid/tgpp/identifiers/technical_specification.rb +0 -33
- data/lib/pubid/tgpp/identifiers.rb +0 -11
- data/lib/pubid/tgpp/parser.rb +0 -78
- data/lib/pubid/tgpp/renderer.rb +0 -52
- data/lib/pubid/tgpp/urn_generator.rb +0 -39
- data/lib/pubid/tgpp/urn_parser.rb +0 -30
- data/lib/pubid/tgpp.rb +0 -83
- data/lib/pubid/type_resolver.rb +0 -59
- data/lib/pubid/un/builder.rb +0 -42
- data/lib/pubid/un/identifier.rb +0 -40
- data/lib/pubid/un/identifiers/document.rb +0 -24
- data/lib/pubid/un/identifiers.rb +0 -9
- data/lib/pubid/un/parser.rb +0 -25
- data/lib/pubid/un/renderer.rb +0 -11
- data/lib/pubid/un.rb +0 -46
- data/lib/pubid/urn_parser/base.rb +0 -81
- data/lib/pubid/urn_parser/errors.rb +0 -16
- data/lib/pubid/urn_parser.rb +0 -14
- data/lib/pubid/w3c/builder.rb +0 -55
- data/lib/pubid/w3c/identifier.rb +0 -130
- data/lib/pubid/w3c/identifiers/candidate_recommendation.rb +0 -31
- data/lib/pubid/w3c/identifiers/candidate_recommendation_draft.rb +0 -31
- data/lib/pubid/w3c/identifiers/draft_note.rb +0 -31
- data/lib/pubid/w3c/identifiers/note.rb +0 -30
- data/lib/pubid/w3c/identifiers/obsolete_recommendation.rb +0 -31
- data/lib/pubid/w3c/identifiers/proposed_edited_recommendation.rb +0 -31
- data/lib/pubid/w3c/identifiers/proposed_recommendation.rb +0 -31
- data/lib/pubid/w3c/identifiers/recommendation.rb +0 -31
- data/lib/pubid/w3c/identifiers/standard.rb +0 -12
- data/lib/pubid/w3c/identifiers/superseded_recommendation.rb +0 -31
- data/lib/pubid/w3c/identifiers/working_draft.rb +0 -30
- data/lib/pubid/w3c/identifiers.rb +0 -25
- data/lib/pubid/w3c/parser.rb +0 -43
- data/lib/pubid/w3c/renderer.rb +0 -35
- data/lib/pubid/w3c/urn_generator.rb +0 -18
- data/lib/pubid/w3c/urn_parser.rb +0 -36
- data/lib/pubid/w3c.rb +0 -67
- data/lib/pubid/xsf/builder.rb +0 -17
- data/lib/pubid/xsf/identifier.rb +0 -66
- data/lib/pubid/xsf/identifiers/xep.rb +0 -31
- data/lib/pubid/xsf/identifiers.rb +0 -9
- data/lib/pubid/xsf/parser.rb +0 -25
- data/lib/pubid/xsf/renderer.rb +0 -23
- data/lib/pubid/xsf/urn_generator.rb +0 -13
- data/lib/pubid/xsf/urn_parser.rb +0 -18
- data/lib/pubid/xsf.rb +0 -81
|
@@ -2,743 +2,498 @@
|
|
|
2
2
|
|
|
3
3
|
module Pubid
|
|
4
4
|
module Nist
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Pubid::Nist.parse(identifier)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# Compact, index-friendly serialization (mirrors the key_value flavors
|
|
16
|
-
# ISO/ITU/ETSI, without a 38-field key_value block). Two transforms,
|
|
17
|
-
# applied symmetrically by to_hash/from_hash so the round-trip stays
|
|
18
|
-
# idempotent:
|
|
19
|
-
# - flatten the single-value Code components (series, number) to bare
|
|
20
|
-
# scalars — `value` is the only stored field. NIST's
|
|
21
|
-
# `Components::Code#part` is a *computed* reader
|
|
22
|
-
# (`value.split("-").last`), and prefix/subpart/parts are never
|
|
23
|
-
# assigned on series/number, so the scalar `value` is lossless:
|
|
24
|
-
# expand recomputes exactly what the object would compute anyway;
|
|
25
|
-
# - flatten the plain single-value components (volume) to bare scalars
|
|
26
|
-
# too — `Components::Volume` holds only `value`, so it expands to a
|
|
27
|
-
# bare { "value" => … } with no part;
|
|
28
|
-
# - drop the redundant build artifacts, decomposed pieces of the
|
|
29
|
-
# canonical number that identity/rendering never read.
|
|
30
|
-
COMPACT_FLAT_CODES = %w[series number subseries].freeze
|
|
31
|
-
COMPACT_FLAT_VALUES = %w[volume].freeze
|
|
32
|
-
COMPACT_DROP_ATTRS = %w[first_number second_number].freeze
|
|
33
|
-
|
|
34
|
-
# Deserialize a (possibly compact) hash: expand the flattened scalars
|
|
35
|
-
# back into Code sub-hashes, then let the shared polymorphic from_hash
|
|
36
|
-
# do the real work. Nested `base` documents are expanded recursively by
|
|
37
|
-
# their own from_hash via apply_mappings, so only this level is touched.
|
|
38
|
-
def self.from_hash(data, options = {})
|
|
39
|
-
super(expand_compact_hash(data), options)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# Expand a compact hash in place-safe fashion: a scalar series/number
|
|
43
|
-
# becomes { "value" => …, "part" => <last-dash segment> }.
|
|
44
|
-
def self.expand_compact_hash(data)
|
|
45
|
-
return data unless data.is_a?(::Hash)
|
|
46
|
-
|
|
47
|
-
out = data.dup
|
|
48
|
-
COMPACT_FLAT_CODES.each do |key|
|
|
49
|
-
out[key] = expand_code(out[key]) if out[key].is_a?(::String)
|
|
50
|
-
end
|
|
51
|
-
COMPACT_FLAT_VALUES.each do |key|
|
|
52
|
-
out[key] = { "value" => out[key] } if out[key].is_a?(::String)
|
|
5
|
+
module Identifiers
|
|
6
|
+
# Base NIST/NBS identifier class
|
|
7
|
+
# Each series type inherits from this and overrides series_code
|
|
8
|
+
class Base < Pubid::Identifier
|
|
9
|
+
# Default: no typed stages. Subclasses override as needed.
|
|
10
|
+
def self.typed_stages
|
|
11
|
+
[]
|
|
53
12
|
end
|
|
54
|
-
out
|
|
55
|
-
end
|
|
56
13
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
14
|
+
# Generate URN for this identifier
|
|
15
|
+
#
|
|
16
|
+
# @return [String] URN representation
|
|
17
|
+
|
|
18
|
+
attribute :publisher, Components::Publisher
|
|
19
|
+
attribute :series, Components::Code # Set by Builder from parsed data
|
|
20
|
+
attribute :number, Components::Code
|
|
21
|
+
|
|
22
|
+
# V2 COMPONENTS (Lutaml::Model objects) - PROPER SEPARATION
|
|
23
|
+
attribute :edition, Components::Edition # Edition (type + id): e2, e2021, r5, -3
|
|
24
|
+
attribute :edition_component, Components::Edition # V2 edition component (alias)
|
|
25
|
+
attribute :volume, Components::Volume # Volume component (v6)
|
|
26
|
+
attribute :part, Components::Part # Part component (n1 or pt1)
|
|
27
|
+
attribute :stage, Components::Stage
|
|
28
|
+
attribute :version_component, Components::Version
|
|
29
|
+
attribute :update_component, Components::Update
|
|
30
|
+
attribute :translation_component, Components::Translation
|
|
31
|
+
attribute :issue_number, Components::IssueNumber
|
|
32
|
+
attribute :parsed_format, :string # :mr, :short, :long, :abbrev
|
|
33
|
+
attribute :publisher_was_parsed, :boolean, default: -> { false }
|
|
34
|
+
|
|
35
|
+
# LEGACY attributes (keep for backward compatibility during migration)
|
|
36
|
+
attribute :parts, Components::Code, collection: true
|
|
37
|
+
attribute :revision, :string
|
|
38
|
+
attribute :revision_year, :string # Year for revision (e.g., r6/1925, r1963, rJun1992)
|
|
39
|
+
attribute :revision_month, :string # Month for revision (e.g., rJun1992)
|
|
40
|
+
attribute :edition_year, :string # Legacy edition year for backward compatibility
|
|
41
|
+
attribute :version, :string
|
|
42
|
+
attribute :update, Components::Update
|
|
43
|
+
attribute :year, :integer
|
|
44
|
+
attribute :month, :integer
|
|
45
|
+
|
|
46
|
+
# Additional attributes for complex patterns
|
|
47
|
+
attribute :first_number, Components::Code
|
|
48
|
+
attribute :second_number, Components::Code
|
|
49
|
+
attribute :update_number, :string
|
|
50
|
+
attribute :update_year, :string
|
|
51
|
+
attribute :addendum, :string
|
|
52
|
+
attribute :addendum_number, :string
|
|
53
|
+
attribute :supplement, :string
|
|
54
|
+
attribute :supplement_date_range_start, :string # For date ranges like Jan1924-Jan1926
|
|
55
|
+
attribute :supplement_date_range_end, :string
|
|
56
|
+
attribute :supplement_has_revision, :boolean, default: -> { false }
|
|
57
|
+
attribute :errata, :string
|
|
58
|
+
attribute :index, :string
|
|
59
|
+
attribute :insert, :string
|
|
60
|
+
attribute :section, :string
|
|
61
|
+
attribute :appendix, :string
|
|
62
|
+
attribute :translation, :string
|
|
63
|
+
attribute :draft, :string
|
|
64
|
+
attribute :draft_number, :string # For -draft N → N pd rendering
|
|
65
|
+
|
|
66
|
+
# Default series_code — subclasses override to provide a normalized series name.
|
|
67
|
+
def series_code
|
|
68
|
+
nil
|
|
80
69
|
end
|
|
81
|
-
compact_hash!(hash["base"]) if hash["base"].is_a?(::Hash)
|
|
82
|
-
hash
|
|
83
|
-
end
|
|
84
|
-
private :compact_hash!
|
|
85
70
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
[]
|
|
89
|
-
end
|
|
71
|
+
def initialize(**attributes)
|
|
72
|
+
super()
|
|
90
73
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# Plain string ("NIST"/"NBS"), not a Components::Publisher wrapper: the
|
|
96
|
-
# value is a single token, so a string serializes flat
|
|
97
|
-
# (`publisher: NBS`, not `publisher: {publisher: NBS}`) and accepts the
|
|
98
|
-
# raw string the circular/supplement builders pass straight through.
|
|
99
|
-
attribute :publisher, :string
|
|
100
|
-
attribute :series, Components::Code # Set by Builder from parsed data
|
|
101
|
-
# SP subseries (Appendix A.2 of the NIST PubID Syntax): for "NIST SP 800-53"
|
|
102
|
-
# the subseries is "800" and the sequence is "53". Populated by the Builder
|
|
103
|
-
# when the series is "SP" and the first number matches a known subseries
|
|
104
|
-
# code. Informational metadata derived from series+number — ignored in
|
|
105
|
-
# equality so a manually-built id (without subseries set) still equals a
|
|
106
|
-
# parsed one.
|
|
107
|
-
attribute :subseries, Components::Code
|
|
108
|
-
attribute :number, Components::Code
|
|
109
|
-
|
|
110
|
-
# V2 COMPONENTS (Lutaml::Model objects) - PROPER SEPARATION
|
|
111
|
-
# `edition` (Components::Edition: type + id + additional_text) is the
|
|
112
|
-
# single source of truth for edition/revision. The former
|
|
113
|
-
# `edition_component` (a byte-identical duplicate) and the `revision`
|
|
114
|
-
# string (always "#{edition.type}#{edition.id}") were unfinished V1->V2
|
|
115
|
-
# migration aliases; both removed. `#revision` survives as a derived
|
|
116
|
-
# reader below.
|
|
117
|
-
attribute :edition, Components::Edition # Edition (type + id): e2, e2021, r5, -3
|
|
118
|
-
attribute :volume, Components::Volume # Volume component (v6)
|
|
119
|
-
attribute :part, Components::Part # Part component (n1 or pt1)
|
|
120
|
-
attribute :stage, Components::Stage
|
|
121
|
-
attribute :version_component, Components::Version
|
|
122
|
-
attribute :update_component, Components::Update
|
|
123
|
-
attribute :translation_component, Components::Translation
|
|
124
|
-
attribute :issue_number, Components::IssueNumber
|
|
125
|
-
attribute :parsed_format, :string # :mr, :short, :long, :abbrev
|
|
126
|
-
# Whether the publisher prefix (NIST/NBS) should be rendered. Defaults
|
|
127
|
-
# to true so the common publisher-bearing id need not serialize the
|
|
128
|
-
# flag at all — the Builder only assigns it (false) for prefix-less
|
|
129
|
-
# inputs, so `to_hash` carries `publisher_was_parsed: false` only in
|
|
130
|
-
# that case and omits it otherwise. (lutaml emits a boolean iff it was
|
|
131
|
-
# explicitly assigned; an omitted key loads as this default.)
|
|
132
|
-
attribute :publisher_was_parsed, :boolean, default: -> { true }
|
|
133
|
-
|
|
134
|
-
# LEGACY attributes (keep for backward compatibility during migration)
|
|
135
|
-
attribute :parts, Components::Code, collection: true
|
|
136
|
-
attribute :revision_year, :string # Year for revision (e.g., r6/1925, r1963, rJun1992)
|
|
137
|
-
attribute :revision_month, :string # Month for revision (e.g., rJun1992)
|
|
138
|
-
attribute :edition_year, :string # Legacy edition year for backward compatibility
|
|
139
|
-
attribute :version, :string
|
|
140
|
-
attribute :update, Components::Update
|
|
141
|
-
attribute :year, :integer
|
|
142
|
-
attribute :month, :integer
|
|
143
|
-
|
|
144
|
-
# Additional attributes for complex patterns
|
|
145
|
-
attribute :first_number, Components::Code
|
|
146
|
-
attribute :second_number, Components::Code
|
|
147
|
-
attribute :update_number, :string
|
|
148
|
-
attribute :update_year, :string
|
|
149
|
-
attribute :addendum, :string
|
|
150
|
-
attribute :addendum_number, :string
|
|
151
|
-
# Single source of truth for the supplement: a structured component with
|
|
152
|
-
# isolated parts (number / year / month / date-range / revision), so a
|
|
153
|
-
# supplement's year is queryable independently of its number. Presence
|
|
154
|
-
# (non-nil) means "is a supplement"; an all-empty component is a bare
|
|
155
|
-
# "sup" marker. Replaces the former flat :supplement string plus the
|
|
156
|
-
# separate date-range/has_revision fields.
|
|
157
|
-
attribute :supplement, Components::Supplement
|
|
158
|
-
attribute :errata, :string
|
|
159
|
-
attribute :index, :string
|
|
160
|
-
attribute :insert, :string
|
|
161
|
-
attribute :section, :string
|
|
162
|
-
attribute :appendix, :string
|
|
163
|
-
attribute :translation, :string
|
|
164
|
-
attribute :draft, :string
|
|
165
|
-
attribute :draft_number, :string # For -draft N → N pd rendering
|
|
166
|
-
|
|
167
|
-
# Default series_code — subclasses override to provide a normalized series name.
|
|
168
|
-
def series_code
|
|
169
|
-
nil
|
|
170
|
-
end
|
|
171
|
-
|
|
172
|
-
def initialize(**attributes)
|
|
173
|
-
# This override calls `super()` with no attributes and assigns through
|
|
174
|
-
# setters instead, so it bypasses the base constructor's coercion and
|
|
175
|
-
# unknown-key check. Apply them here to keep the cross-flavor contract.
|
|
176
|
-
attributes = self.class.normalize_init_attributes(attributes)
|
|
177
|
-
super()
|
|
74
|
+
attrs = self.class.attributes
|
|
75
|
+
attributes.each do |key, value|
|
|
76
|
+
next if value.nil?
|
|
178
77
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
78
|
+
setter = :"#{key}="
|
|
79
|
+
public_send(setter, value) if attrs.key?(key)
|
|
80
|
+
end
|
|
182
81
|
|
|
183
|
-
|
|
184
|
-
|
|
82
|
+
# NOTE: Compound number building is handled by the Builder class
|
|
83
|
+
# Do NOT build compound numbers here - let the builder apply special patterns first
|
|
84
|
+
# See lib/pubid/nist/builder.rb lines 368-472 for compound number logic
|
|
185
85
|
end
|
|
186
86
|
|
|
187
|
-
#
|
|
188
|
-
#
|
|
189
|
-
|
|
190
|
-
|
|
87
|
+
# Compute revision from edition component for backward compatibility
|
|
88
|
+
# @return [String, nil] revision string (e.g., "r5") or nil
|
|
89
|
+
def revision
|
|
90
|
+
return @revision if @revision
|
|
191
91
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
# :number, retained from the parse for building
|
|
197
|
-
# - parsed_format: records the input format for round-trip rendering
|
|
198
|
-
# - subseries: derived from series+number (which SP subseries the
|
|
199
|
-
# document belongs to); populated by the Builder for known SP
|
|
200
|
-
# subseries codes. Ignored in equality so a manually-built id
|
|
201
|
-
# without subseries set still equals a parsed one.
|
|
202
|
-
EQUALITY_IGNORED_ATTRS = %i[
|
|
203
|
-
first_number second_number parsed_format subseries
|
|
204
|
-
].freeze
|
|
205
|
-
|
|
206
|
-
# Logical identity comparison: equal when every attribute except the
|
|
207
|
-
# build artifacts/aliases above matches. (Edition#== already ignores
|
|
208
|
-
# its rendering-only original_prefix.)
|
|
209
|
-
def ==(other)
|
|
210
|
-
return false unless other.instance_of?(self.class)
|
|
211
|
-
|
|
212
|
-
self.class.attributes.each_key.all? do |name|
|
|
213
|
-
EQUALITY_IGNORED_ATTRS.include?(name) || public_send(name) == other.public_send(name)
|
|
92
|
+
# Compute from edition component if available
|
|
93
|
+
if edition&.type && edition.id
|
|
94
|
+
"#{edition.type}#{edition.id}"
|
|
95
|
+
end
|
|
214
96
|
end
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
alias eql? ==
|
|
218
97
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
end
|
|
98
|
+
# Backward compatibility: translation method returns translation_component
|
|
99
|
+
# This allows tests to use parsed.translation.language instead of parsed.translation_component.language
|
|
100
|
+
def translation
|
|
101
|
+
translation_component
|
|
102
|
+
end
|
|
225
103
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
# supplement matches that document across ALL editions, years, and
|
|
231
|
-
# supplements — the basis for "select docs by ID parts".
|
|
232
|
-
#
|
|
233
|
-
# Asymmetric (unlike ==): "NBS CIRC 25".matches?("NBS CIRC 25sup1924")
|
|
234
|
-
# is true, but not the reverse. The candidate must be the same class or
|
|
235
|
-
# a subclass so series-level identity still holds.
|
|
236
|
-
def matches?(candidate)
|
|
237
|
-
return false unless candidate.is_a?(self.class)
|
|
238
|
-
|
|
239
|
-
self.class.attributes.each_key.all? do |name|
|
|
240
|
-
next true if EQUALITY_IGNORED_ATTRS.include?(name)
|
|
241
|
-
|
|
242
|
-
query_val = public_send(name)
|
|
243
|
-
next true if query_val.nil?
|
|
244
|
-
next true if query_val.is_a?(String) && query_val.empty?
|
|
245
|
-
next true if query_val.is_a?(Array) && query_val.empty?
|
|
246
|
-
|
|
247
|
-
query_val == candidate.public_send(name)
|
|
104
|
+
# Backward compatibility: language method returns translation_component
|
|
105
|
+
# This allows tests to use parsed.language instead of parsed.translation_component
|
|
106
|
+
def language
|
|
107
|
+
translation_component
|
|
248
108
|
end
|
|
249
|
-
end
|
|
250
109
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
110
|
+
# Generate identifier string in specified format
|
|
111
|
+
# @param format [:full, :long, :abbreviated, :short, :mr] output format
|
|
112
|
+
def to_s(format = nil)
|
|
113
|
+
# Handle both keyword argument (hash) and positional argument (symbol/string)
|
|
114
|
+
format = format[:format] if format.is_a?(Hash)
|
|
115
|
+
|
|
116
|
+
# Default to parsed_format if available (preserves input format on round-trip)
|
|
117
|
+
# Falls back to :short format for output (normalization)
|
|
118
|
+
# Explicit format parameter always overrides parsed_format
|
|
119
|
+
effective_format = format || parsed_format&.to_sym || :short
|
|
120
|
+
effective_format = effective_format.to_sym if effective_format.is_a?(String)
|
|
121
|
+
case effective_format
|
|
122
|
+
when :full, :long
|
|
123
|
+
to_full_style
|
|
124
|
+
when :abbreviated, :abbrev
|
|
125
|
+
to_abbreviated_style
|
|
126
|
+
when :short
|
|
127
|
+
to_short_style
|
|
128
|
+
when :mr
|
|
129
|
+
to_mr_style
|
|
130
|
+
else
|
|
131
|
+
to_short_style
|
|
132
|
+
end
|
|
133
|
+
end
|
|
269
134
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
135
|
+
# Returns weight based on amount of defined attributes
|
|
136
|
+
# Used for ranking identifiers by specificity for conflict resolution
|
|
137
|
+
# @return [Integer] weight score (higher = more specific)
|
|
138
|
+
def weight
|
|
139
|
+
self.class.attributes.keys.inject(0) do |sum, key|
|
|
140
|
+
val = public_send(key)
|
|
141
|
+
val && !val.to_s.empty? ? sum + 1 : sum
|
|
142
|
+
end
|
|
143
|
+
end
|
|
277
144
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
145
|
+
# Merge another document into this one
|
|
146
|
+
# Used for combining document data, preferring more specific values
|
|
147
|
+
# @param document [Base] another NIST document to merge
|
|
148
|
+
# @return [Base] self with merged attributes
|
|
149
|
+
def merge(document)
|
|
150
|
+
return self unless document.is_a?(Base)
|
|
151
|
+
|
|
152
|
+
attrs = self.class.attributes
|
|
153
|
+
attrs.each_key do |var_name|
|
|
154
|
+
next if var_name == :rendering_style
|
|
155
|
+
next if var_name == :parsed_format
|
|
156
|
+
|
|
157
|
+
current_val = public_send(var_name)
|
|
158
|
+
new_val = document.public_send(var_name)
|
|
159
|
+
next unless new_val
|
|
160
|
+
|
|
161
|
+
should_merge = case var_name
|
|
162
|
+
when :publisher, :series, :number
|
|
163
|
+
true
|
|
164
|
+
when :edition
|
|
165
|
+
current_val.nil? || edition_greater?(new_val,
|
|
166
|
+
current_val)
|
|
167
|
+
when :volume, :part, :version, :revision
|
|
168
|
+
current_val.nil? || (new_val.to_s.length > current_val.to_s.length)
|
|
169
|
+
when :supplement, :errata, :index, :insert, :section, :appendix, :translation
|
|
170
|
+
true
|
|
171
|
+
when :year, :month, :update, :draft
|
|
172
|
+
true
|
|
173
|
+
else
|
|
174
|
+
false
|
|
175
|
+
end
|
|
283
176
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
def language
|
|
287
|
-
translation_component
|
|
288
|
-
end
|
|
177
|
+
public_send(:"#{var_name}=", new_val) if should_merge
|
|
178
|
+
end
|
|
289
179
|
|
|
290
|
-
|
|
291
|
-
# to the renderer. Pubid::Identifier#render only forwards
|
|
292
|
-
# :with_edition; NIST needs :nist_format for multi-format support.
|
|
293
|
-
def render(format: :human, **opts)
|
|
294
|
-
registry = self.class.format_registry
|
|
295
|
-
unless registry
|
|
296
|
-
raise ArgumentError, "No format registry configured on #{self.class}"
|
|
180
|
+
self
|
|
297
181
|
end
|
|
298
182
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
183
|
+
# Helper to compare edition values numerically
|
|
184
|
+
# @return [Boolean] true if edition1 is greater than edition2
|
|
185
|
+
def edition_greater?(edition1, edition2)
|
|
186
|
+
num1 = extract_edition_number(edition1)
|
|
187
|
+
num2 = extract_edition_number(edition2)
|
|
188
|
+
num1 && num2 && num1 > num2
|
|
302
189
|
end
|
|
303
190
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
# Default to parsed_format if available (preserves input format on round-trip)
|
|
315
|
-
# Falls back to :short format for output (normalization)
|
|
316
|
-
# Explicit format parameter always overrides parsed_format
|
|
317
|
-
rendered = render(format: :human,
|
|
318
|
-
nist_format: format || parsed_format&.to_sym || :short)
|
|
319
|
-
|
|
320
|
-
# NIST's `to_s` takes a POSITIONAL format and its `render` override
|
|
321
|
-
# builds no rendering context, so neither the flag nor the context
|
|
322
|
-
# reaches the shared hook. Apply the annotation fallback here.
|
|
323
|
-
annotate_plain_render(rendered, annotated: annotated)
|
|
324
|
-
end
|
|
325
|
-
|
|
326
|
-
# NIST has its own defined MR format (to_mr_style) used by relaton-nist
|
|
327
|
-
# and downstream tooling. The generic Renderers::MrString does not know
|
|
328
|
-
# about NIST series, revisions, supplements, etc., so delegate to the
|
|
329
|
-
# established style for losslessness (issue #142).
|
|
330
|
-
def to_mr_string
|
|
331
|
-
to_mr_style
|
|
332
|
-
end
|
|
191
|
+
# Extract numeric value from edition (r3 -> 3, r5 -> 5, e2 -> 2)
|
|
192
|
+
# @return [Integer, nil] the edition number or nil if not extractable
|
|
193
|
+
def extract_edition_number(edition)
|
|
194
|
+
# Handle both String and Edition component
|
|
195
|
+
edition_str = edition.to_s
|
|
196
|
+
# Match patterns like r3, r5, e2, etc.
|
|
197
|
+
match = edition_str.match(/^[er]?(\d+)$/)
|
|
198
|
+
match ? match[1].to_i : nil
|
|
199
|
+
end
|
|
333
200
|
|
|
334
|
-
|
|
335
|
-
# (e.g. `NIST.SP.800-53`). The slug, however, must be lowercase to
|
|
336
|
-
# match the cross-flavor convention; project the MR through `downcase`.
|
|
337
|
-
def to_slug
|
|
338
|
-
to_mr_string.downcase
|
|
339
|
-
end
|
|
201
|
+
private
|
|
340
202
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
203
|
+
def to_full_style
|
|
204
|
+
# "National Institute of Standards and Technology Special Publication 800-27, Revision A"
|
|
205
|
+
result = publisher_full_name
|
|
206
|
+
result += " #{series_full_name}" if series
|
|
207
|
+
result += " #{number.value}" if number
|
|
208
|
+
result += parts.map { |p| "-#{p}" }.join if parts&.any?
|
|
347
209
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
210
|
+
# Render volume and issue number in long form: "Vol. 6, No. 12"
|
|
211
|
+
if volume && issue_number
|
|
212
|
+
result += " Vol. #{volume}, #{issue_number.to_s(:long)}"
|
|
213
|
+
elsif volume
|
|
214
|
+
result += " Vol. #{volume}"
|
|
215
|
+
end
|
|
352
216
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
# @param document [Base] another NIST document to merge
|
|
356
|
-
# @return [Base] self with merged attributes
|
|
357
|
-
def merge(document)
|
|
358
|
-
return self unless document.is_a?(Pubid::Nist::Identifier)
|
|
359
|
-
|
|
360
|
-
attrs = self.class.attributes
|
|
361
|
-
attrs.each_key do |var_name|
|
|
362
|
-
next if var_name == :rendering_style
|
|
363
|
-
next if var_name == :parsed_format
|
|
364
|
-
|
|
365
|
-
current_val = public_send(var_name)
|
|
366
|
-
new_val = document.public_send(var_name)
|
|
367
|
-
next unless new_val
|
|
368
|
-
|
|
369
|
-
should_merge = case var_name
|
|
370
|
-
when :publisher, :series, :number
|
|
371
|
-
true
|
|
372
|
-
when :edition
|
|
373
|
-
current_val.nil? || edition_greater?(new_val,
|
|
374
|
-
current_val)
|
|
375
|
-
when :volume, :part, :version
|
|
376
|
-
current_val.nil? || (new_val.to_s.length > current_val.to_s.length)
|
|
377
|
-
when :supplement, :errata, :index, :insert, :section, :appendix, :translation
|
|
378
|
-
true
|
|
379
|
-
when :year, :month, :update, :draft
|
|
380
|
-
true
|
|
381
|
-
else
|
|
382
|
-
false
|
|
383
|
-
end
|
|
384
|
-
|
|
385
|
-
public_send(:"#{var_name}=", new_val) if should_merge
|
|
386
|
-
end
|
|
217
|
+
# NEW: Use edition component properly
|
|
218
|
+
result += " #{edition.to_s(:long)}" if edition
|
|
387
219
|
|
|
388
|
-
|
|
389
|
-
end
|
|
220
|
+
result += ", Revision #{revision.sub(/^r/, '')}" if revision
|
|
390
221
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
def edition_greater?(edition1, edition2)
|
|
394
|
-
num1 = extract_edition_number(edition1)
|
|
395
|
-
num2 = extract_edition_number(edition2)
|
|
396
|
-
num1 && num2 && num1 > num2
|
|
397
|
-
end
|
|
222
|
+
# V2: Use version_component
|
|
223
|
+
result += " #{version_component.to_s(:long)}" if version_component
|
|
398
224
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
def extract_edition_number(edition)
|
|
402
|
-
# Handle both String and Edition component
|
|
403
|
-
edition_str = edition.to_s
|
|
404
|
-
# Match patterns like r3, r5, e2, etc.
|
|
405
|
-
match = edition_str.match(/^[er]?(\d+)$/)
|
|
406
|
-
match ? match[1].to_i : nil
|
|
407
|
-
end
|
|
225
|
+
# V2: Use update_component
|
|
226
|
+
result += " #{update_component.to_s(:long)}" if update_component
|
|
408
227
|
|
|
409
|
-
|
|
228
|
+
# V2: Use stage
|
|
229
|
+
result += " #{stage.to_s(:long)}" if stage
|
|
410
230
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
result = publisher_full_name
|
|
414
|
-
result += " #{series_full_name}" if series
|
|
415
|
-
result += " #{number.value}" if number
|
|
416
|
-
result += parts.map { |p| "-#{p}" }.join if parts&.any?
|
|
231
|
+
# V2: Use translation_component (already includes space)
|
|
232
|
+
result += translation_component.to_s(:long) if translation_component
|
|
417
233
|
|
|
418
|
-
|
|
419
|
-
if volume && issue_number
|
|
420
|
-
result += " Vol. #{volume}, #{issue_number.to_s(:long)}"
|
|
421
|
-
elsif volume
|
|
422
|
-
result += " Vol. #{volume}"
|
|
234
|
+
result
|
|
423
235
|
end
|
|
424
236
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
237
|
+
def to_abbreviated_style
|
|
238
|
+
# "Natl. Inst. Stand. Technol. Spec. Publ. 800-57 Part 1, Revision 4"
|
|
239
|
+
result = publisher_abbreviated_name
|
|
240
|
+
result += " #{series_abbreviated_name}" if series
|
|
241
|
+
result += " #{number}" if number
|
|
242
|
+
result += " Part #{parts.first}" if parts&.any?
|
|
429
243
|
|
|
430
|
-
|
|
431
|
-
|
|
244
|
+
# NEW: Use edition component properly
|
|
245
|
+
result += " #{edition.to_s(:abbrev)}" if edition
|
|
432
246
|
|
|
433
|
-
|
|
434
|
-
result += " #{update_component.to_s(:long)}" if update_component
|
|
247
|
+
result += ", Revision #{revision}" if revision
|
|
435
248
|
|
|
436
|
-
|
|
437
|
-
|
|
249
|
+
# V2: Use version_component
|
|
250
|
+
result += " #{version_component.to_s(:abbrev)}" if version_component
|
|
438
251
|
|
|
439
|
-
|
|
440
|
-
|
|
252
|
+
# V2: Use update_component
|
|
253
|
+
result += " #{update_component.to_s(:abbrev)}" if update_component
|
|
441
254
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
def to_abbreviated_style
|
|
446
|
-
# "Natl. Inst. Stand. Technol. Spec. Publ. 800-57 Part 1, Revision 4"
|
|
447
|
-
result = publisher_abbreviated_name
|
|
448
|
-
result += " #{series_abbreviated_name}" if series
|
|
449
|
-
result += " #{number}" if number
|
|
450
|
-
result += " Part #{parts.first}" if parts&.any?
|
|
255
|
+
# V2: Use stage
|
|
256
|
+
result += " #{stage.to_s(:abbrev)}" if stage
|
|
451
257
|
|
|
452
|
-
|
|
453
|
-
|
|
258
|
+
# V2: Use translation_component
|
|
259
|
+
result += ", #{translation_component.to_s(:abbrev)}" if translation_component
|
|
454
260
|
|
|
455
|
-
|
|
261
|
+
result
|
|
262
|
+
end
|
|
456
263
|
|
|
457
|
-
|
|
458
|
-
|
|
264
|
+
def to_short_style
|
|
265
|
+
# "SP 800-187" or "NIST SP 800-187" - handle compound series properly
|
|
266
|
+
result = ""
|
|
267
|
+
|
|
268
|
+
# Determine effective publisher
|
|
269
|
+
# Only show publisher if it was explicitly parsed (either directly or from series prefix)
|
|
270
|
+
effective_publisher = if publisher && publisher_was_parsed
|
|
271
|
+
# Publisher was in input (either as separate field or extracted from "NBS CS" series)
|
|
272
|
+
publisher.to_s
|
|
273
|
+
else
|
|
274
|
+
# No publisher in input, don't show default
|
|
275
|
+
nil
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
# Determine effective series - PREFER series_code if subclass defines it
|
|
279
|
+
# This allows normalization (e.g., LCIRC → LC in LetterCircular)
|
|
280
|
+
effective_series = if series_code
|
|
281
|
+
series_code
|
|
282
|
+
elsif series
|
|
283
|
+
series.to_s
|
|
284
|
+
end
|
|
285
|
+
|
|
286
|
+
# Special handling for compound series that include publisher prefix
|
|
287
|
+
# If series starts with "NBS " (like "NBS CIRC"), use it as-is
|
|
288
|
+
if effective_series&.start_with?("NBS ")
|
|
289
|
+
result += effective_series
|
|
290
|
+
elsif effective_publisher && effective_series
|
|
291
|
+
result += "#{effective_publisher} #{effective_series}"
|
|
292
|
+
elsif effective_series && publisher_was_parsed
|
|
293
|
+
# Only add "NIST" prefix if publisher was explicitly in the input
|
|
294
|
+
result += "NIST #{effective_series}"
|
|
295
|
+
elsif effective_series
|
|
296
|
+
# No publisher in input, just show series without prefix
|
|
297
|
+
result += effective_series
|
|
298
|
+
end
|
|
459
299
|
|
|
460
|
-
|
|
461
|
-
|
|
300
|
+
result += " #{number}" if number
|
|
301
|
+
result += parts.map { |p| "-#{p}" }.join if parts&.any?
|
|
302
|
+
|
|
303
|
+
# NEW: Use Volume and Part components (v6n1 notation for CSM, pt1 for SP)
|
|
304
|
+
if volume.is_a?(Components::Volume) && part.is_a?(Components::Part)
|
|
305
|
+
# CSM series: v#n# notation
|
|
306
|
+
result += " #{volume}#{part}"
|
|
307
|
+
elsif part.is_a?(Components::Part)
|
|
308
|
+
# SP and other series: use Part.type to determine format
|
|
309
|
+
result += part.to_s
|
|
310
|
+
# Legacy: Render standalone volume (not part of v#n#)
|
|
311
|
+
elsif volume && !issue_number && !part
|
|
312
|
+
vol_str = volume.is_a?(Components::Volume) ? volume.to_s : "v#{volume}"
|
|
313
|
+
result += vol_str
|
|
314
|
+
elsif volume && issue_number
|
|
315
|
+
# Render volume and issue number in short form: "v6n12"
|
|
316
|
+
vol_str = volume.is_a?(Components::Volume) ? volume.to_s : "v#{volume}"
|
|
317
|
+
result += "#{vol_str}n#{issue_number.number}"
|
|
318
|
+
end
|
|
462
319
|
|
|
463
|
-
|
|
464
|
-
|
|
320
|
+
# NEW: Use edition component properly (e2, e2021, r5, -3)
|
|
321
|
+
# NO space before edition when number present (per NIST spec)
|
|
322
|
+
# Only add space for bare edition (no number case) or if original_prefix has specific format
|
|
323
|
+
if edition
|
|
324
|
+
if edition.original_prefix && !edition.original_prefix.empty?
|
|
325
|
+
# original_prefix includes the full prefix (e.g., " Rev. " for verbose format)
|
|
326
|
+
result += edition.to_s
|
|
327
|
+
elsif number
|
|
328
|
+
# Number present, NO space: "800-53r5"
|
|
329
|
+
result += edition.to_s
|
|
330
|
+
else
|
|
331
|
+
# Bare edition, add space: " r5"
|
|
332
|
+
result += " #{edition}"
|
|
333
|
+
end
|
|
334
|
+
end
|
|
465
335
|
|
|
466
|
-
|
|
467
|
-
|
|
336
|
+
# V2: Use version_component if available, else use version string
|
|
337
|
+
if version_component
|
|
338
|
+
result += " #{version_component.to_s(:short)}"
|
|
339
|
+
elsif version
|
|
340
|
+
result += " Ver. #{version}"
|
|
341
|
+
end
|
|
468
342
|
|
|
469
|
-
|
|
470
|
-
|
|
343
|
+
# Add supplement with date range support - FIX: proper spacing
|
|
344
|
+
if supplement_date_range_start && supplement_date_range_end
|
|
345
|
+
result += "supp#{supplement_date_range_start}-#{supplement_date_range_end}"
|
|
346
|
+
elsif supplement_has_revision
|
|
347
|
+
result += "supprev"
|
|
348
|
+
elsif supplement && !supplement.empty?
|
|
349
|
+
# Smart dash logic:
|
|
350
|
+
# - If supplement starts with letter (month like "Jan1924"), NO dash
|
|
351
|
+
# - If supplement is digits only (year like "1924"), WITH dash
|
|
352
|
+
result += if supplement.match?(/^[A-Z]/)
|
|
353
|
+
"supp#{supplement}"
|
|
354
|
+
else
|
|
355
|
+
"supp-#{supplement}"
|
|
356
|
+
end
|
|
357
|
+
elsif supplement
|
|
358
|
+
result += "supp"
|
|
359
|
+
end
|
|
471
360
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
effective_publisher = if publisher && publisher_was_parsed
|
|
479
|
-
# Publisher was in input (either as separate field or extracted from "NBS CS" series)
|
|
480
|
-
publisher.to_s
|
|
481
|
-
else
|
|
482
|
-
# No publisher in input, don't show default
|
|
483
|
-
nil
|
|
484
|
-
end
|
|
485
|
-
|
|
486
|
-
# Determine effective series - PREFER series_code if subclass defines it
|
|
487
|
-
# This allows normalization (e.g., LCIRC → LC in LetterCircular)
|
|
488
|
-
effective_series = if series_code
|
|
489
|
-
series_code
|
|
490
|
-
elsif series
|
|
491
|
-
series.to_s
|
|
492
|
-
end
|
|
361
|
+
# Add other attributes
|
|
362
|
+
result += errata.to_s if errata
|
|
363
|
+
result += "index" if index
|
|
364
|
+
result += "insert" if insert
|
|
365
|
+
result += "sec#{section}" if section
|
|
366
|
+
result += "app" if appendix
|
|
493
367
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
elsif effective_publisher && effective_series
|
|
499
|
-
result += "#{effective_publisher} #{effective_series}"
|
|
500
|
-
elsif effective_series && publisher_was_parsed
|
|
501
|
-
# Only add "NIST" prefix if publisher was explicitly in the input
|
|
502
|
-
result += "NIST #{effective_series}"
|
|
503
|
-
elsif effective_series
|
|
504
|
-
# No publisher in input, just show series without prefix
|
|
505
|
-
result += effective_series
|
|
506
|
-
end
|
|
368
|
+
# Add addendum - render as " Add." suffix
|
|
369
|
+
if addendum || addendum_number
|
|
370
|
+
result += " Add."
|
|
371
|
+
end
|
|
507
372
|
|
|
508
|
-
|
|
509
|
-
|
|
373
|
+
# V2: Use update_component if available, else use update string
|
|
374
|
+
if update_component
|
|
375
|
+
result += update_component.to_s(:short)
|
|
376
|
+
elsif update
|
|
377
|
+
result += "-upd#{update}"
|
|
378
|
+
end
|
|
510
379
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
380
|
+
# Add draft - render as {N}pd if draft_number present
|
|
381
|
+
if draft_number
|
|
382
|
+
result += " #{draft_number}pd"
|
|
383
|
+
elsif draft&.to_s&.include?("draft") && !draft.to_s.include?("Draft)")
|
|
384
|
+
result += "-draft"
|
|
385
|
+
end
|
|
514
386
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
result += append_short_components
|
|
387
|
+
# V2: Add stage component (at end, before translation)
|
|
388
|
+
if stage
|
|
389
|
+
result += " #{stage.to_s(:short)}"
|
|
390
|
+
end
|
|
520
391
|
|
|
521
|
-
|
|
522
|
-
|
|
392
|
+
# V2: Use translation_component if available, else use translation string
|
|
393
|
+
# Note: translation_component.to_s already includes the space prefix
|
|
394
|
+
if translation_component
|
|
395
|
+
result += translation_component.to_s(:short)
|
|
396
|
+
elsif translation
|
|
397
|
+
result += " #{translation}"
|
|
398
|
+
end
|
|
523
399
|
|
|
524
|
-
|
|
525
|
-
# publisher/series/number in short (human) form. Extracted from
|
|
526
|
-
# #to_short_style so subclasses that build a series-specific prefix can
|
|
527
|
-
# reuse it instead of hand-listing components (and forgetting some).
|
|
528
|
-
#
|
|
529
|
-
# skip_part: true lets a series that renders its part differently
|
|
530
|
-
# (e.g. FIPS uses dash "-1", not "pt1") emit the part itself and skip
|
|
531
|
-
# the generic part rendering here, while still getting volume/edition/
|
|
532
|
-
# supplement/etc.
|
|
533
|
-
def append_short_components(skip_part: false)
|
|
534
|
-
result = ""
|
|
535
|
-
effective_part = skip_part ? nil : part
|
|
536
|
-
|
|
537
|
-
# Volume and Part components (v6n1 notation for CSM, pt1 for SP)
|
|
538
|
-
if volume.is_a?(Components::Volume) && effective_part.is_a?(Components::Part)
|
|
539
|
-
# CSM series: v#n# notation
|
|
540
|
-
result += " #{volume}#{effective_part}"
|
|
541
|
-
elsif effective_part.is_a?(Components::Part)
|
|
542
|
-
# SP and other series: use Part.type to determine format
|
|
543
|
-
result += effective_part.to_s
|
|
544
|
-
# Legacy: Render standalone volume (not part of v#n#)
|
|
545
|
-
elsif volume && !issue_number && !effective_part
|
|
546
|
-
vol_str = volume.is_a?(Components::Volume) ? volume.to_s : "v#{volume}"
|
|
547
|
-
result += vol_str
|
|
548
|
-
elsif volume && issue_number
|
|
549
|
-
# Render volume and issue number in short form: "v6n12"
|
|
550
|
-
vol_str = volume.is_a?(Components::Volume) ? volume.to_s : "v#{volume}"
|
|
551
|
-
result += "#{vol_str}n#{issue_number.number}"
|
|
400
|
+
result
|
|
552
401
|
end
|
|
553
402
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
403
|
+
def to_mr_style
|
|
404
|
+
# "NIST.SP.800-116r1.ipd" (machine-readable with dots)
|
|
405
|
+
result = (publisher || "NIST").to_s
|
|
406
|
+
|
|
407
|
+
# Determine effective series - PREFER series_code if subclass defines it
|
|
408
|
+
# This allows normalization (e.g., LCIRC → LC in LetterCircular)
|
|
409
|
+
effective_series = if series_code
|
|
410
|
+
series_code
|
|
411
|
+
elsif series
|
|
412
|
+
series.to_s
|
|
413
|
+
end
|
|
414
|
+
|
|
415
|
+
result += ".#{effective_series}" if effective_series
|
|
416
|
+
result += ".#{number}" if number
|
|
417
|
+
result += parts.map { |p| "-#{p}" }.join if parts&.any?
|
|
418
|
+
|
|
419
|
+
# Part component (pt1, v6n1, etc.)
|
|
420
|
+
result += part.to_s if part.is_a?(Components::Part)
|
|
421
|
+
|
|
422
|
+
# NEW: Use edition component - NO space before edition in MR format (per NIST spec)
|
|
423
|
+
if edition
|
|
424
|
+
# If edition has original_prefix set (e.g., verbose " Rev. "), use it as-is
|
|
425
|
+
# Otherwise, no space needed in MR format: ".800-53r5"
|
|
426
|
+
if edition.original_prefix && !edition.original_prefix.empty?
|
|
427
|
+
end
|
|
563
428
|
result += edition.to_s
|
|
564
|
-
else
|
|
565
|
-
# Bare edition, add space: " r5"
|
|
566
|
-
result += " #{edition}"
|
|
567
429
|
end
|
|
568
|
-
end
|
|
569
430
|
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
# (e.g. "800-53r5"), so version reads "800-45ver2" not
|
|
573
|
-
# "800-45 ver2".
|
|
574
|
-
if version_component
|
|
575
|
-
result += version_component.to_s(:short)
|
|
576
|
-
elsif version
|
|
577
|
-
result += "ver#{version}"
|
|
578
|
-
end
|
|
431
|
+
# V2: Use version_component
|
|
432
|
+
result += version_component.to_s(:mr) if version_component
|
|
579
433
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
# uses "sup2", "sup1940", "supA"); date-range keeps its inner dash.
|
|
583
|
-
# Rendered from the structured component; a present-but-empty
|
|
584
|
-
# component is the bare "sup" marker.
|
|
585
|
-
result += supplement_short
|
|
586
|
-
|
|
587
|
-
# Add other attributes
|
|
588
|
-
result += errata.to_s if errata
|
|
589
|
-
result += "index" if index
|
|
590
|
-
result += "insert" if insert
|
|
591
|
-
result += "sec#{section}" if section
|
|
592
|
-
result += "app" if appendix
|
|
593
|
-
|
|
594
|
-
# Add addendum - render as " Add." suffix
|
|
595
|
-
if addendum || addendum_number
|
|
596
|
-
result += " Add."
|
|
597
|
-
end
|
|
434
|
+
# V2: Use update_component
|
|
435
|
+
result += update_component.to_s(:mr) if update_component
|
|
598
436
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
result += update_component.to_s(:short)
|
|
602
|
-
elsif update
|
|
603
|
-
result += "-upd#{update}"
|
|
604
|
-
end
|
|
437
|
+
# V2: Use stage
|
|
438
|
+
result += ".#{stage.to_s(:mr)}" if stage
|
|
605
439
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
result += "-draft"
|
|
611
|
-
end
|
|
440
|
+
# Add addendum - render as ".Add." suffix in MR format
|
|
441
|
+
if addendum || addendum_number
|
|
442
|
+
result += ".Add."
|
|
443
|
+
end
|
|
612
444
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
result += " #{stage.to_s(:short)}"
|
|
616
|
-
end
|
|
445
|
+
# V2: Use translation_component
|
|
446
|
+
result += translation_component.to_s(:mr) if translation_component
|
|
617
447
|
|
|
618
|
-
|
|
619
|
-
# Note: translation_component.to_s already includes the space prefix
|
|
620
|
-
if translation_component
|
|
621
|
-
result += translation_component.to_s(:short)
|
|
622
|
-
elsif translation
|
|
623
|
-
result += " #{translation}"
|
|
448
|
+
result
|
|
624
449
|
end
|
|
625
450
|
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
# Determine effective series - PREFER series_code if subclass defines it
|
|
634
|
-
# This allows normalization (e.g., LCIRC → LC in LetterCircular)
|
|
635
|
-
effective_series = if series_code
|
|
636
|
-
series_code
|
|
637
|
-
elsif series
|
|
638
|
-
series.to_s
|
|
639
|
-
end
|
|
640
|
-
|
|
641
|
-
result += ".#{effective_series}" if effective_series
|
|
642
|
-
result += ".#{number}" if number
|
|
643
|
-
result += parts.map { |p| "-#{p}" }.join if parts&.any?
|
|
644
|
-
|
|
645
|
-
result += append_mr_components
|
|
646
|
-
|
|
647
|
-
result
|
|
648
|
-
end
|
|
649
|
-
|
|
650
|
-
# Render the optional component tail for machine-readable (MR) form.
|
|
651
|
-
# Mirrors #append_short_components so the MR output is just as lossless;
|
|
652
|
-
# subclasses that override #to_mr_style reuse this instead of
|
|
653
|
-
# hand-listing components. skip_part: behaves as in the short helper.
|
|
654
|
-
def append_mr_components(skip_part: false)
|
|
655
|
-
result = ""
|
|
656
|
-
effective_part = skip_part ? nil : part
|
|
657
|
-
|
|
658
|
-
# Volume / Part components (pt1, v6n1, etc.)
|
|
659
|
-
if volume.is_a?(Components::Volume) && effective_part.is_a?(Components::Part)
|
|
660
|
-
result += "#{volume}#{effective_part}"
|
|
661
|
-
elsif effective_part.is_a?(Components::Part)
|
|
662
|
-
result += effective_part.to_s
|
|
663
|
-
elsif volume && !issue_number && !effective_part
|
|
664
|
-
result += (volume.is_a?(Components::Volume) ? volume.to_s : "v#{volume}")
|
|
665
|
-
elsif volume && issue_number
|
|
666
|
-
vol_str = volume.is_a?(Components::Volume) ? volume.to_s : "v#{volume}"
|
|
667
|
-
result += "#{vol_str}n#{issue_number.number}"
|
|
451
|
+
def series_full_name
|
|
452
|
+
{
|
|
453
|
+
"SP" => "Special Publication",
|
|
454
|
+
"FIPS" => "Federal Information Processing Standards",
|
|
455
|
+
"IR" => "Interagency Report",
|
|
456
|
+
"TN" => "Technical Note",
|
|
457
|
+
}[series] || series
|
|
668
458
|
end
|
|
669
459
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
result += supplement_short
|
|
678
|
-
|
|
679
|
-
# Use update_component
|
|
680
|
-
result += update_component.to_s(:mr) if update_component
|
|
681
|
-
|
|
682
|
-
# Use stage
|
|
683
|
-
result += ".#{stage.to_s(:mr)}" if stage
|
|
684
|
-
|
|
685
|
-
# Add addendum - render as ".Add." suffix in MR format
|
|
686
|
-
if addendum || addendum_number
|
|
687
|
-
result += ".Add."
|
|
460
|
+
def series_abbreviated_name
|
|
461
|
+
{
|
|
462
|
+
"SP" => "Spec. Publ.",
|
|
463
|
+
"FIPS" => "Fed. Inf. Proc. Stand.",
|
|
464
|
+
"IR" => "Interag. Rep.",
|
|
465
|
+
"TN" => "Tech. Note",
|
|
466
|
+
}[series&.to_s || series_code] || (series&.to_s || series_code)
|
|
688
467
|
end
|
|
689
468
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
"FIPS" => "Federal Information Processing Standards",
|
|
700
|
-
"IR" => "Interagency Report",
|
|
701
|
-
"TN" => "Technical Note",
|
|
702
|
-
}[series] || series
|
|
703
|
-
end
|
|
704
|
-
|
|
705
|
-
def series_abbreviated_name
|
|
706
|
-
{
|
|
707
|
-
"SP" => "Spec. Publ.",
|
|
708
|
-
"FIPS" => "Fed. Inf. Proc. Stand.",
|
|
709
|
-
"IR" => "Interag. Rep.",
|
|
710
|
-
"TN" => "Tech. Note",
|
|
711
|
-
}[series&.to_s || series_code] || (series&.to_s || series_code)
|
|
712
|
-
end
|
|
713
|
-
|
|
714
|
-
def publisher_full_name
|
|
715
|
-
case publisher.to_s
|
|
716
|
-
when "NBS"
|
|
717
|
-
"National Bureau of Standards"
|
|
718
|
-
when "NIST"
|
|
719
|
-
"National Institute of Standards and Technology"
|
|
720
|
-
else
|
|
721
|
-
publisher.to_s
|
|
469
|
+
def publisher_full_name
|
|
470
|
+
case publisher.to_s
|
|
471
|
+
when "NBS"
|
|
472
|
+
"National Bureau of Standards"
|
|
473
|
+
when "NIST"
|
|
474
|
+
"National Institute of Standards and Technology"
|
|
475
|
+
else
|
|
476
|
+
publisher.to_s
|
|
477
|
+
end
|
|
722
478
|
end
|
|
723
|
-
end
|
|
724
479
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
480
|
+
def publisher_abbreviated_name
|
|
481
|
+
case publisher.to_s
|
|
482
|
+
when "NBS"
|
|
483
|
+
"Natl. Bur. Stand."
|
|
484
|
+
when "NIST"
|
|
485
|
+
"Natl. Inst. Stand. Technol."
|
|
486
|
+
else
|
|
487
|
+
publisher.to_s
|
|
488
|
+
end
|
|
733
489
|
end
|
|
734
|
-
end
|
|
735
490
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
491
|
+
# Default publisher for series without explicit publisher
|
|
492
|
+
# Subclasses can override
|
|
493
|
+
def default_publisher
|
|
494
|
+
"NIST"
|
|
495
|
+
end
|
|
740
496
|
end
|
|
741
497
|
end
|
|
742
|
-
|
|
743
498
|
end
|
|
744
499
|
end
|