Almirah 0.1.0 → 0.1.1

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: 4bc6867a502188fb11b4632e9ab695d6fda2af0d1bfef94d3976d069acfb409f
4
- data.tar.gz: 7d993b275d67bf0fa9cc6f40bfb3c43c2d16f6bb8cab5b76135866b5d81b59b9
3
+ metadata.gz: 4194e03230075235a57516fed73b44215dde4a7cb42474b641bdbd7ce8a6ad55
4
+ data.tar.gz: f1a4f05ca5b4cf643cd179019c67cb08ea69c8876a235dfa368e99ec782ab21f
5
5
  SHA512:
6
- metadata.gz: '087e3aa7b1792ef031d42945fa29d05e5d2231b3e6b83177bfd529e3e7de646a24ac091a0be6e175575c814f87154641aad2036aa9ea7bd8f9247e6e50bd5aca'
7
- data.tar.gz: 223acb70d369cdb753635b67b424815cee057ce0309d379a9547ec7769aa9ec78385a178a4862b859444cdd0a187e37c9eaf9771860a2756f1dfea68439133d5
6
+ metadata.gz: 56dc9e44de93dccbaf9424d6b654c00e08591b9cdcd62b5061d3356441b68f3c5b6a61778cc9d78bcf277fceb8c25d1b6f9bf34ca6f1a0a0f0284ce361d346a2
7
+ data.tar.gz: 59790d27191f78845e8b7ca8e19f0c26858234dbb419f248de5034a1aac3451ed9afbcc26905fa062c2efc13b0613f3a60e2b9e57b590c3f6cd01ff55df83809
@@ -105,6 +105,7 @@ class DocFabric
105
105
 
106
106
  item = ControlledParagraph.new( text, id )
107
107
  item.parent_doc = doc
108
+ item.parent_heading = doc.headings[-1]
108
109
  if up_link
109
110
  item.up_link = up_link
110
111
  doc.items_with_uplinks_number += 1 #for statistics
@@ -43,7 +43,16 @@ class ControlledParagraph < Paragraph
43
43
  if @down_links.length == 1
44
44
  s += "\t\t<td class=\"item_id\"><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html##{@down_links[0].id}\" class=\"external\">#{@down_links[0].id}</a></td>\n"
45
45
  else
46
- s += "\t\t<td class=\"item_id\"><a href=\"./../#{down_link_doc_name}/#{down_link_doc_name}.html\" class=\"external\">#{@down_links.length}</a></td>\n"
46
+ s += "\t\t<td class=\"item_id\">"
47
+ s += "<div id=\"DL_#{@id}\" style=\"display: block;\">"
48
+ s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{@down_links.length}</a>"
49
+ s += "</div>"
50
+ s += "<div id=\"DLS_#{@id}\" style=\"display: none;\">"
51
+ @down_links.each do |lnk|
52
+ s += "\t\t\t<a href=\"./../#{lnk.parent_doc.id}/#{lnk.parent_doc.id}.html##{lnk.id}\" class=\"external\">#{lnk.id}</a>\n<br>"
53
+ end
54
+ s += "</div>"
55
+ s += "</td>\n"
47
56
  end
48
57
  else
49
58
  s += "\t\t<td class=\"item_id\"></td>\n"
@@ -2,8 +2,10 @@ require_relative "text_line"
2
2
 
3
3
  class DocItem < TextLine
4
4
  attr_accessor :parent_doc
5
+ attr_accessor :parent_heading
5
6
 
6
7
  @parent_doc = nil
8
+ @parent_heading = nil
7
9
 
8
10
  @@htmlTableRenderInProgress = false
9
11
  end
@@ -4,11 +4,47 @@ class Heading < Paragraph
4
4
 
5
5
  attr_accessor :level
6
6
  attr_accessor :anchor_id
7
+ attr_accessor :section_number
8
+
9
+ @@global_section_number = ""
7
10
 
8
11
  def initialize(text, level)
9
12
  @text = text
10
13
  @level = level
11
14
  @anchor_id = getTextWithoutSpaces()
15
+
16
+ if @@global_section_number = ""
17
+ @@global_section_number = "1"
18
+ for n in 1..(level-1) do
19
+ @@global_section_number += ".1"
20
+ end
21
+ else
22
+ previous_level = @@global_section_number.split(".").length
23
+
24
+ if previous_level == level
25
+
26
+ a = @@global_section_number.split(".")
27
+ a[-1] = (a[-1].to_i() +1).to_s
28
+ @@global_section_number = a.join(".")
29
+
30
+ elsif previous_level < level
31
+
32
+ a = @@global_section_number.split(".")
33
+ a.push("1")
34
+ @@global_section_number = a.join(".")
35
+
36
+ else # previous_level > level
37
+
38
+ a = @@global_section_number.split(".")
39
+ a.pop
40
+ @@global_section_number = a.join(".")
41
+ end
42
+ end
43
+ @section_number = @@global_section_number
44
+ end
45
+
46
+ def get_section_info
47
+ s = @section_number + " " + @text
12
48
  end
13
49
 
14
50
  def to_html
@@ -40,6 +40,8 @@ class BaseDocument
40
40
  if nav_pane
41
41
  file.puts nav_pane.to_html
42
42
  end
43
+ elsif s.include?('{{DOCUMENT_TITLE}}')
44
+ file.puts s.gsub! '{{DOCUMENT_TITLE}}', @title
43
45
  else
44
46
  file.puts s
45
47
  end
@@ -36,7 +36,10 @@ class Traceability < BaseDocument
36
36
  html_rows.append('')
37
37
  s = "<h1>#{@title}</h1>\n"
38
38
  s += "<table class=\"controlled\">\n"
39
- s += "\t<thead> <th>#</th> <th style='font-weight: bold;'>#{@top_doc.title}</th> <th>#</th> <th style='font-weight: bold;'>#{@bottom_doc.title}</th> </thead>\n"
39
+ s += "\t<thead> <th>#</th> <th style='font-weight: bold;'>#{@top_doc.title}</th> "
40
+ s += "<th>#</th> <th style='font-weight: bold;'>#{@bottom_doc.title}</th> "
41
+ s += "<th style='font-weight: bold;'>Document Section</th>"
42
+ s += "</thead>\n"
40
43
  html_rows.append s
41
44
 
42
45
  sorted_items = @top_doc.controlled_items.sort_by { |w| w.id }
@@ -67,11 +70,13 @@ class Traceability < BaseDocument
67
70
 
68
71
  top_item.down_links.each do |bottom_item|
69
72
  bottom_f_text = bottom_item.format_string( bottom_item.text )
73
+ document_section = bottom_item.parent_heading.get_section_info
70
74
  s += "\t<tr>\n"
71
75
  s += "\t\t<td class=\"item_id\" #{id_color}><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
72
- s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_f_text}</td>\n"
76
+ s += "\t\t<td class=\"item_text\" style='width: 34%;'>#{top_f_text}</td>\n"
73
77
  s += "\t\t<td class=\"item_id\"><a href=\"./../#{bottom_item.parent_doc.id}/#{bottom_item.parent_doc.id}.html##{bottom_item.id}\" class=\"external\">#{bottom_item.id}</a></td>\n"
74
- s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{bottom_f_text}</td>\n"
78
+ s += "\t\t<td class=\"item_text\" style='width: 34%;'>#{bottom_f_text}</td>\n"
79
+ s += "\t\t<td class=\"item_text\" style='width: 16%;'>#{document_section}</td>\n"
75
80
  s += "\t</tr>\n"
76
81
  end
77
82
 
@@ -83,11 +88,14 @@ class Traceability < BaseDocument
83
88
  if bottom_item.parent_doc.id == @bottom_doc.id
84
89
 
85
90
  bottom_f_text = bottom_item.format_string( bottom_item.text )
91
+ document_section = bottom_item.parent_heading.get_section_info
92
+
86
93
  s += "\t<tr>\n"
87
94
  s += "\t\t<td class=\"item_id\" #{id_color}><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
88
- s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_f_text}</td>\n"
95
+ s += "\t\t<td class=\"item_text\" style='width: 34%;'>#{top_f_text}</td>\n"
89
96
  s += "\t\t<td class=\"item_id\"><a href=\"./../#{bottom_item.parent_doc.id}/#{bottom_item.parent_doc.id}.html##{bottom_item.id}\" class=\"external\">#{bottom_item.id}</a></td>\n"
90
- s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{bottom_f_text}</td>\n"
97
+ s += "\t\t<td class=\"item_text\" style='width: 34%;'>#{bottom_f_text}</td>\n"
98
+ s += "\t\t<td class=\"item_text\" style='width: 16%;'>#{document_section}</td>\n"
91
99
  s += "\t</tr>\n"
92
100
  end
93
101
  end
@@ -95,9 +103,10 @@ class Traceability < BaseDocument
95
103
  else
96
104
  s += "\t<tr>\n"
97
105
  s += "\t\t<td class=\"item_id\"><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
98
- s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_f_text}</td>\n"
106
+ s += "\t\t<td class=\"item_text\" style='width: 34%;'>#{top_f_text}</td>\n"
99
107
  s += "\t\t<td class=\"item_id\"></td>\n"
100
- s += "\t\t<td class=\"item_text\" style='width: 42%;'></td>\n"
108
+ s += "\t\t<td class=\"item_text\" style='width: 34%;'></td>\n"
109
+ s += "\t\t<td class=\"item_text\" style='width: 16%;'></td>\n"
101
110
  s += "\t</tr>\n"
102
111
  end
103
112
  return s
@@ -174,6 +174,15 @@
174
174
  font-size: 1.5em;
175
175
  font-family: "Trebuchet MS", Verdana, sans-serif;
176
176
  }
177
+ #top_nav a.split {
178
+ float: right;
179
+ color: white;
180
+ text-align: center;
181
+ padding: 4px 6px;
182
+ text-decoration: none;
183
+ font-size: 1.5em;
184
+ font-family: "Trebuchet MS", Verdana, sans-serif;
185
+ }
177
186
  #top_nav a:hover {
178
187
  background-color: black;
179
188
  color: white;
@@ -194,12 +203,31 @@ function closeNav() {
194
203
  document.getElementById("nav_pane").style.visibility = "hidden";
195
204
  console.log("Mouse Out");
196
205
  }
206
+
207
+ window.onload = (event) => {
208
+ for (var i = 0, n = document.images.length; i < n; i++)
209
+ {
210
+ elem = document.images[i];
211
+ if (elem.width > 640)
212
+ {
213
+ elem.style.width = "640px";
214
+ }
215
+ }
216
+ };
217
+
218
+ function downlink_OnClick(clicked){
219
+ clicked.style.display = 'none';
220
+ id_parts = clicked.id.split("_");
221
+ required_id = "DLS_" + id_parts[1];
222
+ document.getElementById(required_id).style.display = 'block';
223
+ }
197
224
  </script>
198
225
  </head>
199
226
  <body>
200
227
  <div id="top_nav">
201
228
  <a href="./../../index.html"><span><i class="fa fa-home" aria-hidden="true"></i></span>&nbsp;Home</a>
202
229
  <!--a href="javascript:void(0)"> About</a-->
230
+ <a class="split">{{DOCUMENT_TITLE}}</a>
203
231
  </div>
204
232
  <div id="main">
205
233
  <div id="nav_pane">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Almirah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksandr Ivanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-09 00:00:00.000000000 Z
11
+ date: 2024-03-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The software part of the Almirah framework
14
14
  email: oleksandr.ivanov.development@gmail.com