relaton-bib 1.4.0 → 2.1.7
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/.github/workflows/integration-tests.yml +54 -0
- data/.github/workflows/rake.yml +15 -0
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +3 -1
- data/CLAUDE.md +108 -0
- data/Gemfile +11 -0
- data/README.adoc +229 -314
- data/bin/console +1 -1
- data/docs/hash.adoc +132 -83
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +663 -0
- data/lib/relaton/bib/converter/asciibib.rb +13 -0
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +245 -0
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +341 -0
- data/lib/relaton/bib/converter/bibtex.rb +23 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +386 -0
- data/lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb +71 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +308 -0
- data/lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb +52 -0
- data/lib/relaton/bib/converter/bibxml.rb +51 -0
- data/lib/relaton/bib/hash_parser_v1.rb +767 -0
- data/lib/relaton/bib/item_data.rb +229 -0
- data/lib/relaton/bib/model/abstract.rb +16 -0
- data/lib/relaton/bib/model/address.rb +22 -0
- data/lib/relaton/bib/model/affiliation.rb +16 -0
- data/lib/relaton/bib/model/bibdata.rb +9 -0
- data/lib/relaton/bib/model/bibdata_shared.rb +10 -0
- data/lib/relaton/bib/model/bibitem.rb +9 -0
- data/lib/relaton/bib/model/bibitem_shared.rb +10 -0
- data/lib/relaton/bib/model/contact.rb +14 -0
- data/lib/relaton/bib/model/contribution_info.rb +16 -0
- data/lib/relaton/bib/model/contributor.rb +29 -0
- data/lib/relaton/bib/model/copyright.rb +27 -0
- data/lib/relaton/bib/model/date.rb +29 -0
- data/lib/relaton/bib/model/depiction.rb +16 -0
- data/lib/relaton/bib/model/docidentifier.rb +34 -0
- data/lib/relaton/bib/model/doctype.rb +14 -0
- data/lib/relaton/bib/model/edition.rb +14 -0
- data/lib/relaton/bib/model/ext.rb +35 -0
- data/lib/relaton/bib/model/extent.rb +16 -0
- data/lib/relaton/bib/model/formattedref.rb +43 -0
- data/lib/relaton/bib/model/full_name_type.rb +64 -0
- data/lib/relaton/bib/model/fullname.rb +11 -0
- data/lib/relaton/bib/model/ics.rb +49 -0
- data/lib/relaton/bib/model/image.rb +28 -0
- data/lib/relaton/bib/model/item.rb +44 -0
- data/lib/relaton/bib/model/item_base.rb +20 -0
- data/lib/relaton/bib/model/item_shared.rb +88 -0
- data/lib/relaton/bib/model/keyword.rb +30 -0
- data/lib/relaton/bib/model/locality.rb +18 -0
- data/lib/relaton/bib/model/locality_stack.rb +14 -0
- data/lib/relaton/bib/model/localized_string.rb +48 -0
- data/lib/relaton/bib/model/localized_string_attrs.rb +24 -0
- data/lib/relaton/bib/model/logo.rb +14 -0
- data/lib/relaton/bib/model/medium.rb +22 -0
- data/lib/relaton/bib/model/note.rb +16 -0
- data/lib/relaton/bib/model/organization.rb +11 -0
- data/lib/relaton/bib/model/organization_type.rb +40 -0
- data/lib/relaton/bib/model/person.rb +36 -0
- data/lib/relaton/bib/model/phone.rb +14 -0
- data/lib/relaton/bib/model/place.rb +33 -0
- data/lib/relaton/bib/model/price.rb +14 -0
- data/lib/relaton/bib/model/relation.rb +41 -0
- data/lib/relaton/bib/model/series.rb +32 -0
- data/lib/relaton/bib/model/size.rb +23 -0
- data/lib/relaton/bib/model/source_locality_stack.rb +14 -0
- data/lib/relaton/bib/model/status.rb +27 -0
- data/lib/relaton/bib/model/structured_identifier.rb +48 -0
- data/lib/relaton/bib/model/subdivision.rb +16 -0
- data/lib/relaton/bib/model/title.rb +56 -0
- data/lib/relaton/bib/model/type/plain_date.rb +16 -0
- data/lib/relaton/bib/model/type/string_date.rb +48 -0
- data/lib/relaton/bib/model/uri.rb +18 -0
- data/lib/relaton/bib/model/validity.rb +16 -0
- data/lib/relaton/bib/model/version.rb +43 -0
- data/lib/relaton/bib/model_autoload.rb +85 -0
- data/lib/relaton/bib/namespace_helper.rb +21 -0
- data/lib/relaton/bib/sanitizer.rb +74 -0
- data/lib/relaton/bib/util.rb +18 -0
- data/lib/relaton/bib/version.rb +5 -0
- data/lib/relaton/bib/versions.json +35 -0
- data/lib/relaton/bib.rb +41 -0
- data/relaton-bib.gemspec +12 -16
- metadata +118 -129
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -39
- data/.github/workflows/windows.yml +0 -41
- data/grammars/basicdoc.rng +0 -986
- data/grammars/biblio.rng +0 -1237
- data/grammars/isodoc.rng +0 -1613
- data/grammars/reqt.rng +0 -165
- data/lib/relaton_bib/bib_item_locality.rb +0 -107
- data/lib/relaton_bib/biblio_note.rb +0 -44
- data/lib/relaton_bib/biblio_version.rb +0 -49
- data/lib/relaton_bib/bibliographic_date.rb +0 -90
- data/lib/relaton_bib/bibliographic_item.rb +0 -726
- data/lib/relaton_bib/bibtex_parser.rb +0 -245
- data/lib/relaton_bib/classification.rb +0 -40
- data/lib/relaton_bib/contribution_info.rb +0 -109
- data/lib/relaton_bib/contributor.rb +0 -215
- data/lib/relaton_bib/copyright_association.rb +0 -77
- data/lib/relaton_bib/deep_dup.rb +0 -30
- data/lib/relaton_bib/document_identifier.rb +0 -95
- data/lib/relaton_bib/document_relation.rb +0 -94
- data/lib/relaton_bib/document_relation_collection.rb +0 -46
- data/lib/relaton_bib/document_status.rb +0 -93
- data/lib/relaton_bib/editorial_group.rb +0 -41
- data/lib/relaton_bib/formatted_ref.rb +0 -17
- data/lib/relaton_bib/formatted_string.rb +0 -55
- data/lib/relaton_bib/hash_converter.rb +0 -497
- data/lib/relaton_bib/hit.rb +0 -46
- data/lib/relaton_bib/hit_collection.rb +0 -73
- data/lib/relaton_bib/ics.rb +0 -37
- data/lib/relaton_bib/localized_string.rb +0 -93
- data/lib/relaton_bib/medium.rb +0 -44
- data/lib/relaton_bib/organization.rb +0 -135
- data/lib/relaton_bib/person.rb +0 -206
- data/lib/relaton_bib/place.rb +0 -49
- data/lib/relaton_bib/series.rb +0 -134
- data/lib/relaton_bib/structured_identifier.rb +0 -171
- data/lib/relaton_bib/technical_committee.rb +0 -36
- data/lib/relaton_bib/typed_title_string.rb +0 -96
- data/lib/relaton_bib/typed_uri.rb +0 -47
- data/lib/relaton_bib/validity.rb +0 -52
- data/lib/relaton_bib/version.rb +0 -3
- data/lib/relaton_bib/workers_pool.rb +0 -43
- data/lib/relaton_bib/workgroup.rb +0 -46
- data/lib/relaton_bib/xml_parser.rb +0 -463
- data/lib/relaton_bib.rb +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 15d36c3ed1e4ae0042f96a06a6320dccbe089a87a691b77b8ad14e276217bd22
|
|
4
|
+
data.tar.gz: d6db31f185b72668da0c289bc462a62d1cfd1b9dda542f37b9dee7257d5282b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 304fcb5b02e2c019d532164228acede4ed81c210eafededbbdd9446ac94fcd32d142be5be7689db09bc17b7aa3e6cfb333b892220ba36e64fcccc2bdda2df29c
|
|
7
|
+
data.tar.gz: 390cf8b808ab85b099d573b4bea833d265a2326d81c00936e5cebe6ae79c9243991843d44a46d3d24e403137f1ec27b433acc532c51f99a0d5e91d0ed66d6744
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
name: integration-tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master, main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
tests:
|
|
10
|
+
name: Integration test ${{ matrix.repo }}
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: '${{ github.workflow }}-${{ github.job }}-${{ matrix.repo }}-${{ github.head_ref || github.ref_name }}'
|
|
15
|
+
cancel-in-progress: true
|
|
16
|
+
|
|
17
|
+
continue-on-error: true
|
|
18
|
+
strategy:
|
|
19
|
+
matrix:
|
|
20
|
+
repo: [ relaton-render ]
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v3
|
|
24
|
+
with:
|
|
25
|
+
submodules: true
|
|
26
|
+
|
|
27
|
+
- uses: ruby/setup-ruby@v1
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: '3.3'
|
|
30
|
+
bundler-cache: true
|
|
31
|
+
|
|
32
|
+
- uses: actions/checkout@v3
|
|
33
|
+
with:
|
|
34
|
+
submodules: recursive
|
|
35
|
+
repository: relaton/${{ matrix.repo }}
|
|
36
|
+
path: ${{ matrix.repo }}
|
|
37
|
+
fetch-depth: 0
|
|
38
|
+
|
|
39
|
+
- if: github.event_name == 'pull_request'
|
|
40
|
+
run: |
|
|
41
|
+
if [ `git rev-parse --verify "${GITHUB_HEAD_REF}" 2>/dev/null` ]
|
|
42
|
+
then
|
|
43
|
+
git checkout "${GITHUB_HEAD_REF}"
|
|
44
|
+
fi
|
|
45
|
+
working-directory: ${{ matrix.repo }}
|
|
46
|
+
|
|
47
|
+
- run: |
|
|
48
|
+
gem_name=$(echo ${GITHUB_REPOSITORY} | cut -d "/" -f 2)
|
|
49
|
+
bundle remove ${gem_name} || true
|
|
50
|
+
bundle add ${gem_name} --path ..
|
|
51
|
+
working-directory: ${{ matrix.repo }}
|
|
52
|
+
|
|
53
|
+
- run: bundle exec rake
|
|
54
|
+
working-directory: ${{ matrix.repo }}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: rake
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches: [ master, main, lutaml-integration ]
|
|
8
|
+
tags: [ v* ]
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
rake:
|
|
13
|
+
uses: relaton/support/.github/workflows/rake.yml@main
|
|
14
|
+
secrets:
|
|
15
|
+
pat_token: ${{ secrets.RELATON_CI_PAT_TOKEN }}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
|
+
# See https://github.com/metanorma/cimas
|
|
3
|
+
name: release
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
next_version:
|
|
9
|
+
description: |
|
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc).
|
|
11
|
+
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version
|
|
12
|
+
required: true
|
|
13
|
+
default: 'skip'
|
|
14
|
+
repository_dispatch:
|
|
15
|
+
types: [ do-release ]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
release:
|
|
20
|
+
uses: relaton/support/.github/workflows/release.yml@main
|
|
21
|
+
with:
|
|
22
|
+
next_version: ${{ github.event.inputs.next_version }}
|
|
23
|
+
secrets:
|
|
24
|
+
rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
|
data/.gitignore
CHANGED
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
/spec/reports/
|
|
8
8
|
/tmp/
|
|
9
9
|
.vscode/
|
|
10
|
+
/vendor/
|
|
10
11
|
|
|
11
12
|
# rspec failure tracking
|
|
12
13
|
.rspec_status
|
|
13
|
-
.rubocop-https---raw-githubusercontent-com-riboseinc-oss-guides-master-ci-rubocop-yml
|
|
14
14
|
Gemfile.lock
|
|
15
|
+
.claude/
|
|
16
|
+
.rubocop-remote-87c7cdd254a8d09d005ee06efac7acc0.yml
|
|
17
|
+
rubocop-87c7cdd254a8d09d005ee06efac7acc0.yml
|
data/.rubocop.yml
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
# https://github.com/riboseinc/oss-guides
|
|
3
3
|
# All project-specific additions and overrides should be specified in this file.
|
|
4
4
|
|
|
5
|
+
require: rubocop-rails
|
|
6
|
+
|
|
5
7
|
inherit_from:
|
|
6
8
|
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
|
7
9
|
AllCops:
|
|
8
|
-
TargetRubyVersion: 2
|
|
10
|
+
TargetRubyVersion: 3.2
|
|
9
11
|
Rails:
|
|
10
12
|
Enabled: false
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
RelatonBib is a Ruby gem that implements the [BibliographicItem model](https://github.com/metanorma/relaton-models#bibliography-uml-models) for bibliographic reference management. It's part of the Relaton ecosystem and serves as the base library for other Relaton gems.
|
|
8
|
+
|
|
9
|
+
## Common Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install dependencies
|
|
13
|
+
bundle install
|
|
14
|
+
|
|
15
|
+
# Run all tests
|
|
16
|
+
bundle exec rake spec
|
|
17
|
+
|
|
18
|
+
# Run a single test file
|
|
19
|
+
bundle exec rspec spec/relaton_bib/bibliographic_item_spec.rb
|
|
20
|
+
|
|
21
|
+
# Run a specific test by line number
|
|
22
|
+
bundle exec rspec spec/relaton_bib/bibliographic_item_spec.rb:42
|
|
23
|
+
|
|
24
|
+
# Run linting
|
|
25
|
+
bundle exec rubocop
|
|
26
|
+
|
|
27
|
+
# Auto-fix linting issues
|
|
28
|
+
bundle exec rubocop -a
|
|
29
|
+
|
|
30
|
+
# Interactive console
|
|
31
|
+
bin/console
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Architecture
|
|
35
|
+
|
|
36
|
+
### Serialization Layer (lutaml-model)
|
|
37
|
+
|
|
38
|
+
The codebase uses [lutaml-model](https://github.com/lutaml/lutaml-model) for serialization. Each model class in `lib/relaton/bib/model/` inherits from `Lutaml::Model::Serializable` and declares attributes with XML/YAML/JSON mappings.
|
|
39
|
+
|
|
40
|
+
### Constant loading (autoload)
|
|
41
|
+
|
|
42
|
+
Model and converter constants are wired via Ruby `autoload` from a central manifest,
|
|
43
|
+
[lib/relaton/bib/model_autoload.rb](lib/relaton/bib/model_autoload.rb). This makes load order
|
|
44
|
+
irrelevant and avoids circular requires between mutually-referencing classes (e.g. `OrganizationType`
|
|
45
|
+
↔ `Subdivision`). **When adding a new model class, add an `autoload` entry to the manifest** rather
|
|
46
|
+
than a `require_relative` in a sibling file. The manifest also eagerly loads `lutaml/model`/`lutaml/xml`
|
|
47
|
+
and runs the `Lutaml::Model::Config.configure` block so the XML adapter is set regardless of which
|
|
48
|
+
class is referenced first. Exceptions that keep `require_relative`: files that only *reopen* an
|
|
49
|
+
already-defined module to add methods (the converter method-partials under
|
|
50
|
+
`lib/relaton/bib/converter/*/`), which `autoload` cannot express.
|
|
51
|
+
|
|
52
|
+
### Core Classes
|
|
53
|
+
|
|
54
|
+
**`Relaton::Bib::Item`** ([lib/relaton/bib/model/item.rb](lib/relaton/bib/model/item.rb)) - The main serialization class defining all bibliographic attributes and their XML mappings. Uses `ItemData` as its underlying model.
|
|
55
|
+
|
|
56
|
+
**`Relaton::Bib::ItemData`** ([lib/relaton/bib/item_data.rb](lib/relaton/bib/item_data.rb)) - The data container class that holds bibliographic data and provides conversion methods (`to_xml`, `to_yaml`, `to_bibtex`, `to_rfcxml`). This separation allows the same data to be serialized differently (bibitem vs bibdata).
|
|
57
|
+
|
|
58
|
+
**`Relaton::Bib::Bibitem`** and **`Relaton::Bib::Bibdata`** - Variants of `Item` with different XML root elements and attributes (bibitem excludes `ext`, bibdata excludes `id`).
|
|
59
|
+
|
|
60
|
+
### Component Models
|
|
61
|
+
|
|
62
|
+
Each bibliographic attribute has its own class in `lib/relaton/bib/model/`:
|
|
63
|
+
|
|
64
|
+
- `Title`, `LocalizedString`, `LocalizedMarkedUpString` - text with language/script
|
|
65
|
+
- `Contributor`, `Person`, `Organization` - contributors and affiliations
|
|
66
|
+
- `Docidentifier` - document IDs (DOI, ISBN, etc.)
|
|
67
|
+
- `Date` - publication dates with custom `StringDate` type
|
|
68
|
+
- `Relation` - related documents (circular reference with Item)
|
|
69
|
+
- `Ext` - extension data (doctype, ICS codes, structured identifiers)
|
|
70
|
+
|
|
71
|
+
### Parsing
|
|
72
|
+
|
|
73
|
+
- **`HashParserV1`** ([lib/relaton/bib/hash_parser_v1.rb](lib/relaton/bib/hash_parser_v1.rb)) - Converts legacy Hash/YAML format to `ItemData`
|
|
74
|
+
- **`Converter::BibXml`** ([lib/relaton/bib/converter/bibxml.rb](lib/relaton/bib/converter/bibxml.rb)) - Parses RFC BibXML format via `Relaton::Bib::Converter::BibXml.to_item`
|
|
75
|
+
- **lutaml-model native** - `Item.from_xml`, `Item.from_yaml`, `Item.from_json` handle current format
|
|
76
|
+
|
|
77
|
+
### Rendering
|
|
78
|
+
|
|
79
|
+
- **`Renderer::BibtexBuilder`** - Converts `ItemData` to BibTeX format
|
|
80
|
+
- **`Converter::BibXml`** - Converts `ItemData` to RFC XML format via `Relaton::Bib::Converter::BibXml.to_xml`
|
|
81
|
+
- **lutaml-model native** - `to_xml`, `to_yaml`, `to_json` via the serialization classes
|
|
82
|
+
|
|
83
|
+
### Usage Pattern
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
# Parse from YAML
|
|
87
|
+
item = Relaton::Bib::Item.from_yaml(yaml_string)
|
|
88
|
+
|
|
89
|
+
# Parse from XML
|
|
90
|
+
item = Relaton::Bib::Bibitem.from_xml(xml_string)
|
|
91
|
+
item = Relaton::Bib::Bibdata.from_xml(xml_string)
|
|
92
|
+
|
|
93
|
+
# Parse from RFC XML
|
|
94
|
+
item = Relaton::Bib::Converter::BibXml.to_item(xml_string)
|
|
95
|
+
|
|
96
|
+
# Convert to different formats (returns string)
|
|
97
|
+
item.to_xml # as <bibitem>
|
|
98
|
+
item.to_xml(bibdata: true) # as <bibdata>
|
|
99
|
+
item.to_yaml
|
|
100
|
+
item.to_bibtex
|
|
101
|
+
item.to_rfcxml
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Code Style
|
|
105
|
+
|
|
106
|
+
- Follows Ribose OSS Ruby style guide (inherited via `.rubocop.yml`)
|
|
107
|
+
- Target Ruby version: 3.1+
|
|
108
|
+
- Uses YARD documentation comments
|
data/Gemfile
CHANGED
|
@@ -2,3 +2,14 @@ source "https://rubygems.org"
|
|
|
2
2
|
|
|
3
3
|
# Specify your gem's dependencies in relaton-bib.gemspec
|
|
4
4
|
gemspec
|
|
5
|
+
|
|
6
|
+
gem "byebug"
|
|
7
|
+
gem "equivalent-xml", "~> 0.6"
|
|
8
|
+
gem "openssl", "~> 3.3.2" # 3.3.0 raises error when rubocop fetches https resources
|
|
9
|
+
gem "rake", "~> 13.0"
|
|
10
|
+
gem "rspec", "~> 3.0"
|
|
11
|
+
gem "rubocop"
|
|
12
|
+
gem "rubocop-performance"
|
|
13
|
+
gem "rubocop-rails"
|
|
14
|
+
gem "ruby-jing"
|
|
15
|
+
gem "simplecov"
|