martile 1.2.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be76b25bcef2907f0d7603e5576018fe669ca9b954fff5b14bd002ba648a20f0
4
- data.tar.gz: 2c66373e1409180abc5d6f06f1698e516bf0fe658b792cd68e36ed866c9781be
3
+ metadata.gz: 45bed3d0771bb32b6215f3b90ed567171b628811ca7a1fa0f721a198945f5b35
4
+ data.tar.gz: 6f30e95b6696a2dc82ba117c91e0a7fe06a99822e02ad60abbf540ccf43f08a3
5
5
  SHA512:
6
- metadata.gz: 5bae3c21b1974e818bb50d36b593b1c98f8ebf0ad559fe6aeab269bc43fbb34ea31e50e53abd7e9fbaecd52356e07786db6a0c1b22f02b8a233302bf2b35f925
7
- data.tar.gz: f94ae42b6b29daedb73d810e2acc0a24bf41724d49e9ff83ce20d3822de73838591f65dcb9415c47a209a9fdeaa7d5c9da0acdb9d42ff7c0d45ad8ffd5ea798d
6
+ metadata.gz: 1b7da4fbed2332530432d3784eec11fb071db3ae66d3aebf7d3638ecc7a14418a5bd65cc9d299a23bbddc78b9b15d4b2380890bc4e748d3ea27218514b0ce1b0
7
+ data.tar.gz: 7e538b514e0d0e361585b16c65525fdff0caf2576c6eeaee1791b26ee0bdb9fc708ef246586e29844eef53a500cfdc6c924c7cf00545c3e6ca10fd7b52e9a52f
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/martile.rb CHANGED
@@ -15,6 +15,7 @@ require 'jsmenubuilder'
15
15
 
16
16
 
17
17
  # feature: 16-Jul-2019 An HTML Tabs component can now be created from XML
18
+ # XML can now be created using !tag notation e.g. !tabs
18
19
  # feature: 05-May-2019 Dimensions can now be supplied for an iframe
19
20
  # improvment: 06-Mar-2019 Checks for mindmap tags outside of other tags
20
21
  # feature: 03-Mar-2019 A high level mindmap with associated doc can now be
@@ -154,7 +155,8 @@ class Martile
154
155
 
155
156
  s250 = apply_filter(s240) {|x| nomarkdown x }
156
157
 
157
- s255 = tabs(s250)
158
+ s253 = bang_xml(s250)
159
+ s255 = tabs(s253)
158
160
  s260 = Yatoc.new(Kramdown::Document.new(s255).to_html, debug: debug).to_html
159
161
  puts ('s260: ' + s260.inspect).debug if debug
160
162
 
@@ -228,7 +230,30 @@ class Martile
228
230
  "<audio controls='controls'>\n%s\n</audio>" % [sources.join("\n")]
229
231
  end
230
232
 
231
- end
233
+ end
234
+
235
+ def bang_xml(s)
236
+
237
+ indent = -> (line) { ' ' + line }
238
+ a = s.split(/(?=^\!\w+)/)
239
+
240
+ a.map do |s|
241
+
242
+ if s =~ /^!!/ then
243
+
244
+ parent, children = s.split(/^!!/,2)
245
+ tree = parent.sub(/^!/,'') + children.split(/^!!/).map do |x|
246
+ x.lines[1..-1].map(&indent).unshift(x.lines[0]).map(&indent)
247
+ end.join
248
+
249
+ LineTree.new(tree).to_xml(declaration: false)
250
+
251
+ else
252
+ s
253
+ end
254
+
255
+ end.join
256
+ end
232
257
 
233
258
  def code_block_to_html(s)
234
259
 
@@ -741,7 +766,7 @@ class Martile
741
766
  a.each do |html|
742
767
 
743
768
  istart = s =~ /^<tabs[^>]*>/
744
- iend = s =~ /^<\/tabs>/
769
+ iend = s =~ /<\/tabs>/
745
770
  s.slice!(istart, (iend - istart) + '</tab>'.length + 1)
746
771
  s.insert(istart, html)
747
772
 
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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file