printgraphpaper 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c049ad40600d3aaf91788b547acefecd7932c6b13d4fea9053c703a668b6c87a
4
+ data.tar.gz: bfdf7750f1329c12bddec4d4a9343b8dc2156cb06218c52052ab0cb10d1bb597
5
+ SHA512:
6
+ metadata.gz: 22a93d2daa70be5fd9bd3ffbead532ca6f3c2a3b0ab3458802f416b01248649951ba9ad28361e43af350891c74cca59f47e88e814240215cdfc8f07a2bfb62ba
7
+ data.tar.gz: bbc3e339d41c8f7497f08102f6926fc5d09db53d6f6ca4840eb5384fb2472b787b298143da71e5bf3714cc628b863743a3d8a7a82cc32dd17a27533da0285e35
checksums.yaml.gz.sig ADDED
Binary file
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: printgraphpaper.rb
4
+
5
+
6
+ require 'rexle'
7
+
8
+
9
+ class PrintGraphPaper
10
+
11
+ attr_reader :to_html
12
+
13
+ def initialize(orientation: :portrait, cols: 30, rows: 44,
14
+ size: '20px', color: '#aaa')
15
+
16
+ @orientation, @cols, @rows = orientation, cols, rows
17
+ @size, @color = size, color
18
+ @to_html = build_html()
19
+
20
+ end
21
+
22
+ private
23
+
24
+ def build_html()
25
+
26
+ doc = build_table()
27
+ table = doc.root.xml pretty: true
28
+
29
+ html=<<EOF
30
+ <!DOCTYPE html>
31
+ <html lang="en">
32
+ <head>
33
+ <meta charset="UTF-8" />
34
+ <title>Graph paper template</title>
35
+ <style>
36
+
37
+ table {}
38
+ table, th, td {
39
+ background-color: #{@color};
40
+ border: 1px solid black;
41
+ border-collapse: collapse;
42
+ }
43
+
44
+ td { background-color: transparent; width: 20px; height: 20px;}
45
+
46
+ @media print {
47
+ table, th, td {
48
+ border: 1px solid #{@color};
49
+ }
50
+
51
+ }
52
+
53
+ </style>
54
+ </head>
55
+ <body>
56
+ #{table}
57
+ </body>
58
+ </html>
59
+ EOF
60
+
61
+ end
62
+
63
+ def build_table()
64
+
65
+ doc = Rexle.new('<table/>')
66
+
67
+ @rows.times do
68
+
69
+ tr = Rexle::Element.new('tr')
70
+
71
+ @cols.times do
72
+ td = Rexle::Element.new('td', value: '&nbsp;')
73
+ tr.add td
74
+ end
75
+
76
+ doc.root.add tr
77
+
78
+ end
79
+
80
+ doc
81
+
82
+ end
83
+
84
+ end
85
+
86
+
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: printgraphpaper
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
+ MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
14
+ YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjEwNTE2MDk0NjUyWhcN
15
+ MjIwNTE2MDk0NjUyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
+ cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQD72xU2
17
+ y/s0H91BPF2KjsmykGYe0qePh99OIhs4adZJDQmZHmp7lfNAZaD5X+D8OjlTfpb9
18
+ 8Kk/bv3XwPv8RChnttNL5W38SL8lcCnN+5KjahXQAqvKdN7fvCFfaU1Lqo6NiOPY
19
+ MKcoo82aGF+Klu2Zhd0J7/HzS9oNbFc9+17mgMVwyJIsdkIQi/vaTGDVRJ4Mviqr
20
+ Sih6dUXUL5qHwIZ3E9boBdxSGfciuREqdMB/4ZoRDRC8pZO5vsW5tDpvRWUgKJxX
21
+ cs7NM687DfiOPNSkf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-05-16 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: rexle
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.5'
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 1.5.11
50
+ type: :runtime
51
+ prerelease: false
52
+ version_requirements: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - "~>"
55
+ - !ruby/object:Gem::Version
56
+ version: '1.5'
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 1.5.11
60
+ description:
61
+ email: digital.robertson@gmail.com
62
+ executables: []
63
+ extensions: []
64
+ extra_rdoc_files: []
65
+ files:
66
+ - lib/printgraphpaper.rb
67
+ homepage: https://github.com/jrobertson/printgraphpaper
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ requirements: []
86
+ rubyforge_project:
87
+ rubygems_version: 2.7.10
88
+ signing_key:
89
+ specification_version: 4
90
+ summary: Generates graph paper in HTML format suitable for printing.
91
+ test_files: []
metadata.gz.sig ADDED
Binary file