legal_beagle 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -0
- data/lib/legal_beagle/info.rb +1 -1
- data/lib/legal_beagle/to_prawn.rb +34 -14
- metadata +52 -59
data/README.md
CHANGED
data/lib/legal_beagle/info.rb
CHANGED
@@ -7,30 +7,43 @@ module MaRuKu::Out::Prawn
|
|
7
7
|
@pdf = pdf
|
8
8
|
array_to_prawn(@children)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
def array_to_prawn(children)
|
12
12
|
children.each do |c|
|
13
13
|
send("to_prawn_#{c.node_type}", c)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def to_prawn_ol(ol)
|
18
|
+
ol.children.each_with_index do |c, i|
|
19
|
+
to_prawn_ol_span(c, i)
|
20
|
+
end
|
21
|
+
@pdf.text ' '
|
22
|
+
end
|
23
|
+
|
17
24
|
def to_prawn_ul(ul)
|
18
25
|
ul.children.each do |c|
|
19
|
-
|
26
|
+
to_prawn_ul_span(c)
|
20
27
|
end
|
21
28
|
@pdf.text ' '
|
22
29
|
end
|
23
|
-
|
24
|
-
def
|
30
|
+
|
31
|
+
def li_text(li)
|
25
32
|
if li.children.empty?
|
26
|
-
|
33
|
+
li.to_html
|
27
34
|
else
|
28
|
-
|
35
|
+
to_pdf_string(li.children)
|
29
36
|
end
|
30
|
-
|
31
|
-
@pdf.text " • " + text, :indent_paragraphs => 20
|
32
37
|
end
|
33
|
-
|
38
|
+
|
39
|
+
def to_prawn_ol_span(li, i)
|
40
|
+
@pdf.text " #{i+1}. " + li_text(li), :indent_paragraphs => 20
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_prawn_ul_span(li)
|
44
|
+
@pdf.text " • " + li_text(li), :indent_paragraphs => 20
|
45
|
+
end
|
46
|
+
|
34
47
|
def to_prawn_paragraph(para)
|
35
48
|
text = to_pdf_string(para.children)
|
36
49
|
@pdf.text text, :inline_format => true
|
@@ -55,6 +68,13 @@ module MaRuKu::Out::Prawn
|
|
55
68
|
"<strong>#{to_pdf_string(strong.children)}</strong>"
|
56
69
|
end
|
57
70
|
|
71
|
+
def to_prawn_string_im_image(image)
|
72
|
+
options = {}
|
73
|
+
options[:width] = image.children.first.to_i if image.children.first
|
74
|
+
@pdf.image image.url, options
|
75
|
+
""
|
76
|
+
end
|
77
|
+
|
58
78
|
def entity_table
|
59
79
|
@table ||= {
|
60
80
|
"lsquo" => "‘",
|
@@ -63,25 +83,25 @@ module MaRuKu::Out::Prawn
|
|
63
83
|
"rdquo" => "”"
|
64
84
|
}
|
65
85
|
end
|
66
|
-
|
86
|
+
|
67
87
|
def to_prawn_string_paragraph(para)
|
68
88
|
para.to_html
|
69
89
|
end
|
70
|
-
|
90
|
+
|
71
91
|
def to_prawn_string_entity(entity)
|
72
92
|
name = entity.entity_name
|
73
93
|
typographic = entity_table[name]
|
74
94
|
raise "I don't know how to make a typographic #{name}" unless typographic
|
75
95
|
typographic
|
76
96
|
end
|
77
|
-
|
97
|
+
|
78
98
|
# TODO find a less ghetto way to do leading-trailing margins
|
79
99
|
def to_prawn_header(header)
|
80
100
|
size = { 1 => 16, 2 => 12 }[header.level]
|
81
101
|
@pdf.text header.children.join("\n"), :size => size, :style => :bold
|
82
102
|
@pdf.text ' '
|
83
103
|
end
|
84
|
-
|
104
|
+
|
85
105
|
def to_prawn_div(div)
|
86
106
|
if div.attributes[:class] == "signature"
|
87
107
|
signature_name = div.children.map.join(" ")
|
@@ -98,7 +118,7 @@ module MaRuKu::Out::Prawn
|
|
98
118
|
text signature_name + " (Print)"
|
99
119
|
end
|
100
120
|
else
|
101
|
-
puts "Didn't write div to pdf: #{div.inspect}"
|
121
|
+
puts "Didn't write div to pdf: #{div.inspect}"
|
102
122
|
end
|
103
123
|
end
|
104
124
|
end
|
metadata
CHANGED
@@ -1,103 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: legal_beagle
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Mat Schaffer
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-28 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: jekyll
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70225829968280 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
18
|
+
requirements:
|
22
19
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 0.7.0
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: prawn
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *70225829968280
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: prawn
|
27
|
+
requirement: &70225829967780 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
29
|
+
requirements:
|
33
30
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
35
32
|
version: 0.11.1
|
36
33
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rspec
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *70225829967780
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &70225829967400 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version:
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
47
44
|
type: :development
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: mocha
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *70225829967400
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: mocha
|
49
|
+
requirement: &70225829966940 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
version:
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
58
55
|
type: :development
|
59
|
-
|
60
|
-
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70225829966940
|
58
|
+
description: This tool was originally developed by Mashion.net for use in generating
|
59
|
+
contracts and agreements. Hopefully it'll grow to somethign more useful eventually.
|
61
60
|
email: mat@mashion.net
|
62
61
|
executables: []
|
63
|
-
|
64
62
|
extensions: []
|
65
|
-
|
66
63
|
extra_rdoc_files: []
|
67
|
-
|
68
|
-
files:
|
64
|
+
files:
|
69
65
|
- README.md
|
70
66
|
- lib/legal_beagle/converter.rb
|
71
67
|
- lib/legal_beagle/info.rb
|
72
68
|
- lib/legal_beagle/to_prawn.rb
|
73
69
|
- lib/legal_beagle.rb
|
74
|
-
has_rdoc: true
|
75
70
|
homepage: http://github.com/mashion/legal_beagle
|
76
71
|
licenses: []
|
77
|
-
|
78
72
|
post_install_message:
|
79
73
|
rdoc_options: []
|
80
|
-
|
81
|
-
require_paths:
|
74
|
+
require_paths:
|
82
75
|
- lib
|
83
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
77
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version:
|
89
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
83
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
version:
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
95
88
|
requirements: []
|
96
|
-
|
97
89
|
rubyforge_project: nowarning
|
98
|
-
rubygems_version: 1.
|
90
|
+
rubygems_version: 1.8.15
|
99
91
|
signing_key:
|
100
92
|
specification_version: 3
|
101
|
-
summary: A very primitive tool for doing legal documents by converting markdown to
|
93
|
+
summary: A very primitive tool for doing legal documents by converting markdown to
|
94
|
+
pdf.
|
102
95
|
test_files: []
|
103
|
-
|
96
|
+
has_rdoc: false
|