martile 0.9.0 → 0.9.1
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 +1 -2
- data/lib/martile.rb +73 -28
- metadata +25 -26
- metadata.gz.sig +1 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d76119c9a5f939fa15ec66be4cf3d6778977c07
|
4
|
+
data.tar.gz: b9a35aeca3680743de0495c421d6980c15efe1a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31d107cb6d1e1dfd8dba1b4bd0ca622ec88f635279f490f6b45909ca20d92a6267e740cc1cd9de28dea9a8e73bf9ec43b63fda41ce2ea847b2c496b1c9c12639
|
7
|
+
data.tar.gz: bc783f50cb54bb26105a5b9901809213a1d017af039a26f26047f205069c989dea8ed6d1d091c2a07212120265eedb8ed5df03237f72a61af7941233bd13cab1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
�
|
2
|
-
����?�+D��W��x�=@��
|
1
|
+
[V�]�6Swdqj���^���u^���B�|r��(�@�b�E��"<��o[ђ�1᠒f�>z��l@��Y.�<�f��ja��3���J�;�m��۱�����I+�=�g8(�CC��Y�iW�&S*C�H��9@�ih3� c���_���0�`~�.��ƣRI�SJŻO�A��!���;�Jg}�DO"4�p}�HB躏����rɎ[ ���5��p�{o�V���<����f8��I��b��Ի�����E ~��
|
data/lib/martile.rb
CHANGED
@@ -12,6 +12,7 @@ require 'mindmapdoc'
|
|
12
12
|
require 'flowchartviz'
|
13
13
|
|
14
14
|
|
15
|
+
# feature: 23-Jul-2018 An HTML form can now be generated
|
15
16
|
# feature: 12-Feb-2018 Transforms <mindmap> tags into a
|
16
17
|
# mindmap + related headings
|
17
18
|
# feature: 8-Feb-2018 A section attribute id can now include a dash (-).
|
@@ -55,71 +56,101 @@ class Martile
|
|
55
56
|
|
56
57
|
attr_reader :to_s, :data_source
|
57
58
|
|
58
|
-
def initialize(raw_s, ignore_domainlabel: nil, debug: false)
|
59
|
+
def initialize(raw_s='', ignore_domainlabel: nil, debug: false, log: nil)
|
59
60
|
|
60
61
|
@data_source = {}
|
61
62
|
|
62
|
-
@ignore_domainlabel = ignore_domainlabel
|
63
|
+
@ignore_domainlabel, @log = ignore_domainlabel, log
|
63
64
|
|
64
65
|
raw_s.gsub!("\r",'')
|
65
66
|
|
66
67
|
|
67
|
-
|
68
|
-
puts '
|
68
|
+
s10 = raw_s =~ /^__DATA__$/ ? parse__data__(raw_s) : raw_s
|
69
|
+
puts 's10: ' + s10.inspect if debug
|
69
70
|
|
70
|
-
|
71
|
-
puts '
|
71
|
+
s20 = MindmapDoc.new(debug: debug).transform(s10)
|
72
|
+
puts 's20: ' + s20.inspect if debug
|
72
73
|
|
73
|
-
|
74
|
+
s30 = apply_filter(s20) {|x| slashpre x }
|
74
75
|
#puts 's1 : ' + s1.inspect
|
75
|
-
|
76
|
+
s40 = apply_filter(s30) {|x| code_block_to_html(x.strip + "\n") }
|
76
77
|
|
77
78
|
#puts 's2 : ' + s2.inspect
|
78
79
|
#s3 = apply_filter(s2, %w(ol ul)) {|x| explicit_list_to_html x }
|
79
80
|
#puts 's3 : ' + s3.inspect
|
80
|
-
|
81
|
+
s50 = apply_filter(s40) {|x| ordered_list_to_html x }
|
81
82
|
#puts 's4 : ' + s4.inspect
|
82
83
|
|
83
|
-
|
84
|
+
s60 = apply_filter(s50) {|x| unordered_list_to_html x }
|
84
85
|
#puts 's5 : ' + s5.inspect
|
85
86
|
|
86
|
-
|
87
|
+
s70 = apply_filter(s60) {|x| dynarex_to_markdown x }
|
87
88
|
#puts 's6 :' + s6.inspect
|
88
89
|
|
89
|
-
|
90
|
+
s80 = apply_filter(s70) {|x| table_to_html x }
|
90
91
|
#puts 's7 : ' + s7.inspect
|
91
92
|
|
92
|
-
|
93
|
+
s90 = apply_filter(s80) {|x| underline x}
|
93
94
|
#puts 's8: ' + s8.inspect
|
94
|
-
|
95
|
+
s100 = apply_filter(s90) {|x| section x }
|
95
96
|
#puts 's9: ' + s9.inspect
|
96
97
|
|
97
|
-
|
98
|
+
s110 = apply_filter(s100) {|x| smartlink x }
|
98
99
|
|
99
100
|
#puts 's10: ' + s10.inspect
|
100
101
|
|
101
102
|
#s11 = section s9
|
102
103
|
#puts 's11 : ' + s11.inspect
|
103
|
-
|
104
|
+
s120 = apply_filter(s110) {|x| audiotag x }
|
104
105
|
#puts 's12 : ' + s12.inspect
|
105
|
-
|
106
|
+
s130 = apply_filter(s120) {|x| videotag x }
|
106
107
|
#puts 's13 : ' + s13.inspect
|
107
|
-
|
108
|
+
s140 = apply_filter(s130) {|x| iframetag x }
|
108
109
|
#puts 's14 : ' + s14.inspect
|
109
|
-
|
110
|
+
s150 = apply_filter(s140) {|x| kvx_to_dl x }
|
110
111
|
#puts 's15 : ' + s15.inspect
|
111
|
-
|
112
|
+
s160 = apply_filter(s150) {|x| list_item_to_hyperlink x }
|
113
|
+
s165 = apply_filter(s160) {|x| formify x }
|
112
114
|
#puts 's16 : ' + s16.inspect
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
115
|
+
s170 = apply_filter(s165) {|x| mtlite_utils x }
|
116
|
+
s180 = apply_filter(s170) {|x| hyperlinkify x }
|
117
|
+
s190 = apply_filter(s180) {|x| highlight x }
|
118
|
+
s200 = apply_filter(s190) {|x| details x }
|
119
|
+
s210 = apply_filter(s200) {|x| qrcodetag x }
|
120
|
+
s220 = apply_filter(s210) {|x| svgtag x }
|
121
|
+
|
119
122
|
|
120
123
|
#puts 's17 : ' + s17.inspect
|
121
124
|
|
122
|
-
@to_s =
|
125
|
+
@to_s = s220
|
126
|
+
end
|
127
|
+
|
128
|
+
def create_form(s)
|
129
|
+
|
130
|
+
a = LineTree.new(s).to_a
|
131
|
+
|
132
|
+
def create_form_item(raw_name)
|
133
|
+
|
134
|
+
name = raw_name.downcase[/\w+/]
|
135
|
+
type = name =~ /password/ ? :password : :text
|
136
|
+
|
137
|
+
['div', {},
|
138
|
+
['label', {for: name}, raw_name],
|
139
|
+
['input', {type: type, id: name, name: name}]
|
140
|
+
]
|
141
|
+
end
|
142
|
+
|
143
|
+
a2 = a[0][1..-1].select {|x| x[0] =~ /[^:]+\:/}.map do |x|
|
144
|
+
create_form_item(x[0][/[^:]+\:/])
|
145
|
+
end
|
146
|
+
|
147
|
+
button_name, link = s.match(/\[([^\]]+)\]\(["']([^"']+)["']\)/).captures
|
148
|
+
|
149
|
+
a2 << ['div', {class: 'button'}, ['button', {type: 'submit'}, button_name]]
|
150
|
+
|
151
|
+
a2.insert 0, 'form', {id: a[0][0], action: link, method: 'post'}
|
152
|
+
Rexle.new(a2).xml pretty: true, declaration: false
|
153
|
+
|
123
154
|
end
|
124
155
|
|
125
156
|
def to_html()
|
@@ -235,6 +266,20 @@ class Martile
|
|
235
266
|
s.gsub('<','<').gsub('>','>')
|
236
267
|
end
|
237
268
|
|
269
|
+
def formify(s)
|
270
|
+
|
271
|
+
s.split(/(?=\n\w+)/).map do |s|
|
272
|
+
|
273
|
+
if s =~ /(?=\w+\n \w+: +\[ +\])/ then
|
274
|
+
create_form(s)
|
275
|
+
else
|
276
|
+
s
|
277
|
+
end
|
278
|
+
|
279
|
+
end.join
|
280
|
+
|
281
|
+
end
|
282
|
+
|
238
283
|
def iframetag(s)
|
239
284
|
|
240
285
|
s.gsub(/\B!i\[\]\((https?:\/\/[^\)]+)\)\B/) do |x|
|
@@ -353,7 +398,7 @@ class Martile
|
|
353
398
|
# convert square brackets to unicode check boxes
|
354
399
|
# replaces a [] with a unicode checkbox,
|
355
400
|
# and [x] with a unicode checked checkbox
|
356
|
-
s2 = s.gsub(/\s\[\
|
401
|
+
s2 = s.gsub(/\s\[ {0,1}\]\s/,' ☐ ').gsub(/\s\[x\]\s/,' ☑ ')
|
357
402
|
|
358
403
|
# create domain labels for hyperlinks
|
359
404
|
#
|
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: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,28 +10,27 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
ASPGReskINIIrA==
|
13
|
+
MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwNzIzMDk0NDI5WhcN
|
15
|
+
MTkwNzIzMDk0NDI5WjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCwfp13
|
17
|
+
9uVBVoJJp1oHHQalluwWpU3nz9Jc8ullSoGgqZIhyojes2xEYyLxpH7NrHaFkT+D
|
18
|
+
nktpIBXGqBd4Ws3KOca4fWZc7SXeV4ZDsg0sZ3JhJeyBdXsNbSecbJAR9V1C8lke
|
19
|
+
66D57mq37JJUGXAdqobTbStJzsVs5NYMWKOdF4fxr9e81bLLVmwzlSV9zsfqv6BG
|
20
|
+
qYstlCktdJZK75VBw81vlsu5LkS/hlabtTECkXXg/kbmZ4ap2JUU6OWGEbNX9H9z
|
21
|
+
+32VSVNh1xpil1TUtEB/XDX1H8z80W7zylzqf5vF9GXrQAuGM0KE+awWM8SgN36d
|
22
|
+
CgyzhzIUYFcppwHzAgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
23
|
+
HQYDVR0OBBYEFHGsvIkCXBMjMK0UORqOkQT/MfrMMCYGA1UdEQQfMB2BG2dlbW1h
|
24
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
|
25
|
+
ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAAsJLX2e4bv+02/BrLr9
|
26
|
+
xxMG2XGMJei7gUyQbVifInSCEm1usNakx5PIPy4UBeSp/EaSuXV7KO6jqZTeBs1o
|
27
|
+
XI9x9ELUf+YO+9CV4/CP3WmjepQ3drZY7oRt7fyhVRbTR3Ey/N8Gjvkomku1xVaf
|
28
|
+
+5KNJjpNNT0ZWIl8Le3aOrS9FaGLglmsFvCHjVmW5x23SM50oliGw/kUSf62UFIL
|
29
|
+
n7suVG+ciUKasz70DplBkzIlMmqct4Dd//7YbfPbqxNCZ8uvbiWm8At8Y80FhvM1
|
30
|
+
h9crBM07TwSkUs7Sqw12Wh0aEldB8f+8+8mRzbWrJxdYt0EC7ZeByVSu26XqSA9a
|
31
|
+
QUQ=
|
33
32
|
-----END CERTIFICATE-----
|
34
|
-
date: 2018-
|
33
|
+
date: 2018-07-23 00:00:00.000000000 Z
|
35
34
|
dependencies:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: rqrcode
|
@@ -59,20 +58,20 @@ dependencies:
|
|
59
58
|
requirements:
|
60
59
|
- - "~>"
|
61
60
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0.
|
61
|
+
version: '0.2'
|
63
62
|
- - ">="
|
64
63
|
- !ruby/object:Gem::Version
|
65
|
-
version: 0.
|
64
|
+
version: 0.2.0
|
66
65
|
type: :runtime
|
67
66
|
prerelease: false
|
68
67
|
version_requirements: !ruby/object:Gem::Requirement
|
69
68
|
requirements:
|
70
69
|
- - "~>"
|
71
70
|
- !ruby/object:Gem::Version
|
72
|
-
version: '0.
|
71
|
+
version: '0.2'
|
73
72
|
- - ">="
|
74
73
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
74
|
+
version: 0.2.0
|
76
75
|
- !ruby/object:Gem::Dependency
|
77
76
|
name: flowchartviz
|
78
77
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
C�_�8㞥껣�X���ZI{X>��:�.+"�l�b����[�@�C�;��!��w����gJN��%���z^�C�\��+#�t��d��zq�
|
1
|
+
�5!�&�(�/��JDUٚ[�[�^�vt�,+�.�]��Ad�X����n�1Ӟ�9n�>w�h�T��� ��u��o���EV��7��i$3��sQm�%��yQ���52��Xҫ�S��H���[�H�k��b��L��p(ؠ��y!�1O�E@��9XK��E���|O4�;������(:ţ�`'L*�wSV9AK��ï�iڑ!�z�_kl���z��j�}G��I�ų���=�)�^L��{�R5���T
|