relaton-render 0.1.0 → 3.0.0.pre.alpha.25
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/rake.yml +4 -1
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +2 -2
- data/Gemfile +17 -1
- data/README.adoc +61 -197
- data/docs/citation-style-pack.adoc +367 -0
- data/lib/relaton/render/general.rb +305 -0
- data/lib/relaton/render/iso690/element.rb +153 -0
- data/lib/relaton/render/iso690/elements/access.rb +44 -0
- data/lib/relaton/render/iso690/elements/authorizer.rb +30 -0
- data/lib/relaton/render/iso690/elements/citeid.rb +39 -0
- data/lib/relaton/render/iso690/elements/component_part.rb +99 -0
- data/lib/relaton/render/iso690/elements/creator.rb +258 -0
- data/lib/relaton/render/iso690/elements/edition.rb +92 -0
- data/lib/relaton/render/iso690/elements/extent.rb +71 -0
- data/lib/relaton/render/iso690/elements/identifier.rb +46 -0
- data/lib/relaton/render/iso690/elements/location.rb +73 -0
- data/lib/relaton/render/iso690/elements/medium.rb +32 -0
- data/lib/relaton/render/iso690/elements/numeration.rb +26 -0
- data/lib/relaton/render/iso690/elements/production.rb +92 -0
- data/lib/relaton/render/iso690/elements/pub_date.rb +56 -0
- data/lib/relaton/render/iso690/elements/series.rb +66 -0
- data/lib/relaton/render/iso690/elements/size.rb +41 -0
- data/lib/relaton/render/iso690/elements/status.rb +30 -0
- data/lib/relaton/render/iso690/elements/stddoc.rb +40 -0
- data/lib/relaton/render/iso690/elements/title.rb +56 -0
- data/lib/relaton/render/iso690/elements/updated.rb +38 -0
- data/lib/relaton/render/iso690/elements.rb +67 -0
- data/lib/relaton/render/iso690/fields.rb +142 -0
- data/lib/relaton/render/iso690/i18n/en.yml +47 -0
- data/lib/relaton/render/iso690/i18n/fr.yml +14 -0
- data/lib/relaton/render/iso690/i18n/ja.yml +38 -0
- data/lib/relaton/render/iso690/i18n.rb +83 -0
- data/lib/relaton/render/iso690/identifier_kinds.rb +29 -0
- data/lib/relaton/render/iso690/index_renderer.rb +57 -0
- data/lib/relaton/render/iso690/kinds.rb +53 -0
- data/lib/relaton/render/iso690/renderer.rb +148 -0
- data/lib/relaton/render/iso690/style/locale.rb +53 -0
- data/lib/relaton/render/iso690/style/name_form.rb +87 -0
- data/lib/relaton/render/iso690/style/scheme.rb +33 -0
- data/lib/relaton/render/iso690/style/sort_rule.rb +25 -0
- data/lib/relaton/render/iso690/style/template_map.rb +40 -0
- data/lib/relaton/render/iso690/style/type_template.rb +37 -0
- data/lib/relaton/render/iso690/style.rb +119 -0
- data/lib/relaton/render/iso690/styles/author-date.yml +31 -0
- data/lib/relaton/render/iso690/template.rb +248 -0
- data/lib/relaton/render/iso690.rb +26 -0
- data/lib/relaton/render/version.rb +5 -0
- data/lib/relaton-render.rb +12 -5
- data/relaton-render.gemspec +7 -11
- metadata +57 -86
- data/lib/isodoc/i18n.rb +0 -24
- data/lib/isodoc-yaml/i18n-ar.yaml +0 -2
- data/lib/isodoc-yaml/i18n-de.yaml +0 -2
- data/lib/isodoc-yaml/i18n-en.yaml +0 -22
- data/lib/isodoc-yaml/i18n-es.yaml +0 -2
- data/lib/isodoc-yaml/i18n-fr.yaml +0 -2
- data/lib/isodoc-yaml/i18n-ru.yaml +0 -23
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +0 -2
- data/lib/parse/parse.rb +0 -54
- data/lib/parse/parse_contributors.rb +0 -96
- data/lib/parse/parse_extract.rb +0 -155
- data/lib/relaton/config.yml +0 -67
- data/lib/relaton/render.rb +0 -123
- data/lib/relaton/render_classes.rb +0 -126
- data/lib/relaton/render_fields.rb +0 -151
- data/lib/relaton/version.rb +0 -5
- data/lib/template/template.rb +0 -152
- data/lib/utils/utils.rb +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ecdbfb0b1c82700b6c957c9eeb259fd48f48d391a35062b07e4d6d6ede4ccb2e
|
|
4
|
+
data.tar.gz: 199330b061ce3e07eb3edff0364ffc313773eb27cf6f7b8d0a216bff4caa3cac
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f21d46a60631252c2011e73096ea2ff321fae8f8f361c9e8bc46b53709d304da350bac73ab3eb44cdf7c5a4ec6a35c74f10875aa5548e417fc9c66afc43a8693
|
|
7
|
+
data.tar.gz: 2fac8549403467928c30917f75e167fba771a3f175c5128d9c2a1daab37cb813cd29b1feb493746559c985df068b68306d9cdd2cd1cb5fb63b82e0e79445a150
|
data/.github/workflows/rake.yml
CHANGED
|
@@ -8,8 +8,11 @@ on:
|
|
|
8
8
|
tags: [ v* ]
|
|
9
9
|
pull_request:
|
|
10
10
|
|
|
11
|
+
permissions:
|
|
12
|
+
contents: write
|
|
13
|
+
|
|
11
14
|
jobs:
|
|
12
15
|
rake:
|
|
13
|
-
uses: metanorma/
|
|
16
|
+
uses: metanorma/ci/.github/workflows/generic-rake.yml@main
|
|
14
17
|
secrets:
|
|
15
18
|
pat_token: ${{ secrets.METANORMA_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
|
+
jobs:
|
|
18
|
+
release:
|
|
19
|
+
uses: relaton/support/.github/workflows/release.yml@main
|
|
20
|
+
with:
|
|
21
|
+
next_version: ${{ github.event.inputs.next_version }}
|
|
22
|
+
secrets:
|
|
23
|
+
rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
|
|
24
|
+
|
data/.gitignore
ADDED
data/.rubocop.yml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# Auto-generated by Cimas: Do not edit it manually!
|
|
2
2
|
# See https://github.com/metanorma/cimas
|
|
3
3
|
inherit_from:
|
|
4
|
-
- https://raw.githubusercontent.com/riboseinc/oss-guides/
|
|
4
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
|
|
5
5
|
|
|
6
6
|
# local repo-specific modifications
|
|
7
7
|
# ...
|
|
8
8
|
|
|
9
9
|
AllCops:
|
|
10
|
-
TargetRubyVersion:
|
|
10
|
+
TargetRubyVersion: 3.4
|
data/Gemfile
CHANGED
|
@@ -3,6 +3,22 @@ Encoding.default_internal = Encoding::UTF_8
|
|
|
3
3
|
|
|
4
4
|
source "https://rubygems.org"
|
|
5
5
|
|
|
6
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
6
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
7
7
|
|
|
8
8
|
gemspec
|
|
9
|
+
|
|
10
|
+
group :development, :test do
|
|
11
|
+
gem "canon"
|
|
12
|
+
gem "relaton", ">= 3.0.0.pre.alpha", "< 4" # the model fixtures; the engine itself is model-agnostic
|
|
13
|
+
gem "debug"
|
|
14
|
+
gem "iso-690-test-suite", github: "relaton/iso-690-test-suite"
|
|
15
|
+
gem "rake", ">= 12.3.3"
|
|
16
|
+
gem "rspec", "~> 3.0"
|
|
17
|
+
gem "simplecov"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
begin
|
|
21
|
+
eval_gemfile("Gemfile.devel")
|
|
22
|
+
rescue StandardError
|
|
23
|
+
nil
|
|
24
|
+
end
|
data/README.adoc
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
= Relaton Render
|
|
2
2
|
|
|
3
|
-
image:https://img.shields.io/gem/v/
|
|
4
|
-
image:https://github.com/metanorma/
|
|
5
|
-
image:https://codeclimate.com/github/metanorma/
|
|
3
|
+
image:https://img.shields.io/gem/v/relaton-render.svg["Gem Version", link="https://rubygems.org/gems/relaton-render"]
|
|
4
|
+
image:https://github.com/metanorma/relaton-render/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/relaton-render/actions?workflow=rake"]
|
|
5
|
+
// image:https://codeclimate.com/github/metanorma/relaton-render/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-render"]
|
|
6
6
|
|
|
7
7
|
Gem that takes a https://github.com/relaton/relaton[Relaton] bibliographic description and
|
|
8
8
|
a configuration, and generates a https://www.metanorma.org[Metanorma] XML rendering of that description.
|
|
@@ -13,15 +13,31 @@ a configuration, and generates a https://www.metanorma.org[Metanorma] XML render
|
|
|
13
13
|
----
|
|
14
14
|
input = "<bibitem type='...'>....</bibitem>"
|
|
15
15
|
|
|
16
|
-
Relaton::Render::General.new(template: ..., nametemplate: ..., seriestemplate: ..., language: "en", script: "Latn")
|
|
16
|
+
r = Relaton::Render::General.new(template: ..., nametemplate: ..., seriestemplate: ..., language: "en", script: "Latn")
|
|
17
|
+
|
|
18
|
+
r.render(input) == "Author1 and Author2 2000. Title &c."
|
|
19
|
+
|
|
20
|
+
bibliography = "<references><bibitem id=''>...</bibitem>...<bibitem id=''>...</bibitem></references>"
|
|
21
|
+
|
|
22
|
+
r.render_all(bibliography, type: "author-cite") ==
|
|
23
|
+
|
|
24
|
+
{ bibitem["id"] :
|
|
25
|
+
{ author: "Author1 and Author2",
|
|
26
|
+
date: "2000a",
|
|
27
|
+
citation: "Author1 and Author2 2000a",
|
|
28
|
+
formattedref: "Author1 and Author2 2000a. Title &c."
|
|
29
|
+
}
|
|
30
|
+
}
|
|
17
31
|
----
|
|
18
32
|
|
|
33
|
+
The gem processes either Relaton XML, or native Relaton classes.
|
|
34
|
+
|
|
19
35
|
The gem is intended to be inherited from by Metanorma flavours, which may specialise it with their own
|
|
20
36
|
code. The templates are however intended to determine much of the rendering.
|
|
21
37
|
|
|
22
|
-
Gems can provide their configurations in YAML files, and parse them before passing them to the call to
|
|
23
|
-
The built-in values for
|
|
24
|
-
the parameters of initialising
|
|
38
|
+
Gems can provide their configurations in YAML files, and parse them before passing them to the call to Relaton::Render.
|
|
39
|
+
The built-in values for Relaton::Render are given in `/lib/relaton/render/general/config.yml`, and can be overridden by
|
|
40
|
+
the parameters of initialising Relaton::Render.
|
|
25
41
|
|
|
26
42
|
The parameters are:
|
|
27
43
|
|
|
@@ -29,213 +45,61 @@ The parameters are:
|
|
|
29
45
|
`script`:: in ISO-15124
|
|
30
46
|
`template`:: templates for rendering different bibliographic types
|
|
31
47
|
`nametemplate`:: templates for rendering personal names
|
|
48
|
+
`authorcitetemplate`:: templates for rendering names for the purpose of author-date citations
|
|
32
49
|
`seriestemplate`:: template for rendering series
|
|
33
50
|
`journaltemplate`:: template for rendering journals in article citations
|
|
34
51
|
`extenttemplate`:: templates for rendering extents
|
|
35
|
-
`
|
|
36
|
-
`
|
|
52
|
+
`sizetemplate`:: templates for rendering sizes
|
|
53
|
+
`edition_ordinal`:: override formatting of edition with ordinal
|
|
37
54
|
`date`:: default date format (from Twitter CLDR)
|
|
55
|
+
`i18nhash`:: Metanorma internationalisation hash
|
|
38
56
|
|
|
39
|
-
==
|
|
40
|
-
|
|
41
|
-
=== Templates
|
|
42
|
-
|
|
43
|
-
There is one template provided for each of the bibliographic types recognised by Relaton (`/bibitem/@type`), and a default template:
|
|
44
|
-
|
|
45
|
-
Currently supported:
|
|
46
|
-
|
|
47
|
-
* article
|
|
48
|
-
* book
|
|
49
|
-
* booklet
|
|
50
|
-
* manual
|
|
51
|
-
* proceedings
|
|
52
|
-
* presentation
|
|
53
|
-
* thesis
|
|
54
|
-
* techreport
|
|
55
|
-
* standard
|
|
56
|
-
* unpublished
|
|
57
|
-
* electronic resource
|
|
58
|
-
* inbook
|
|
59
|
-
* incollection
|
|
60
|
-
* inproceedings
|
|
61
|
-
* journal
|
|
62
|
-
* website
|
|
63
|
-
* webresource
|
|
64
|
-
* dataset
|
|
65
|
-
|
|
66
|
-
Not currently supported:
|
|
67
|
-
|
|
68
|
-
* map
|
|
69
|
-
* audiovisual
|
|
70
|
-
* film
|
|
71
|
-
* video
|
|
72
|
-
* broadcast
|
|
73
|
-
* software
|
|
74
|
-
* graphic_work
|
|
75
|
-
* music
|
|
76
|
-
* performance
|
|
77
|
-
* patent
|
|
78
|
-
* archival
|
|
79
|
-
* social_media
|
|
80
|
-
* alert
|
|
81
|
-
* message
|
|
82
|
-
* conversation
|
|
83
|
-
* misc (default)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
In Metanorma, not all types are used, but there are exemplars for all of these given on this site, following
|
|
87
|
-
the human-readable style used in ISO 690. These can be overridden by supplying corresponding paramerers in the call
|
|
88
|
-
to initialise Iso690Render.
|
|
89
|
-
|
|
90
|
-
Each `template` is a string marked up with https://shopify.github.io/liquid/[Liquid Markup], with the following fields
|
|
91
|
-
drawn from the bibliographic item:
|
|
92
|
-
|
|
93
|
-
|===
|
|
94
|
-
| Field | Relaton XPath | Multiple | Can come from host | Note
|
|
95
|
-
|
|
96
|
-
| title | ./title | | |
|
|
97
|
-
| edition | ./edition | | Y | If numeric value, is given internationalised rendering of "nth edition", as set in edition_numbering. Otherwise, the textual content of the tag is given.
|
|
98
|
-
| edition_raw | ./edition | | Y | The strict textual content of the tag is given.
|
|
99
|
-
| medium | ./medium | | Y |
|
|
100
|
-
| place | ./place | | Y |
|
|
101
|
-
| publisher | ./contributor[role/@type = 'publisher']/organization/name | | Y |
|
|
102
|
-
| distributor | ./contributor[role/@type = 'distributor']/organization/name | | Y |
|
|
103
|
-
| standardidentifier | ./docidentifier[not(@type = 'metanorma' or @type = 'ordinal')] | Y | |
|
|
104
|
-
| status | ./status | | | Rendering varies by flavour
|
|
105
|
-
| uri | ./uri[@type = 'doi' or @type = 'uri' or @type = 'src' or true] | | |
|
|
106
|
-
| access_location | ./accessLocation | | Y |
|
|
107
|
-
| extent | ./extent | Y | | Render with standard abbreviations for pp, vols, with n-dash, with delimiting of multiple locations
|
|
108
|
-
| creatornames | ./contributor[role/@type = 'author'] \| ./contributor[role/@type = 'performer'] \| ./contributor[role/@type = 'adapter'] \| ./contributor[role/@type = 'translator'] \| ./contributor[role/@type = 'editor'] \| ./contributor[role/@type = 'publisher'] \| ./contributor[role/@type = 'distributor'] \| ./contributor | Y | | <<nametemplate,`nametemplate`>> applied to each name; joining template from internationalisation applied to multiple names
|
|
109
|
-
| role | ./contributor[role/description] \| ./contributor[role/@type] | | |
|
|
110
|
-
| date | ./date[@type = 'issued'] \| ./date[@type = 'circulated'] \| ./date | | Y |
|
|
111
|
-
| date_updated | ./date[@type = 'updated'] | | Y |
|
|
112
|
-
| date_accessed | ./date[@type = 'accessed'] | | Y |
|
|
113
|
-
| series | ./series[@type = 'main' or not(@type) or true] | | Y | <<seriestemplate,`seriestemplate`>> applies to series
|
|
114
|
-
| host_creatornames | ./relation[@type = 'includedIn']/ bibitem/contributor[role/@type = 'author'] | | Y | Follows options for `creatornames`
|
|
115
|
-
| host_title | ./relation[@type = 'includedIn']/ bibitem/title | Y | Y | Follows options for `creatornames`
|
|
116
|
-
| host_role | ./relation[@type = 'includedIn']/ bibitem/contributor[role/description] \| ./relation[@type = 'includedIn']/ bibitem/contributor[role/@type] | | Y |
|
|
117
|
-
| type | ./@type | |
|
|
118
|
-
| labels | | | text to be looked up in internationalisation configuration files: "edition", "In", "At", "Vol", "Vols", "p.", "pp"
|
|
119
|
-
|===
|
|
120
|
-
|
|
121
|
-
Many fields are populated either by the description of the bibliographic item itself, or by the description of the item containing it (the _host_ item: `./relation[@type = 'includedIn']/bibitem`). For example, in a paper included in an edited volume, the edition will typically be given for the editor volume, rather than for the paper. Those fields are indicated by "Can come from host" in the table.
|
|
122
|
-
|
|
123
|
-
The Liquid template surrounds each field by preceding and following punctuation.
|
|
124
|
-
|
|
125
|
-
* Fields are space-delimited. So `<em>{{ title }}</em> [{{medium}}]` are two separate fields.
|
|
126
|
-
* If fields are not space-delimited, this is indicated by inserting `|`. So `{{ title }}|{{ medium}}` is two fields, rendered with no space separation.
|
|
127
|
-
* If the field is empty, its surrounding markup is also removed. So if there is no medium, then `[{{medium}}]` is not rendered, and the brackets will be stripped.
|
|
128
|
-
* Underscore is treated as space, attaching to the preceding or following field. So `,_{{ edition }}_{{ labels['edition'] }}` is treated as the one field.
|
|
129
|
-
* If punctuation is space delimited, it is inserted regardless of preceding content. So `{{ creatornames }} ({{date}}) .` will insert the full stop whether or not the date is present.
|
|
130
|
-
* Space between punctuation and before punctuation is automatically removed.
|
|
131
|
-
|
|
132
|
-
For example:
|
|
133
|
-
|
|
134
|
-
....
|
|
135
|
-
"{{ creatornames }} ({{date}}) . <em>{{ title }}</em> [{{medium}}] ,_{{ edition }}_{{ labels['edition'] }} ."
|
|
136
|
-
....
|
|
137
|
-
|
|
138
|
-
If a type uses another type's template, the type is mapped to the other type's name; e.g.
|
|
139
|
-
|
|
140
|
-
....
|
|
141
|
-
template:
|
|
142
|
-
book: ...
|
|
143
|
-
booklet: book
|
|
144
|
-
....
|
|
145
|
-
|
|
146
|
-
[[nametemplate]]
|
|
147
|
-
=== Name templates
|
|
148
|
-
|
|
149
|
-
The `nametemplate` is a hash of Liquid templates for the formatting of contributor names in particular positions. It
|
|
150
|
-
draws on the following fields drawn from the bibliographic item:
|
|
151
|
-
|
|
152
|
-
|===
|
|
153
|
-
| Field | Relaton XPath | Multiple | Note
|
|
154
|
-
|
|
155
|
-
| surname[0] | ./contributor[1]/person/name/surname \| ./contributor[1]/person/name/completename \| ./contributor[1]/organization/name | | i.e. surname is the name default
|
|
156
|
-
| surname[1] | ./contributor[2]/name/surname | |
|
|
157
|
-
| surname[2] | ./contributor[3]/name/surname | |
|
|
158
|
-
| initials[0] | ./contributor[1]/name/initial | | If not supplied, the first letter of each given name is used instead
|
|
159
|
-
| initials[1] | ./contributor[2]/name/initial | |
|
|
160
|
-
| given[0] | ./contributor[1]/name/forename[1] | | If not supplied, initials are used instead
|
|
161
|
-
| given[1] | ./contributor[2]/name/forename[1] | |
|
|
162
|
-
| middle[0] | ./contributor[1]/name/forename[not(first())] | Y |
|
|
163
|
-
| middle[1] | ./contributor[2]/name/forename[not(first())] | Y |
|
|
164
|
-
|===
|
|
165
|
-
|
|
166
|
-
There are at least three distinct `nametemplate` instances that need to be provided, one for a single contributor (`one:`), one for two contributors (`two:`), one for three or more (`more:`), and optionally one for "et al." (`etal:`). The number of contributors for which "et al." starts being used is indicated by `etal_count`.
|
|
167
|
-
|
|
168
|
-
For example:
|
|
169
|
-
....
|
|
170
|
-
{
|
|
171
|
-
one: "{{ surname[0] }}, {{ given[0] }} {{ middle[0] | slice : 0 }}",
|
|
172
|
-
two: "{{ surname[0] }}, {{ given[0] }} {{ middle[0] | slice : 0 }} & {{ given[1] }} {{ middle[1] | slice : 0 }} {{ surname[1] }}",
|
|
173
|
-
more: "{{ surname[0] }}, {{ given[0] }} {{ middle[0] | slice : 0 }}, {{ given[1] }} {{ middle[1] | slice : 0 }} {{ surname[1] }} & {{ given[2] }} {{ middle[2] | slice : 0 }} {{ surname[2] }}",
|
|
174
|
-
etal: "{{ surname[0] }}, {{ given[0] }} {{ middle[0] | slice : 0 }}, {{ given[1] }} {{ middle[1] | slice : 0 }} {{ surname[1] }} <em>et al.</em>",
|
|
175
|
-
etal_count: 6
|
|
176
|
-
}
|
|
177
|
-
....
|
|
178
|
-
|
|
179
|
-
In the case of `more`, the `(name)[1]` entries are repeated for all additional authors above 2 and before the final author.
|
|
180
|
-
|
|
181
|
-
[[seriestemplate]]
|
|
182
|
-
=== Series template
|
|
183
|
-
|
|
184
|
-
The `seriestemplate` is a template for the rendering of series information. It draws on the following fields drawn from the bibliographic item:
|
|
185
|
-
|
|
186
|
-
|===
|
|
187
|
-
| Field | Relaton XPath | Multiple | Can come from host | Note
|
|
188
|
-
|
|
189
|
-
| series_title | ./series[@type = 'main' or not(@type) or true]/name | | Y |
|
|
190
|
-
| series_abbr | ./series[@type = 'main' or not(@type) or true]/abbreviation | | Y |
|
|
191
|
-
| series_num | ./series[@type = 'main' or not(@type) or true]/number | | Y |
|
|
192
|
-
| series_partnumber | ./series[@type = 'main' or not(@type) or true]/partnumber | | Y |
|
|
193
|
-
| series_run | ./series[@type = 'main' or not(@type) or true]/run | | Y |
|
|
194
|
-
|===
|
|
57
|
+
== Functionality
|
|
195
58
|
|
|
196
|
-
|
|
59
|
+
=== Rendering single reference
|
|
197
60
|
|
|
198
|
-
|
|
61
|
+
Given an Relaton bibitem object (or equivalent Relaton XML), `render(input)` will output a formatted reference for that
|
|
62
|
+
bibitem, following the rules laid out in the configuration. That output can be inserted into the `<formattedref>` element
|
|
63
|
+
of the bibitem by the calling code, and used as the authoritative rendering of the citation.
|
|
199
64
|
|
|
200
|
-
|
|
65
|
+
This method does not address how the bibliographic item is to be cited, and does not differentiate citations with the same
|
|
66
|
+
author and date. It should not be used for rendering of references aligned to the author-date citation system.
|
|
201
67
|
|
|
202
|
-
|
|
68
|
+
=== Rendering multiple references
|
|
203
69
|
|
|
204
|
-
|
|
70
|
+
Given a collection of Relaton bibitem objects (or equivalent Relaton XML, wrapped in `<references>`),
|
|
71
|
+
`render_all(bibliography, type: type)`
|
|
72
|
+
will output a hash of objects, with information to be used both for rendering references, and for generating citations.
|
|
73
|
+
This method addresses the disambiguation of citations, and changes to rendering of references reflecting that disambiguation
|
|
74
|
+
(e.g. differentiating two works with the same wuthor surname and year: _Jones 1996a_ and _Jones 1996b_).
|
|
75
|
+
For that reason, this method should be used for references using the author-date citation system.
|
|
205
76
|
|
|
206
|
-
|
|
77
|
+
The `type` argument of `render_all` reflects the citation system to be used.
|
|
207
78
|
|
|
208
|
-
|
|
79
|
+
* If it is set to "author-date", citations with the same author and date will be disambiguated from each other
|
|
80
|
+
by appending a letter to the date, in the order in which they occur in `bibliography`. (That means that any fixed sorting
|
|
81
|
+
of references needs to be applied before the bibliography is presented to the method.)
|
|
82
|
+
* If it is set to nil (as is the default), no such disambiguation occurs.
|
|
209
83
|
|
|
210
|
-
|
|
84
|
+
The hash maps from the anchor of each bibitem (`bibitem/@id`), to an object containing the following fields:
|
|
211
85
|
|
|
212
|
-
|
|
86
|
+
`formattedref`:: the formatted reference, as output by `render(input)`, but with the date of the citation disambiguated
|
|
87
|
+
if called with `type: "author-date"`.
|
|
88
|
+
`citation`:: the citation for the reference (Author-Date if called with `type: "author-date"`; `docidentifier` if called with `type: nil`).
|
|
89
|
+
`author`:: the author designation for the reference (if called with `type: "author-date"`)
|
|
90
|
+
`date`:: the date designation for the reference, with disambiguating letter if necessary (if called with `type: "author-date"`).
|
|
91
|
+
The author and date are differentiated so that consumers can separate them in citations -- e.g. "Jones (1996) claims",
|
|
92
|
+
"(Jones 1996, 1997)".
|
|
213
93
|
|
|
214
|
-
|
|
94
|
+
=== Parsing single reference
|
|
215
95
|
|
|
216
|
-
|
|
96
|
+
Given an Relaton bibitem object (or equivalent Relaton XML), `parse(input)` will output the hash of fields that is passed into the
|
|
97
|
+
Liquid templates described below for rendering: it is the hash of bibliographic fields extracted by the gem.
|
|
217
98
|
|
|
218
|
-
|
|
219
|
-
{
|
|
220
|
-
book: "{{ volume }}_{{ label['extent']['volume'] }}, {{ page }}_{{ label['extent']['page'] }}"
|
|
221
|
-
inbook: "{{ volume }}: {{ page }}"
|
|
222
|
-
misc: "{{ label['extent']['volume'] }}_{{ volume }}, {{ label['extent']['page'] }}_{{ page }}"
|
|
223
|
-
}
|
|
224
|
-
....
|
|
225
|
-
|
|
226
|
-
The internationalisation files define a singular and a plural version of the locality types, under `labels['extent']`
|
|
227
|
-
|
|
228
|
-
* The plural is always used if the extent is a range (with a `<from>` and `<to>`).
|
|
229
|
-
* In a host type of bibliographic item, the extent is singular only if the value is `1`, else it is plural (_1 p._, _2 pp._)
|
|
230
|
-
* In an included item (`inbook`, `incollection`, `inproceedings`, `article`, or any item with an `includedIn` relation),
|
|
231
|
-
the singular is used if the extent is not a range (_pp. 2–4_ vs. _p. 3_)..
|
|
99
|
+
== Configuration
|
|
232
100
|
|
|
233
|
-
|
|
101
|
+
For the configuation YAML used in relaton-render, refer to https://relaton.org/specs/relaton-render
|
|
234
102
|
|
|
235
|
-
|
|
103
|
+
== Documentation
|
|
236
104
|
|
|
237
|
-
|
|
238
|
-
`edition_number`:: has following values corresponding to the rule-based number rules defined in https://github.com/twitter/twitter-cldr-rb[Twitter CLDR]
|
|
239
|
-
for a language. For example, English _4th_ is defined as `["OrdinalRules", "digits-ordinal"]`, because under twitter-cldr, `4th` is generated as `4.localize(:en).to_rbnf_s("OrdinalRules", "digits-ordinal")`.
|
|
240
|
-
`edition`:: is the localised expression for edition, with the edition number given as %. So _4th ed.` is generated with `edition` as `% ed.`.
|
|
241
|
-
`date`:: date format default, taken from https://github.com/twitter/twitter-cldr-rb[Twitter CLDR]: `to_full_s`, `to_long_s`, `to_medium_s`, `to_short_s`, or one of the `to_additional_s` formats. One value is given for each of "month_year", "day_month_year", and "date_time"; e.g. `{ month_year: to_long_s, day_month_year: to_long_s, date_time: to_long_s }`.
|
|
105
|
+
* link:docs/citation-style-pack.adoc[Defining a Citation Style: the pack format] — the authoritative spec for CitationStyle YAML packs: resource types, presentation patterns, model presentation templates, locale/punctuation, inheritance and conformance.
|