pubid 1.15.19 → 2.0.0.pre.alpha.2
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/LICENSE.txt +1 -1
- data/README.adoc +2041 -53
- data/archived-gems/pubid-ccsds/update_codes.yaml +1 -0
- data/archived-gems/pubid-iec/stages.yaml +129 -0
- data/archived-gems/pubid-iec/update_codes.yaml +67 -0
- data/archived-gems/pubid-ieee/update_codes.yaml +104 -0
- data/archived-gems/pubid-iso/stages.yaml +106 -0
- data/archived-gems/pubid-iso/update_codes.yaml +4 -0
- data/archived-gems/pubid-itu/i18n.yaml +13 -0
- data/archived-gems/pubid-itu/series.yaml +42 -0
- data/archived-gems/pubid-nist/publishers.yaml +6 -0
- data/archived-gems/pubid-nist/series.yaml +121 -0
- data/archived-gems/pubid-nist/stages.yaml +16 -0
- data/archived-gems/pubid-nist/update_codes.yaml +93 -0
- data/archived-gems/pubid-plateau/update_codes.yaml +6 -0
- data/data/ccsds/update_codes.yaml +1 -0
- data/data/iec/update_codes.yaml +67 -0
- data/data/ieee/update_codes.yaml +104 -0
- data/data/iso/update_codes.yaml +21 -0
- data/data/nist/update_codes.yaml +89 -0
- data/data/plateau/update_codes.yaml +6 -0
- data/lib/pubid/amca/builder.rb +176 -0
- data/lib/pubid/amca/identifier.rb +57 -0
- data/lib/pubid/amca/identifiers/base.rb +64 -0
- data/lib/pubid/amca/identifiers/interpretation.rb +51 -0
- data/lib/pubid/amca/identifiers/publication.rb +47 -0
- data/lib/pubid/amca/identifiers/standard.rb +22 -0
- data/lib/pubid/amca/identifiers.rb +12 -0
- data/lib/pubid/amca/parser.rb +153 -0
- data/lib/pubid/amca/scheme.rb +16 -0
- data/lib/pubid/amca/single_identifier.rb +33 -0
- data/lib/pubid/amca/urn_generator.rb +50 -0
- data/lib/pubid/amca.rb +26 -0
- data/lib/pubid/ansi/builder.rb +52 -0
- data/lib/pubid/ansi/identifier.rb +55 -0
- data/lib/pubid/ansi/identifiers/american_national_standard.rb +12 -0
- data/lib/pubid/ansi/identifiers/standard.rb +16 -0
- data/lib/pubid/ansi/identifiers.rb +11 -0
- data/lib/pubid/ansi/parser.rb +91 -0
- data/lib/pubid/ansi/scheme.rb +15 -0
- data/lib/pubid/ansi/single_identifier.rb +45 -0
- data/lib/pubid/ansi/urn_generator.rb +76 -0
- data/lib/pubid/ansi.rb +27 -0
- data/lib/pubid/api/builder.rb +85 -0
- data/lib/pubid/api/components/code.rb +9 -0
- data/lib/pubid/api/identifier.rb +68 -0
- data/lib/pubid/api/identifiers/base.rb +24 -0
- data/lib/pubid/api/identifiers/bulletin.rb +15 -0
- data/lib/pubid/api/identifiers/continuous_operations_standard.rb +15 -0
- data/lib/pubid/api/identifiers/mpms.rb +44 -0
- data/lib/pubid/api/identifiers/publication.rb +15 -0
- data/lib/pubid/api/identifiers/recommended_practice.rb +15 -0
- data/lib/pubid/api/identifiers/specification.rb +15 -0
- data/lib/pubid/api/identifiers/standard.rb +15 -0
- data/lib/pubid/api/identifiers/technical_report.rb +15 -0
- data/lib/pubid/api/identifiers/typeless_standard.rb +27 -0
- data/lib/pubid/api/parser.rb +140 -0
- data/lib/pubid/api/scheme.rb +66 -0
- data/lib/pubid/api/single_identifier.rb +46 -0
- data/lib/pubid/api/urn_generator.rb +41 -0
- data/lib/pubid/api.rb +17 -0
- data/lib/pubid/ashrae/builder.rb +498 -0
- data/lib/pubid/ashrae/identifier.rb +57 -0
- data/lib/pubid/ashrae/identifiers/addenda_package.rb +46 -0
- data/lib/pubid/ashrae/identifiers/addendum.rb +55 -0
- data/lib/pubid/ashrae/identifiers/base.rb +23 -0
- data/lib/pubid/ashrae/identifiers/combined_addenda.rb +51 -0
- data/lib/pubid/ashrae/identifiers/errata.rb +40 -0
- data/lib/pubid/ashrae/identifiers/guideline.rb +38 -0
- data/lib/pubid/ashrae/identifiers/interpretation.rb +39 -0
- data/lib/pubid/ashrae/identifiers/standard.rb +38 -0
- data/lib/pubid/ashrae/identifiers.rb +16 -0
- data/lib/pubid/ashrae/parser.rb +724 -0
- data/lib/pubid/ashrae/scheme.rb +53 -0
- data/lib/pubid/ashrae/single_identifier.rb +23 -0
- data/lib/pubid/ashrae/supplement_identifier.rb +23 -0
- data/lib/pubid/ashrae/urn_generator.rb +59 -0
- data/lib/pubid/ashrae.rb +21 -0
- data/lib/pubid/asme/builder.rb +153 -0
- data/lib/pubid/asme/components/code.rb +18 -0
- data/lib/pubid/asme/identifier.rb +61 -0
- data/lib/pubid/asme/identifiers/base.rb +70 -0
- data/lib/pubid/asme/identifiers/standard.rb +12 -0
- data/lib/pubid/asme/identifiers.rb +10 -0
- data/lib/pubid/asme/parser.rb +308 -0
- data/lib/pubid/asme/scheme.rb +37 -0
- data/lib/pubid/asme/single_identifier.rb +29 -0
- data/lib/pubid/asme/urn_generator.rb +133 -0
- data/lib/pubid/asme.rb +21 -0
- data/lib/pubid/astm/builder.rb +159 -0
- data/lib/pubid/astm/components/code.rb +33 -0
- data/lib/pubid/astm/identifier.rb +92 -0
- data/lib/pubid/astm/identifiers/adjunct.rb +21 -0
- data/lib/pubid/astm/identifiers/base.rb +13 -0
- data/lib/pubid/astm/identifiers/data_series.rb +25 -0
- data/lib/pubid/astm/identifiers/iso_dual_published.rb +74 -0
- data/lib/pubid/astm/identifiers/manual.rb +40 -0
- data/lib/pubid/astm/identifiers/monograph.rb +25 -0
- data/lib/pubid/astm/identifiers/research_report.rb +18 -0
- data/lib/pubid/astm/identifiers/standard.rb +52 -0
- data/lib/pubid/astm/identifiers/technical_report.rb +23 -0
- data/lib/pubid/astm/identifiers/work_in_progress.rb +21 -0
- data/lib/pubid/astm/parser.rb +244 -0
- data/lib/pubid/astm/scheme.rb +55 -0
- data/lib/pubid/astm/single_identifier.rb +25 -0
- data/lib/pubid/astm/urn_generator.rb +99 -0
- data/lib/pubid/astm.rb +38 -0
- data/lib/pubid/bsi/builder.rb +1483 -0
- data/lib/pubid/bsi/components/code.rb +11 -0
- data/lib/pubid/bsi/components/date.rb +11 -0
- data/lib/pubid/bsi/components/publisher.rb +11 -0
- data/lib/pubid/bsi/components/type.rb +11 -0
- data/lib/pubid/bsi/identifier.rb +87 -0
- data/lib/pubid/bsi/identifiers/addendum_document.rb +64 -0
- data/lib/pubid/bsi/identifiers/adopted_european_norm.rb +95 -0
- data/lib/pubid/bsi/identifiers/adopted_international_standard.rb +82 -0
- data/lib/pubid/bsi/identifiers/aerospace_standard.rb +118 -0
- data/lib/pubid/bsi/identifiers/amendment.rb +40 -0
- data/lib/pubid/bsi/identifiers/base.rb +11 -0
- data/lib/pubid/bsi/identifiers/british_industrial_practice.rb +27 -0
- data/lib/pubid/bsi/identifiers/british_standard.rb +33 -0
- data/lib/pubid/bsi/identifiers/bundled_identifier.rb +114 -0
- data/lib/pubid/bsi/identifiers/committee_document.rb +51 -0
- data/lib/pubid/bsi/identifiers/consolidated_identifier.rb +152 -0
- data/lib/pubid/bsi/identifiers/corrigendum.rb +28 -0
- data/lib/pubid/bsi/identifiers/detailed_specification.rb +69 -0
- data/lib/pubid/bsi/identifiers/disc.rb +56 -0
- data/lib/pubid/bsi/identifiers/draft_document.rb +71 -0
- data/lib/pubid/bsi/identifiers/electronic_book.rb +52 -0
- data/lib/pubid/bsi/identifiers/expert_commentary.rb +47 -0
- data/lib/pubid/bsi/identifiers/explanatory_supplement.rb +82 -0
- data/lib/pubid/bsi/identifiers/flex.rb +61 -0
- data/lib/pubid/bsi/identifiers/handbook.rb +39 -0
- data/lib/pubid/bsi/identifiers/index.rb +62 -0
- data/lib/pubid/bsi/identifiers/method.rb +76 -0
- data/lib/pubid/bsi/identifiers/national_annex.rb +73 -0
- data/lib/pubid/bsi/identifiers/practice_guide.rb +27 -0
- data/lib/pubid/bsi/identifiers/publicly_available_specification.rb +79 -0
- data/lib/pubid/bsi/identifiers/published_document.rb +79 -0
- data/lib/pubid/bsi/identifiers/section.rb +62 -0
- data/lib/pubid/bsi/identifiers/set.rb +46 -0
- data/lib/pubid/bsi/identifiers/standalone_amendment.rb +40 -0
- data/lib/pubid/bsi/identifiers/supplement_document.rb +51 -0
- data/lib/pubid/bsi/identifiers/supplementary_index.rb +81 -0
- data/lib/pubid/bsi/identifiers/technical_specification.rb +79 -0
- data/lib/pubid/bsi/identifiers/test_method.rb +67 -0
- data/lib/pubid/bsi/identifiers/value_added_publication.rb +52 -0
- data/lib/pubid/bsi/identifiers.rb +52 -0
- data/lib/pubid/bsi/model.rb +196 -0
- data/lib/pubid/bsi/parser.rb +659 -0
- data/lib/pubid/bsi/scheme.rb +243 -0
- data/lib/pubid/bsi/single_identifier.rb +129 -0
- data/lib/pubid/bsi/urn_generator.rb +84 -0
- data/lib/pubid/bsi.rb +32 -0
- data/lib/pubid/builder/base.rb +138 -0
- data/lib/pubid/bundled_identifier.rb +126 -0
- data/lib/pubid/ccsds/builder.rb +56 -0
- data/lib/pubid/ccsds/identifier.rb +84 -0
- data/lib/pubid/ccsds/identifiers/base.rb +89 -0
- data/lib/pubid/ccsds/identifiers/base_BASE_88929.rb +70 -0
- data/lib/pubid/ccsds/identifiers/corrigendum.rb +39 -0
- data/lib/pubid/ccsds/identifiers.rb +10 -0
- data/lib/pubid/ccsds/parser.rb +71 -0
- data/lib/pubid/ccsds/scheme.rb +57 -0
- data/lib/pubid/ccsds/single_identifier.rb +77 -0
- data/lib/pubid/ccsds/supplement_identifier.rb +33 -0
- data/lib/pubid/ccsds/urn_generator.rb +115 -0
- data/lib/pubid/ccsds.rb +21 -0
- data/lib/pubid/cen_cenelec/builder.rb +330 -0
- data/lib/pubid/cen_cenelec/identifier.rb +52 -0
- data/lib/pubid/cen_cenelec/identifiers/adopted_european_norm.rb +40 -0
- data/lib/pubid/cen_cenelec/identifiers/amendment.rb +29 -0
- data/lib/pubid/cen_cenelec/identifiers/base.rb +75 -0
- data/lib/pubid/cen_cenelec/identifiers/cen_report.rb +28 -0
- data/lib/pubid/cen_cenelec/identifiers/cen_workshop_agreement.rb +27 -0
- data/lib/pubid/cen_cenelec/identifiers/cenelec_harmonization_document.rb +28 -0
- data/lib/pubid/cen_cenelec/identifiers/consolidated_identifier.rb +61 -0
- data/lib/pubid/cen_cenelec/identifiers/corrigendum.rb +35 -0
- data/lib/pubid/cen_cenelec/identifiers/european_norm.rb +41 -0
- data/lib/pubid/cen_cenelec/identifiers/european_prestandard.rb +37 -0
- data/lib/pubid/cen_cenelec/identifiers/european_specification.rb +28 -0
- data/lib/pubid/cen_cenelec/identifiers/fragment.rb +22 -0
- data/lib/pubid/cen_cenelec/identifiers/guide.rb +27 -0
- data/lib/pubid/cen_cenelec/identifiers/harmonization_document.rb +27 -0
- data/lib/pubid/cen_cenelec/identifiers/technical_report.rb +27 -0
- data/lib/pubid/cen_cenelec/identifiers/technical_specification.rb +35 -0
- data/lib/pubid/cen_cenelec/identifiers.rb +32 -0
- data/lib/pubid/cen_cenelec/parser.rb +144 -0
- data/lib/pubid/cen_cenelec/scheme.rb +164 -0
- data/lib/pubid/cen_cenelec/single_identifier.rb +130 -0
- data/lib/pubid/cen_cenelec/supplement_identifier.rb +48 -0
- data/lib/pubid/cen_cenelec/urn_generator.rb +129 -0
- data/lib/pubid/cen_cenelec.rb +21 -0
- data/lib/pubid/cie/builder.rb +399 -0
- data/lib/pubid/cie/components/code.rb +72 -0
- data/lib/pubid/cie/components/language.rb +58 -0
- data/lib/pubid/cie/identifier.rb +71 -0
- data/lib/pubid/cie/identifiers/bundle.rb +20 -0
- data/lib/pubid/cie/identifiers/conference.rb +32 -0
- data/lib/pubid/cie/identifiers/corrigendum.rb +40 -0
- data/lib/pubid/cie/identifiers/dual_published.rb +41 -0
- data/lib/pubid/cie/identifiers/identical.rb +64 -0
- data/lib/pubid/cie/identifiers/joint_published.rb +52 -0
- data/lib/pubid/cie/identifiers/standard.rb +58 -0
- data/lib/pubid/cie/identifiers/supplement.rb +45 -0
- data/lib/pubid/cie/identifiers/tutorial_bundle.rb +20 -0
- data/lib/pubid/cie/identifiers.rb +17 -0
- data/lib/pubid/cie/parser.rb +347 -0
- data/lib/pubid/cie/scheme.rb +64 -0
- data/lib/pubid/cie/single_identifier.rb +30 -0
- data/lib/pubid/cie/supplement_identifier.rb +26 -0
- data/lib/pubid/cie/urn_generator.rb +123 -0
- data/lib/pubid/cie.rb +28 -0
- data/lib/pubid/components/code.rb +33 -0
- data/lib/pubid/components/date.rb +49 -0
- data/lib/pubid/components/edition.rb +32 -0
- data/lib/pubid/components/factory.rb +50 -0
- data/lib/pubid/components/language.rb +37 -0
- data/lib/pubid/components/locality.rb +10 -0
- data/lib/pubid/components/publisher.rb +36 -0
- data/lib/pubid/components/stage.rb +54 -0
- data/lib/pubid/components/type.rb +58 -0
- data/lib/pubid/components/typed_stage.rb +59 -0
- data/lib/pubid/components.rb +16 -0
- data/lib/pubid/core/pattern_doc_generator.rb +272 -0
- data/lib/pubid/core/update_codes.rb +77 -0
- data/lib/pubid/core.rb +8 -0
- data/lib/pubid/csa/builder.rb +671 -0
- data/lib/pubid/csa/components/code.rb +9 -0
- data/lib/pubid/csa/components.rb +9 -0
- data/lib/pubid/csa/composite_identifier.rb +27 -0
- data/lib/pubid/csa/identifier.rb +513 -0
- data/lib/pubid/csa/identifiers/base.rb +133 -0
- data/lib/pubid/csa/identifiers/bundled.rb +125 -0
- data/lib/pubid/csa/identifiers/canadian_adopted.rb +82 -0
- data/lib/pubid/csa/identifiers/cec.rb +129 -0
- data/lib/pubid/csa/identifiers/combined.rb +130 -0
- data/lib/pubid/csa/identifiers/csa_adopted.rb +78 -0
- data/lib/pubid/csa/identifiers/package.rb +65 -0
- data/lib/pubid/csa/identifiers/series.rb +127 -0
- data/lib/pubid/csa/identifiers/standard.rb +10 -0
- data/lib/pubid/csa/identifiers.rb +17 -0
- data/lib/pubid/csa/parser.rb +445 -0
- data/lib/pubid/csa/scheme.rb +44 -0
- data/lib/pubid/csa/single_identifier.rb +30 -0
- data/lib/pubid/csa/urn_generator.rb +80 -0
- data/lib/pubid/csa/wrapper_identifier.rb +31 -0
- data/lib/pubid/csa.rb +25 -0
- data/lib/pubid/etsi/builder.rb +133 -0
- data/lib/pubid/etsi/components/code.rb +42 -0
- data/lib/pubid/etsi/components/version.rb +37 -0
- data/lib/pubid/etsi/components.rb +10 -0
- data/lib/pubid/etsi/identifier.rb +57 -0
- data/lib/pubid/etsi/identifiers/amendment.rb +15 -0
- data/lib/pubid/etsi/identifiers/base.rb +38 -0
- data/lib/pubid/etsi/identifiers/corrigendum.rb +15 -0
- data/lib/pubid/etsi/identifiers/etsi_standard.rb +19 -0
- data/lib/pubid/etsi/identifiers/supplement_identifier.rb +91 -0
- data/lib/pubid/etsi/identifiers.rb +14 -0
- data/lib/pubid/etsi/parser.rb +133 -0
- data/lib/pubid/etsi/scheme.rb +42 -0
- data/lib/pubid/etsi/urn_generator.rb +76 -0
- data/lib/pubid/etsi.rb +21 -0
- data/lib/pubid/export/auditor.rb +89 -0
- data/lib/pubid/export/data_class_exporter.rb +59 -0
- data/lib/pubid/export/exporter.rb +74 -0
- data/lib/pubid/export/flavor_exporter.rb +402 -0
- 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/result.rb +97 -0
- data/lib/pubid/export/scheme_exporter.rb +70 -0
- data/lib/pubid/export.rb +18 -0
- data/lib/pubid/format_detector.rb +16 -0
- data/lib/pubid/format_registry.rb +42 -0
- data/lib/pubid/identifier.rb +242 -0
- data/lib/pubid/identifier_metadata.rb +148 -0
- data/lib/pubid/identifier_registry.rb +198 -0
- data/lib/pubid/idf/builder.rb +82 -0
- data/lib/pubid/idf/identifier.rb +129 -0
- data/lib/pubid/idf/identifiers/amendment.rb +27 -0
- data/lib/pubid/idf/identifiers/corrigendum.rb +27 -0
- data/lib/pubid/idf/identifiers/international_standard.rb +123 -0
- data/lib/pubid/idf/identifiers/reviewed_method.rb +100 -0
- data/lib/pubid/idf/identifiers.rb +13 -0
- data/lib/pubid/idf/parser.rb +143 -0
- data/lib/pubid/idf/scheme.rb +61 -0
- data/lib/pubid/idf/single_identifier.rb +19 -0
- data/lib/pubid/idf/supplement_identifier.rb +43 -0
- data/lib/pubid/idf/urn_generator.rb +84 -0
- data/lib/pubid/idf.rb +25 -0
- data/lib/pubid/iec/builder.rb +458 -0
- data/lib/pubid/iec/components/code.rb +60 -0
- data/lib/pubid/iec/components/consolidated_amendment.rb +59 -0
- data/lib/pubid/iec/components/publisher.rb +36 -0
- data/lib/pubid/iec/components/sheet.rb +32 -0
- data/lib/pubid/iec/components/trf_info.rb +38 -0
- data/lib/pubid/iec/components/vap_suffix.rb +41 -0
- data/lib/pubid/iec/identifier.rb +256 -0
- data/lib/pubid/iec/identifiers/amendment.rb +94 -0
- data/lib/pubid/iec/identifiers/base.rb +82 -0
- data/lib/pubid/iec/identifiers/component_specification.rb +39 -0
- data/lib/pubid/iec/identifiers/conformity_assessment.rb +39 -0
- data/lib/pubid/iec/identifiers/consolidated_identifier.rb +82 -0
- data/lib/pubid/iec/identifiers/corrigendum.rb +94 -0
- data/lib/pubid/iec/identifiers/fragment_identifier.rb +137 -0
- data/lib/pubid/iec/identifiers/guide.rb +104 -0
- data/lib/pubid/iec/identifiers/international_standard.rb +147 -0
- data/lib/pubid/iec/identifiers/interpretation_sheet.rb +104 -0
- data/lib/pubid/iec/identifiers/operational_document.rb +39 -0
- data/lib/pubid/iec/identifiers/publicly_available_specification.rb +101 -0
- data/lib/pubid/iec/identifiers/sheet_identifier.rb +62 -0
- data/lib/pubid/iec/identifiers/societal_technology_trend_report.rb +40 -0
- data/lib/pubid/iec/identifiers/systems_reference_document.rb +40 -0
- data/lib/pubid/iec/identifiers/technical_report.rb +132 -0
- data/lib/pubid/iec/identifiers/technical_specification.rb +132 -0
- data/lib/pubid/iec/identifiers/technology_report.rb +39 -0
- data/lib/pubid/iec/identifiers/test_report_form.rb +78 -0
- data/lib/pubid/iec/identifiers/vap_identifier.rb +73 -0
- data/lib/pubid/iec/identifiers/white_paper.rb +39 -0
- data/lib/pubid/iec/identifiers/working_document.rb +96 -0
- data/lib/pubid/iec/parser.rb +417 -0
- data/lib/pubid/iec/rendering_style.rb +113 -0
- data/lib/pubid/iec/scheme.rb +71 -0
- data/lib/pubid/iec/single_identifier.rb +80 -0
- data/lib/pubid/iec/supplement_identifier.rb +161 -0
- data/lib/pubid/iec/urn_generator.rb +79 -0
- data/lib/pubid/iec/urn_parser.rb +90 -0
- data/lib/pubid/iec.rb +85 -0
- data/lib/pubid/ieee/aiee/builder.rb +71 -0
- data/lib/pubid/ieee/aiee/identifier.rb +105 -0
- data/lib/pubid/ieee/aiee/parser.rb +130 -0
- data/lib/pubid/ieee/aiee.rb +11 -0
- data/lib/pubid/ieee/builder.rb +1237 -0
- data/lib/pubid/ieee/components/code.rb +102 -0
- data/lib/pubid/ieee/components/draft.rb +93 -0
- data/lib/pubid/ieee/components/relationship.rb +157 -0
- data/lib/pubid/ieee/components/typed_stage.rb +100 -0
- data/lib/pubid/ieee/identifier.rb +54 -0
- data/lib/pubid/ieee/identifiers/adopted_standard.rb +33 -0
- data/lib/pubid/ieee/identifiers/base.rb +591 -0
- data/lib/pubid/ieee/identifiers/conformance_identifier.rb +35 -0
- data/lib/pubid/ieee/identifiers/corrigendum.rb +37 -0
- data/lib/pubid/ieee/identifiers/csa_dual_published.rb +51 -0
- data/lib/pubid/ieee/identifiers/dual_identifier.rb +18 -0
- data/lib/pubid/ieee/identifiers/dual_published.rb +28 -0
- data/lib/pubid/ieee/identifiers/iec_ieee_copublished.rb +27 -0
- data/lib/pubid/ieee/identifiers/interpretation_identifier.rb +34 -0
- data/lib/pubid/ieee/identifiers/joint_development.rb +172 -0
- data/lib/pubid/ieee/identifiers/multi_numbered_identifier.rb +51 -0
- data/lib/pubid/ieee/identifiers/nesc/base.rb +56 -0
- data/lib/pubid/ieee/identifiers/nesc/draft.rb +28 -0
- data/lib/pubid/ieee/identifiers/nesc/handbook.rb +32 -0
- data/lib/pubid/ieee/identifiers/nesc/redline.rb +26 -0
- data/lib/pubid/ieee/identifiers/nesc/standard.rb +26 -0
- data/lib/pubid/ieee/identifiers/nesc.rb +15 -0
- data/lib/pubid/ieee/identifiers/parenthetical_identifier.rb +20 -0
- data/lib/pubid/ieee/identifiers/project_draft_identifier.rb +26 -0
- data/lib/pubid/ieee/identifiers/redlined_standard.rb +33 -0
- data/lib/pubid/ieee/identifiers/si_standard.rb +73 -0
- data/lib/pubid/ieee/identifiers/standard.rb +41 -0
- data/lib/pubid/ieee/identifiers/supplement_identifier.rb +23 -0
- data/lib/pubid/ieee/identifiers.rb +33 -0
- data/lib/pubid/ieee/ire/builder.rb +61 -0
- data/lib/pubid/ieee/ire/identifier.rb +58 -0
- data/lib/pubid/ieee/ire/parser.rb +91 -0
- data/lib/pubid/ieee/ire.rb +11 -0
- data/lib/pubid/ieee/nesc/builder.rb +101 -0
- data/lib/pubid/ieee/nesc/parser.rb +154 -0
- data/lib/pubid/ieee/nesc.rb +10 -0
- data/lib/pubid/ieee/parser.rb +1226 -0
- data/lib/pubid/ieee/scheme.rb +90 -0
- data/lib/pubid/ieee/typed_stages.rb +172 -0
- data/lib/pubid/ieee/urn_generator.rb +188 -0
- data/lib/pubid/ieee.rb +32 -0
- data/lib/pubid/ieee_debug.rb +31 -0
- data/lib/pubid/iho/builder.rb +37 -0
- data/lib/pubid/iho/identifier.rb +61 -0
- data/lib/pubid/iho/identifiers/base.rb +41 -0
- data/lib/pubid/iho/identifiers/bibliographic.rb +16 -0
- data/lib/pubid/iho/identifiers/circular_letter.rb +15 -0
- data/lib/pubid/iho/identifiers/miscellaneous.rb +16 -0
- data/lib/pubid/iho/identifiers/publication.rb +15 -0
- data/lib/pubid/iho/identifiers/standard.rb +15 -0
- data/lib/pubid/iho/identifiers.rb +14 -0
- data/lib/pubid/iho/parser.rb +68 -0
- data/lib/pubid/iho/scheme.rb +29 -0
- data/lib/pubid/iho/urn_generator.rb +29 -0
- data/lib/pubid/iho.rb +21 -0
- data/lib/pubid/iso/builder.rb +309 -0
- data/lib/pubid/iso/bundled_identifier.rb +85 -0
- data/lib/pubid/iso/combined_identifier.rb +22 -0
- data/lib/pubid/iso/components/code.rb +36 -0
- data/lib/pubid/iso/components/publisher.rb +60 -0
- data/lib/pubid/iso/components.rb +12 -0
- data/lib/pubid/iso/format_resolver.rb +45 -0
- data/lib/pubid/iso/identifier.rb +330 -0
- data/lib/pubid/iso/identifiers/addendum.rb +104 -0
- data/lib/pubid/iso/identifiers/amendment.rb +128 -0
- data/lib/pubid/iso/identifiers/base.rb +115 -0
- data/lib/pubid/iso/identifiers/corrigendum.rb +108 -0
- data/lib/pubid/iso/identifiers/data.rb +76 -0
- data/lib/pubid/iso/identifiers/directives.rb +59 -0
- data/lib/pubid/iso/identifiers/directives_supplement.rb +119 -0
- data/lib/pubid/iso/identifiers/extract.rb +30 -0
- data/lib/pubid/iso/identifiers/guide.rb +100 -0
- data/lib/pubid/iso/identifiers/international_standard.rb +168 -0
- data/lib/pubid/iso/identifiers/international_standardized_profile.rb +94 -0
- data/lib/pubid/iso/identifiers/international_workshop_agreement.rb +89 -0
- data/lib/pubid/iso/identifiers/pas.rb +93 -0
- data/lib/pubid/iso/identifiers/recommendation.rb +45 -0
- data/lib/pubid/iso/identifiers/supplement.rb +87 -0
- data/lib/pubid/iso/identifiers/tc_document.rb +108 -0
- data/lib/pubid/iso/identifiers/technical_report.rb +103 -0
- data/lib/pubid/iso/identifiers/technical_specification.rb +102 -0
- data/lib/pubid/iso/identifiers/technology_trends_assessments.rb +95 -0
- data/lib/pubid/iso/identifiers.rb +33 -0
- data/lib/pubid/iso/parser.rb +512 -0
- data/lib/pubid/iso/rendering_style.rb +120 -0
- data/lib/pubid/iso/scheme.rb +193 -0
- data/lib/pubid/iso/single_identifier.rb +64 -0
- data/lib/pubid/iso/supplement_identifier.rb +27 -0
- data/lib/pubid/iso/urn_generator.rb +426 -0
- data/lib/pubid/iso/urn_parser.rb +437 -0
- data/lib/pubid/iso/utilities.rb +86 -0
- data/lib/pubid/iso.rb +50 -0
- data/lib/pubid/itu/builder.rb +171 -0
- data/lib/pubid/itu/components/code.rb +39 -0
- data/lib/pubid/itu/components/sector.rb +35 -0
- data/lib/pubid/itu/components/series.rb +29 -0
- data/lib/pubid/itu/i18n.rb +9 -0
- data/lib/pubid/itu/i18n.yaml +30 -0
- data/lib/pubid/itu/identifier.rb +118 -0
- data/lib/pubid/itu/identifiers/amendment.rb +43 -0
- data/lib/pubid/itu/identifiers/annex.rb +74 -0
- data/lib/pubid/itu/identifiers/base.rb +154 -0
- data/lib/pubid/itu/identifiers/combined_identifier.rb +47 -0
- data/lib/pubid/itu/identifiers/corrigendum.rb +44 -0
- data/lib/pubid/itu/identifiers/recommendation.rb +16 -0
- data/lib/pubid/itu/identifiers/special_publication.rb +31 -0
- data/lib/pubid/itu/identifiers/supplement.rb +46 -0
- data/lib/pubid/itu/identifiers.rb +16 -0
- data/lib/pubid/itu/model.rb +111 -0
- data/lib/pubid/itu/parser.rb +225 -0
- data/lib/pubid/itu/scheme.rb +174 -0
- data/lib/pubid/itu/urn_generator.rb +105 -0
- data/lib/pubid/itu.rb +22 -0
- data/lib/pubid/jcgm/builder.rb +88 -0
- data/lib/pubid/jcgm/components/publisher.rb +20 -0
- data/lib/pubid/jcgm/components.rb +9 -0
- data/lib/pubid/jcgm/identifier.rb +54 -0
- data/lib/pubid/jcgm/identifiers/amendment.rb +35 -0
- data/lib/pubid/jcgm/identifiers/guide.rb +21 -0
- data/lib/pubid/jcgm/identifiers/gum_guide.rb +51 -0
- data/lib/pubid/jcgm/identifiers.rb +11 -0
- data/lib/pubid/jcgm/parser.rb +84 -0
- data/lib/pubid/jcgm/scheme.rb +60 -0
- data/lib/pubid/jcgm/single_identifier.rb +48 -0
- data/lib/pubid/jcgm/supplement_identifier.rb +16 -0
- data/lib/pubid/jcgm/urn_generator.rb +110 -0
- data/lib/pubid/jcgm.rb +31 -0
- data/lib/pubid/jis/builder.rb +124 -0
- data/lib/pubid/jis/components/code.rb +59 -0
- data/lib/pubid/jis/components.rb +9 -0
- data/lib/pubid/jis/identifier.rb +61 -0
- data/lib/pubid/jis/identifiers/amendment.rb +16 -0
- data/lib/pubid/jis/identifiers/base.rb +72 -0
- data/lib/pubid/jis/identifiers/explanation.rb +22 -0
- data/lib/pubid/jis/identifiers/japanese_industrial_standard.rb +16 -0
- data/lib/pubid/jis/identifiers/standard.rb +27 -0
- data/lib/pubid/jis/identifiers/technical_report.rb +31 -0
- data/lib/pubid/jis/identifiers/technical_specification.rb +31 -0
- data/lib/pubid/jis/identifiers.rb +17 -0
- data/lib/pubid/jis/parser.rb +109 -0
- data/lib/pubid/jis/scheme.rb +49 -0
- data/lib/pubid/jis/single_identifier.rb +37 -0
- data/lib/pubid/jis/supplement_identifier.rb +47 -0
- data/lib/pubid/jis/urn_generator.rb +25 -0
- data/lib/pubid/jis.rb +23 -0
- data/lib/pubid/lutaml/no_store_registration.rb +30 -0
- data/lib/pubid/nist/builder.rb +2269 -0
- data/lib/pubid/nist/components/code.rb +38 -0
- data/lib/pubid/nist/components/edition.rb +134 -0
- data/lib/pubid/nist/components/issue_number.rb +28 -0
- data/lib/pubid/nist/components/part.rb +77 -0
- data/lib/pubid/nist/components/publisher.rb +24 -0
- data/lib/pubid/nist/components/stage.rb +53 -0
- data/lib/pubid/nist/components/supplement.rb +188 -0
- data/lib/pubid/nist/components/translation.rb +42 -0
- data/lib/pubid/nist/components/update.rb +103 -0
- data/lib/pubid/nist/components/version.rb +35 -0
- data/lib/pubid/nist/components/volume.rb +32 -0
- data/lib/pubid/nist/components.rb +19 -0
- data/lib/pubid/nist/configuration.rb +77 -0
- data/lib/pubid/nist/identifier.rb +62 -0
- data/lib/pubid/nist/identifiers/base.rb +578 -0
- data/lib/pubid/nist/identifiers/circular.rb +68 -0
- data/lib/pubid/nist/identifiers/circular_supplement.rb +50 -0
- data/lib/pubid/nist/identifiers/commercial_standard.rb +41 -0
- data/lib/pubid/nist/identifiers/commercial_standard_emergency.rb +56 -0
- data/lib/pubid/nist/identifiers/commercial_standards_monthly.rb +56 -0
- data/lib/pubid/nist/identifiers/crpl_report.rb +132 -0
- data/lib/pubid/nist/identifiers/federal_information_processing_standards.rb +104 -0
- data/lib/pubid/nist/identifiers/grant_contractor_report.rb +35 -0
- data/lib/pubid/nist/identifiers/handbook.rb +50 -0
- data/lib/pubid/nist/identifiers/internal_report.rb +56 -0
- data/lib/pubid/nist/identifiers/letter_circular.rb +45 -0
- data/lib/pubid/nist/identifiers/miscellaneous_publication.rb +65 -0
- data/lib/pubid/nist/identifiers/monograph.rb +69 -0
- data/lib/pubid/nist/identifiers/ncstar.rb +41 -0
- data/lib/pubid/nist/identifiers/nsrds.rb +41 -0
- data/lib/pubid/nist/identifiers/owmwp.rb +35 -0
- data/lib/pubid/nist/identifiers/report.rb +67 -0
- data/lib/pubid/nist/identifiers/special_publication.rb +36 -0
- data/lib/pubid/nist/identifiers/technical_note.rb +90 -0
- data/lib/pubid/nist/identifiers.rb +33 -0
- data/lib/pubid/nist/parser.rb +1117 -0
- data/lib/pubid/nist/scheme.rb +199 -0
- data/lib/pubid/nist/supplement_identifier.rb +67 -0
- data/lib/pubid/nist/urn_generator.rb +133 -0
- data/lib/pubid/nist.rb +37 -0
- data/lib/pubid/oiml/builder.rb +189 -0
- data/lib/pubid/oiml/components/code.rb +20 -0
- data/lib/pubid/oiml/components.rb +9 -0
- data/lib/pubid/oiml/identifier.rb +61 -0
- data/lib/pubid/oiml/identifiers/amendment.rb +13 -0
- data/lib/pubid/oiml/identifiers/annex.rb +62 -0
- data/lib/pubid/oiml/identifiers/base.rb +36 -0
- data/lib/pubid/oiml/identifiers/basic_publication.rb +13 -0
- data/lib/pubid/oiml/identifiers/document.rb +13 -0
- data/lib/pubid/oiml/identifiers/expert_report.rb +13 -0
- data/lib/pubid/oiml/identifiers/guide.rb +13 -0
- data/lib/pubid/oiml/identifiers/recommendation.rb +13 -0
- data/lib/pubid/oiml/identifiers/seminar_report.rb +13 -0
- data/lib/pubid/oiml/identifiers/vocabulary.rb +13 -0
- data/lib/pubid/oiml/identifiers.rb +18 -0
- data/lib/pubid/oiml/parser.rb +173 -0
- data/lib/pubid/oiml/scheme.rb +46 -0
- data/lib/pubid/oiml/single_identifier.rb +90 -0
- data/lib/pubid/oiml/supplement_identifier.rb +43 -0
- data/lib/pubid/oiml/urn_generator.rb +64 -0
- data/lib/pubid/oiml.rb +26 -0
- data/lib/pubid/parser/common_parse_methods.rb +13 -0
- data/lib/pubid/parser/common_parse_rules.rb +56 -0
- data/lib/pubid/parser.rb +8 -0
- data/lib/pubid/parsers/base.rb +11 -0
- data/lib/pubid/parsers/mr_string.rb +93 -0
- data/lib/pubid/plateau/builder.rb +50 -0
- data/lib/pubid/plateau/identifier.rb +57 -0
- data/lib/pubid/plateau/identifiers/annex.rb +16 -0
- data/lib/pubid/plateau/identifiers/base.rb +51 -0
- data/lib/pubid/plateau/identifiers/handbook.rb +34 -0
- data/lib/pubid/plateau/identifiers/technical_report.rb +20 -0
- data/lib/pubid/plateau/identifiers.rb +12 -0
- data/lib/pubid/plateau/parser.rb +63 -0
- data/lib/pubid/plateau/scheme.rb +45 -0
- data/lib/pubid/plateau/supplement_identifier.rb +72 -0
- data/lib/pubid/plateau/urn_generator.rb +29 -0
- data/lib/pubid/plateau.rb +26 -0
- data/lib/pubid/renderers/base.rb +53 -0
- data/lib/pubid/renderers/directives_renderer.rb +61 -0
- data/lib/pubid/renderers/guide_renderer.rb +24 -0
- data/lib/pubid/renderers/human_readable.rb +70 -0
- data/lib/pubid/renderers/iwa_renderer.rb +20 -0
- data/lib/pubid/renderers/mr_string.rb +16 -0
- data/lib/pubid/renderers/supplement_renderer.rb +36 -0
- data/lib/pubid/renderers/urn.rb +11 -0
- data/lib/pubid/renderers.rb +14 -0
- data/lib/pubid/rendering/base.rb +73 -0
- data/lib/pubid/rendering/common.rb +211 -0
- data/lib/pubid/rendering/context.rb +159 -0
- data/lib/pubid/rendering/date.rb +27 -0
- data/lib/pubid/rendering/format.rb +25 -0
- data/lib/pubid/rendering/language.rb +21 -0
- data/lib/pubid/rendering/numbering.rb +24 -0
- data/lib/pubid/rendering/publisher.rb +25 -0
- data/lib/pubid/rendering/stage.rb +38 -0
- data/lib/pubid/rendering/supplement.rb +46 -0
- data/lib/pubid/rendering.rb +16 -0
- data/lib/pubid/sae/builder.rb +32 -0
- data/lib/pubid/sae/components/code.rb +9 -0
- data/lib/pubid/sae/components/date.rb +19 -0
- data/lib/pubid/sae/components/type.rb +19 -0
- data/lib/pubid/sae/components.rb +11 -0
- data/lib/pubid/sae/identifier.rb +37 -0
- data/lib/pubid/sae/identifiers/base.rb +42 -0
- data/lib/pubid/sae/identifiers.rb +9 -0
- data/lib/pubid/sae/parser.rb +55 -0
- data/lib/pubid/sae/scheme.rb +47 -0
- data/lib/pubid/sae/urn_generator.rb +38 -0
- data/lib/pubid/sae.rb +19 -0
- data/lib/pubid/scheme.rb +219 -0
- data/lib/pubid/urn_generator/base.rb +110 -0
- data/lib/pubid/utils/string_normalizer.rb +196 -0
- data/lib/pubid/utils.rb +7 -0
- data/lib/pubid/version.rb +3 -1
- data/lib/pubid.rb +137 -13
- data/lib/tasks/docs.rake +37 -0
- data/lib/tasks/export.rake +38 -0
- data/lib/tasks/website-data.json +7488 -0
- metadata +616 -171
- data/lib/pubid/registry.rb +0 -30
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Cie
|
|
5
|
+
class Scheme < Pubid::Scheme
|
|
6
|
+
class << self
|
|
7
|
+
def identifiers
|
|
8
|
+
[
|
|
9
|
+
Identifiers::Standard,
|
|
10
|
+
Identifiers::Conference,
|
|
11
|
+
Identifiers::Bundle,
|
|
12
|
+
Identifiers::DualPublished,
|
|
13
|
+
Identifiers::Identical,
|
|
14
|
+
Identifiers::JointPublished,
|
|
15
|
+
Identifiers::Supplement,
|
|
16
|
+
Identifiers::TutorialBundle,
|
|
17
|
+
]
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def supplement_identifiers
|
|
21
|
+
[
|
|
22
|
+
Identifiers::Corrigendum,
|
|
23
|
+
]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def typed_stages
|
|
27
|
+
identifiers.flat_map { |klass| klass::TYPED_STAGES }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def supplement_typed_stages
|
|
31
|
+
supplement_identifiers.flat_map { |klass| klass::TYPED_STAGES }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def locate_typed_stage_by_abbr(abbr)
|
|
35
|
+
abbr = "" if abbr.nil?
|
|
36
|
+
|
|
37
|
+
typed_stage = (typed_stages + supplement_typed_stages).detect do |ts|
|
|
38
|
+
ts.abbr.include?(abbr)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
unless typed_stage
|
|
42
|
+
raise ArgumentError,
|
|
43
|
+
"Unknown type abbreviation: '#{abbr}'"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
typed_stage
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def locate_identifier_klass_by_type_code(type_code)
|
|
50
|
+
identifier_klass = (identifiers + supplement_identifiers).detect do |klass|
|
|
51
|
+
klass.type[:key].to_s == type_code.to_s
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
unless identifier_klass
|
|
55
|
+
raise ArgumentError,
|
|
56
|
+
"Unknown type code: #{type_code}"
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
identifier_klass
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Cie
|
|
5
|
+
# Base class for single CIE identifiers (standards, conferences, etc.)
|
|
6
|
+
# Single Responsibility: Provide common attributes for base documents
|
|
7
|
+
#
|
|
8
|
+
# Single identifiers are base documents that can exist independently,
|
|
9
|
+
# as opposed to supplement identifiers (amendments, corrigenda) which
|
|
10
|
+
# modify a base identifier.
|
|
11
|
+
#
|
|
12
|
+
# Classes inheriting from SingleIdentifier:
|
|
13
|
+
# - Standard (common CIE publications)
|
|
14
|
+
# - Conference (conference proceedings)
|
|
15
|
+
# - Bundle (bundles of multiple identifiers)
|
|
16
|
+
# - JointPublished (co-published with ISO/IEC)
|
|
17
|
+
# - DualPublished (dual published with IEC)
|
|
18
|
+
# - Identical (identical to ISO publications)
|
|
19
|
+
# - TutorialBundle (tutorial bundles)
|
|
20
|
+
class SingleIdentifier < Identifier
|
|
21
|
+
# CIE uses a fixed publisher string
|
|
22
|
+
def publisher
|
|
23
|
+
"CIE"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attribute :year, :string
|
|
27
|
+
attribute :date_separator, :string # "dash" or "colon"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Cie
|
|
5
|
+
# Base class for CIE supplement identifiers
|
|
6
|
+
# Single Responsibility: Provide common attributes for supplement documents
|
|
7
|
+
#
|
|
8
|
+
# Supplement identifiers modify or extend base identifiers.
|
|
9
|
+
# Unlike ISO/IEC, CIE supplements store base information as flat
|
|
10
|
+
# string attributes rather than recursive Identifier objects.
|
|
11
|
+
#
|
|
12
|
+
# Classes inheriting from SupplementIdentifier:
|
|
13
|
+
# - Corrigendum (corrigenda with /CorN notation)
|
|
14
|
+
# - Supplement (supplements with -SPN notation)
|
|
15
|
+
#
|
|
16
|
+
# Architecture Note:
|
|
17
|
+
# CIE uses a different architectural approach than ISO/IEC:
|
|
18
|
+
# - ISO/IEC: Recursive base_identifier objects
|
|
19
|
+
# - CIE: Flat string attributes (base_number, base_year, etc.)
|
|
20
|
+
class SupplementIdentifier < Identifier
|
|
21
|
+
# Common attribute for all CIE identifiers
|
|
22
|
+
# Values: "current" (colon date separator) or "legacy" (dash date separator)
|
|
23
|
+
attribute :style, :string
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Cie
|
|
5
|
+
class UrnGenerator < Pubid::UrnGenerator::Base
|
|
6
|
+
def generate
|
|
7
|
+
parts = ["urn", "cie"]
|
|
8
|
+
|
|
9
|
+
special_type = special_identifier_type_component
|
|
10
|
+
parts << special_type if special_type
|
|
11
|
+
|
|
12
|
+
if maybe(:s_prefix)
|
|
13
|
+
parts << "s"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
parts << publisher_component
|
|
17
|
+
|
|
18
|
+
if identifier.code
|
|
19
|
+
parts << identifier.code.to_s
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
year = extract_year
|
|
23
|
+
parts << year.to_s if year
|
|
24
|
+
|
|
25
|
+
language = maybe(:language)
|
|
26
|
+
if language
|
|
27
|
+
if language&.code
|
|
28
|
+
parts << language.code.to_s.downcase
|
|
29
|
+
if language&.format
|
|
30
|
+
parts << language.format.to_s.downcase
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
parts << language.to_s.downcase
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
stage = maybe(:stage)
|
|
38
|
+
parts << stage.to_s.downcase if stage
|
|
39
|
+
|
|
40
|
+
date_separator = maybe(:date_separator)
|
|
41
|
+
parts << "sep.#{date_separator}" if date_separator
|
|
42
|
+
|
|
43
|
+
iec_identifier = maybe(:iec_identifier)
|
|
44
|
+
parts << "iec.#{iec_identifier}" if iec_identifier
|
|
45
|
+
|
|
46
|
+
iso_reference = maybe(:iso_reference)
|
|
47
|
+
parts << "iso.#{iso_reference}" if iso_reference
|
|
48
|
+
|
|
49
|
+
doc_type = maybe(:doc_type)
|
|
50
|
+
parts << "doctype.#{doc_type}" if doc_type
|
|
51
|
+
|
|
52
|
+
identifiers_string = maybe(:identifiers_string)
|
|
53
|
+
parts << "bundle.#{identifiers_string}" if identifiers_string
|
|
54
|
+
|
|
55
|
+
bundle_number = maybe(:bundle_number)
|
|
56
|
+
parts << "tut-bundle.#{bundle_number}" if bundle_number
|
|
57
|
+
|
|
58
|
+
languages = maybe(:languages)
|
|
59
|
+
if languages&.any?
|
|
60
|
+
lang_codes = languages.map(&:code).join(",")
|
|
61
|
+
parts << lang_codes
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
parts.join(":")
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def extract_year
|
|
70
|
+
year = maybe(:year)
|
|
71
|
+
return year if year
|
|
72
|
+
|
|
73
|
+
date = identifier.date
|
|
74
|
+
if date
|
|
75
|
+
return date.year
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
nil
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def special_identifier_type_component
|
|
82
|
+
return nil unless identifier.class
|
|
83
|
+
|
|
84
|
+
class_name = identifier.class.name.to_s
|
|
85
|
+
case class_name
|
|
86
|
+
when /DualPublished/
|
|
87
|
+
"dual-pub"
|
|
88
|
+
when /Identical/
|
|
89
|
+
"identical"
|
|
90
|
+
when /JointPublished/
|
|
91
|
+
"joint-pub"
|
|
92
|
+
when /Bundle$/
|
|
93
|
+
"bundle"
|
|
94
|
+
when /TutorialBundle/
|
|
95
|
+
"tut-bundle"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def publisher_component
|
|
100
|
+
pub = "cie"
|
|
101
|
+
|
|
102
|
+
if identifier.publisher
|
|
103
|
+
p = identifier.publisher.to_s
|
|
104
|
+
pub = p.to_s.downcase
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
copublisher = maybe(:copublisher)
|
|
108
|
+
if copublisher
|
|
109
|
+
cp = copublisher.to_s
|
|
110
|
+
pub = "#{pub}-#{cp.to_s.downcase}"
|
|
111
|
+
else
|
|
112
|
+
copubs = maybe(:copublishers)
|
|
113
|
+
if copubs&.any?
|
|
114
|
+
cp = copubs.map(&:to_s)
|
|
115
|
+
pub = "#{pub}-#{cp.join('-').downcase}"
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
pub
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
end
|
data/lib/pubid/cie.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Cie
|
|
5
|
+
module Components
|
|
6
|
+
autoload :Code, "#{__dir__}/cie/components/code"
|
|
7
|
+
autoload :Language, "#{__dir__}/cie/components/language"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
autoload :Builder, "#{__dir__}/cie/builder"
|
|
11
|
+
autoload :Identifier, "#{__dir__}/cie/identifier"
|
|
12
|
+
autoload :Identifiers, "#{__dir__}/cie/identifiers"
|
|
13
|
+
autoload :Parser, "#{__dir__}/cie/parser"
|
|
14
|
+
autoload :Scheme, "#{__dir__}/cie/scheme"
|
|
15
|
+
autoload :SingleIdentifier, "#{__dir__}/cie/single_identifier"
|
|
16
|
+
autoload :SupplementIdentifier, "#{__dir__}/cie/supplement_identifier"
|
|
17
|
+
autoload :UrnGenerator, "#{__dir__}/cie/urn_generator"
|
|
18
|
+
|
|
19
|
+
# Main entry point for CIE identifiers
|
|
20
|
+
# Delegates to Identifier.parse
|
|
21
|
+
def self.parse(input)
|
|
22
|
+
Identifier.parse(input)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Register Ucie flavor with the registry
|
|
28
|
+
Pubid::Registry.register(:cie, Pubid::Cie)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Components
|
|
5
|
+
class Code < Lutaml::Model::Serializable
|
|
6
|
+
attribute :value, :string
|
|
7
|
+
|
|
8
|
+
def to_s
|
|
9
|
+
value.to_s
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def render(context: nil)
|
|
13
|
+
value.to_s
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Returns hash code for code component
|
|
17
|
+
# @return [Integer] hash code
|
|
18
|
+
# @note Memoized for performance
|
|
19
|
+
def hash
|
|
20
|
+
@hash ||= value.hash
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Checks equality with another code component
|
|
24
|
+
# @param other [Object] object to compare with
|
|
25
|
+
# @return [Boolean] true if equal
|
|
26
|
+
def eql?(other)
|
|
27
|
+
return false unless other.is_a?(self.class)
|
|
28
|
+
|
|
29
|
+
value == other.value
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Pubid
|
|
6
|
+
module Components
|
|
7
|
+
# Publication date component
|
|
8
|
+
class Date < Lutaml::Model::Serializable
|
|
9
|
+
attribute :year, :string
|
|
10
|
+
attribute :month, :string
|
|
11
|
+
attribute :day, :string
|
|
12
|
+
|
|
13
|
+
# Render date with optional context for flavor-specific formatting
|
|
14
|
+
#
|
|
15
|
+
# @param _context [RenderingContext] rendering context
|
|
16
|
+
# (for future extensibility)
|
|
17
|
+
# @param _include_month [Boolean] include month in output
|
|
18
|
+
# (for future extensibility)
|
|
19
|
+
# @return [String] rendered date string
|
|
20
|
+
def render(context: nil)
|
|
21
|
+
to_s
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def to_s(_context: nil, _include_month: false)
|
|
25
|
+
return year.to_s unless month
|
|
26
|
+
|
|
27
|
+
result = "#{year}-#{month}"
|
|
28
|
+
result += "-#{day}" if day
|
|
29
|
+
result
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Returns hash code for date component
|
|
33
|
+
# @return [Integer] hash code
|
|
34
|
+
# @note Memoized for performance
|
|
35
|
+
def hash
|
|
36
|
+
@hash ||= [year, month, day].compact.map(&:hash).hash
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Checks equality with another date component
|
|
40
|
+
# @param other [Object] object to compare with
|
|
41
|
+
# @return [Boolean] true if equal
|
|
42
|
+
def eql?(other)
|
|
43
|
+
return false unless other.is_a?(self.class)
|
|
44
|
+
|
|
45
|
+
year == other.year && month == other.month && day == other.day
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Components
|
|
5
|
+
# Edition component (typically a year and number)
|
|
6
|
+
class Edition < Lutaml::Model::Serializable
|
|
7
|
+
attribute :year, :string
|
|
8
|
+
attribute :number, Lutaml::Model::Type::Value # Accept any value type
|
|
9
|
+
attribute :original_text, :string # Store the exact parsed edition text
|
|
10
|
+
|
|
11
|
+
def to_s
|
|
12
|
+
# Always use canonical format for rendering
|
|
13
|
+
number_value = number.is_a?(Components::Code) ? number.value : number
|
|
14
|
+
number_value ? "ED#{number_value}" : nil
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# V1 API compatibility - tests expect .value on edition itself
|
|
18
|
+
def value
|
|
19
|
+
number.is_a?(Components::Code) ? number.value : number
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def render(context: nil)
|
|
23
|
+
to_s
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Method to get the original parsed format if needed
|
|
27
|
+
def original_format
|
|
28
|
+
original_text
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "code"
|
|
4
|
+
require_relative "date"
|
|
5
|
+
require_relative "edition"
|
|
6
|
+
require_relative "language"
|
|
7
|
+
require_relative "publisher"
|
|
8
|
+
|
|
9
|
+
module Pubid
|
|
10
|
+
module Components
|
|
11
|
+
# Coerces loose primitive kwargs (matching pubid 1.x's `Identifier.create`
|
|
12
|
+
# signature) into the structured Component objects pubid 2.x expects.
|
|
13
|
+
#
|
|
14
|
+
# Used by per-flavor `.create` factories.
|
|
15
|
+
module Factory
|
|
16
|
+
# Per-kwarg coercer. Returns a Component, or an Array<Component> for
|
|
17
|
+
# collection attributes such as `languages`.
|
|
18
|
+
COERCERS = {
|
|
19
|
+
publisher: ->(v) { Publisher.new(body: v.to_s) },
|
|
20
|
+
number: ->(v) { Code.new(value: v.to_s) },
|
|
21
|
+
part: ->(v) { Code.new(value: v.to_s) },
|
|
22
|
+
subpart: ->(v) { Code.new(value: v.to_s) },
|
|
23
|
+
year: ->(v) { Date.new(year: v.to_s) },
|
|
24
|
+
edition: ->(v) { Edition.new(number: v) },
|
|
25
|
+
language: ->(v) { [Language.new(code: v.to_s)] },
|
|
26
|
+
}.freeze
|
|
27
|
+
|
|
28
|
+
# 1.x kwarg name → 2.x attribute name.
|
|
29
|
+
# Applied after coercion.
|
|
30
|
+
KEY_RENAMES = {
|
|
31
|
+
year: :date,
|
|
32
|
+
language: :languages,
|
|
33
|
+
}.freeze
|
|
34
|
+
|
|
35
|
+
# Convert a hash of 1.x-style primitive kwargs into a hash of 2.x-style
|
|
36
|
+
# Component-valued attributes ready for `<IdentifierClass>.new(...)`.
|
|
37
|
+
#
|
|
38
|
+
# Unknown keys pass through unchanged; nil values are dropped.
|
|
39
|
+
def self.from_hash(opts)
|
|
40
|
+
opts.each_with_object({}) do |(k, v), out|
|
|
41
|
+
next if v.nil?
|
|
42
|
+
|
|
43
|
+
target = KEY_RENAMES.fetch(k, k)
|
|
44
|
+
coercer = COERCERS[k]
|
|
45
|
+
out[target] = coercer ? coercer.call(v) : v
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Components
|
|
5
|
+
# Language component (typically a language code)
|
|
6
|
+
class Language < Lutaml::Model::Serializable
|
|
7
|
+
CHAR_MAP = {
|
|
8
|
+
"R" => "ru",
|
|
9
|
+
"F" => "fr",
|
|
10
|
+
"E" => "en",
|
|
11
|
+
"A" => "ar",
|
|
12
|
+
"S" => "es",
|
|
13
|
+
"D" => "de",
|
|
14
|
+
}.freeze
|
|
15
|
+
|
|
16
|
+
# code is always an ISO 639-1 two-letter code
|
|
17
|
+
attribute :code, :string, values: CHAR_MAP.values
|
|
18
|
+
attribute :original_code, :string # Store the actual parsed format
|
|
19
|
+
|
|
20
|
+
def to_s(lang_single: false)
|
|
21
|
+
# When multi-char format requested (lang_single: false) but original was
|
|
22
|
+
# single-char, normalize to multi-char (for with_edition: true mode)
|
|
23
|
+
if !lang_single && original_code&.length == 1
|
|
24
|
+
code
|
|
25
|
+
elsif original_code
|
|
26
|
+
original_code
|
|
27
|
+
else
|
|
28
|
+
lang_single ? CHAR_MAP.key(code) : code
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def render(context: nil, **opts)
|
|
33
|
+
to_s(**opts)
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
|
|
5
|
+
module Pubid
|
|
6
|
+
module Components
|
|
7
|
+
# Publisher ISO, IEC, etc.
|
|
8
|
+
class Publisher < Lutaml::Model::Serializable
|
|
9
|
+
attribute :body, :string
|
|
10
|
+
|
|
11
|
+
def to_s
|
|
12
|
+
body
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def render(context: nil)
|
|
16
|
+
body
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Returns hash code for publisher component
|
|
20
|
+
# @return [Integer] hash code
|
|
21
|
+
# @note Memoized for performance
|
|
22
|
+
def hash
|
|
23
|
+
@hash ||= body.hash
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Checks equality with another publisher component
|
|
27
|
+
# @param other [Object] object to compare with
|
|
28
|
+
# @return [Boolean] true if equal
|
|
29
|
+
def eql?(other)
|
|
30
|
+
return false unless other.is_a?(self.class)
|
|
31
|
+
|
|
32
|
+
body == other.body
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
require_relative "../rendering/context" if File.exist?(File.join(__dir__,
|
|
5
|
+
"../../rendering/context.rb"))
|
|
6
|
+
|
|
7
|
+
module Pubid
|
|
8
|
+
module Components
|
|
9
|
+
# Stage component (a set of defined stages)
|
|
10
|
+
class Stage < Lutaml::Model::Serializable
|
|
11
|
+
attribute :name, :string
|
|
12
|
+
attribute :stage_code, :string
|
|
13
|
+
attribute :harmonized_stages, :string, collection: true
|
|
14
|
+
attribute :abbr, :string
|
|
15
|
+
|
|
16
|
+
# Render stage with optional context for flavor-specific separators
|
|
17
|
+
#
|
|
18
|
+
# @param context [RenderingContext] rendering context for flavor rules
|
|
19
|
+
# @param has_copublisher [Boolean] whether identifier has copublisher
|
|
20
|
+
# @return [String] rendered stage string
|
|
21
|
+
def to_s(context: nil, has_copublisher: false)
|
|
22
|
+
return "" unless abbr
|
|
23
|
+
|
|
24
|
+
if context
|
|
25
|
+
sep = context.stage_separator_for(has_copublisher:)
|
|
26
|
+
sep == "" ? abbr : "#{sep}#{abbr}"
|
|
27
|
+
else
|
|
28
|
+
# Default behavior: space after copublisher, slash otherwise
|
|
29
|
+
has_copublisher ? " #{abbr}" : "/#{abbr}"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def render(context: nil)
|
|
34
|
+
abbr.to_s
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Returns hash code for stage component
|
|
38
|
+
# @return [Integer] hash code
|
|
39
|
+
# @note Memoized for performance
|
|
40
|
+
def hash
|
|
41
|
+
@hash ||= [stage_code, abbr].compact.map(&:hash).hash
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Checks equality with another stage component
|
|
45
|
+
# @param other [Object] object to compare with
|
|
46
|
+
# @return [Boolean] true if equal
|
|
47
|
+
def eql?(other)
|
|
48
|
+
return false unless other.is_a?(self.class)
|
|
49
|
+
|
|
50
|
+
stage_code == other.stage_code && abbr == other.abbr
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "lutaml/model"
|
|
4
|
+
require_relative "../rendering/context" if File.exist?(File.join(__dir__,
|
|
5
|
+
"../../rendering/context.rb"))
|
|
6
|
+
|
|
7
|
+
module Pubid
|
|
8
|
+
module Components
|
|
9
|
+
# Resource type component (a set of defined resource types)
|
|
10
|
+
class Type < Lutaml::Model::Serializable
|
|
11
|
+
attribute :name, :string
|
|
12
|
+
attribute :abbr, :string
|
|
13
|
+
attribute :type_code, :string
|
|
14
|
+
|
|
15
|
+
# Render type with optional context for flavor-specific separators and default handling
|
|
16
|
+
#
|
|
17
|
+
# @param context [RenderingContext] rendering context for flavor rules
|
|
18
|
+
# @param has_prefix [Boolean] whether there's a prefix (stage or copublisher)
|
|
19
|
+
# @return [String] rendered type string
|
|
20
|
+
def to_s(context: nil, has_prefix: false)
|
|
21
|
+
return "" unless abbr
|
|
22
|
+
|
|
23
|
+
# Check if this type should be rendered (not the default)
|
|
24
|
+
if context && !context.should_render_type?(abbr)
|
|
25
|
+
return ""
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
if context
|
|
29
|
+
sep = context.type_separator_for(has_prefix)
|
|
30
|
+
sep == "" ? abbr : "#{sep}#{abbr}"
|
|
31
|
+
else
|
|
32
|
+
# Default behavior: space after prefix, slash otherwise
|
|
33
|
+
has_prefix ? " #{abbr}" : "/#{abbr}"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def render(context: nil)
|
|
38
|
+
name.to_s
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Returns hash code for type component
|
|
42
|
+
# @return [Integer] hash code
|
|
43
|
+
# @note Memoized for performance
|
|
44
|
+
def hash
|
|
45
|
+
@hash ||= [type_code, abbr].compact.map(&:hash).hash
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Checks equality with another type component
|
|
49
|
+
# @param other [Object] object to compare with
|
|
50
|
+
# @return [Boolean] true if equal
|
|
51
|
+
def eql?(other)
|
|
52
|
+
return false unless other.is_a?(self.class)
|
|
53
|
+
|
|
54
|
+
type_code == other.type_code && abbr == other.abbr
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|