relaton-cli 0.8.1 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 61c465951c40ba63b7c43873f5f67130c5969d5159346323690c8a59da8f6615
4
- data.tar.gz: 2102ecbb526226b4db972eb5929a9a35f8311be6835a0ac22315c858cb5795c7
3
+ metadata.gz: 9e92b840207550a2f9a1d8f9ec25ba318961ebddcfa6e8a2a19b48ff531d9454
4
+ data.tar.gz: c137f99cd4b3c48688a2b6c53be14fd0f6496028288f97b536d296a61f0b77ea
5
5
  SHA512:
6
- metadata.gz: 4946ad0413e23113edaeaa520d17d419cab1e4f9e4d1d6176284d544d7f366c48205a8ee0da0af0e8dbc3070edbc1d8c36916078c87f58e0de3f5aecc06d23ae
7
- data.tar.gz: 9d6580f6ab0fa3e1e914c299ebfa80cf63f619b3730512d0515808b316a30535e6e2495643ff7a2ab8cfb2087fd112a6e05d75961fcc7742af3f1ac2c921f72b
6
+ metadata.gz: 3fb5300b2701b4fcca6c7da00a16ca3f58fa07e22c987e1b8a0757037fbd93c0b28e294b71454f7cd722196b26056ab3c22df2da8d6c26cf4177287217f71bd7
7
+ data.tar.gz: 93735d8cf0d650eb410e65f46999f3eafcd0b3de91a2a88c44be7cfeb07a4c5d830e3e979fd42d8abd75f60b5a1371cedae21fa72885cd1767f7317e92dd6441
@@ -8,16 +8,16 @@
8
8
  <div class="doc-identifier">
9
9
  <h{{ depth }}>
10
10
  {% if document.html == "" %}
11
- {{ document.docidentifier }}
11
+ {{ document.docid.id }}
12
12
  {% else %}
13
- <a href="{{ document.html }}">{{ document.docidentifier }}</a>
13
+ <a href="{{ document.html }}">{{ document.docid.id }}</a>
14
14
  {% endif %}
15
15
  </h{{ depth }}>
16
16
  </div>
17
17
 
18
18
  <div class="doc-type-wrap">
19
- <div class="doc-type {{ document.doctype | downcase | split: " " | join: "-" }}">
20
- {{ document.doctype }}
19
+ <div class="doc-type {{ document.type | downcase | split: " " | join: "-" }}">
20
+ {{ document.type }}
21
21
  </div>
22
22
  </div>
23
23
  </div>
@@ -32,12 +32,12 @@
32
32
  </h{{ depth | plus: 1 }}>
33
33
  </div>
34
34
 
35
- <div class="doc-info {{ document.stage | downcase }}">
36
- <div class="doc-stage {{ document.stage | downcase }}">
37
- {{ document.stage }}
35
+ <div class="doc-info {{ document.docstatus.stage | downcase }}">
36
+ <div class="doc-stage {{ document.docstatus.stage | downcase }}">
37
+ {{ document.docstatus.stage }}
38
38
  </div>
39
39
  <div class="doc-dates">
40
- {% unless document.stage == "published" %}
40
+ {% unless document.docstatus.stage == "published" %}
41
41
  <div class="doc-updated">
42
42
  {% else %}
43
43
  <div class="doc-published">
@@ -53,9 +53,9 @@ module Relaton
53
53
  )
54
54
  end
55
55
 
56
- # def xml_content(file)
57
- # File.read(file, encoding: "utf-8")
58
- # end
56
+ def xml_content(file)
57
+ File.read(file, encoding: "utf-8")
58
+ end
59
59
 
60
60
  def install_dependencies(dependencies)
61
61
  dependencies.each { |dependency| require(dependency) }
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cli
3
- VERSION = "0.8.1".freeze
3
+ VERSION = "0.8.6".freeze
4
4
  end
5
5
  end
@@ -61,7 +61,24 @@ module Relaton::Cli
61
61
 
62
62
  # TODO: This should be recursive, but it's not
63
63
  def hash_to_liquid(hash)
64
- hash.map { |key, value| [key.to_s, empty2nil(value)] }.to_h
64
+ hash.map do |key, value|
65
+ case key
66
+ when "title"
67
+ if value.is_a?(Array)
68
+ title = value.detect { |t| t["type"] == "main" } || value.first
69
+ v = title ? title["content"] : nil
70
+ elsif value.is_a?(Hash) then v = value["content"]
71
+ else v = value
72
+ end
73
+ when "docid"
74
+ if value.is_a?(Array)
75
+ v = value.detect { |did| did["id"] !~ /^(http|https):\/\// } || value.first
76
+ else v = value
77
+ end
78
+ else v = value
79
+ end
80
+ [key.to_s, empty2nil(v)]
81
+ end.to_h
65
82
  end
66
83
 
67
84
  def empty2nil(value)
@@ -16,8 +16,8 @@
16
16
  </div>
17
17
 
18
18
  <div class="doc-type-wrap">
19
- <div class="doc-type {{ document.doctype | downcase | split: " " | join: "-" }}">
20
- {{ document.doctype }}
19
+ <div class="doc-type {{ document.type | downcase | split: " " | join: "-" }}">
20
+ {{ document.type }}
21
21
  </div>
22
22
  </div>
23
23
  </div>
@@ -32,12 +32,12 @@
32
32
  </h{{ depth | plus: 1 }}>
33
33
  </div>
34
34
 
35
- <div class="doc-info {{ document.stage | downcase }}">
36
- <div class="doc-stage {{ document.stage | downcase }}">
37
- {{ document.stage }}
35
+ <div class="doc-info {{ document.docstatus.stage | downcase }}">
36
+ <div class="doc-stage {{ document.docstatus.stage | downcase }}">
37
+ {{ document.docstatus.stage }}
38
38
  </div>
39
39
  <div class="doc-dates">
40
- {% unless document.stage == "published" %}
40
+ {% unless document.docstatus.stage == "published" %}
41
41
  <div class="doc-updated">
42
42
  {% else %}
43
43
  <div class="doc-published">
@@ -757,7 +757,7 @@ body.container {
757
757
  }
758
758
 
759
759
  .doc-line {
760
- padding-top: 1em;
760
+ padding-top: 2em;
761
761
  }
762
762
 
763
763
  .doc-line:after {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-27 00:00:00.000000000 Z
11
+ date: 2020-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake