relaton-bib 1.11.2 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +13 -0
- data/lib/relaton_bib/bibliographic_item.rb +48 -30
- data/lib/relaton_bib/typed_title_string.rb +12 -0
- data/lib/relaton_bib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fff6fdcb77f7545cc6989fa6dcc65eadfde4609ee167eaacf2648205a43a9d4
|
4
|
+
data.tar.gz: d2529ceddabe29e386900bceedc3f101e9bf441a87c5d9ac128a7450813083d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4aab0bed22dcc71b722547965dedc1a3b315cb092e5b08817cd760c2f3db4363d82d079d58da165f634f440974e2f474255a64a626c2917199ac546b3d05dc9
|
7
|
+
data.tar.gz: 21e8feee74c3f8c28b465068700b43c63f9f2ed81cca87974807cae646ed287def53651dce58c5fb5ca2ab274cf482cc1f34b634bdb276a39250df91ed000a6d
|
data/README.adoc
CHANGED
@@ -416,6 +416,19 @@ item.to_bibtex
|
|
416
416
|
...
|
417
417
|
----
|
418
418
|
|
419
|
+
=== Export bibliographic item to Citeproc
|
420
|
+
|
421
|
+
[source,ruby]
|
422
|
+
----
|
423
|
+
item.to_citeproc
|
424
|
+
=> [{"title"=>"Geographic information",
|
425
|
+
"edition"=>"1",
|
426
|
+
"author"=>[{"family"=>"Bierman", "given"=>"A."}, {"family"=>"Bierman", "given"=>"Forename"}],
|
427
|
+
"publisher"=>"Institute of Electrical and Electronics Engineers",
|
428
|
+
"publisher-place"=>"bib place",
|
429
|
+
...
|
430
|
+
----
|
431
|
+
|
419
432
|
=== Exporting bibliographic item to AsciiBib
|
420
433
|
|
421
434
|
[source,ruby]
|
@@ -401,30 +401,26 @@ module RelatonBib
|
|
401
401
|
hash
|
402
402
|
end
|
403
403
|
|
404
|
-
#
|
404
|
+
#
|
405
|
+
# Reander BibTeX
|
406
|
+
#
|
407
|
+
# @param bibtex [BibTeX::Bibliography, nil]
|
408
|
+
#
|
405
409
|
# @return [String]
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
bibtex_classification item
|
421
|
-
item.keywords = keyword.map(&:content).join(", ") if keyword.any?
|
422
|
-
bibtex_docidentifier item
|
423
|
-
item.timestamp = fetched.to_s if fetched
|
424
|
-
bibtex_link item
|
425
|
-
bibtex ||= BibTeX::Bibliography.new
|
426
|
-
bibtex << item
|
427
|
-
bibtex.to_s
|
410
|
+
#
|
411
|
+
def to_bibtex(bibtex = nil)
|
412
|
+
bibtext_item(bibtex).to_s
|
413
|
+
end
|
414
|
+
|
415
|
+
#
|
416
|
+
# Render citeproc
|
417
|
+
#
|
418
|
+
# @param bibtex [BibTeX::Bibliography, nil]
|
419
|
+
#
|
420
|
+
# @return [Hash] citeproc
|
421
|
+
#
|
422
|
+
def to_citeproc(bibtex = nil)
|
423
|
+
bibtext_item(bibtex).to_citeproc.map { |cp| cp.transform_keys(&:to_s) }
|
428
424
|
end
|
429
425
|
|
430
426
|
# @param lang [String, nil] language code Iso639
|
@@ -555,13 +551,35 @@ module RelatonBib
|
|
555
551
|
|
556
552
|
private
|
557
553
|
|
558
|
-
#
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
554
|
+
#
|
555
|
+
# Create BibTeX item for this document
|
556
|
+
#
|
557
|
+
# @param [BibTeX::Bibliography, nil] bibtex <description>
|
558
|
+
#
|
559
|
+
# @return [BibTeX::Bibliography] BibTeX bibliography
|
560
|
+
#
|
561
|
+
def bibtext_item(bibtex) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
|
562
|
+
item = BibTeX::Entry.new
|
563
|
+
item.type = bibtex_type
|
564
|
+
item.key = id
|
565
|
+
title.to_bibtex item
|
566
|
+
item.edition = edition if edition
|
567
|
+
bibtex_author item
|
568
|
+
bibtex_contributor item
|
569
|
+
item.address = place.first.name if place.any?
|
570
|
+
bibtex_note item
|
571
|
+
bibtex_relation item
|
572
|
+
bibtex_extent item
|
573
|
+
bibtex_date item
|
574
|
+
bibtex_series item
|
575
|
+
bibtex_classification item
|
576
|
+
item.keywords = keyword.map(&:content).join(", ") if keyword.any?
|
577
|
+
bibtex_docidentifier item
|
578
|
+
item.timestamp = fetched.to_s if fetched
|
579
|
+
bibtex_link item
|
580
|
+
bibtex ||= BibTeX::Bibliography.new
|
581
|
+
bibtex << item
|
582
|
+
bibtex
|
565
583
|
end
|
566
584
|
|
567
585
|
# @return [String]
|
@@ -62,6 +62,18 @@ module RelatonBib
|
|
62
62
|
tl.each { |t| opts[:builder].title { t.to_xml opts[:builder] } }
|
63
63
|
end
|
64
64
|
|
65
|
+
#
|
66
|
+
# Add main title ot bibtex entry
|
67
|
+
#
|
68
|
+
# @param [BibTeX::Entry] item bibtex entry
|
69
|
+
#
|
70
|
+
def to_bibtex(item)
|
71
|
+
tl = titles.detect { |t| t.type == "main" }
|
72
|
+
return unless tl
|
73
|
+
|
74
|
+
item.title = tl.title.content
|
75
|
+
end
|
76
|
+
|
65
77
|
private
|
66
78
|
|
67
79
|
# @param lang [String]
|
data/lib/relaton_bib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|