hlt 0.1.10 → 0.1.11
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/hlt.rb +33 -3
- metadata +6 -6
- 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: 92eee83d9a2c6260c28978ee46751505c850a577
|
4
|
+
data.tar.gz: ec03bab4c6335cb5294088a9764339108bb3a4fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1e832c6a3d400e8e0e9637a17babdb006557b99c80349854e0d16100f576843929404bac00709b489a2bbe114fe1a9456441d8cc836fcaa73f161d62cfbf7a8
|
7
|
+
data.tar.gz: 45bde2628a415aa0adf2b6d39bc1617dcc889425bda7e273e94a58894b278f039d343eb03157258440935701a7a3312b7c518ea91dd6e3593cbc24e30d051e73
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/hlt.rb
CHANGED
@@ -9,12 +9,42 @@ class Hlt
|
|
9
9
|
attr_reader :to_html
|
10
10
|
|
11
11
|
def initialize(raw_s)
|
12
|
+
|
12
13
|
# strip out lines which are blank or only contain a comment
|
13
|
-
s = raw_s.lines.to_a.reject!{|x| x[/(^\s
|
14
|
+
#s = raw_s.lines.to_a.reject!{|x| x[/(^\s+\#\s)|(^\s*$)/] }
|
15
|
+
s = raw_s
|
16
|
+
|
14
17
|
# strip out the text from the line containing a comment
|
15
18
|
s.gsub!(/((^#\s|\s#\s).*)/,'').strip if s[/((^#\s|\s#\s).*)/]
|
16
19
|
a = s.scan(/^\[([^\]]+)\]\n/).map(&:first)
|
17
|
-
|
20
|
+
s.gsub!(/\n\[[^\]]+\]\n/, " !CODE\n")
|
21
|
+
|
22
|
+
s2 = s.lines.to_a.map!{|line|
|
23
|
+
|
24
|
+
hash = "(\s+\{[^\}]+\})?"
|
25
|
+
line.sub(/^\s+(\w+)?(?:[\.#]\w+){1,}#{hash}/) do |x|
|
26
|
+
|
27
|
+
raw_attrs = x.slice!(/\{.*\}/)
|
28
|
+
attrs = raw_attrs[1..-2] if raw_attrs
|
29
|
+
|
30
|
+
a2 = []
|
31
|
+
tag = x[/((?:^|\s+)\w*)#/,1] || 'div'
|
32
|
+
tag += 'div' if tag.strip.empty?
|
33
|
+
|
34
|
+
x.sub(/(?:\.\w+){1,}/) do |x2|
|
35
|
+
a = x2[/(?:\.\w+){1,}/].split('.')
|
36
|
+
a.shift
|
37
|
+
a2 << "class: '%s'" % a.join(' ')
|
38
|
+
end
|
39
|
+
|
40
|
+
x.sub(/#\w+/) {|x2| a2 << "id: '%s'" % x2[1..-1] }
|
41
|
+
|
42
|
+
a2 << attrs if attrs
|
43
|
+
"%s {%s}" % [tag, a2.join(', ')]
|
44
|
+
|
45
|
+
end
|
46
|
+
}.join
|
47
|
+
|
18
48
|
raw_html = LineTree.new(s2).to_xml
|
19
49
|
html = raw_html.gsub('!CODE').with_index do |x,i|
|
20
50
|
"\n\n" + a[i].lines.map{|x| ' ' * 4 + x}.join + "\n"
|
@@ -22,4 +52,4 @@ class Hlt
|
|
22
52
|
@to_html = Rexle.new(html).xml pretty: true
|
23
53
|
end
|
24
54
|
|
25
|
-
end
|
55
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hlt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -29,20 +29,20 @@ cert_chain:
|
|
29
29
|
WLDjnwWJij3s1n0smA0epN35TNfBPwBuMix0lFvcsZD+rLm3Q/VpL11uc8WftPB8
|
30
30
|
AjmkUd4GsuVwySXdl57hm+F/UhshciKo
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date: 2013-
|
32
|
+
date: 2013-10-02 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: line-tree
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
description:
|
@@ -62,12 +62,12 @@ require_paths:
|
|
62
62
|
- lib
|
63
63
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: '0'
|
68
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
69
|
requirements:
|
70
|
-
- -
|
70
|
+
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
72
|
version: '0'
|
73
73
|
requirements: []
|
metadata.gz.sig
CHANGED
Binary file
|