martile 1.4.1 → 1.4.6
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
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/martile.rb +50 -9
- metadata +5 -45
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3072339279e9010415dab6b0aac593b625ad7fddce9895449cdf90d750ad6e82
|
4
|
+
data.tar.gz: b32add46e7c651c1311778ca3ca25eaa8e171540d4bab14f23404218ad750730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a52f3f5dec66a4c3b8c696657285c5e18ddd6ebcd76d2f0c26b02a9ca0f0d6374c93973a87374281e736aaec3b0e5d89ee763b2d00905768cd614f41ead6c39
|
7
|
+
data.tar.gz: 5faf6a84bc1b8b587674c9b74677ff5a25ae343d225e735bf652dd37fd465fe883e30e0e5177672f74b33121c397c3df2d168d1435ff25a20d773d1057bd474f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -15,6 +15,13 @@ require 'jsmenubuilder'
|
|
15
15
|
require 'htmlcom'
|
16
16
|
|
17
17
|
|
18
|
+
# feature: 01-Sep-2020 Introduced the nomarkdown tag and nomarkdown2 tag.
|
19
|
+
# The nomarkdown2 tag has the advantage of being used
|
20
|
+
# inside tags which other Markdown parse don't read.
|
21
|
+
# The tag will remove itself before completion to_s.
|
22
|
+
# feature: 08-Aug-2020 Implemented #to_Webpage
|
23
|
+
# improvement: 23-Apr-2020 A self-closing sidenav tag is now valid
|
24
|
+
# feature: 01-Mar-2020 A src attribute can now be used in the sidenav tag
|
18
25
|
# feature: 29-Feb-2020 The sidenav tag can now contain a raw hierachical list
|
19
26
|
# feature: 22-Jan-2020 An HtmlCom::Accordion component can now be generated
|
20
27
|
# using the tag <accordion>
|
@@ -112,10 +119,11 @@ class Martile
|
|
112
119
|
#puts 's1 : ' + s1.inspect
|
113
120
|
s40 = apply_filter(s30) {|x| code_block_to_html(x.strip + "\n") }
|
114
121
|
|
122
|
+
s45 = s40.gsub(/<pre[^>]*>/,'\0{::nomarkdown2}').gsub(/<\/pre>/,'{:2/}\0')
|
115
123
|
#puts 's2 : ' + s2.inspect
|
116
124
|
#s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
|
117
125
|
#puts 's3 : ' + s3.inspect
|
118
|
-
s50 = apply_filter(
|
126
|
+
s50 = apply_filter(s45) {|x| ordered_list_to_html x }
|
119
127
|
#puts 's4 : ' + s4.inspect
|
120
128
|
|
121
129
|
s60 = apply_filter(s50) {|x| unordered_list_to_html x }
|
@@ -157,10 +165,10 @@ class Martile
|
|
157
165
|
s220 = apply_filter(s210) {|x| svgtag x }
|
158
166
|
s230 = apply_filter(s220) {|x| embedtag x }
|
159
167
|
s240 = apply_filter(s230) {|x| script_out x }
|
168
|
+
s245 = s240.gsub(/\{::nomarkdown2\}/,'').gsub(/\{:2\/\}/,'')
|
169
|
+
@to_s = s245.to_s
|
160
170
|
|
161
|
-
|
162
|
-
|
163
|
-
s250 = apply_filter(s240) {|x| nomarkdown x }
|
171
|
+
s250 = apply_filter(s245) {|x| nomarkdown x }
|
164
172
|
s252 = sidenav(s250)
|
165
173
|
s253 = bang_xml(s252)
|
166
174
|
puts ('s235 after bang_xml: ' + s253.inspect).debug if @debug
|
@@ -231,6 +239,30 @@ class Martile
|
|
231
239
|
@js.join("\n")
|
232
240
|
end
|
233
241
|
|
242
|
+
def to_webpage()
|
243
|
+
|
244
|
+
a = RexleBuilder.build do |xml|
|
245
|
+
xml.html do
|
246
|
+
xml.head do
|
247
|
+
xml.meta name: "viewport", content: \
|
248
|
+
"width=device-width, initial-scale=1"
|
249
|
+
xml.style "\nbody {font-family: Arial;}\n\n" + @css.join("\n")
|
250
|
+
end
|
251
|
+
xml.body to_html()
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
doc = Rexle.new(a)
|
256
|
+
|
257
|
+
doc.root.element('body').add \
|
258
|
+
Rexle::Element.new('script').add_text "\n" +
|
259
|
+
@js.join("\n").gsub(/^ +\/\/[^\n]+\n/,'')
|
260
|
+
|
261
|
+
"<!DOCTYPE html>\n" + doc.xml(pretty: true, declaration: false)\
|
262
|
+
.gsub(/<\/div>/,'\0' + "\n").gsub(/\n *<!--[^>]+>/,'')
|
263
|
+
|
264
|
+
end
|
265
|
+
|
234
266
|
private
|
235
267
|
|
236
268
|
def accordion(s1)
|
@@ -475,15 +507,16 @@ class Martile
|
|
475
507
|
|
476
508
|
@filter = []
|
477
509
|
|
478
|
-
a = s.split(/(
|
510
|
+
a = s.split(/(?=\{::nomarkdown2?\})/).map.with_index do |row, i|
|
479
511
|
|
480
|
-
row.sub(
|
512
|
+
row.sub(/\{::nomarkdown2?\}.*{:2?\/}/m) do |pattern|
|
481
513
|
placeholder = '!' + Time.now.to_i.to_s + i.to_s
|
482
514
|
@filter << [placeholder, pattern]
|
483
515
|
placeholder
|
484
516
|
end
|
485
517
|
|
486
518
|
end
|
519
|
+
|
487
520
|
a.join
|
488
521
|
|
489
522
|
end
|
@@ -779,15 +812,23 @@ class Martile
|
|
779
812
|
s = s1.clone
|
780
813
|
if s =~ /^<sidenav/ then
|
781
814
|
|
782
|
-
content = s[
|
815
|
+
content = s[/(<sidenav[^>]+\/>|<sidenav[^>]+>([^<]*<[^>]+>)?)/]
|
783
816
|
puts ('content: ' + content.inspect) if @debug
|
784
817
|
|
785
818
|
doc = if content then
|
786
819
|
|
787
820
|
s.sub!(content,'')
|
788
821
|
doc2 = Rexle.new(content)
|
789
|
-
|
790
|
-
|
822
|
+
|
823
|
+
h = doc2.root.attributes
|
824
|
+
target = h[:target] || 'pgview'
|
825
|
+
|
826
|
+
txt = if h[:src] then
|
827
|
+
RXFHelper.read(h[:src]).first.sub(/<\?links[^>]+>\n/,'')
|
828
|
+
else
|
829
|
+
doc2.root.text
|
830
|
+
end
|
831
|
+
|
791
832
|
puts 'txt: ' + txt.inspect if @debug
|
792
833
|
|
793
834
|
html = HtmlCom::Tree.new(txt).to_webpage
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: martile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
g0+rPDPUCWKVNHo7BG5zGRDcLsJO0QeIILy/AQaSAE3lQiHmC47nhsiBK0qNehWa
|
36
36
|
47XiKvz0ZVCGgrz4GEb723WC
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: yatoc
|
@@ -118,27 +118,7 @@ dependencies:
|
|
118
118
|
- !ruby/object:Gem::Version
|
119
119
|
version: 0.1.6
|
120
120
|
- !ruby/object:Gem::Dependency
|
121
|
-
name:
|
122
|
-
requirement: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - "~>"
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '0.2'
|
127
|
-
- - ">="
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
version: 0.2.10
|
130
|
-
type: :runtime
|
131
|
-
prerelease: false
|
132
|
-
version_requirements: !ruby/object:Gem::Requirement
|
133
|
-
requirements:
|
134
|
-
- - "~>"
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '0.2'
|
137
|
-
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
version: 0.2.10
|
140
|
-
- !ruby/object:Gem::Dependency
|
141
|
-
name: jstreebuilder
|
121
|
+
name: htmlcom
|
142
122
|
requirement: !ruby/object:Gem::Requirement
|
143
123
|
requirements:
|
144
124
|
- - "~>"
|
@@ -146,7 +126,7 @@ dependencies:
|
|
146
126
|
version: '0.2'
|
147
127
|
- - ">="
|
148
128
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.2.
|
129
|
+
version: 0.2.4
|
150
130
|
type: :runtime
|
151
131
|
prerelease: false
|
152
132
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -156,27 +136,7 @@ dependencies:
|
|
156
136
|
version: '0.2'
|
157
137
|
- - ">="
|
158
138
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.2.
|
160
|
-
- !ruby/object:Gem::Dependency
|
161
|
-
name: htmlcom
|
162
|
-
requirement: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: 0.2.0
|
167
|
-
- - "~>"
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
version: '0.2'
|
170
|
-
type: :runtime
|
171
|
-
prerelease: false
|
172
|
-
version_requirements: !ruby/object:Gem::Requirement
|
173
|
-
requirements:
|
174
|
-
- - ">="
|
175
|
-
- !ruby/object:Gem::Version
|
176
|
-
version: 0.2.0
|
177
|
-
- - "~>"
|
178
|
-
- !ruby/object:Gem::Version
|
179
|
-
version: '0.2'
|
139
|
+
version: 0.2.4
|
180
140
|
description:
|
181
141
|
email: james@jamesrobertson.eu
|
182
142
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|