planner_template 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/planner_template.rb +66 -0
- metadata +87 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7c2670a0da91a350d241f24be1522037b0f749fd
|
4
|
+
data.tar.gz: 5bdb85f06f990527b728a3bfd29237c9a8302c3c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 71c62baae39b148d57b87a7f7e55daf86523d3a4a8a3a3d1d0b5163c0916ac0084311a0539b631b39fb332bdff102d0bd72a7e682310a441dba5b2b4d533fd9e
|
7
|
+
data.tar.gz: 737610a604e7d2b2a409553e3c5e1b16145f88fb7079974e8eded81503b0594a42e54217fd648189b0002ddbd8d358b278dbfa313de974ba501ccae19dab508f
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: planner_template.rb
|
4
|
+
|
5
|
+
require 'nokorexi'
|
6
|
+
|
7
|
+
module LIBRARY
|
8
|
+
|
9
|
+
def fetch_filepath(filename)
|
10
|
+
|
11
|
+
lib = File.dirname(__FILE__)
|
12
|
+
File.join(lib, '..', 'template', filename)
|
13
|
+
end
|
14
|
+
|
15
|
+
def fetch_file(filename)
|
16
|
+
|
17
|
+
filepath = fetch_filepath filename
|
18
|
+
read filepath
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def generate_webpage(xml, xsl)
|
23
|
+
|
24
|
+
# transform the xml to html
|
25
|
+
doc = Nokogiri::XML(xml)
|
26
|
+
xslt = Nokogiri::XSLT(xsl)
|
27
|
+
xslt.transform(doc).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
def read(s)
|
31
|
+
RXFHelper.read(s).first
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class PlannerTemplate
|
36
|
+
include LIBRARY
|
37
|
+
|
38
|
+
|
39
|
+
def initialize(src, template: 'default')
|
40
|
+
|
41
|
+
@xml = read src
|
42
|
+
@xmldoc = Rexle.new(@xml)
|
43
|
+
@template = template
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_html()
|
48
|
+
xsl = fetch_file File.join(@template, 'planner.xsl')
|
49
|
+
@html = generate_webpage(@xml, xsl)
|
50
|
+
end
|
51
|
+
|
52
|
+
def to_xml(options)
|
53
|
+
Rexle.new(@xml).xml(options)
|
54
|
+
end
|
55
|
+
|
56
|
+
protected
|
57
|
+
|
58
|
+
def fetch_css()
|
59
|
+
|
60
|
+
%w(layout.css style.css).map do |filename|
|
61
|
+
fetch_file File.join(@template, filename)
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: planner_template
|
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
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE3MDUwNzExMzE1NFoXDTE4MDUwNzExMzE1NFowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldT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
jo3POqDsUuOz+w==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-05-07 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: nokorexi
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.3'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.3.1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.3'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.3.1
|
56
|
+
description:
|
57
|
+
email: james@jamesrobertson.eu
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/planner_template.rb
|
63
|
+
homepage: https://github.com/jrobertson/planner_template
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.6.8
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Base class for generating an HTML based weekly planner etc.
|
87
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|