hlt 0.4.1 → 0.5.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.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +1 -1
  3. data.tar.gz.sig +0 -0
  4. data/lib/hlt.rb +52 -4
  5. metadata +23 -3
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 177206ed959aa3c17abc22050257590a9c65e080
4
- data.tar.gz: f3fb89fcf8cd6df14f55553c9b9dff3afaf84daf
3
+ metadata.gz: bb7466834814fe0e00f3272371a1d407b9fb73f2
4
+ data.tar.gz: 54fdb09907aff7bbf5910f2a075cd9a0632d54a6
5
5
  SHA512:
6
- metadata.gz: 553e007c6ebc549b2e938968b19423ae8c1fd89cce346edf191841e08be90a8b7d448707aa983442b9ef69686f9b6fff37750110b389f03d22f35ed6a2e9c3bc
7
- data.tar.gz: 770f81428195a0caad85adc3cb7915fbd511e11f4aec193d469a4e551082537fd56523ecdb2135b547f60f2d1ce15977f753c586df766fc6e1c5bb991ef6d9cd
6
+ metadata.gz: 56ce1329ecd686e7168734f70858eeabfd1c7813a68c8400cfeb1a3f90d622b7f52f7cd64ed14c58e8fbbea596db3ba29f6c79b7cce48143f8dd0a8c04940657
7
+ data.tar.gz: 64579a2a9adebd0211907ab930da944bf74f815887645b5b3c8f142abd7ab312951590a1b02a2092f66434d06c2a6c226bccf0706a48cdbe6ee8c72fa518c914
@@ -1 +1 @@
1
- ����É7{sc����+��� _R<޽%m�0`�9qn4չ)}����RJ����Km�D�,A 9��ek���|���b]}�>�~�&��RF�\�ke%�Aş�X��1GUQq~�8..�n��Ln䔷��!R3U0Y]$լ�dOeX��-��� ��=��|ޔ��
1
+ ]���T��eN���?|�¹P���"f�K�'���K�������@}'�w���mzVbO*?�bB���Y��q���ӝ��/?�j�1�W� �')JF��Sj��YЭYA��%ʃV"�72}���d;��!/�* �X�"R?�76�@ ���$�X0 #��,�n�l��w��y��a��ўU��5��6���ckϰ(�+��$H��j�����ve)���#�����8b&A�"��3u��n��)��W��t
data.tar.gz.sig CHANGED
Binary file
data/lib/hlt.rb CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  require 'line-tree'
6
6
  require 'rdiscount'
7
+ require 'rexle-builder'
7
8
 
8
9
  class Hlt
9
10
 
@@ -61,8 +62,9 @@ class Hlt
61
62
  }
62
63
 
63
64
  s2.unshift "root\n"
64
-
65
- raw_html = LineTree.new(s2.join, ignore_non_element: false).to_xml
65
+ s3 = s2.join.gsub(/^(\s*)-\s+/,'\1templatecode ').\
66
+ gsub(/^(\s*)=\s+/,'\1templateoutput ')
67
+ raw_html = LineTree.new(s3, ignore_non_element: false).to_xml
66
68
 
67
69
  html = raw_html.gsub('!CODE').with_index do |x,i|
68
70
  "\n\n" + a_code[i].lines.map{|x| ' ' * 4 + x}.join + "\n"
@@ -91,7 +93,7 @@ class Hlt
91
93
 
92
94
 
93
95
  #html = doc.xml opt
94
- @to_doc = doc
96
+ @doc = doc
95
97
  html = doc.root.xpath('*'){|x| x.xml opt}.join("\n")
96
98
 
97
99
  time = Time.now
@@ -103,6 +105,20 @@ class Hlt
103
105
 
104
106
  end
105
107
 
108
+ def render()
109
+
110
+ s = "xml = RexleBuilder.new\n"
111
+ s << scanbuild(@doc.to_a)
112
+ a = eval s
113
+
114
+ Rexle.new(a).element('root/.').xml pretty: true
115
+
116
+ end
117
+
118
+ def to_doc()
119
+ @doc
120
+ end
121
+
106
122
  private
107
123
 
108
124
  def filter_xml(s)
@@ -207,5 +223,37 @@ class Hlt
207
223
  %w{ th st nd rd th th th th th th }[n % 10] )
208
224
  end
209
225
 
226
+ # under development 04-Nov-2015
227
+
228
+ def scanbuild(x, indent=0)
229
+
230
+ name, attributes, *remaining = x
231
+
232
+ children = remaining.shift
233
+ text = ''
234
+
235
+
236
+ if children.is_a? Array then
237
+ nested = scanbuild(children, indent+1)
238
+ else
239
+ text = children
240
+ end
241
+
242
+ pad = ' ' * indent
243
+
244
+ s2 = if children.is_a? Array then
245
+ "%sxml.%s(%s,%s) do\n%s" % [pad, name, attributes.to_s, text.inspect, nested]
246
+ else
247
+ ' ' * indent + "xml.%s(%s,%s)" % [name, attributes.to_s, text.inspect]
248
+ end
249
+
250
+ if remaining.any? and remaining[0].is_a? Array then
251
+ s2 << "\n" + scanbuild(remaining[0], indent+1)
252
+ end
253
+
254
+ s2 << "\n%send" % [pad] if children.is_a?(Array)
255
+
256
+ s2
257
+ end
210
258
 
211
- end
259
+ 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.4.1
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  N3HzwT7MWhAYJMZarxR3Ex/3IaAB+NtAHcEtSB7E/q26iMAybB6QTR4W4RTD+5t0
32
32
  cbGTR3O9WFjg/w==
33
33
  -----END CERTIFICATE-----
34
- date: 2015-11-03 00:00:00.000000000 Z
34
+ date: 2015-11-04 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: line-tree
@@ -73,6 +73,26 @@ dependencies:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 2.1.7.1
76
+ - !ruby/object:Gem::Dependency
77
+ name: rexle-builder
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '0.2'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 0.2.1
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '0.2'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 0.2.1
76
96
  description:
77
97
  email: james@r0bertson.co.uk
78
98
  executables: []
@@ -103,5 +123,5 @@ rubyforge_project:
103
123
  rubygems_version: 2.4.8
104
124
  signing_key:
105
125
  specification_version: 4
106
- summary: hlt
126
+ summary: Intended for building an HTML page from a kind of a Slim template
107
127
  test_files: []
metadata.gz.sig CHANGED
Binary file