martile 1.4.0 → 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/martile.rb +78 -12
- 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: 8cac99545ba0c3f73fcffcd71c8de008cbc7b0074034c7417d302eff401419e8
|
4
|
+
data.tar.gz: f9726561ce6eb1df19f5e01c473e359a9211bb89149e334a791db8f5d3d89733
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1582650be2cf7c13d675fe849b30e428c7e8d3e5ecf33266863f753623ce16f2d8ae1aed61882b25d9ee3986d4bba7790839a25987fb551c1b0ff944e6e6771b
|
7
|
+
data.tar.gz: 134872da40df6a1ab83760e64eb928d9b268ee74bf432c4b78b873fb515a43c2ce37f6bfc098624727c87b0987d15a81ea4c1761dc67ff6c8730ed046278e3a5
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -15,6 +15,14 @@ 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
|
25
|
+
# feature: 29-Feb-2020 The sidenav tag can now contain a raw hierachical list
|
18
26
|
# feature: 22-Jan-2020 An HtmlCom::Accordion component can now be generated
|
19
27
|
# using the tag <accordion>
|
20
28
|
# feature: 16-Sep-2019 An HTML Tree component can now be generated when
|
@@ -111,10 +119,11 @@ class Martile
|
|
111
119
|
#puts 's1 : ' + s1.inspect
|
112
120
|
s40 = apply_filter(s30) {|x| code_block_to_html(x.strip + "\n") }
|
113
121
|
|
122
|
+
s45 = s40.gsub(/<pre/,'{::nomarkdown}\0').gsub(/<\/pre>/,'\0{:/}')
|
114
123
|
#puts 's2 : ' + s2.inspect
|
115
124
|
#s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
|
116
125
|
#puts 's3 : ' + s3.inspect
|
117
|
-
s50 = apply_filter(
|
126
|
+
s50 = apply_filter(s45) {|x| ordered_list_to_html x }
|
118
127
|
#puts 's4 : ' + s4.inspect
|
119
128
|
|
120
129
|
s60 = apply_filter(s50) {|x| unordered_list_to_html x }
|
@@ -156,10 +165,10 @@ class Martile
|
|
156
165
|
s220 = apply_filter(s210) {|x| svgtag x }
|
157
166
|
s230 = apply_filter(s220) {|x| embedtag x }
|
158
167
|
s240 = apply_filter(s230) {|x| script_out x }
|
168
|
+
s245 = s240.gsub(/\{::nomarkdown2\}/,'').gsub(/\{:2\/\}/,'')
|
169
|
+
@to_s = s245.to_s
|
159
170
|
|
160
|
-
|
161
|
-
|
162
|
-
s250 = apply_filter(s240) {|x| nomarkdown x }
|
171
|
+
s250 = apply_filter(s245) {|x| nomarkdown x }
|
163
172
|
s252 = sidenav(s250)
|
164
173
|
s253 = bang_xml(s252)
|
165
174
|
puts ('s235 after bang_xml: ' + s253.inspect).debug if @debug
|
@@ -230,6 +239,30 @@ class Martile
|
|
230
239
|
@js.join("\n")
|
231
240
|
end
|
232
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
|
+
|
233
266
|
private
|
234
267
|
|
235
268
|
def accordion(s1)
|
@@ -474,15 +507,16 @@ class Martile
|
|
474
507
|
|
475
508
|
@filter = []
|
476
509
|
|
477
|
-
a = s.split(/(
|
510
|
+
a = s.split(/(?=\{::nomarkdown2?\})/).map.with_index do |row, i|
|
478
511
|
|
479
|
-
row.sub(
|
512
|
+
row.sub(/\{::nomarkdown2?\}.*{:2?\/}/m) do |pattern|
|
480
513
|
placeholder = '!' + Time.now.to_i.to_s + i.to_s
|
481
514
|
@filter << [placeholder, pattern]
|
482
515
|
placeholder
|
483
516
|
end
|
484
517
|
|
485
518
|
end
|
519
|
+
|
486
520
|
a.join
|
487
521
|
|
488
522
|
end
|
@@ -776,13 +810,45 @@ class Martile
|
|
776
810
|
def sidenav(s1)
|
777
811
|
|
778
812
|
s = s1.clone
|
779
|
-
if s =~ /^<sidenav
|
813
|
+
if s =~ /^<sidenav/ then
|
814
|
+
|
815
|
+
content = s[/(<sidenav[^>]+\/>|<sidenav[^>]+>([^<]*<[^>]+>)?)/]
|
816
|
+
puts ('content: ' + content.inspect) if @debug
|
817
|
+
|
818
|
+
doc = if content then
|
819
|
+
|
820
|
+
s.sub!(content,'')
|
821
|
+
doc2 = Rexle.new(content)
|
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
|
+
|
832
|
+
puts 'txt: ' + txt.inspect if @debug
|
833
|
+
|
834
|
+
html = HtmlCom::Tree.new(txt).to_webpage
|
835
|
+
puts 'html: ' + html.inspect if @debug
|
836
|
+
|
837
|
+
doc2 = Rexle.new(html)
|
838
|
+
|
839
|
+
doc2.root.xpath('body/ul[@class="sidenav"]/li//a').each do |node|
|
840
|
+
node.attributes[:target] = target
|
841
|
+
end
|
842
|
+
|
843
|
+
doc2
|
844
|
+
|
845
|
+
else
|
846
|
+
s.sub!(/^<sidenav\/>/,'')
|
847
|
+
html = HtmlCom::Tree.new(s).to_webpage
|
848
|
+
Rexle.new(html)
|
849
|
+
end
|
850
|
+
|
780
851
|
|
781
|
-
s.sub!(/^<sidenav\/>/,'')
|
782
|
-
#jtb = JsTreeBuilder.new :tree, {src: tree, debug: true}
|
783
|
-
jtb = JsTreeBuilder.new(:sidebar, {src: s, hn: 2, debug: @debug})
|
784
|
-
html = jtb.to_webpage
|
785
|
-
doc = Rexle.new(html)
|
786
852
|
html2 = Kramdown::Document.new(Martile.new(s, toc: false).to_html)\
|
787
853
|
.to_html
|
788
854
|
div = Rexle.new("<div class='main'>%s</div>" % html2)
|
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.5
|
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-01
|
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
|