metanorma-release 0.2.8 → 0.2.10

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: 33318ed83e806c7f0f7e4d16c3095762cf64f3558214a6775549c2dd5bd74302
4
- data.tar.gz: 3d72e6618afb935951e22b19284299dad2adc3c7940cd87735fb47bb3f13b650
3
+ metadata.gz: b076e06eeb68abca60395688f6931f6d0ba71f787f1d9ca703eae6a09e0eb3de
4
+ data.tar.gz: 005d48aa61abf265a30c845f3201a403865e38fb74365a090714f7bb834b20a8
5
5
  SHA512:
6
- metadata.gz: eff37e2e0d375443613b578fabf7f47a51b007557ff602995105c020fe8a67034b755514d5f75d9e915189b8a189b1b32b3439ea632e478413556bd2bebc4575
7
- data.tar.gz: fa1201421381243f2e7b1ef363c621afe636b4d684493a29b53a333f44417093f32bae0cc1ee0c99a4a9f6722177b28e6e457811909680ca631dd871d4ac0143
6
+ metadata.gz: 81f45c4bb5451194e748abcb8e15662266840d428d3fa6625012b8e31ae56c2fd59b385395c8643f71e79b86741ebb3dc42f07f84c63fab647f479ba34479fef
7
+ data.tar.gz: fa69130d435783ffa9bb45b40c6b473763dcee49b06db3a20e1d8a4208a23c35b20473890675780632e6e79bf980fe9a39b0b4c156f0ff67e24e55a9caefa658
@@ -79,7 +79,7 @@ module Metanorma
79
79
  desc: "Filter stages"
80
80
  option :output_dir, type: :string, default: "_site/cc",
81
81
  desc: "Output directory"
82
- option :file_routing, type: :string, default: "by-document",
82
+ option :file_routing, type: :string,
83
83
  desc: "File routing (by-document|flat|by-format)"
84
84
  option :cache_dir, type: :string, desc: "Cache directory"
85
85
  option :data_dir, type: :string, desc: "Write flattened documents.json for site generators"
@@ -77,7 +77,7 @@ module Metanorma
77
77
  channels: cli_options[:channels].any? ? cli_options[:channels] : Array(file_data["channels"]),
78
78
  stages: cli_options[:stages].any? ? cli_options[:stages] : Array(file_data["stages"]),
79
79
  output_dir: cli_options[:output_dir] || file_data["output_dir"],
80
- file_routing: cli_options[:file_routing] || file_data["file_routing"],
80
+ file_routing: cli_options[:file_routing] || file_data["file_routing"] || "by-document",
81
81
  cache_dir: cli_options[:cache_dir] || file_data["cache_dir"],
82
82
  data_dir: cli_options[:data_dir] || file_data["data_dir"],
83
83
  include_drafts: cli_options[:include_drafts] || file_data["include_drafts"],
@@ -85,18 +85,26 @@ module Metanorma
85
85
  def flatten_for_site(doc)
86
86
  bib = doc["bibliographic"] || {}
87
87
  doc_id = resolve_doc_id(bib, doc)
88
+ stage = (doc["stage"] || "published").to_s.downcase
89
+ doctype = extract_doctype(bib) || doc.fetch("doctype", "")
90
+ formats = doc["formats"] || []
88
91
  {
89
92
  "slug" => doc["id"],
90
93
  "id" => doc_id,
91
94
  "title" => doc["title"].to_s,
92
95
  "abstract" => extract_abstract(bib),
93
- "stage" => (doc["stage"] || "published").to_s.downcase,
94
- "doctype" => extract_doctype(bib) || doc.fetch("doctype", ""),
96
+ "stage" => stage,
97
+ "doctype" => doctype,
95
98
  "edition" => doc["edition"],
96
99
  "date" => extract_date(doc),
97
100
  "channels" => doc["channels"] || [],
98
- "formats" => doc["formats"] || [],
101
+ "formats" => formats,
99
102
  "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}",
100
108
  }
101
109
  end
102
110
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Metanorma
4
4
  module Release
5
- VERSION = "0.2.8"
5
+ VERSION = "0.2.10"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-release
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.