metanorma-release 0.2.17 → 0.2.18
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec89b09e8c3ae49b1d216cb7a07322b94f5d4da7cce71ccd72e7257074c35419
|
|
4
|
+
data.tar.gz: 9fb37a76873418ca0e7cda9c4db6fe5362fbc892ba4589b01040979e1e83de49
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 30d808eb7dfdd285a1a19e272ccf9853930a6315cd2211cc1779f9a86d114fc7084a77ba5127aaf5b55bc386e8b67e99993c33c730a3f4cd6edd9308e959c7ae
|
|
7
|
+
data.tar.gz: f020032152aa32a964b57080b8ff73a2b72bc9690d152cef3562b22df3d6dd832f4a8c9ceb617b515f0e43ac094660059794d71c5ed39c81a215aadfc258f989
|
|
@@ -29,7 +29,7 @@ module Metanorma
|
|
|
29
29
|
|
|
30
30
|
index = build_index(result)
|
|
31
31
|
site = Site.new(index: index, output_dir: @config.output_dir,
|
|
32
|
-
data_dir: @config.data_dir)
|
|
32
|
+
data_dir: @config.data_dir, org_config: @org_config)
|
|
33
33
|
site.write!
|
|
34
34
|
site.enrich!
|
|
35
35
|
site.package! if @config.create_zip
|
|
@@ -66,6 +66,20 @@ module Metanorma
|
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
+
def display_categories
|
|
70
|
+
@data.fetch("display_categories", [])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def display_category_for(doctype)
|
|
74
|
+
return nil if doctype.nil? || doctype.empty?
|
|
75
|
+
|
|
76
|
+
display_categories.each do |cat|
|
|
77
|
+
doctypes = cat["doctypes"] || []
|
|
78
|
+
return { "name" => cat["name"], "slug" => cat["slug"] } if doctypes.include?(doctype)
|
|
79
|
+
end
|
|
80
|
+
nil
|
|
81
|
+
end
|
|
82
|
+
|
|
69
83
|
private
|
|
70
84
|
|
|
71
85
|
def dig_defaults_routing(key)
|
|
@@ -9,10 +9,11 @@ module Metanorma
|
|
|
9
9
|
class Site
|
|
10
10
|
attr_reader :index, :output_dir
|
|
11
11
|
|
|
12
|
-
def initialize(index:, output_dir:, data_dir: nil)
|
|
12
|
+
def initialize(index:, output_dir:, data_dir: nil, org_config: nil)
|
|
13
13
|
@index = index
|
|
14
14
|
@output_dir = output_dir
|
|
15
15
|
@data_dir = data_dir
|
|
16
|
+
@org_config = org_config
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
def write!
|
|
@@ -84,28 +85,38 @@ module Metanorma
|
|
|
84
85
|
|
|
85
86
|
def flatten_for_site(doc)
|
|
86
87
|
bib = doc["bibliographic"] || {}
|
|
87
|
-
doc_id = resolve_doc_id(bib, doc)
|
|
88
|
-
stage = (doc["stage"] || "published").to_s.downcase
|
|
89
88
|
doctype = extract_doctype(bib) || doc.fetch("doctype", "")
|
|
90
89
|
formats = doc["formats"] || []
|
|
91
|
-
{
|
|
90
|
+
base = {
|
|
92
91
|
"slug" => doc["id"],
|
|
93
|
-
"id" =>
|
|
92
|
+
"id" => resolve_doc_id(bib, doc),
|
|
94
93
|
"title" => doc["title"].to_s,
|
|
95
94
|
"abstract" => extract_abstract(bib),
|
|
96
|
-
"stage" => stage,
|
|
95
|
+
"stage" => (doc["stage"] || "published").to_s.downcase,
|
|
97
96
|
"doctype" => doctype,
|
|
98
97
|
"edition" => doc["edition"],
|
|
99
98
|
"date" => extract_date(doc),
|
|
100
99
|
"channels" => doc["channels"] || [],
|
|
101
100
|
"formats" => formats,
|
|
102
101
|
"files" => doc["files"] || [],
|
|
103
|
-
"has_html" => formats.include?("html"),
|
|
104
|
-
"has_pdf" => formats.include?("pdf"),
|
|
105
|
-
"has_xml" => formats.include?("xml"),
|
|
106
|
-
"stage_css" => stage.gsub(/\s+/, "-"),
|
|
107
|
-
"doctype_class" => "type-#{doctype.downcase}",
|
|
108
102
|
}
|
|
103
|
+
add_format_flags(base, formats)
|
|
104
|
+
add_display_category(base, doctype)
|
|
105
|
+
base
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def add_format_flags(hash, formats)
|
|
109
|
+
hash["has_html"] = formats.include?("html")
|
|
110
|
+
hash["has_pdf"] = formats.include?("pdf")
|
|
111
|
+
hash["has_xml"] = formats.include?("xml")
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def add_display_category(hash, doctype)
|
|
115
|
+
cat = resolve_display_category(doctype)
|
|
116
|
+
hash["stage_css"] = hash["stage"].gsub(/\s+/, "-")
|
|
117
|
+
hash["doctype_class"] = "type-#{doctype.downcase}"
|
|
118
|
+
hash["display_category"] = cat&.fetch("name", nil)
|
|
119
|
+
hash["display_category_slug"] = cat&.fetch("slug", nil)
|
|
109
120
|
end
|
|
110
121
|
|
|
111
122
|
def resolve_doc_id(bib, doc)
|
|
@@ -152,6 +163,12 @@ module Metanorma
|
|
|
152
163
|
at = entry["at"]
|
|
153
164
|
at ? at.to_s.split(/[T ]/).first : nil
|
|
154
165
|
end
|
|
166
|
+
|
|
167
|
+
def resolve_display_category(doctype)
|
|
168
|
+
return nil unless @org_config
|
|
169
|
+
|
|
170
|
+
@org_config.display_category_for(doctype)
|
|
171
|
+
end
|
|
155
172
|
end
|
|
156
173
|
end
|
|
157
174
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: metanorma-release
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.18
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: relaton-bib
|