martile 0.3.5 → 0.4.0
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 +42 -5
- metadata +4 -4
- metadata.gz.sig +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b10ea83dd4a9a5d91c5a611fecf1b0926ef43992
|
4
|
+
data.tar.gz: d9d9a4c836d0627c420bb69d9fb5215695da7818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcfda9302fc1fc04d48a4912f2bbaadb7170425114cbd4a28426ccf213b9e190f988c1211322534e5a5f7cce2af346514461815573dfac957402e8f3b4319f54
|
7
|
+
data.tar.gz: bf1461af551e30994788a18ea0995b21ddc234be905c6a5143cb68716634e9b869dc3c6829cf1d1c5a2313ae5418b14371f809b6bf3525bf51a416874a472a9b
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -8,10 +8,16 @@ require 'dynarex'
|
|
8
8
|
require 'rdiscount'
|
9
9
|
|
10
10
|
|
11
|
+
# feature: 30-Oct-2014: A section can now be between a set of equal signs at
|
12
|
+
# the beginning of the line
|
13
|
+
# e.g.
|
14
|
+
# =
|
15
|
+
# inside a section
|
16
|
+
# =
|
11
17
|
# bug fix: 07-Oct-2014: Smartlink tested for new cases
|
12
18
|
# feature: 27-Sep-2014: 1. A smartlink can now be used
|
13
19
|
# e.g. ?link http://someurl?
|
14
|
-
# 2. pre
|
20
|
+
# 2. pre tags can now be created from 2 pairs of slash
|
15
21
|
# tags, before and after the pre tag content e.g.
|
16
22
|
# //
|
17
23
|
# testing
|
@@ -51,7 +57,7 @@ class Martile
|
|
51
57
|
|
52
58
|
s = slashpre raw_s
|
53
59
|
|
54
|
-
raw_s2 = apply_filter(s.strip) {|x| code_block_to_html x }
|
60
|
+
raw_s2 = apply_filter(s.strip + "\n") {|x| code_block_to_html x }
|
55
61
|
|
56
62
|
# ensure all angle brackets within <pre><code> is escaped
|
57
63
|
s2 = raw_s2.split(/(?=<pre><code>)/m).map { |y|
|
@@ -87,10 +93,11 @@ class Martile
|
|
87
93
|
|
88
94
|
s8 = apply_filter(s7) {|x| underline x }
|
89
95
|
s9 = apply_filter(s8) {|x| smartlink x }
|
96
|
+
s10 = apply_filter(s9) {|x| section x }
|
90
97
|
|
91
98
|
#puts 's8 : ' + s8.inspect
|
92
99
|
|
93
|
-
@to_html =
|
100
|
+
@to_html = s10
|
94
101
|
end
|
95
102
|
|
96
103
|
private
|
@@ -253,12 +260,42 @@ class Martile
|
|
253
260
|
|
254
261
|
end
|
255
262
|
|
256
|
-
def slashpre(s
|
257
|
-
)
|
263
|
+
def slashpre(s)
|
258
264
|
s.gsub(/\B\/\/([^\/]+)\B\/\//) do |x|
|
259
265
|
"<pre>#{($1).lines.map{|y| y.sub(/^ +/,'')}.join}</pre>"
|
260
266
|
end
|
261
267
|
|
262
268
|
end
|
263
269
|
|
270
|
+
def section(s)
|
271
|
+
|
272
|
+
a = s.lines
|
273
|
+
a2 = a.inject([[]]) do |r,x|
|
274
|
+
|
275
|
+
match = x.match(/^=[^=]#?(\w+)?/)
|
276
|
+
|
277
|
+
if match then
|
278
|
+
|
279
|
+
if r.last.first[/<section/] then
|
280
|
+
|
281
|
+
list = r.pop
|
282
|
+
r << ["%s%s</section>" %
|
283
|
+
[list[0], RDiscount.new(list[1..-1].join).to_html]]
|
284
|
+
r << []
|
285
|
+
else
|
286
|
+
|
287
|
+
raw_id = match.captures.first
|
288
|
+
id = raw_id ? (" id='%s'" % raw_id) : ''
|
289
|
+
r << ["<section#{id}>"]
|
290
|
+
end
|
291
|
+
|
292
|
+
else
|
293
|
+
r.last << x
|
294
|
+
end
|
295
|
+
r
|
296
|
+
end
|
297
|
+
|
298
|
+
a2.join
|
299
|
+
end
|
300
|
+
|
264
301
|
end
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -31,7 +31,7 @@ cert_chain:
|
|
31
31
|
YF3JmVOebtMx3b9sXkLX1YyX0fsg59FXvg9CVfAoaG6qjG2Y/okBwMSqqMLQiiao
|
32
32
|
aRfEuwOkM9Z+zA==
|
33
33
|
-----END CERTIFICATE-----
|
34
|
-
date: 2014-10-
|
34
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
35
35
|
dependencies:
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rexle-builder
|
@@ -62,7 +62,7 @@ dependencies:
|
|
62
62
|
version: '1.0'
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 1.0.
|
65
|
+
version: 1.0.33
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
68
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -72,7 +72,7 @@ dependencies:
|
|
72
72
|
version: '1.0'
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.0.
|
75
|
+
version: 1.0.33
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
77
|
name: rdiscount
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
metadata.gz.sig
CHANGED
@@ -1 +1,3 @@
|
|
1
|
-
|
1
|
+
�.Ԧ��='�����؈Օ����Cc��Bx������&��.�N��y�c<�E��M�Q8
|
2
|
+
��Z���X턜Ie�J0�cV� ��p�_3\�Y �v��?Cy|P�5X�ˎ'\t]�wdȃ��b������m��u��e�� 6 �
|
3
|
+
���҅"%���*
|