martile 0.1.18 → 0.1.20
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 +18 -6
- metadata +15 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f4862ef60a703fe5f68077061c8f565ed46db14
|
4
|
+
data.tar.gz: 957ce7bdb00fe10a977c20db69f6ff24f66c1f9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3937246b2ed64c544e53ca4b380ef3b77c9846a2acf704b84cbc4739eaeb208dfe42b4fbf3d55c6695e2290d237ba419bab5dc9d02b3c0e1a725d8a27e563a89
|
7
|
+
data.tar.gz: 29377f95bf39cca5e0da254adc719541d1aa4e592cbf44c93e6f7d240179749f9daee0b7130cbb945f863166087606f308150ea23b0105bc74aba5f6803a70e4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/martile.rb
CHANGED
@@ -8,6 +8,8 @@ require 'dynarex'
|
|
8
8
|
require 'rdiscount'
|
9
9
|
|
10
10
|
|
11
|
+
# feature: 04-Oct-2013: angle brackets within <pre><code> blocks are
|
12
|
+
# escaped automatically
|
11
13
|
# feature: 03-Oct-2013: HTML tags now handled
|
12
14
|
# bug fix: 25-Sep-2013: removed the new line statement from the join command.
|
13
15
|
# headings etc. should no longer be split with a new line
|
@@ -27,7 +29,16 @@ class Martile
|
|
27
29
|
attr_reader :to_html
|
28
30
|
|
29
31
|
def initialize(s)
|
30
|
-
|
32
|
+
raw_s2 = filter_out_html(s, :code_block_to_html)
|
33
|
+
|
34
|
+
# ensure all angle brackets within <pre><code> is escaped
|
35
|
+
s2 = raw_s2.split(/(?=<pre><code>)/m).map { |y|
|
36
|
+
y.sub(/<pre><code>(.*)<\/code><\/pre>/m) do |x|
|
37
|
+
s3 = ($1)
|
38
|
+
"<pre><code>%s</code></pre>" % s3.gsub(/</,'<').gsub(/>/,'>')
|
39
|
+
end
|
40
|
+
}.join
|
41
|
+
|
31
42
|
#puts 's2 : ' + s2.inspect
|
32
43
|
s3 = filter_out_html(s2, :ordered_list_to_html)
|
33
44
|
#puts 's3 : ' + s3.inspect
|
@@ -47,14 +58,15 @@ class Martile
|
|
47
58
|
b =[]
|
48
59
|
|
49
60
|
while s =~ /^ {4}/ do
|
50
|
-
|
61
|
+
|
51
62
|
a = s.lines.to_a
|
52
63
|
r = a.take_while{|x| x[/^( {4}|\n)/]}
|
53
64
|
|
54
|
-
if r.join.strip.length > 0 then
|
55
|
-
|
56
|
-
|
57
|
-
|
65
|
+
if r.join.strip.length > 0 then
|
66
|
+
raw_code = a.shift(r.length).map{|x| x.sub(/^ {4}/,'')}.join
|
67
|
+
|
68
|
+
code_block = "<pre><code>%s</code></pre>" % raw_code
|
69
|
+
|
58
70
|
b << code_block
|
59
71
|
s = a.join
|
60
72
|
i = r.length
|
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.1.
|
4
|
+
version: 0.1.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -73,6 +73,20 @@ dependencies:
|
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: dynarex
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
76
90
|
description:
|
77
91
|
email: james@r0bertson.co.uk
|
78
92
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|