nthrut 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +3 -0
  3. data.tar.gz.sig +1 -0
  4. data/lib/nthrut.rb +72 -0
  5. metadata +126 -0
  6. metadata.gz.sig +0 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: db05647d46c6334aac63a5f0c6edd844811452b610cb5fb4dd13d992e2ab4f54
4
+ data.tar.gz: fbd8ad6bc143e895c87fd43a77f92f688305771c60c8f1cb674aa2cbbc8a22a7
5
+ SHA512:
6
+ metadata.gz: ed7a893ad598dd294fc0327ad5dc0789fff5fd67a90858df03a83296f38d5910aff022958d06da52913583a84f1814a5bc9ea9e1b5a45f98e1bebf6cf5bdc3ce
7
+ data.tar.gz: f6495eccb54c80f132b3ec182eb3b325cd21d7e7ef6183c1b2095c0abbffb869aef9ee8b5919238dbe577824e688b8a77cbc3dbe9e5c56b37c475218cefd4664
@@ -0,0 +1,3 @@
1
+ �j�j����%�Ȋ���n�a� 9��
2
+ F��T7���E��Q�<�Y�5�a�c�9n�hR��_2�g�I�=���H�dա� �&�c1 �dW@�i�G=�������P�i��VOT���6��Net��0�� ��\I��{��S�
3
+ ���������(��5�e=KEp��98̵�T%��Lk�]S�hC�^{l?L��0m�YxAd���΀zy>�{Cr��5T"X�Ϸ|�[���X���6X0���C�������_�
@@ -0,0 +1 @@
1
+ rͣ� *t�x�è�ʈ������cy����p1��?�g{�w���Mڛ�~Gg .��s�%�$2�� VF῔���= xR_E7^����R��-XU�o��v�\*A�nu���/�`3�g�6�J�����ZUV2��Ķ�sޛ��ZE^��LD��Kw�_�Kg�|̔�݉6�-Q����<:d�ś��E����
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: nthrut.rb
4
+
5
+ require 'haml'
6
+ require 'slim'
7
+ require 'tilt'
8
+
9
+
10
+
11
+ class NThrut
12
+
13
+ def initialize(parent)
14
+
15
+ @parent = parent
16
+ @templates = {}
17
+
18
+ end
19
+
20
+ # jr 140616 not yet used and still needs to be tested
21
+ def transform(xsl, xml)
22
+ Rexslt.new(xsl, xml).to_s
23
+ end
24
+
25
+ def haml(name,options={})
26
+ render name, :haml, options
27
+ end
28
+
29
+ def slim(name,options={})
30
+ render name, :slim, options
31
+ end
32
+
33
+ def template(name, type=nil, &blk)
34
+ @templates.merge!({name => {content: blk.call, type: type}})
35
+ @templates[name]
36
+ end
37
+
38
+
39
+ private
40
+
41
+ def render(name, type, opt={})
42
+
43
+ options = {locals: {}}.merge!(opt)
44
+ locals = options.delete :locals
45
+
46
+ unless @templates[:layout] then
47
+ template(:layout, type) { File.read('views/layout.' + type.to_s) }
48
+ end
49
+
50
+ layout = Tilt[type.to_s].new(options) {|x| @templates[:layout][:content]}
51
+
52
+ unless @templates[name] then
53
+ template(name, type) { File.read("views/%s.%s" % [name.to_s, type.to_s])}
54
+ end
55
+
56
+ template = Tilt[type.to_s].new(options) {|x| @templates[name][:content]}
57
+ layout.render{ template.render(@parent, locals)}
58
+ end
59
+
60
+ def tilt(name, options={})
61
+
62
+ options = {locals: {}}.merge!(opt)
63
+ locals = options.delete :locals
64
+ layout = Tilt[@templates[:layout][:type].to_s].new(options)\
65
+ {|x| @templates[:layout][:content]}
66
+ template = Tilt[@templates[name][:type].to_s].new(options) \
67
+ {|x| @templates[name][:content]}
68
+ layout.render{ template.render(@parent, locals)}
69
+
70
+ end
71
+
72
+ end
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nthrut
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgo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JOz2AhAQAZ/7+Vt70
30
+ nndWdGVkI3CZ+C91v9DYXHLXeDV3F95zDtkFp8k4WggdKt1mtFiiQ7qCIGDMrhzi
31
+ T7PPVdwm7XRE34HKtLtp+cM8xT1vgJmAjM0pWCAlCrhmvMPSL6PUf/FtE/heYVna
32
+ jxXRml39vCKI+Q==
33
+ -----END CERTIFICATE-----
34
+ date: 2019-07-05 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: tilt
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '2.0'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 2.0.9
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '2.0'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 2.0.9
56
+ - !ruby/object:Gem::Dependency
57
+ name: slim
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '4.0'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 4.0.1
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '4.0'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 4.0.1
76
+ - !ruby/object:Gem::Dependency
77
+ name: haml
78
+ requirement: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 5.0.1
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '5.0'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 5.0.1
96
+ description:
97
+ email: james@jamesrobertson.eu
98
+ executables: []
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - lib/nthrut.rb
103
+ homepage: https://github.com/jrobertson/nthrut
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
107
+ post_install_message:
108
+ rdoc_options: []
109
+ require_paths:
110
+ - lib
111
+ required_ruby_version: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ requirements: []
122
+ rubygems_version: 3.0.1
123
+ signing_key:
124
+ specification_version: 4
125
+ summary: No Thrills HTML Renderer using Tilt (NThrut).
126
+ test_files: []
Binary file