Almirah 0.0.4 → 0.0.5
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/almirah/doc_items/image.rb +27 -0
- data/lib/almirah/doc_items/markdown_list.rb +31 -0
- data/lib/almirah/html_render.rb +0 -3
- data/lib/almirah/specification.rb +61 -1
- data/lib/almirah.rb +14 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4e770388ae634e216ef325d7f82a5d32d44bb5405dbea4e32783e3f0d2eea91
|
4
|
+
data.tar.gz: 20871334c2ba2179e361abd1319634281bde45ba38032ec2fd3dabdea98f6e3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad3b925c13c5a6794a82eabb3cfc81894c3f5711e5250cb0cb1dbaee0e79ff56e0e571e1dbcedb969c8384b3db82a021c082017d0cba001cb4ea1a2c314d21cd
|
7
|
+
data.tar.gz: 38532ef2204233611d5330e5825c0ccc0234043eec49f54f81e768d2caecdbc20df78999a8dfed3b074b924fe7ae6c2bcc6d3658771863f7663ab75b8c5167d4
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative "doc_item"
|
2
|
+
|
3
|
+
class Image < DocItem
|
4
|
+
|
5
|
+
attr_accessor :text
|
6
|
+
attr_accessor :path
|
7
|
+
|
8
|
+
def initialize(text, path)
|
9
|
+
@text = text
|
10
|
+
@path = path
|
11
|
+
end
|
12
|
+
|
13
|
+
def getTextWithoutSpaces
|
14
|
+
return @text.split.join('-')
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_html
|
18
|
+
s = ''
|
19
|
+
if @@htmlTableRenderInProgress
|
20
|
+
s += "</table>\n\r"
|
21
|
+
@@htmlTableRenderInProgress = false
|
22
|
+
end
|
23
|
+
|
24
|
+
s += "<img src=\"#{@path}\" alt=\"#{@text}\">"
|
25
|
+
return s
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative "doc_item"
|
2
|
+
|
3
|
+
class MarkdownList < DocItem
|
4
|
+
|
5
|
+
attr_accessor :rows
|
6
|
+
|
7
|
+
def initialize(first_row)
|
8
|
+
@rows = Array.new
|
9
|
+
@rows.append(first_row)
|
10
|
+
end
|
11
|
+
|
12
|
+
def addRow(row)
|
13
|
+
@rows.append(row)
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_html
|
17
|
+
s = ''
|
18
|
+
if @@htmlTableRenderInProgress
|
19
|
+
s += "</table>/n/r"
|
20
|
+
@@htmlTableRenderInProgress = false
|
21
|
+
end
|
22
|
+
|
23
|
+
s += "<ul>\n\r"
|
24
|
+
@rows.each do |r|
|
25
|
+
s += "\t<li>#{r}</li>\n\r"
|
26
|
+
end
|
27
|
+
s += "</ul>\n\r"
|
28
|
+
|
29
|
+
return s
|
30
|
+
end
|
31
|
+
end
|
data/lib/almirah/html_render.rb
CHANGED
@@ -4,6 +4,8 @@ require_relative "doc_items/paragraph"
|
|
4
4
|
require_relative "doc_items/blockquote"
|
5
5
|
require_relative "doc_items/controlled_paragraph"
|
6
6
|
require_relative "doc_items/markdown_table"
|
7
|
+
require_relative "doc_items/image"
|
8
|
+
require_relative "doc_items/markdown_list"
|
7
9
|
|
8
10
|
class Specification
|
9
11
|
|
@@ -15,6 +17,7 @@ class Specification
|
|
15
17
|
attr_accessor :dictionary
|
16
18
|
attr_accessor :controlledParagraphs
|
17
19
|
attr_accessor :tempMdTable
|
20
|
+
attr_accessor :tempMdList
|
18
21
|
|
19
22
|
def initialize(fele_path)
|
20
23
|
|
@@ -24,6 +27,7 @@ class Specification
|
|
24
27
|
@controlledParagraphs = Array.new
|
25
28
|
@dictionary = Hash.new
|
26
29
|
@tempMdTable = nil
|
30
|
+
@tempMdList = nil
|
27
31
|
|
28
32
|
@key = File.basename(fele_path, File.extname(fele_path)).upcase
|
29
33
|
@up_link_key = ""
|
@@ -44,6 +48,10 @@ class Specification
|
|
44
48
|
if @tempMdTable
|
45
49
|
self.docItems.append(@tempMdTable)
|
46
50
|
@tempMdTable = nil
|
51
|
+
end
|
52
|
+
if @tempMdList
|
53
|
+
self.docItems.append(@tempMdList)
|
54
|
+
@tempMdList = nil
|
47
55
|
end
|
48
56
|
|
49
57
|
level = res[1].length
|
@@ -60,6 +68,10 @@ class Specification
|
|
60
68
|
if @tempMdTable
|
61
69
|
self.docItems.append(@tempMdTable)
|
62
70
|
@tempMdTable = nil
|
71
|
+
end
|
72
|
+
if @tempMdList
|
73
|
+
self.docItems.append(@tempMdList)
|
74
|
+
@tempMdList = nil
|
63
75
|
end
|
64
76
|
|
65
77
|
id = res[1]
|
@@ -83,8 +95,47 @@ class Specification
|
|
83
95
|
self.dictionary[ id.to_s ] = item #for fast search
|
84
96
|
self.controlledParagraphs.append(item) #for fast search
|
85
97
|
|
98
|
+
elsif res = /^[!]\[(.*)\]\((.*)\)/.match(s) # Image
|
99
|
+
|
100
|
+
if @tempMdTable
|
101
|
+
self.docItems.append(@tempMdTable)
|
102
|
+
@tempMdTable = nil
|
103
|
+
end
|
104
|
+
if @tempMdList
|
105
|
+
self.docItems.append(@tempMdList)
|
106
|
+
@tempMdList = nil
|
107
|
+
end
|
108
|
+
|
109
|
+
img_text = res[1]
|
110
|
+
img_path = res[2]
|
111
|
+
|
112
|
+
item = Image.new( img_text, img_path )
|
113
|
+
|
114
|
+
self.docItems.append(item)
|
115
|
+
|
116
|
+
elsif res = /^(\*\s?)+(.*)/.match(s) #check if bullet list
|
117
|
+
|
118
|
+
if @tempMdTable
|
119
|
+
self.docItems.append(@tempMdTable)
|
120
|
+
@tempMdTable = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
row = res[2]
|
124
|
+
|
125
|
+
if @tempMdList
|
126
|
+
@tempMdList.addRow(row)
|
127
|
+
else
|
128
|
+
item = MarkdownList.new(row)
|
129
|
+
@tempMdList = item
|
130
|
+
end
|
131
|
+
|
86
132
|
elsif s[0] == '|' #check if table
|
87
133
|
|
134
|
+
if @tempMdList
|
135
|
+
self.docItems.append(@tempMdList)
|
136
|
+
@tempMdList = nil
|
137
|
+
end
|
138
|
+
|
88
139
|
if res = /^[|](-{3,})[|]/.match(s) #check if it is a separator first
|
89
140
|
|
90
141
|
if @tempMdTable
|
@@ -112,6 +163,10 @@ class Specification
|
|
112
163
|
if @tempMdTable
|
113
164
|
self.docItems.append(@tempMdTable)
|
114
165
|
@tempMdTable = nil
|
166
|
+
end
|
167
|
+
if @tempMdList
|
168
|
+
self.docItems.append(@tempMdList)
|
169
|
+
@tempMdList = nil
|
115
170
|
end
|
116
171
|
|
117
172
|
item = Blockquote.new(res[1])
|
@@ -121,7 +176,12 @@ class Specification
|
|
121
176
|
if @tempMdTable
|
122
177
|
self.docItems.append(@tempMdTable)
|
123
178
|
@tempMdTable = nil
|
124
|
-
end
|
179
|
+
end
|
180
|
+
if @tempMdList
|
181
|
+
self.docItems.append(@tempMdList)
|
182
|
+
@tempMdList = nil
|
183
|
+
end
|
184
|
+
|
125
185
|
item = Paragraph.new(s)
|
126
186
|
self.docItems.append(item)
|
127
187
|
end
|
data/lib/almirah.rb
CHANGED
@@ -29,14 +29,26 @@ class Almirah
|
|
29
29
|
|
30
30
|
# Link
|
31
31
|
linker = Linker.new
|
32
|
-
|
32
|
+
combList = documentList.combination(2)
|
33
|
+
combList.each do |c|
|
34
|
+
linker.link(c[0], c[1])
|
35
|
+
end
|
33
36
|
|
34
37
|
# Render
|
35
38
|
FileUtils.remove_dir(pass + "/build", true)
|
36
39
|
FileUtils.mkdir_p(pass + "/build/specifications")
|
37
40
|
|
38
41
|
documentList.each do |spec|
|
39
|
-
|
42
|
+
|
43
|
+
img_src_dir = pass + "/specifications/" + spec.key.downcase + "/img"
|
44
|
+
img_dst_dir = pass + "/build/specifications/" + spec.key.downcase + "/img"
|
45
|
+
|
46
|
+
FileUtils.mkdir_p(img_dst_dir)
|
47
|
+
|
48
|
+
if File.directory?(img_src_dir)
|
49
|
+
FileUtils.copy_entry( img_src_dir, img_dst_dir )
|
50
|
+
end
|
51
|
+
|
40
52
|
HtmlRender.new( spec,
|
41
53
|
getGemRoot() + "/lib/almirah/templates/page.html",
|
42
54
|
"#{pass}/build/specifications/#{spec.key.downcase}/#{spec.key.downcase}.html" )
|
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.0.
|
4
|
+
version: 0.0.5
|
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-01-
|
11
|
+
date: 2024-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The software part of the Almirah system
|
14
14
|
email: oleksandr.ivanov.development@gmail.com
|
@@ -23,13 +23,15 @@ files:
|
|
23
23
|
- lib/almirah/doc_items/controlled_paragraph.rb
|
24
24
|
- lib/almirah/doc_items/doc_item.rb
|
25
25
|
- lib/almirah/doc_items/heading.rb
|
26
|
+
- lib/almirah/doc_items/image.rb
|
27
|
+
- lib/almirah/doc_items/markdown_list.rb
|
26
28
|
- lib/almirah/doc_items/markdown_table.rb
|
27
29
|
- lib/almirah/doc_items/paragraph.rb
|
28
30
|
- lib/almirah/html_render.rb
|
29
31
|
- lib/almirah/linker.rb
|
30
32
|
- lib/almirah/specification.rb
|
31
33
|
- lib/almirah/templates/page.html
|
32
|
-
homepage:
|
34
|
+
homepage: http://almirah.site
|
33
35
|
licenses:
|
34
36
|
- MIT
|
35
37
|
metadata: {}
|