relaton-cli 3.0.7 → 3.1.0
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/lib/relaton-cli.rb +4 -16
- metadata +11 -123
- data/.gitignore +0 -22
- data/.hound.yml +0 -3
- data/.rspec +0 -1
- data/CLAUDE.md +0 -524
- data/Gemfile +0 -42
- data/Rakefile +0 -21
- data/bin/console +0 -11
- data/bin/rspec +0 -29
- data/bin/setup +0 -8
- data/docs/README.adoc +0 -589
- data/exe/relaton +0 -20
- data/frontend/dist/404.html +0 -18
- data/frontend/dist/app.iife.js +0 -1
- data/frontend/dist/style.css +0 -3
- data/i18n.yaml +0 -1
- data/lib/relaton/bibcollection.rb +0 -146
- data/lib/relaton/bibdata.rb +0 -92
- data/lib/relaton/cli/base_convertor.rb +0 -134
- data/lib/relaton/cli/command.rb +0 -390
- data/lib/relaton/cli/data_fetcher.rb +0 -20
- data/lib/relaton/cli/frontend_assets.rb +0 -58
- data/lib/relaton/cli/full_text_search.rb +0 -98
- data/lib/relaton/cli/index_item_normalizer.rb +0 -380
- data/lib/relaton/cli/index_site_generator.rb +0 -1008
- data/lib/relaton/cli/relaton_file.rb +0 -290
- data/lib/relaton/cli/subcommand_collection.rb +0 -263
- data/lib/relaton/cli/subcommand_db.rb +0 -81
- data/lib/relaton/cli/util.rb +0 -8
- data/lib/relaton/cli/version.rb +0 -11
- data/lib/relaton/cli/xml_convertor.rb +0 -47
- data/lib/relaton/cli/xml_to_html_renderer.rb +0 -117
- data/lib/relaton/cli/yaml_convertor.rb +0 -102
- data/lib/relaton/cli.rb +0 -113
- data/lib/relaton/element_finder.rb +0 -29
- data/relaton-cli.gemspec +0 -49
- data/templates/_document.liquid +0 -111
- data/templates/_index.liquid +0 -61
- data/templates/index/page.liquid +0 -20
- data/templates/index-style.css +0 -1017
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
require "nokogiri"
|
|
2
|
-
require "relaton/cli/base_convertor"
|
|
3
|
-
|
|
4
|
-
module Relaton
|
|
5
|
-
module Cli
|
|
6
|
-
class XMLConvertor < Relaton::Cli::BaseConvertor
|
|
7
|
-
def to_yaml
|
|
8
|
-
convert_and_write(file_content, :to_yaml)
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
# Convert to YAML
|
|
12
|
-
#
|
|
13
|
-
# This interface allow us to convert any XML file to YAML.
|
|
14
|
-
# It only require us to provide a valid XML file and it can
|
|
15
|
-
# do converstion using default attributes, but it also allow
|
|
16
|
-
# us to provide custom options to customize this converstion
|
|
17
|
-
# process.
|
|
18
|
-
#
|
|
19
|
-
# @param file [File] The complete path to a XML file
|
|
20
|
-
# @param options [Hash] Options as hash key, value pairs.
|
|
21
|
-
#
|
|
22
|
-
def self.to_yaml(file, options = {})
|
|
23
|
-
new(file, options).to_yaml
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
private
|
|
27
|
-
|
|
28
|
-
def default_ext
|
|
29
|
-
"yaml"
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# @param content [Nokogiri::XML::Document]
|
|
33
|
-
# @return [Hash]
|
|
34
|
-
def convert_content(content)
|
|
35
|
-
if %w[bibitem bibdata].include? content.root.name
|
|
36
|
-
Bibdata.from_xml(content)
|
|
37
|
-
else
|
|
38
|
-
Bibcollection.from_xml(content)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def file_content
|
|
43
|
-
Nokogiri::XML(File.read(file, encoding: "utf-8"))
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
end
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
require "nokogiri"
|
|
2
|
-
require "liquid"
|
|
3
|
-
|
|
4
|
-
module Relaton::Cli
|
|
5
|
-
class XmlToHtmlRenderer
|
|
6
|
-
def initialize(liquid_dir: nil, stylesheet: nil)
|
|
7
|
-
@liquid_dir = liquid_dir
|
|
8
|
-
@stylesheet = read_file(stylesheet)
|
|
9
|
-
init_liquid_template_and_filesystem
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
# @param index_xml [String] Relaton XML
|
|
13
|
-
# @return [String] HTML
|
|
14
|
-
def render(index_xml)
|
|
15
|
-
Liquid::Template
|
|
16
|
-
.parse(template)
|
|
17
|
-
.render(build_liquid_document(index_xml))
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def uri_for_extension(uri, extension)
|
|
21
|
-
uri&.sub(/\.[^.]+$/, ".#{extension}")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Render HTML
|
|
25
|
-
#
|
|
26
|
-
# This interface allow us to convert a Relaton XML to HTML
|
|
27
|
-
# using the specified liquid template and stylesheets. It
|
|
28
|
-
# also do some minor clean during this conversion.
|
|
29
|
-
#
|
|
30
|
-
# @param file [String] Relaton XML
|
|
31
|
-
# @param options [Hash]
|
|
32
|
-
# @return [String] HTML
|
|
33
|
-
def self.render(file, options)
|
|
34
|
-
new(**options).render(file)
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
private
|
|
38
|
-
|
|
39
|
-
attr_reader :stylesheet, :liquid_dir, :template
|
|
40
|
-
|
|
41
|
-
def read_file(file)
|
|
42
|
-
File.read(file, encoding: "utf-8")
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# rubocop:disable Metrics/MethodLength
|
|
46
|
-
# @param source [String] Relaton XML
|
|
47
|
-
def build_liquid_document(source)
|
|
48
|
-
bibcollection = build_bibcollection(source)
|
|
49
|
-
hash_to_liquid(
|
|
50
|
-
depth: 2,
|
|
51
|
-
css: stylesheet,
|
|
52
|
-
title: bibcollection.title,
|
|
53
|
-
date: DateTime.now.to_s,
|
|
54
|
-
author: bibcollection.author,
|
|
55
|
-
documents: document_items(bibcollection)
|
|
56
|
-
)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def init_liquid_template_and_filesystem
|
|
60
|
-
file_system = Liquid::LocalFileSystem.new(liquid_dir)
|
|
61
|
-
@template = read_file(file_system.full_path("index"))
|
|
62
|
-
|
|
63
|
-
Liquid::Template.file_system = file_system
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
67
|
-
|
|
68
|
-
# TODO: This should be recursive, but it's not
|
|
69
|
-
# @param hash [Hash]
|
|
70
|
-
# @option hash [Integer] :dept
|
|
71
|
-
# @option hash [String] :css path to stylesheet file
|
|
72
|
-
# @option hash [String] :title
|
|
73
|
-
# @option hash [String] :author
|
|
74
|
-
# @option hash [Array<Hash>] :documents
|
|
75
|
-
#
|
|
76
|
-
# @return [Hash]
|
|
77
|
-
def hash_to_liquid(hash)
|
|
78
|
-
hash.map do |key, value|
|
|
79
|
-
case key
|
|
80
|
-
when "title"
|
|
81
|
-
if value.is_a?(Array)
|
|
82
|
-
title = value.detect { |t| t["type"] == "main" } || value.first
|
|
83
|
-
v = title ? title["content"] : nil
|
|
84
|
-
elsif value.is_a?(Hash) then v = value["content"]
|
|
85
|
-
else v = value
|
|
86
|
-
end
|
|
87
|
-
when "docidentifier"
|
|
88
|
-
did = if value.is_a?(Array)
|
|
89
|
-
value.detect { |d| (d["id"] || d["content"]).to_s !~ /^(http|https):\/\// } ||
|
|
90
|
-
value.first
|
|
91
|
-
else value
|
|
92
|
-
end
|
|
93
|
-
v = did
|
|
94
|
-
else v = value
|
|
95
|
-
end
|
|
96
|
-
[key.to_s, empty2nil(v)]
|
|
97
|
-
end.to_h
|
|
98
|
-
end
|
|
99
|
-
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
|
100
|
-
|
|
101
|
-
def empty2nil(value)
|
|
102
|
-
value unless value.is_a?(String) && value.empty? && !value.nil?
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# @param source [String] Relaton XML
|
|
106
|
-
# @return [Relaton::Bibcollection]
|
|
107
|
-
def build_bibcollection(source)
|
|
108
|
-
Relaton::Bibcollection.from_xml(Nokogiri::XML(source))
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
# @param bibcollection [Relaton::Bibcollection]
|
|
112
|
-
# @return [Array<Hash>]
|
|
113
|
-
def document_items(bibcollection)
|
|
114
|
-
bibcollection.to_h["root"]["items"].map { |item| hash_to_liquid(item) }
|
|
115
|
-
end
|
|
116
|
-
end
|
|
117
|
-
end
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
require "yaml"
|
|
2
|
-
require "relaton/cli/base_convertor"
|
|
3
|
-
require "relaton/bib"
|
|
4
|
-
|
|
5
|
-
module Relaton
|
|
6
|
-
module Cli
|
|
7
|
-
class YAMLConvertor < Relaton::Cli::BaseConvertor
|
|
8
|
-
def to_xml
|
|
9
|
-
if writable
|
|
10
|
-
convert_and_write(file_content, :to_xml)
|
|
11
|
-
else
|
|
12
|
-
convert_content(file_content).to_xml date_format: :full, bibdata: true
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
class << self
|
|
17
|
-
# Convert to XML
|
|
18
|
-
#
|
|
19
|
-
# This interface allow us to convert any YAML file to XML.
|
|
20
|
-
# It only require us to provide a valid YAML file and it can
|
|
21
|
-
# do converstion using default attributes, but it also allow
|
|
22
|
-
# us to provide custom options to customize this converstion
|
|
23
|
-
# process.
|
|
24
|
-
#
|
|
25
|
-
# @param file [File] The complete path to a YAML file
|
|
26
|
-
# @param options [Hash] Options as hash key, value pairs.
|
|
27
|
-
#
|
|
28
|
-
def to_xml(file, options = {})
|
|
29
|
-
new(file, options).to_xml
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
# @param content [Hash] document in YAML format
|
|
33
|
-
# @return [RelatonBib::BibliographicItem,
|
|
34
|
-
# RelatonIso::IsoBiblioraphicItem]
|
|
35
|
-
def convert_single_file(content)
|
|
36
|
-
flavor = content.dig("ext", "flavor") || doctype(content["docidentifier"])
|
|
37
|
-
if (processor = Relaton::Db::Registry.instance.by_type(flavor))
|
|
38
|
-
begin
|
|
39
|
-
processor.from_yaml content.to_yaml
|
|
40
|
-
rescue RuntimeError
|
|
41
|
-
Relaton::Bib::Item.from_yaml(content.to_yaml)
|
|
42
|
-
end
|
|
43
|
-
else
|
|
44
|
-
Relaton::Bib::Item.from_yaml(content.to_yaml)
|
|
45
|
-
end
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
private
|
|
49
|
-
|
|
50
|
-
# @param content [Hash]
|
|
51
|
-
# @return [String]
|
|
52
|
-
def doctype(docid)
|
|
53
|
-
did = docid.is_a?(Array) ? docid.fetch(0) : docid
|
|
54
|
-
return unless did
|
|
55
|
-
|
|
56
|
-
did["type"] || did.fetch("content")&.match(/^\w+/)&.to_s
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
private
|
|
61
|
-
|
|
62
|
-
def default_ext
|
|
63
|
-
"rxl"
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def file_content
|
|
67
|
-
date_to_string(YAML.load_file(file))
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def date_to_string(obj)
|
|
71
|
-
if obj.is_a? Hash
|
|
72
|
-
obj.reduce({}) do |memo, (k, v)|
|
|
73
|
-
memo[k] = date_to_string(v)
|
|
74
|
-
memo
|
|
75
|
-
end
|
|
76
|
-
elsif obj.is_a? Array
|
|
77
|
-
obj.reduce([]) { |memo, v| memo << date_to_string(v) }
|
|
78
|
-
else
|
|
79
|
-
obj.is_a?(Date) ? obj.to_s : obj
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def convert_collection(content)
|
|
84
|
-
if content.has_key?("root")
|
|
85
|
-
content["root"]["items"] = content["root"]["items"].map do |i|
|
|
86
|
-
# RelatonBib::HashConverter::hash_to_bib(i)
|
|
87
|
-
self.class.convert_single_file(i)
|
|
88
|
-
end
|
|
89
|
-
Relaton::Bibcollection.new(content["root"])
|
|
90
|
-
end
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def xml_content(_raw_file)
|
|
94
|
-
convert_content(file_content).to_xml(date_format: :full, bibdata: true)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def convert_content(content)
|
|
98
|
-
convert_collection(content) || self.class.convert_single_file(content)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
end
|
data/lib/relaton/cli.rb
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
require "fileutils"
|
|
2
|
-
require "thor"
|
|
3
|
-
require "thor/hollaback"
|
|
4
|
-
require_relative "cli/version"
|
|
5
|
-
require_relative "cli/util"
|
|
6
|
-
require_relative "cli/command"
|
|
7
|
-
|
|
8
|
-
module Relaton
|
|
9
|
-
def self.db(dir = nil)
|
|
10
|
-
Cli.relaton dir
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
module Cli
|
|
14
|
-
class RelatonDb
|
|
15
|
-
include Singleton
|
|
16
|
-
|
|
17
|
-
DBCONF = "#{Dir.home}/.relaton/dbpath".freeze
|
|
18
|
-
|
|
19
|
-
# @param dir [String, nil]
|
|
20
|
-
# @return [Relaton::Db]
|
|
21
|
-
def db(dir)
|
|
22
|
-
if dir
|
|
23
|
-
FileUtils.mkdir_p File.dirname(DBCONF)
|
|
24
|
-
File.write DBCONF, dir, encoding: "UTF-8"
|
|
25
|
-
@db = Relaton::Db.new dir, nil
|
|
26
|
-
else
|
|
27
|
-
@db ||= Relaton::Db.new dbpath, nil
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
# @return [String] path to DB
|
|
34
|
-
def dbpath
|
|
35
|
-
if File.exist?(DBCONF)
|
|
36
|
-
File.read(DBCONF, encoding: "UTF-8")
|
|
37
|
-
else "#{Dir.home}/.relaton/cache"
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
class << self
|
|
43
|
-
def version
|
|
44
|
-
require "relaton/bib"
|
|
45
|
-
registry = Relaton::Db::Registry.instance
|
|
46
|
-
# Every flavor now ships inside the single `relaton` gem, so they all
|
|
47
|
-
# report Relaton::VERSION rather than a separate gem version.
|
|
48
|
-
puts "CLI => #{Relaton::Cli::VERSION}"
|
|
49
|
-
puts "relaton => #{Relaton::VERSION}"
|
|
50
|
-
puts "relaton-bib => #{Relaton::VERSION}"
|
|
51
|
-
registry.processors.each_key do |k|
|
|
52
|
-
name = k.to_s.sub("_", "-")
|
|
53
|
-
puts "#{name} => #{Relaton::VERSION}"
|
|
54
|
-
end
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def start(arguments)
|
|
58
|
-
Relaton::Cli::Command.start(arguments)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Relaton
|
|
62
|
-
#
|
|
63
|
-
# Based on current setup, we need to initiate a Db instance to
|
|
64
|
-
# register all of it's supported processor backends. To make it
|
|
65
|
-
# easier we have added it as a class method so we can use this
|
|
66
|
-
# whenever necessary.
|
|
67
|
-
#
|
|
68
|
-
# @param dir [String, nil]
|
|
69
|
-
# @return [Relaton::Db]
|
|
70
|
-
def relaton(dir)
|
|
71
|
-
RelatonDb.instance.db dir
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
# @param content [Nokogiri::XML::Document]
|
|
75
|
-
# @return [RelatonBib::BibliographicItem,
|
|
76
|
-
# RelatonIsoBib::IsoBibliongraphicItem]
|
|
77
|
-
def parse_xml(doc)
|
|
78
|
-
doc.remove_namespaces! if doc.respond_to?(:remove_namespaces!)
|
|
79
|
-
if (proc = Cli.processor(doc))
|
|
80
|
-
proc.from_xml(doc.to_s)
|
|
81
|
-
else
|
|
82
|
-
Relaton::Bib::Item.from_xml(doc.to_s) rescue nil
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# @param doc [Nokogiri::XML::Element]
|
|
87
|
-
# @return [RelatonIso::Processor, RelatonIec::Processor,
|
|
88
|
-
# RelatonNist::Processor, RelatonIetf::Processot,
|
|
89
|
-
# RelatonItu::Processor, RelatonGb::Processor,
|
|
90
|
-
# RelatonOgc::Processor, RelatonCalconnect::Processor]
|
|
91
|
-
def processor(doc)
|
|
92
|
-
docid = doc.at "docidentifier"
|
|
93
|
-
proc = get_proc docid
|
|
94
|
-
return proc if proc
|
|
95
|
-
|
|
96
|
-
Relaton::Db::Registry.instance.by_type(docid&.text&.match(/^\w+/)&.to_s)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
private
|
|
100
|
-
|
|
101
|
-
# @param doc [Nokogiri::XML::Element]
|
|
102
|
-
# @return [RelatonIso::Processor, RelatonIec::Processor,
|
|
103
|
-
# RelatonNist::Processor, RelatonIetf::Processot,
|
|
104
|
-
# RelatonItu::Processor, RelatonGb::Processor,
|
|
105
|
-
# RelatonOgc::Processor, RelatonCalconnect::Processor]
|
|
106
|
-
def get_proc(docid)
|
|
107
|
-
return unless docid && docid[:type]
|
|
108
|
-
|
|
109
|
-
Relaton::Db::Registry.instance.by_type(docid[:type])
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
end
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
module Relaton
|
|
2
|
-
module ElementFinder
|
|
3
|
-
attr_reader :document
|
|
4
|
-
|
|
5
|
-
def find_text(xpath, element = nil)
|
|
6
|
-
find(xpath, element)&.text
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def find_html(xpath, element = nil)
|
|
10
|
-
find(xpath, element)&.inner_html
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def find(xpath, element = nil)
|
|
14
|
-
(element || document).at(apply_namespace(xpath))
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def find_xpath(xpath, element = nil)
|
|
18
|
-
element&.xpath(apply_namespace(xpath))
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def apply_namespace(xpath)
|
|
22
|
-
xpath
|
|
23
|
-
.gsub(%r{/([a-zA-Z])}, "/xmlns:\\1")
|
|
24
|
-
.gsub(%r{::([a-zA-Z])}, "::xmlns:\\1")
|
|
25
|
-
.gsub(%r{\[([a-zA-Z][a-z0-9A-Z@/]* ?=)}, "[xmlns:\\1")
|
|
26
|
-
.gsub(%r{\[([a-zA-Z][a-z0-9A-Z@/]*\])}, "[xmlns:\\1")
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
data/relaton-cli.gemspec
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# relaton-cli is released in lockstep with the combined `relaton` gem from this
|
|
2
|
-
# repo. Derive the version (and the relaton dependency pin) from the single
|
|
3
|
-
# source of truth — root lib/relaton/version.rb — so `gem bump` on that one file
|
|
4
|
-
# re-stamps both gems. No separate version to hand-sync.
|
|
5
|
-
root_version_file = File.expand_path("../../lib/relaton/version.rb", __dir__)
|
|
6
|
-
relaton_version = File.read(root_version_file)[/VERSION\s*=\s*["']([^"']+)["']/, 1] or
|
|
7
|
-
raise "could not parse Relaton::VERSION from #{root_version_file}"
|
|
8
|
-
|
|
9
|
-
Gem::Specification.new do |spec|
|
|
10
|
-
spec.name = "relaton-cli"
|
|
11
|
-
spec.version = relaton_version
|
|
12
|
-
spec.authors = ["Ribose Inc."]
|
|
13
|
-
spec.email = ["open.source@ribose.com"]
|
|
14
|
-
|
|
15
|
-
spec.summary = "Relaton Command-line Interface"
|
|
16
|
-
spec.description = "Relaton Command-line Interface"
|
|
17
|
-
spec.homepage = "https://github.com/relaton/relaton"
|
|
18
|
-
spec.license = "BSD-2-Clause"
|
|
19
|
-
|
|
20
|
-
# Ship lib/, exe/, templates/ and the COMPILED frontend, but not the frontend
|
|
21
|
-
# sources/tooling. `frontend/dist` is gitignored (built by `rake build_frontend`
|
|
22
|
-
# at package/release time), so `git ls-files` won't list it — append it
|
|
23
|
-
# explicitly. Reject the tracked `frontend/` sources so they don't bloat the gem.
|
|
24
|
-
spec.files = (`git ls-files -z`.split("\x0").reject do |f|
|
|
25
|
-
f.match(%r{^(test|spec|features|docs|frontend)/})
|
|
26
|
-
end + Dir.glob("frontend/dist/*")).uniq
|
|
27
|
-
spec.extra_rdoc_files = %w[docs/README.adoc LICENSE]
|
|
28
|
-
spec.bindir = "exe"
|
|
29
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
30
|
-
spec.require_paths = ["lib"]
|
|
31
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.3.0")
|
|
32
|
-
|
|
33
|
-
spec.add_dependency "liquid", "~> 5"
|
|
34
|
-
# The CLI requires "pubid" directly to rescue Pubid::Errors::Error when a
|
|
35
|
-
# reference is unparseable (see command.rb / subcommand_collection.rb). It is
|
|
36
|
-
# already a runtime dep of `relaton`, but declare it here too so the require
|
|
37
|
-
# is self-supporting rather than dependent on relaton's transitive graph.
|
|
38
|
-
# Match the relaton gemspec floor (pessimistic, per house style): 2.0.4
|
|
39
|
-
# carries the IHO series identity components the data re-key keys on.
|
|
40
|
-
spec.add_dependency "pubid", "~> 2.0.4"
|
|
41
|
-
# relaton bundles every flavor plus Relaton::Bib, so depending on `relaton`
|
|
42
|
-
# alone is sufficient — relaton-bib is no longer published standalone.
|
|
43
|
-
spec.add_dependency "relaton", "= #{relaton_version}"
|
|
44
|
-
# Plain-text citation rendering (relaton-cli#94); the constraint mirrors
|
|
45
|
-
# the parent relaton gemspec's.
|
|
46
|
-
spec.add_dependency "relaton-render", ">= 3.0.0.pre.alpha.1", "< 4"
|
|
47
|
-
spec.add_dependency "thor"
|
|
48
|
-
spec.add_dependency "thor-hollaback"
|
|
49
|
-
end
|
data/templates/_document.liquid
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{%- if document.items.size > 0 -%}
|
|
2
|
-
<div class="doc-section">
|
|
3
|
-
{%- else -%}
|
|
4
|
-
<div class="document">
|
|
5
|
-
{%- endif -%}
|
|
6
|
-
|
|
7
|
-
{%- if document.html != blank and document.html != nil -%}
|
|
8
|
-
{%- assign default_link = document.html -%}
|
|
9
|
-
{%- elsif document.pdf != blank and document.pdf != nil -%}
|
|
10
|
-
{%- assign default_link = document.pdf -%}
|
|
11
|
-
{%- elsif document.doc != blank and document.doc != nil -%}
|
|
12
|
-
{%- assign default_link = document.doc -%}
|
|
13
|
-
{%- elsif document.xml != blank and document.xml != nil -%}
|
|
14
|
-
{%- assign default_link = document.xml -%}
|
|
15
|
-
{%- else -%}
|
|
16
|
-
{%- assign default_link = nil -%}
|
|
17
|
-
{%- endif -%}
|
|
18
|
-
|
|
19
|
-
<div class="doc-line">
|
|
20
|
-
<div class="doc-identifier">
|
|
21
|
-
<h{{ depth }}>
|
|
22
|
-
{% if default_link %}
|
|
23
|
-
<a href="{{ default_link }}">{{ document.docidentifier.content }}</a>
|
|
24
|
-
{% else %}
|
|
25
|
-
{{ document.docidentifier.content }}
|
|
26
|
-
{% endif %}
|
|
27
|
-
</h{{ depth }}>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="doc-type-wrap">
|
|
31
|
-
<div class="doc-type {{ document.ext.doctype.content | downcase | split: " " | join: "-" }}">
|
|
32
|
-
{{ document.ext.doctype.content }}
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
{% if document.edition.content %}
|
|
37
|
-
<div class="doc-identifier">
|
|
38
|
-
Edition: {{ document.edition.content }}
|
|
39
|
-
</div>
|
|
40
|
-
{% endif %}
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div class="doc-title">
|
|
44
|
-
<h{{ depth | plus: 1 }}>
|
|
45
|
-
{% if default_link %}
|
|
46
|
-
<a href="{{ default_link }}">{{ document.title }}</a>
|
|
47
|
-
{% else %}
|
|
48
|
-
{{ document.title }}
|
|
49
|
-
{% endif %}
|
|
50
|
-
</h{{ depth | plus: 1 }}>
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
{% if document.status %}
|
|
54
|
-
<div class="doc-info {{ document.status.stage.content | downcase }}">
|
|
55
|
-
<div class="doc-stage {{ document.status.stage.content | downcase }}">
|
|
56
|
-
{% if document.status.substage %}
|
|
57
|
-
{{ document.status.stage.content }}.{{ document.status.substage.content }}
|
|
58
|
-
{% else %}
|
|
59
|
-
{{ document.status.stage.content }}
|
|
60
|
-
{% endif %}
|
|
61
|
-
</div>
|
|
62
|
-
<div class="doc-dates">
|
|
63
|
-
{% unless document.status.stage.content == "published" %}
|
|
64
|
-
<div class="doc-updated">
|
|
65
|
-
{% else %}
|
|
66
|
-
<div class="doc-published">
|
|
67
|
-
{% endunless %}
|
|
68
|
-
{{ document.revdate }}
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
{% endif %}
|
|
73
|
-
|
|
74
|
-
<div class="doc-bib">
|
|
75
|
-
<div class="doc-bib-relaton">
|
|
76
|
-
<a href="{{ document.rxl }}">Relaton XML</a>
|
|
77
|
-
</div>
|
|
78
|
-
</div>
|
|
79
|
-
|
|
80
|
-
<div class="doc-access">
|
|
81
|
-
{% unless document.uri == blank or document.uri == nil %}
|
|
82
|
-
<div class="doc-access-button-uri">
|
|
83
|
-
<a href="{{ document.uri }}">URI</a>
|
|
84
|
-
</div>
|
|
85
|
-
{% endunless %}
|
|
86
|
-
{% unless document.html == blank or document.html == nil %}
|
|
87
|
-
<div class="doc-access-button-html">
|
|
88
|
-
<a href="{{ document.html }}">HTML</a>
|
|
89
|
-
</div>
|
|
90
|
-
{% endunless %}
|
|
91
|
-
{% unless document.pdf == blank or document.pdf == nil %}
|
|
92
|
-
<div class="doc-access-button-pdf">
|
|
93
|
-
<a href="{{ document.pdf }}">PDF</a>
|
|
94
|
-
</div>
|
|
95
|
-
{% endunless %}
|
|
96
|
-
{% unless document.doc == blank or document.doc == nil %}
|
|
97
|
-
<div class="doc-access-button-doc">
|
|
98
|
-
<a href="{{ document.doc }}">Word</a>
|
|
99
|
-
</div>
|
|
100
|
-
{% endunless %}
|
|
101
|
-
{% unless document.xml == blank or document.xml == nil %}
|
|
102
|
-
<div class="doc-access-button-xml">
|
|
103
|
-
<a href="{{ document.xml }}">XML</a>
|
|
104
|
-
</div>
|
|
105
|
-
{% endunless %}
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
{%- if document.items.size > 0 -%}
|
|
110
|
-
{%- include 'document' for document.items -%}
|
|
111
|
-
{%- endif -%}
|
data/templates/_index.liquid
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE HTML>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>{{ title | strip_html }}</title>
|
|
5
|
-
<style>
|
|
6
|
-
<!--
|
|
7
|
-
{{ css }}
|
|
8
|
-
-->
|
|
9
|
-
</style>
|
|
10
|
-
<meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
|
|
11
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>
|
|
12
|
-
<script src="https://cdn.rawgit.com/jgallen23/toc/0.3.2/dist/toc.min.js" type="text/javascript"></script>
|
|
13
|
-
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i|Space+Mono:400,700|Overpass:300,300i,600,900|Ek+Mukta:200" rel="stylesheet" type="text/css"/>
|
|
14
|
-
<link href="https://use.fontawesome.com/releases/v5.0.8/css/solid.css" integrity="sha384-v2Tw72dyUXeU3y4aM2Y0tBJQkGfplr39mxZqlTBDUZAb9BGoC40+rdFCG0m10lXk" crossorigin="anonymous"/>
|
|
15
|
-
<link href="https://use.fontawesome.com/releases/v5.0.8/css/fontawesome.css" integrity="sha384-q3jl8XQu1OpdLgGFvNRnPdj5VIlCvgsDQTQB6owSOHWlAurxul7f+JpUOVdAiJ5P" crossorigin="anonymous"/>
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
<header>
|
|
19
|
-
<div id="topbar-inner">
|
|
20
|
-
<div id="title-bar">
|
|
21
|
-
<div class="doc-access">
|
|
22
|
-
Generated: {{ date }}
|
|
23
|
-
</div>
|
|
24
|
-
<span>{{ author }}</span>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="title-section">
|
|
28
|
-
<div class="coverpage">
|
|
29
|
-
<div class="wrapper-top">
|
|
30
|
-
<div class="coverpage-doc-identity">
|
|
31
|
-
<div class="coverpage-title"><span class="title-first">{{ title }}</span></div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
</header>
|
|
37
|
-
<main class="main-section">
|
|
38
|
-
{% include 'document' for documents %}
|
|
39
|
-
</main>
|
|
40
|
-
<footer>
|
|
41
|
-
<div class="copyright">
|
|
42
|
-
<div class="doc-access">
|
|
43
|
-
Generated: {{ date }}
|
|
44
|
-
</div>
|
|
45
|
-
<p class="year">© {{ author }}</p>
|
|
46
|
-
<p class="message">All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized otherwise in any form or by any means, electronic or mechanical, including photocopying, or posting on the internet or an intranet, without prior written permission.</p>
|
|
47
|
-
</div>
|
|
48
|
-
</footer>
|
|
49
|
-
<script>
|
|
50
|
-
$(document).ready(function() {
|
|
51
|
-
$('[id^=toc]').each(function () {
|
|
52
|
-
var currentToc = $(this);
|
|
53
|
-
var url = window.location.href;
|
|
54
|
-
currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' <\/a>");
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
anchors.options = { placement: 'left' };
|
|
58
|
-
anchors.add('h1, h2, h3, h4');
|
|
59
|
-
</script>
|
|
60
|
-
</body>
|
|
61
|
-
</html>
|
data/templates/index/page.liquid
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
-
<title>{{ title | strip_html }}</title>
|
|
7
|
-
{%- if description %}
|
|
8
|
-
<meta name="description" content="{{ description | escape }}">
|
|
9
|
-
{%- endif %}
|
|
10
|
-
<meta name="generator" content="relaton-cli index">
|
|
11
|
-
{%- if favicon %}
|
|
12
|
-
<link rel="icon" href="{{ favicon | escape }}"{% if favicon_type %} type="{{ favicon_type }}"{% endif %}>
|
|
13
|
-
{%- endif %}
|
|
14
|
-
<style>{{ css }}</style>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div id="relaton-index-app" data-title="{{ title | escape }}" data-generated="{{ generated }}"{% if description %} data-description="{{ description | escape }}"{% endif %} data-total="{{ total }}" data-shards="{{ shards }}" data-shard-size="{{ shard_size }}" data-detail-shards="{{ detail_shards }}" data-detail-shard-size="{{ detail_shard_size }}"></div>
|
|
18
|
-
<script>{{ iife }}</script>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|