martile 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +1 -2
  4. data/lib/martile.rb +73 -28
  5. metadata +25 -26
  6. metadata.gz.sig +1 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57637649c3072e471cb8d293c282f29037ac14dd
4
- data.tar.gz: '0718b4d00db1429b7816034f08a7c06c537a06af'
3
+ metadata.gz: 2d76119c9a5f939fa15ec66be4cf3d6778977c07
4
+ data.tar.gz: b9a35aeca3680743de0495c421d6980c15efe1a0
5
5
  SHA512:
6
- metadata.gz: '039685ca2a2afe7d052da5785431293778aa884cd99f43896d47326aee7898539f1307063a5c7e62311a36af2754c95a01c932826968b8e238d3df02e2cfe9cb'
7
- data.tar.gz: fdb183d1c62180f4e99a2a8d6ba1e3151f36bea401ef9e3260a4533099eb4ba3e8fc8cb6f93ba99f9d0f42c94411d136a876d09c3ad9179835dce4e17c72ff23
6
+ metadata.gz: 31d107cb6d1e1dfd8dba1b4bd0ca622ec88f635279f490f6b45909ca20d92a6267e740cc1cd9de28dea9a8e73bf9ec43b63fda41ce2ea847b2c496b1c9c12639
7
+ data.tar.gz: bc783f50cb54bb26105a5b9901809213a1d017af039a26f26047f205069c989dea8ed6d1d091c2a07212120265eedb8ed5df03237f72a61af7941233bd13cab1
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1 @@
1
- 9v��)^��'O���d���]����B�������X�m��/{�/规{���� ߂J��g�/I*����4x�|�>4������ ��:�B8nn�Ǭ+�<C�Ug;��5���z j����ڼ��冿N��S�8:q�ɌeN7&�$��e�t���.?n!���_v?7�[�����F�� �T��n%�"H5 /\H�^����&�)j��
2
- ����?�+D��W��x�=@��
1
+ [V�]6Swdqj���^���u^���B�|r��(�@�bE��"<��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ŻOA��!���;�Jg}�DO"4�p}�HB躏����rɎ[ ���5��p{o�V���<����f8��I��b��Ի�����E ~��
@@ -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
- s0 = raw_s =~ /^__DATA__$/ ? parse__data__(raw_s) : raw_s
68
- puts 's0: ' + s0.inspect if debug
68
+ s10 = raw_s =~ /^__DATA__$/ ? parse__data__(raw_s) : raw_s
69
+ puts 's10: ' + s10.inspect if debug
69
70
 
70
- s1 = MindmapDoc.new(debug: debug).transform(s0)
71
- puts 's1: ' + s1.inspect if debug
71
+ s20 = MindmapDoc.new(debug: debug).transform(s10)
72
+ puts 's20: ' + s20.inspect if debug
72
73
 
73
- s2 = apply_filter(s1) {|x| slashpre x }
74
+ s30 = apply_filter(s20) {|x| slashpre x }
74
75
  #puts 's1 : ' + s1.inspect
75
- s3 = apply_filter(s2) {|x| code_block_to_html(x.strip + "\n") }
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
- s4 = apply_filter(s3) {|x| ordered_list_to_html x }
81
+ s50 = apply_filter(s40) {|x| ordered_list_to_html x }
81
82
  #puts 's4 : ' + s4.inspect
82
83
 
83
- s5 = apply_filter(s4) {|x| unordered_list_to_html x }
84
+ s60 = apply_filter(s50) {|x| unordered_list_to_html x }
84
85
  #puts 's5 : ' + s5.inspect
85
86
 
86
- s6 = apply_filter(s5) {|x| dynarex_to_markdown x }
87
+ s70 = apply_filter(s60) {|x| dynarex_to_markdown x }
87
88
  #puts 's6 :' + s6.inspect
88
89
 
89
- s7 = apply_filter(s6) {|x| table_to_html x }
90
+ s80 = apply_filter(s70) {|x| table_to_html x }
90
91
  #puts 's7 : ' + s7.inspect
91
92
 
92
- s8 = apply_filter(s7) {|x| underline x}
93
+ s90 = apply_filter(s80) {|x| underline x}
93
94
  #puts 's8: ' + s8.inspect
94
- s9 = apply_filter(s8) {|x| section x }
95
+ s100 = apply_filter(s90) {|x| section x }
95
96
  #puts 's9: ' + s9.inspect
96
97
 
97
- s10 = apply_filter(s9) {|x| smartlink x }
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
- s12 = apply_filter(s10) {|x| audiotag x }
104
+ s120 = apply_filter(s110) {|x| audiotag x }
104
105
  #puts 's12 : ' + s12.inspect
105
- s13 = apply_filter(s12) {|x| videotag x }
106
+ s130 = apply_filter(s120) {|x| videotag x }
106
107
  #puts 's13 : ' + s13.inspect
107
- s14 = apply_filter(s13) {|x| iframetag x }
108
+ s140 = apply_filter(s130) {|x| iframetag x }
108
109
  #puts 's14 : ' + s14.inspect
109
- s15 = apply_filter(s14) {|x| kvx_to_dl x }
110
+ s150 = apply_filter(s140) {|x| kvx_to_dl x }
110
111
  #puts 's15 : ' + s15.inspect
111
- s16 = apply_filter(s15) {|x| list_item_to_hyperlink x }
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
- s17 = apply_filter(s16) {|x| mtlite_utils x }
114
- s18 = apply_filter(s17) {|x| hyperlinkify x }
115
- s19 = apply_filter(s18) {|x| highlight x }
116
- s20 = apply_filter(s19) {|x| details x }
117
- s21 = apply_filter(s20) {|x| qrcodetag x }
118
- s22 = apply_filter(s21) {|x| svgtag x }
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 = s22
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('<','&lt;').gsub('>','&gt;')
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\[\s*\]\s/,' &#9744; ').gsub(/\s\[x\]\s/,' &#9745; ')
401
+ s2 = s.gsub(/\s\[ {0,1}\]\s/,' &#9744; ').gsub(/\s\[x\]\s/,' &#9745; ')
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.0
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
- MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
- YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
- 8ixkARkWAmV1MB4XDTE3MDMxMTE4NTYyMVoXDTE4MDMxMTE4NTYyMVowSDESMBAG
16
- A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
- EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
- ggEBALtBTWyAMzfST7sOUXsjeFeiT3lPIwfYQHN6TWLqWDj2JQhozGoceAbCt5tC
19
- AmY6fE+Jw/bvNowgreODfwH0hAZSD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CERTIFICATE-----
34
- date: 2018-02-12 00:00:00.000000000 Z
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.1'
61
+ version: '0.2'
63
62
  - - ">="
64
63
  - !ruby/object:Gem::Version
65
- version: 0.1.4
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.1'
71
+ version: '0.2'
73
72
  - - ">="
74
73
  - !ruby/object:Gem::Version
75
- version: 0.1.4
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
- �xI=�G��:b��l;�tkxs�yq�958Htζ��x�p��a�E��y����Fs�)5QZ걩�HE��;z���؍^�A�����8!��.a?��eD4�
2
- C�_�8㞥껣�X���ZI{X>��:�.+"�l�b����[�@�C�;��!��w����gJN��%Ÿ���z^�C�\��+#�t��d��zq�
1
+ �5!�&�(�/��JDUٚ[�[�^�vt�,+�.�]��AdX����n�1Ӟ�9n�>whT��� ��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