rrtf 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.byebug_history +6 -3
- data/CHANGELOG.md +24 -0
- data/README.md +194 -84
- data/documentation/RRTF.html +5 -5
- data/documentation/RRTF/AnonymousStyle.html +792 -0
- data/documentation/RRTF/BorderFormatting.html +821 -0
- data/documentation/RRTF/BorderStyle.html +493 -0
- data/documentation/RRTF/CharacterFormatting.html +293 -162
- data/documentation/RRTF/CharacterStyle.html +53 -109
- data/documentation/RRTF/Colour.html +61 -1
- data/documentation/RRTF/ColourTable.html +52 -52
- data/documentation/RRTF/CommandNode.html +367 -971
- data/documentation/RRTF/ContainerNode.html +44 -44
- data/documentation/RRTF/Converters.html +1 -1
- data/documentation/RRTF/Converters/HTML.html +1 -1
- data/documentation/RRTF/Converters/HTML/Helpers.html +1 -1
- data/documentation/RRTF/Converters/HTML/Node.html +1 -1
- data/documentation/RRTF/Converters/HTML/NodeSet.html +1 -1
- data/documentation/RRTF/Document.html +267 -255
- data/documentation/RRTF/DocumentFormatting.html +833 -0
- data/documentation/RRTF/DocumentProperties.html +444 -0
- data/documentation/RRTF/Font.html +1 -1
- data/documentation/RRTF/FontTable.html +1 -1
- data/documentation/RRTF/FooterNode.html +16 -16
- data/documentation/RRTF/GeometryNode.html +774 -0
- data/documentation/RRTF/GeometryProperties.html +1014 -0
- data/documentation/RRTF/HeaderNode.html +16 -16
- data/documentation/RRTF/ImageNode.html +705 -492
- data/documentation/RRTF/Information.html +1 -1
- data/documentation/RRTF/LinkNode.html +10 -10
- data/documentation/RRTF/ListLevel.html +1 -1
- data/documentation/RRTF/ListLevelNode.html +37 -37
- data/documentation/RRTF/ListMarker.html +1 -1
- data/documentation/RRTF/ListNode.html +19 -19
- data/documentation/RRTF/ListTable.html +1 -1
- data/documentation/RRTF/ListTemplate.html +1 -1
- data/documentation/RRTF/ListTextNode.html +14 -14
- data/documentation/RRTF/Node.html +26 -26
- data/documentation/RRTF/Page.html +129 -0
- data/documentation/RRTF/Page/Margin.html +1158 -0
- data/documentation/RRTF/Page/Size.html +946 -0
- data/documentation/RRTF/PageFormatting.html +954 -0
- data/documentation/RRTF/ParagraphFormatting.html +338 -56
- data/documentation/RRTF/ParagraphNode.html +10 -10
- data/documentation/RRTF/ParagraphStyle.html +72 -111
- data/documentation/RRTF/PositionFormatting.html +780 -0
- data/documentation/RRTF/PositionStyle.html +424 -0
- data/documentation/RRTF/Properties.html +243 -0
- data/documentation/RRTF/RTFError.html +21 -10
- data/documentation/RRTF/ShadingFormatting.html +712 -0
- data/documentation/RRTF/ShadingStyle.html +424 -0
- data/documentation/RRTF/Style.html +284 -697
- data/documentation/RRTF/Stylesheet.html +36 -3
- data/documentation/RRTF/TableCellNode.html +131 -131
- data/documentation/RRTF/TableNode.html +82 -82
- data/documentation/RRTF/TableRowNode.html +53 -53
- data/documentation/RRTF/TextNode.html +46 -46
- data/documentation/RRTF/Utilities.html +837 -17
- data/documentation/_index.html +139 -6
- data/documentation/class_list.html +1 -1
- data/documentation/file.README.html +218 -87
- data/documentation/index.html +218 -87
- data/documentation/method_list.html +631 -391
- data/documentation/top-level-namespace.html +1 -1
- data/examples/01.rtf +947 -20
- data/examples/01_everything.rb +176 -0
- data/examples/02.rtf +13 -0
- data/examples/02_basic_paragraph.rb +10 -0
- data/examples/03.rtf +20 -0
- data/examples/03_paragraph_inline_style.rb +14 -0
- data/examples/04.rtf +21 -0
- data/examples/04_paragraph_with_character_style.rb +18 -0
- data/examples/05.rtf +21 -0
- data/examples/05_hyperlinks.rb +21 -0
- data/examples/06.rtf +21 -0
- data/examples/06_basic_list.rb +21 -0
- data/examples/07.rtf +28 -0
- data/examples/07_nested_list.rb +27 -0
- data/examples/08.rtf +807 -0
- data/examples/08_images.rb +17 -0
- data/examples/09.rtf +84 -0
- data/examples/09_shapes.rb +56 -0
- data/examples/10.rtf +34 -0
- data/examples/10_stylesheet.rb +18 -0
- data/examples/resources/images/redshirt.png +0 -0
- data/examples/resources/images/redshirts.jpg +0 -0
- data/examples/resources/json/redshirt_styles.json +72 -8
- data/examples/~$01.rtf +0 -0
- data/lib/rrtf.rb +4 -16
- data/lib/rrtf/colour.rb +8 -0
- data/lib/rrtf/formatting.rb +988 -0
- data/lib/rrtf/node.rb +17 -1851
- data/lib/rrtf/node/command_node.rb +242 -0
- data/lib/rrtf/node/container_node.rb +75 -0
- data/lib/rrtf/node/document.rb +339 -0
- data/lib/rrtf/node/footer_node.rb +47 -0
- data/lib/rrtf/node/geometry_node.rb +65 -0
- data/lib/rrtf/node/header_node.rb +47 -0
- data/lib/rrtf/node/image_node.rb +175 -0
- data/lib/rrtf/node/link_node.rb +10 -0
- data/lib/rrtf/node/list_level_node.rb +44 -0
- data/lib/rrtf/node/list_node.rb +30 -0
- data/lib/rrtf/node/list_text_node.rb +22 -0
- data/lib/rrtf/node/node.rb +53 -0
- data/lib/rrtf/node/paragraph_node.rb +11 -0
- data/lib/rrtf/node/table_cell_node.rb +233 -0
- data/lib/rrtf/node/table_node.rb +136 -0
- data/lib/rrtf/node/table_row_node.rb +92 -0
- data/lib/rrtf/node/text_node.rb +76 -0
- data/lib/rrtf/page.rb +7 -0
- data/lib/rrtf/page/margin.rb +98 -0
- data/lib/rrtf/page/size.rb +98 -0
- data/lib/rrtf/properties.rb +3 -0
- data/lib/rrtf/properties/document_properties.rb +34 -0
- data/lib/rrtf/properties/geometry_properties.rb +380 -0
- data/lib/rrtf/properties/properties.rb +13 -0
- data/lib/rrtf/style.rb +4 -5
- data/lib/rrtf/style/anonymous_style.rb +73 -0
- data/lib/rrtf/style/border_style.rb +27 -0
- data/lib/rrtf/style/character_style.rb +1 -7
- data/lib/rrtf/style/paragraph_style.rb +0 -6
- data/lib/rrtf/style/position_style.rb +26 -0
- data/lib/rrtf/style/shading_style.rb +26 -0
- data/lib/rrtf/style/style.rb +60 -101
- data/lib/rrtf/utilities.rb +138 -0
- data/lib/rrtf/version.rb +1 -1
- data/rrtf.gemspec +1 -0
- metadata +85 -10
- data/examples/01_mac_libreoffice5_2_3_3.png +0 -0
- data/examples/01_mac_pages6_2.png +0 -0
- data/examples/01_mac_textedit1_12.png +0 -0
- data/examples/01_mac_word15_36.png +0 -0
- data/examples/01_styles_and_paragraphs.rb +0 -32
- data/lib/rrtf/paper.rb +0 -53
- data/lib/rrtf/style/document_style.rb +0 -116
- data/lib/rrtf/style/formatting.rb +0 -320
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc70901e84aadb460e92e00edce17a81a70cd993
|
4
|
+
data.tar.gz: 9cbfde57e949d1479bf77b7f0773d9502a4436e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01d07f75d2b50486c3e55174e10dff2954e235ce6c999be4b8a9d6abb1d5904df7c7a6578c9cebc3606d7ad59fd829031e3d5210233d1d172dd56b1a8cf6bb33
|
7
|
+
data.tar.gz: 0a74b57a08c94e549579b21196109718c3e2eac0fb042c760f3820224a21898e249997e4483ce2511cbccdc90527c7484c464c5755282768fc2fd574f3c1ba30
|
data/.byebug_history
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
_Version 0.0.1:_
|
2
|
+
|
3
|
+
- Initial RRTF release based on the ifad-rtf gem with stylesheet support added.
|
4
|
+
|
5
|
+
_Version 0.0.2:_
|
6
|
+
|
7
|
+
- Simplified style syntax and changed all options hash keys to strings.
|
8
|
+
- Extract paragraph & character style formatting attributes into modules.
|
9
|
+
|
10
|
+
_Version 1.0.0:_
|
11
|
+
|
12
|
+
- Migrate DocumentStyle to DocumentProperties since DocumentStyle was not logically a descendent of the Style class (a style can be added to a stylesheet and applied to elements within a document, e.g. paragraphs, characters, tables, but use properties to style an entire document).
|
13
|
+
- Extract document and page formatting attributes into modules.
|
14
|
+
- Create Page module and Page::Margin and Page::Size classes to assist in parsing page size and margin from strings.
|
15
|
+
- Use the FastImage gem to identify image type and dimensions in place of custom byte-level functions.
|
16
|
+
- Remove character formatting helpers (bold, italic, font, etc.); use apply() with anonymous styles instead.
|
17
|
+
- Remove crop options from ImageNode; Word 2016 improperly parses them and LibreOffice ignores them.
|
18
|
+
- Remove x_scaling and y_scaling attributes from ImageNode; the same behavior can be accomplished with display_width & display_height.
|
19
|
+
- Add sizing_mode attribute to ImageNode to allow absolute sizing and fixed aspect ratio sizing.
|
20
|
+
- Allow anonymous paragraph and character styles.
|
21
|
+
- Add AnonymousStyle base class to support other style types (e.g. border styling).
|
22
|
+
- Add BorderFormatting module and BorderStyle class to allow border definition on paragraphs and images.
|
23
|
+
- Add ShadingFormatting module and ShadingStyle class to allow paragraph shading.
|
24
|
+
- Add ShapeNode class to implement basic shapes.
|
data/README.md
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
# RRTF: Ruby Rich-Text-Format Document Generator
|
2
2
|
|
3
|
-
RRTF enables programatic creation of Rich Text Format (RTF) documents in Ruby, focusing on simplifying RTF document assembly and generating clean RTF source code. This gem is founded on the [ifad-rtf gem](https://github.com/clbustos/rtf), but
|
3
|
+
RRTF enables programatic creation of Rich Text Format (RTF) documents in Ruby, focusing on simplifying RTF document assembly and generating clean RTF source code. This gem is founded on the [ifad-rtf gem](https://github.com/clbustos/rtf), but has simpler syntax and supports more RTF constructs.
|
4
4
|
|
5
|
-
-
|
6
|
-
-
|
7
|
-
-
|
5
|
+
- __Document__: Page orientation, size, margin, and gutter; mirror margins, tab width, enable/disable hyphenation, hyphenation width, maximum consecutive hyphenations, and enable/disable widow-and-orphan control.
|
6
|
+
- __Text__: Bold, italic, underline, underline color, uppercase, subscript, superscript, strike, emboss, imprint, foreground color, background color, hidden, kerning, character spacing, highlight, font, font size.
|
7
|
+
- __Paragraphs__: Justification, left indent, right indent, first line indent, space before, space after, line spacing, indentation, drop caps, keep-on-page, keep-with-next, enable/disable hyphenation, enable/disable widow-and-orphan control, absolute positioning (frames), borders, and shading.
|
8
|
+
- __Hyperlinks__: Insert hyperlinks in text runs.
|
9
|
+
- __Lists__: Basic unordered (bullet) lists.
|
10
|
+
- __Images__: Embed, size, and define borders for PNG, JPEG, and BMP images.
|
11
|
+
- __Shapes__: Draw basic shapes, custom shapes, and text boxes.
|
12
|
+
- __Stylesheets__: Define paragraph and character styles, enabling the end user to easily modify the look of RTF documents.
|
8
13
|
|
9
|
-
The gem was created with reference to the [Microsoft Office RTF Specification (v1.9.1)](https://www.microsoft.com/en-us/download/details.aspx?id=10725).
|
14
|
+
The gem was created with reference to the [Microsoft Office RTF Specification (v1.9.1)](https://www.microsoft.com/en-us/download/details.aspx?id=10725). The syntax for custom shapes was determined by reverse engineering the RTF output from Word 2016 and reference to [Microsoft's Binary Format Specification (pp. 32-33)](https://www.loc.gov/preservation/digital/formats/digformatspecs/OfficeDrawing97-2007BinaryFormatSpecification.pdf).
|
10
15
|
|
11
16
|
## Installation
|
12
17
|
|
@@ -26,97 +31,203 @@ Or install it yourself as:
|
|
26
31
|
|
27
32
|
## Usage
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
"base_style": "BODY",
|
42
|
-
"justification": "CENTER",
|
43
|
-
"space_after": 100,
|
44
|
-
"bold": true,
|
45
|
-
"underline": "DOUBLE",
|
46
|
-
"underline_color": "#ff0000",
|
47
|
-
"uppercase": true,
|
48
|
-
"font_size": 36
|
49
|
-
},
|
50
|
-
{
|
51
|
-
"type": "paragraph",
|
52
|
-
"id": "H1",
|
53
|
-
"name": "Heading 1",
|
54
|
-
"primary": true,
|
55
|
-
"next_style": "BODY",
|
56
|
-
"space_after": 40,
|
57
|
-
"space_before": 200,
|
58
|
-
"underline": "SINGLE",
|
59
|
-
"underline_color": "#ff0000",
|
60
|
-
"bold": true,
|
61
|
-
"font_size": 24
|
62
|
-
},
|
63
|
-
{
|
64
|
-
"type": "paragraph",
|
65
|
-
"id": "BODY",
|
66
|
-
"name": "Normal",
|
67
|
-
"primary": true,
|
68
|
-
"default": true,
|
69
|
-
"justification": "LEFT",
|
70
|
-
"font_size": 24,
|
71
|
-
"hyphenate": true
|
72
|
-
},
|
73
|
-
{
|
74
|
-
"type": "character",
|
75
|
-
"id": "EMPH",
|
76
|
-
"name": "Emphasis",
|
77
|
-
"additive": true,
|
78
|
-
"italic": true,
|
79
|
-
"bold": true,
|
80
|
-
"foreground_color": "#ff0000",
|
81
|
-
"locked": true
|
82
|
-
}
|
83
|
-
]
|
34
|
+
```ruby
|
35
|
+
require 'rrtf'
|
36
|
+
|
37
|
+
# Construct an object representing the RTF document
|
38
|
+
rtf = RRTF::Document.new
|
39
|
+
|
40
|
+
# ...
|
41
|
+
# Call methods on `rtf` to generate content
|
42
|
+
# ...
|
43
|
+
|
44
|
+
# Convert document into RTF string
|
45
|
+
rtf.to_rtf
|
84
46
|
```
|
85
47
|
|
86
|
-
|
48
|
+
#### Paragraphs
|
49
|
+
|
50
|
+
- __Plain paragraph__
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
rtf.paragraph << \
|
54
|
+
"Should you ever find yourself on a spacefaring vessel "\
|
55
|
+
"wearing RED shirt, take heed and be on guard, for danger "\
|
56
|
+
"is immanent and you are likely expendable among the crew."
|
57
|
+
```
|
58
|
+
|
59
|
+
- __Paragraph with inline styling__
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
rtf.paragraph(
|
63
|
+
"justification" => "RIGHT",
|
64
|
+
"foreground_color" => '#ff0000',
|
65
|
+
"font" => "ROMAN:Times"
|
66
|
+
) << \
|
67
|
+
"Should you ever find yourself on a spacefaring vessel "\
|
68
|
+
"wearing RED shirt, take heed and be on guard, for danger "\
|
69
|
+
"is immanent and you are likely expendable among the crew."
|
70
|
+
```
|
71
|
+
|
72
|
+
- __Paragraph with inline character styling__
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
rtf.paragraph do |p|
|
76
|
+
p << "Should you ever find yourself on a spacefaring vessel wearing a "
|
77
|
+
p.apply(
|
78
|
+
"foreground_color" => '#ff0000',
|
79
|
+
"underline_color" => '#ff0000',
|
80
|
+
"italic" => true,
|
81
|
+
"bold" => true,
|
82
|
+
"underline" => "SINGLE"
|
83
|
+
) << "red"
|
84
|
+
p << " shirt, take heed and be on guard, for danger "
|
85
|
+
p << "is immanent and you are likely expendable among the crew."
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
#### Hyperlinks
|
87
90
|
|
88
|
-
|
91
|
+
```ruby
|
92
|
+
rtf.paragraph do |p|
|
93
|
+
p << "Should you ever find yourself on a spacefaring vessel wearing a "
|
94
|
+
p.apply(
|
95
|
+
"foreground_color" => '#ff0000',
|
96
|
+
"underline_color" => '#ff0000',
|
97
|
+
"italic" => true,
|
98
|
+
"bold" => true,
|
99
|
+
"underline" => "SINGLE"
|
100
|
+
) do |emphasis|
|
101
|
+
emphasis.link(
|
102
|
+
"https://en.wikipedia.org/wiki/Redshirt_(character)", "red shirt")
|
103
|
+
end
|
104
|
+
p << ", take heed and be on guard, for danger "
|
105
|
+
p << "is immanent and you are likely expendable among the crew."
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
109
|
+
#### Lists
|
89
110
|
|
90
111
|
```ruby
|
91
|
-
|
92
|
-
|
112
|
+
rtf.list do |l|
|
113
|
+
l.item do |li|
|
114
|
+
li << "Never venture into an ominous setting."
|
115
|
+
end
|
116
|
+
|
117
|
+
l.item do |li|
|
118
|
+
li << "Never attempt to disable an unknown entity. "
|
119
|
+
li << "Get away quickly."
|
120
|
+
end
|
121
|
+
|
122
|
+
l.item do |li|
|
123
|
+
li << "Never stand guard alone. Make certain at least three "
|
124
|
+
li << "other redshirts are present."
|
125
|
+
end
|
126
|
+
end
|
127
|
+
```
|
128
|
+
|
129
|
+
#### Images
|
130
|
+
|
131
|
+
```ruby
|
132
|
+
rtf.image(DIR+'/resources/images/redshirt.png',
|
133
|
+
"width" => "2in", # can also set "height"
|
134
|
+
"sizing_mode" => "FIX_ASPECT_RATIO", # can also be "ABSOLUTE"
|
135
|
+
"border" => {
|
136
|
+
"sides" => "ALL",
|
137
|
+
"color" => '#ff0000',
|
138
|
+
"line_type" => "DOT",
|
139
|
+
"width" => "5pt",
|
140
|
+
"spacing" => "12pt"
|
141
|
+
}
|
142
|
+
)
|
143
|
+
```
|
93
144
|
|
94
|
-
|
145
|
+
#### Shapes
|
146
|
+
|
147
|
+
- __Basic shapes__
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
rtf.geometry(
|
151
|
+
"type" => "RECTANGLE",
|
152
|
+
"fill_color" => '#cccccc',
|
153
|
+
"top" => 0,
|
154
|
+
"left" => 0,
|
155
|
+
"width" => "2in",
|
156
|
+
"height" => "2in",
|
157
|
+
"horizontal_reference" => "PAGE",
|
158
|
+
"vertical_reference" => "PAGE"
|
159
|
+
)
|
160
|
+
```
|
161
|
+
|
162
|
+
- __Text boxes__
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
rtf.geometry(
|
166
|
+
"type" => "TEXT_BOX",
|
167
|
+
"line_color" => '#000000',
|
168
|
+
"line_width" => '3pt',
|
169
|
+
"top" => "5in",
|
170
|
+
"left" => "2.5in",
|
171
|
+
"width" => "3in",
|
172
|
+
"height" => "3in",
|
173
|
+
"horizontal_reference" => "PAGE",
|
174
|
+
"vertical_reference" => "PAGE"
|
175
|
+
) do |box|
|
176
|
+
box.paragraph do |p|
|
177
|
+
p << "Should you ever find yourself on a spacefaring vessel wearing a "
|
178
|
+
p << "RED"
|
179
|
+
p << " shirt, take heed and be on guard, for danger "
|
180
|
+
p << "is immanent and you are likely expendable among the crew."
|
181
|
+
end
|
182
|
+
end
|
183
|
+
```
|
184
|
+
|
185
|
+
- __Custom shapes__
|
186
|
+
|
187
|
+
```ruby
|
188
|
+
rtf.geometry(
|
189
|
+
"type" => "CUSTOM",
|
190
|
+
"top" => 0,
|
191
|
+
"left" => "4in",
|
192
|
+
"width" => "3in",
|
193
|
+
"height" => "3in",
|
194
|
+
"path" => [
|
195
|
+
# points are relative to the upper left corner of the shape as
|
196
|
+
# determined by "top"/"left"/"bottom"/"right"/"width"/"height"
|
197
|
+
["START_AT", [0,0] ],
|
198
|
+
["LINE_TO", ['2in', 0] ],
|
199
|
+
["CUBIC_BEZIER_TO", ['3in', 0], ['3in', '1.5in'], ['3in', '3in'] ],
|
200
|
+
["LINE_TO", [0, 0] ],
|
201
|
+
["CLOSE_PATH" ],
|
202
|
+
["END" ]
|
203
|
+
],
|
204
|
+
"fill_color" => '#00cc00',
|
205
|
+
"line_color" => '#000099'
|
206
|
+
)
|
207
|
+
```
|
208
|
+
|
209
|
+
#### Stylesheet
|
95
210
|
|
211
|
+
```ruby
|
212
|
+
raw_styles = JSON.parse File.read(DIR+'/resources/json/redshirt_styles.json')
|
96
213
|
rtf = RRTF::Document.new("stylesheet" => raw_styles)
|
97
214
|
styles = rtf.stylesheet.styles
|
98
215
|
|
99
|
-
rtf.paragraph(styles['TITLE']) << "
|
100
|
-
rtf.paragraph(styles['
|
101
|
-
p << "
|
102
|
-
p.apply(
|
103
|
-
p << "
|
104
|
-
p << "likely expendable among the crew..."
|
105
|
-
end
|
106
|
-
rtf.paragraph(styles['H1']) << "1. The Danger of Away Missions"
|
107
|
-
rtf.paragraph(styles['BODY']) do |p|
|
108
|
-
p << "If you're ever assigned an away mission, it's almost certain to be your doom. "
|
109
|
-
p << "The optimal strategy is to avoid away missions to begin with..."
|
110
|
-
end
|
111
|
-
rtf.paragraph(styles['H1']) << "2. Avoiding High-Ranking Officers"
|
112
|
-
rtf.paragraph(styles['BODY']) do |p|
|
113
|
-
p << "You're likely to notice an influx of unfortunate outcomes around "
|
114
|
-
p << "certain high-ranking officers. Its to your advantage to quickly identify and "
|
115
|
-
p << "avoid these officers..."
|
216
|
+
rtf.paragraph(styles['TITLE']) << "Redshirt Pocket Guide"
|
217
|
+
rtf.paragraph(styles['SUBTITLE']) do |p|
|
218
|
+
p << "3"
|
219
|
+
p.apply("superscript" => true) << "rd"
|
220
|
+
p << " Edition"
|
116
221
|
end
|
117
222
|
```
|
118
223
|
|
119
|
-
|
224
|
+
## TODO
|
225
|
+
|
226
|
+
- Develop rspec examples to replace the unit tests for the classes in the original ifad-rtf gem.
|
227
|
+
- Make existing comments yard friendly.
|
228
|
+
- Refactor interface between styles and colour/font tables: right now AnonymousStyle defines push_colours and push_fonts methods that are called by CommandNode#paragraph, CommandNode#apply, and ImageNode#initialize (these actions should rather be taken when a style is created or updated).
|
229
|
+
- Fix list and nested list formatting issues (alignment).
|
230
|
+
- Add support for tables.
|
120
231
|
|
121
232
|
## Development
|
122
233
|
|
@@ -128,7 +239,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
128
239
|
|
129
240
|
Bug reports and pull requests are welcome on GitHub at https://github.com/whileman133/rrtf.
|
130
241
|
|
131
|
-
|
132
242
|
## License
|
133
243
|
|
134
244
|
Just like ifad-rtf, this gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/documentation/RRTF.html
CHANGED
@@ -79,7 +79,7 @@
|
|
79
79
|
<dl>
|
80
80
|
<dt>Defined in:</dt>
|
81
81
|
<dd>lib/rrtf.rb<span class="defines">,<br />
|
82
|
-
lib/rrtf/font.rb,<br /> lib/rrtf/list.rb,<br /> lib/rrtf/node.rb,<br /> lib/rrtf/
|
82
|
+
lib/rrtf/font.rb,<br /> lib/rrtf/list.rb,<br /> lib/rrtf/colour.rb,<br /> lib/rrtf/version.rb,<br /> lib/rrtf/node/node.rb,<br /> lib/rrtf/utilities.rb,<br /> lib/rrtf/stylesheet.rb,<br /> lib/rrtf/information.rb,<br /> lib/rrtf/style/style.rb,<br /> lib/rrtf/node/document.rb,<br /> lib/rrtf/node/link_node.rb,<br /> lib/rrtf/node/list_node.rb,<br /> lib/rrtf/node/text_node.rb,<br /> lib/rrtf/node/image_node.rb,<br /> lib/rrtf/node/table_node.rb,<br /> lib/rrtf/node/footer_node.rb,<br /> lib/rrtf/node/header_node.rb,<br /> lib/rrtf/node/command_node.rb,<br /> lib/rrtf/node/geometry_node.rb,<br /> lib/rrtf/style/border_style.rb,<br /> lib/rrtf/node/container_node.rb,<br /> lib/rrtf/node/list_text_node.rb,<br /> lib/rrtf/node/paragraph_node.rb,<br /> lib/rrtf/node/table_row_node.rb,<br /> lib/rrtf/style/shading_style.rb,<br /> lib/rrtf/node/list_level_node.rb,<br /> lib/rrtf/node/table_cell_node.rb,<br /> lib/rrtf/style/position_style.rb,<br /> lib/rrtf/properties/properties.rb,<br /> lib/rrtf/style/anonymous_style.rb,<br /> lib/rrtf/style/character_style.rb,<br /> lib/rrtf/style/paragraph_style.rb,<br /> lib/rrtf/properties/document_properties.rb,<br /> lib/rrtf/properties/geometry_properties.rb</span>
|
83
83
|
</dd>
|
84
84
|
</dl>
|
85
85
|
|
@@ -89,11 +89,11 @@
|
|
89
89
|
<p class="children">
|
90
90
|
|
91
91
|
|
92
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="RRTF/CharacterFormatting.html" title="RRTF::CharacterFormatting (module)">CharacterFormatting</a></span>, <span class='object_link'><a href="RRTF/Converters.html" title="RRTF::Converters (module)">Converters</a></span>, <span class='object_link'><a href="RRTF/ParagraphFormatting.html" title="RRTF::ParagraphFormatting (module)">ParagraphFormatting</a></span>
|
92
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="RRTF/BorderFormatting.html" title="RRTF::BorderFormatting (module)">BorderFormatting</a></span>, <span class='object_link'><a href="RRTF/CharacterFormatting.html" title="RRTF::CharacterFormatting (module)">CharacterFormatting</a></span>, <span class='object_link'><a href="RRTF/Converters.html" title="RRTF::Converters (module)">Converters</a></span>, <span class='object_link'><a href="RRTF/DocumentFormatting.html" title="RRTF::DocumentFormatting (module)">DocumentFormatting</a></span>, <span class='object_link'><a href="RRTF/Page.html" title="RRTF::Page (module)">Page</a></span>, <span class='object_link'><a href="RRTF/PageFormatting.html" title="RRTF::PageFormatting (module)">PageFormatting</a></span>, <span class='object_link'><a href="RRTF/ParagraphFormatting.html" title="RRTF::ParagraphFormatting (module)">ParagraphFormatting</a></span>, <span class='object_link'><a href="RRTF/PositionFormatting.html" title="RRTF::PositionFormatting (module)">PositionFormatting</a></span>, <span class='object_link'><a href="RRTF/ShadingFormatting.html" title="RRTF::ShadingFormatting (module)">ShadingFormatting</a></span>
|
93
93
|
|
94
94
|
|
95
95
|
|
96
|
-
<strong class="classes">Classes:</strong> <span class='object_link'><a href="RRTF/CharacterStyle.html" title="RRTF::CharacterStyle (class)">CharacterStyle</a></span>, <span class='object_link'><a href="RRTF/Colour.html" title="RRTF::Colour (class)">Colour</a></span>, <span class='object_link'><a href="RRTF/ColourTable.html" title="RRTF::ColourTable (class)">ColourTable</a></span>, <span class='object_link'><a href="RRTF/CommandNode.html" title="RRTF::CommandNode (class)">CommandNode</a></span>, <span class='object_link'><a href="RRTF/ContainerNode.html" title="RRTF::ContainerNode (class)">ContainerNode</a></span>, <span class='object_link'><a href="RRTF/Document.html" title="RRTF::Document (class)">Document</a></span>, <span class='object_link'><a href="RRTF/
|
96
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="RRTF/AnonymousStyle.html" title="RRTF::AnonymousStyle (class)">AnonymousStyle</a></span>, <span class='object_link'><a href="RRTF/BorderStyle.html" title="RRTF::BorderStyle (class)">BorderStyle</a></span>, <span class='object_link'><a href="RRTF/CharacterStyle.html" title="RRTF::CharacterStyle (class)">CharacterStyle</a></span>, <span class='object_link'><a href="RRTF/Colour.html" title="RRTF::Colour (class)">Colour</a></span>, <span class='object_link'><a href="RRTF/ColourTable.html" title="RRTF::ColourTable (class)">ColourTable</a></span>, <span class='object_link'><a href="RRTF/CommandNode.html" title="RRTF::CommandNode (class)">CommandNode</a></span>, <span class='object_link'><a href="RRTF/ContainerNode.html" title="RRTF::ContainerNode (class)">ContainerNode</a></span>, <span class='object_link'><a href="RRTF/Document.html" title="RRTF::Document (class)">Document</a></span>, <span class='object_link'><a href="RRTF/DocumentProperties.html" title="RRTF::DocumentProperties (class)">DocumentProperties</a></span>, <span class='object_link'><a href="RRTF/Font.html" title="RRTF::Font (class)">Font</a></span>, <span class='object_link'><a href="RRTF/FontTable.html" title="RRTF::FontTable (class)">FontTable</a></span>, <span class='object_link'><a href="RRTF/FooterNode.html" title="RRTF::FooterNode (class)">FooterNode</a></span>, <span class='object_link'><a href="RRTF/GeometryNode.html" title="RRTF::GeometryNode (class)">GeometryNode</a></span>, <span class='object_link'><a href="RRTF/GeometryProperties.html" title="RRTF::GeometryProperties (class)">GeometryProperties</a></span>, <span class='object_link'><a href="RRTF/HeaderNode.html" title="RRTF::HeaderNode (class)">HeaderNode</a></span>, <span class='object_link'><a href="RRTF/ImageNode.html" title="RRTF::ImageNode (class)">ImageNode</a></span>, <span class='object_link'><a href="RRTF/Information.html" title="RRTF::Information (class)">Information</a></span>, <span class='object_link'><a href="RRTF/LinkNode.html" title="RRTF::LinkNode (class)">LinkNode</a></span>, <span class='object_link'><a href="RRTF/ListLevel.html" title="RRTF::ListLevel (class)">ListLevel</a></span>, <span class='object_link'><a href="RRTF/ListLevelNode.html" title="RRTF::ListLevelNode (class)">ListLevelNode</a></span>, <span class='object_link'><a href="RRTF/ListMarker.html" title="RRTF::ListMarker (class)">ListMarker</a></span>, <span class='object_link'><a href="RRTF/ListNode.html" title="RRTF::ListNode (class)">ListNode</a></span>, <span class='object_link'><a href="RRTF/ListTable.html" title="RRTF::ListTable (class)">ListTable</a></span>, <span class='object_link'><a href="RRTF/ListTemplate.html" title="RRTF::ListTemplate (class)">ListTemplate</a></span>, <span class='object_link'><a href="RRTF/ListTextNode.html" title="RRTF::ListTextNode (class)">ListTextNode</a></span>, <span class='object_link'><a href="RRTF/Node.html" title="RRTF::Node (class)">Node</a></span>, <span class='object_link'><a href="RRTF/ParagraphNode.html" title="RRTF::ParagraphNode (class)">ParagraphNode</a></span>, <span class='object_link'><a href="RRTF/ParagraphStyle.html" title="RRTF::ParagraphStyle (class)">ParagraphStyle</a></span>, <span class='object_link'><a href="RRTF/PositionStyle.html" title="RRTF::PositionStyle (class)">PositionStyle</a></span>, <span class='object_link'><a href="RRTF/Properties.html" title="RRTF::Properties (class)">Properties</a></span>, <span class='object_link'><a href="RRTF/RTFError.html" title="RRTF::RTFError (class)">RTFError</a></span>, <span class='object_link'><a href="RRTF/ShadingStyle.html" title="RRTF::ShadingStyle (class)">ShadingStyle</a></span>, <span class='object_link'><a href="RRTF/Style.html" title="RRTF::Style (class)">Style</a></span>, <span class='object_link'><a href="RRTF/Stylesheet.html" title="RRTF::Stylesheet (class)">Stylesheet</a></span>, <span class='object_link'><a href="RRTF/TableCellNode.html" title="RRTF::TableCellNode (class)">TableCellNode</a></span>, <span class='object_link'><a href="RRTF/TableNode.html" title="RRTF::TableNode (class)">TableNode</a></span>, <span class='object_link'><a href="RRTF/TableRowNode.html" title="RRTF::TableRowNode (class)">TableRowNode</a></span>, <span class='object_link'><a href="RRTF/TextNode.html" title="RRTF::TextNode (class)">TextNode</a></span>, <span class='object_link'><a href="RRTF/Utilities.html" title="RRTF::Utilities (class)">Utilities</a></span>
|
97
97
|
|
98
98
|
|
99
99
|
</p>
|
@@ -104,7 +104,7 @@
|
|
104
104
|
<dt id="VERSION-constant" class="">VERSION =
|
105
105
|
|
106
106
|
</dt>
|
107
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.
|
107
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>1.0.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
108
108
|
|
109
109
|
</dl>
|
110
110
|
|
@@ -119,7 +119,7 @@
|
|
119
119
|
</div>
|
120
120
|
|
121
121
|
<div id="footer">
|
122
|
-
Generated on Mon Jul
|
122
|
+
Generated on Mon Jul 31 21:48:57 2017 by
|
123
123
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
124
124
|
0.9.9 (ruby-2.3.3).
|
125
125
|
</div>
|
@@ -0,0 +1,792 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: RRTF::AnonymousStyle
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.9
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "RRTF::AnonymousStyle";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (A)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../RRTF.html" title="RRTF (module)">RRTF</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">AnonymousStyle</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: RRTF::AnonymousStyle
|
63
|
+
<span class="abstract note title">Abstract</span>
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">RRTF::AnonymousStyle</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<dl>
|
96
|
+
<dt>Defined in:</dt>
|
97
|
+
<dd>lib/rrtf/style/anonymous_style.rb</dd>
|
98
|
+
</dl>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
<div class="note abstract">
|
105
|
+
<strong>This class is abstract.</strong>
|
106
|
+
<div class='inline'></div>
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<p>Represents an arbitrary style that can be applied to an element within an
|
110
|
+
RTF document (e.g. paragraph, characters, border, table, etc.)</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
<p class="tag_title">Author:</p>
|
118
|
+
<ul class="author">
|
119
|
+
|
120
|
+
<li>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
<div class='inline'>
|
127
|
+
<p>Wesley Hileman</p>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</li>
|
131
|
+
|
132
|
+
</ul>
|
133
|
+
<p class="tag_title">Since:</p>
|
134
|
+
<ul class="since">
|
135
|
+
|
136
|
+
<li>
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<div class='inline'>
|
143
|
+
<p>1.0.0</p>
|
144
|
+
</div>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
</div><div id="subclasses">
|
151
|
+
<h2>Direct Known Subclasses</h2>
|
152
|
+
<p class="children"><span class='object_link'><a href="BorderStyle.html" title="RRTF::BorderStyle (class)">BorderStyle</a></span>, <span class='object_link'><a href="PositionStyle.html" title="RRTF::PositionStyle (class)">PositionStyle</a></span>, <span class='object_link'><a href="ShadingStyle.html" title="RRTF::ShadingStyle (class)">ShadingStyle</a></span>, <span class='object_link'><a href="Style.html" title="RRTF::Style (class)">Style</a></span></p>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<h2>
|
163
|
+
Instance Method Summary
|
164
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
165
|
+
</h2>
|
166
|
+
|
167
|
+
<ul class="summary">
|
168
|
+
|
169
|
+
<li class="public ">
|
170
|
+
<span class="summary_signature">
|
171
|
+
|
172
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(options = {}) ⇒ AnonymousStyle </a>
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</span>
|
177
|
+
|
178
|
+
|
179
|
+
<span class="note title constructor">constructor</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
<span class="summary_desc"><div class='inline'>
|
189
|
+
<p>Constructor (empty for now).</p>
|
190
|
+
</div></span>
|
191
|
+
|
192
|
+
</li>
|
193
|
+
|
194
|
+
|
195
|
+
<li class="public ">
|
196
|
+
<span class="summary_signature">
|
197
|
+
|
198
|
+
<a href="#prefix-instance_method" title="#prefix (instance method)">#<strong>prefix</strong>(document) ⇒ Object </a>
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
</span>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<span class="abstract note title">abstract</span>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
<span class="summary_desc"><div class='inline'>
|
213
|
+
<p>This method retrieves the command prefix text associated with a Style
|
214
|
+
object.</p>
|
215
|
+
</div></span>
|
216
|
+
|
217
|
+
</li>
|
218
|
+
|
219
|
+
|
220
|
+
<li class="public ">
|
221
|
+
<span class="summary_signature">
|
222
|
+
|
223
|
+
<a href="#push_colours-instance_method" title="#push_colours (instance method)">#<strong>push_colours</strong>(colours) ⇒ Object </a>
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
</span>
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
<span class="summary_desc"><div class='inline'>
|
238
|
+
<p>Pushes the colour objects present in formatting attributes onto the
|
239
|
+
supplied colour table.</p>
|
240
|
+
</div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
<li class="public ">
|
246
|
+
<span class="summary_signature">
|
247
|
+
|
248
|
+
<a href="#push_fonts-instance_method" title="#push_fonts (instance method)">#<strong>push_fonts</strong>(fonts) ⇒ Object </a>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
</span>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<span class="summary_desc"><div class='inline'>
|
263
|
+
<p>Pushes the font objects present in formatting attributes onto the supplied
|
264
|
+
font table.</p>
|
265
|
+
</div></span>
|
266
|
+
|
267
|
+
</li>
|
268
|
+
|
269
|
+
|
270
|
+
<li class="public ">
|
271
|
+
<span class="summary_signature">
|
272
|
+
|
273
|
+
<a href="#rtf_formatting-instance_method" title="#rtf_formatting (instance method)">#<strong>rtf_formatting</strong> ⇒ Object </a>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
</span>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
<span class="abstract note title">abstract</span>
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
<span class="summary_desc"><div class='inline'>
|
288
|
+
<p>Generates a string containing an RTF sequence that describes the formatting
|
289
|
+
present in the style.</p>
|
290
|
+
</div></span>
|
291
|
+
|
292
|
+
</li>
|
293
|
+
|
294
|
+
|
295
|
+
<li class="public ">
|
296
|
+
<span class="summary_signature">
|
297
|
+
|
298
|
+
<a href="#suffix-instance_method" title="#suffix (instance method)">#<strong>suffix</strong>(document) ⇒ Object </a>
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
</span>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
<span class="abstract note title">abstract</span>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<span class="summary_desc"><div class='inline'>
|
313
|
+
<p>This method retrieves the command suffix text associated with a Style
|
314
|
+
object.</p>
|
315
|
+
</div></span>
|
316
|
+
|
317
|
+
</li>
|
318
|
+
|
319
|
+
|
320
|
+
</ul>
|
321
|
+
|
322
|
+
|
323
|
+
<div id="constructor_details" class="method_details_list">
|
324
|
+
<h2>Constructor Details</h2>
|
325
|
+
|
326
|
+
<div class="method_details first">
|
327
|
+
<h3 class="signature first" id="initialize-instance_method">
|
328
|
+
|
329
|
+
#<strong>initialize</strong>(options = {}) ⇒ <tt><span class='object_link'><a href="" title="RRTF::AnonymousStyle (class)">AnonymousStyle</a></span></tt>
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
</h3><div class="docstring">
|
336
|
+
<div class="discussion">
|
337
|
+
|
338
|
+
<p>Constructor (empty for now).</p>
|
339
|
+
|
340
|
+
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
<div class="tags">
|
344
|
+
|
345
|
+
<p class="tag_title">Since:</p>
|
346
|
+
<ul class="since">
|
347
|
+
|
348
|
+
<li>
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
<div class='inline'>
|
355
|
+
<p>1.0.0</p>
|
356
|
+
</div>
|
357
|
+
|
358
|
+
</li>
|
359
|
+
|
360
|
+
</ul>
|
361
|
+
|
362
|
+
</div><table class="source_code">
|
363
|
+
<tr>
|
364
|
+
<td>
|
365
|
+
<pre class="lines">
|
366
|
+
|
367
|
+
|
368
|
+
10
|
369
|
+
11</pre>
|
370
|
+
</td>
|
371
|
+
<td>
|
372
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/style/anonymous_style.rb', line 10</span>
|
373
|
+
|
374
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
375
|
+
<span class='kw'>end</span></pre>
|
376
|
+
</td>
|
377
|
+
</tr>
|
378
|
+
</table>
|
379
|
+
</div>
|
380
|
+
|
381
|
+
</div>
|
382
|
+
|
383
|
+
|
384
|
+
<div id="instance_method_details" class="method_details_list">
|
385
|
+
<h2>Instance Method Details</h2>
|
386
|
+
|
387
|
+
|
388
|
+
<div class="method_details first">
|
389
|
+
<h3 class="signature first" id="prefix-instance_method">
|
390
|
+
|
391
|
+
#<strong>prefix</strong>(document) ⇒ <tt>Object</tt>
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
</h3><div class="docstring">
|
398
|
+
<div class="discussion">
|
399
|
+
<div class="note abstract">
|
400
|
+
<strong>This method is abstract.</strong>
|
401
|
+
<div class='inline'></div>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<p>This method retrieves the command prefix text associated with a Style
|
405
|
+
object. This method always returns nil and should be overridden by derived
|
406
|
+
classes as needed.</p>
|
407
|
+
|
408
|
+
|
409
|
+
</div>
|
410
|
+
</div>
|
411
|
+
<div class="tags">
|
412
|
+
|
413
|
+
<p class="tag_title">Since:</p>
|
414
|
+
<ul class="since">
|
415
|
+
|
416
|
+
<li>
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
<div class='inline'>
|
423
|
+
<p>1.0.0</p>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
</li>
|
427
|
+
|
428
|
+
</ul>
|
429
|
+
|
430
|
+
</div><table class="source_code">
|
431
|
+
<tr>
|
432
|
+
<td>
|
433
|
+
<pre class="lines">
|
434
|
+
|
435
|
+
|
436
|
+
17
|
437
|
+
18
|
438
|
+
19</pre>
|
439
|
+
</td>
|
440
|
+
<td>
|
441
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/style/anonymous_style.rb', line 17</span>
|
442
|
+
|
443
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_prefix'>prefix</span><span class='lparen'>(</span><span class='id identifier rubyid_document'>document</span><span class='rparen'>)</span>
|
444
|
+
<span class='kw'>nil</span>
|
445
|
+
<span class='kw'>end</span></pre>
|
446
|
+
</td>
|
447
|
+
</tr>
|
448
|
+
</table>
|
449
|
+
</div>
|
450
|
+
|
451
|
+
<div class="method_details ">
|
452
|
+
<h3 class="signature " id="push_colours-instance_method">
|
453
|
+
|
454
|
+
#<strong>push_colours</strong>(colours) ⇒ <tt>Object</tt>
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
|
460
|
+
</h3><div class="docstring">
|
461
|
+
<div class="discussion">
|
462
|
+
|
463
|
+
<div class="note notetag">
|
464
|
+
<strong>Note:</strong>
|
465
|
+
<div class='inline'>
|
466
|
+
<p>All colours used in an RTF document must appear in the document's
|
467
|
+
header as a colour table. This method assists in generating that table.</p>
|
468
|
+
</div>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
|
472
|
+
<p>Pushes the colour objects present in formatting attributes onto the
|
473
|
+
supplied colour table.</p>
|
474
|
+
|
475
|
+
|
476
|
+
</div>
|
477
|
+
</div>
|
478
|
+
<div class="tags">
|
479
|
+
<p class="tag_title">Parameters:</p>
|
480
|
+
<ul class="param">
|
481
|
+
|
482
|
+
<li>
|
483
|
+
|
484
|
+
<span class='name'>colours</span>
|
485
|
+
|
486
|
+
|
487
|
+
<span class='type'>(<tt><span class='object_link'><a href="ColourTable.html" title="RRTF::ColourTable (class)">ColourTable</a></span></tt>)</span>
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
—
|
492
|
+
<div class='inline'>
|
493
|
+
<p>the table in which the formatting colours will be stored.</p>
|
494
|
+
</div>
|
495
|
+
|
496
|
+
</li>
|
497
|
+
|
498
|
+
</ul>
|
499
|
+
|
500
|
+
<p class="tag_title">Since:</p>
|
501
|
+
<ul class="since">
|
502
|
+
|
503
|
+
<li>
|
504
|
+
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
<div class='inline'>
|
510
|
+
<p>1.0.0</p>
|
511
|
+
</div>
|
512
|
+
|
513
|
+
</li>
|
514
|
+
|
515
|
+
</ul>
|
516
|
+
|
517
|
+
</div><table class="source_code">
|
518
|
+
<tr>
|
519
|
+
<td>
|
520
|
+
<pre class="lines">
|
521
|
+
|
522
|
+
|
523
|
+
43
|
524
|
+
44
|
525
|
+
45
|
526
|
+
46
|
527
|
+
47
|
528
|
+
48
|
529
|
+
49
|
530
|
+
50
|
531
|
+
51
|
532
|
+
52
|
533
|
+
53
|
534
|
+
54
|
535
|
+
55
|
536
|
+
56
|
537
|
+
57
|
538
|
+
58
|
539
|
+
59
|
540
|
+
60</pre>
|
541
|
+
</td>
|
542
|
+
<td>
|
543
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/style/anonymous_style.rb', line 43</span>
|
544
|
+
|
545
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_push_colours'>push_colours</span><span class='lparen'>(</span><span class='id identifier rubyid_colours'>colours</span><span class='rparen'>)</span>
|
546
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_foreground_color'>foreground_color</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:foreground_color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_foreground_color'>foreground_color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
547
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_background_color'>background_color</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:background_color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_background_color'>background_color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
548
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_underline_color'>underline_color</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:underline_color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_underline_color'>underline_color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
549
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_highlight_color'>highlight_color</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:highlight_color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_highlight_color'>highlight_color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
550
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_color'>color</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:color</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
551
|
+
|
552
|
+
<span class='comment'># border
|
553
|
+
</span> <span class='id identifier rubyid_border'>border</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_b'>b</span><span class='op'>|</span>
|
554
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span> <span class='kw'>unless</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_color'>color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
555
|
+
<span class='kw'>end</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:border</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_border'>border</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
556
|
+
|
557
|
+
<span class='comment'># shading
|
558
|
+
</span> <span class='kw'>unless</span> <span class='op'>!</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:shading</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_shading'>shading</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
559
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_shading'>shading</span><span class='period'>.</span><span class='id identifier rubyid_background_color'>background_color</span> <span class='kw'>unless</span> <span class='id identifier rubyid_shading'>shading</span><span class='period'>.</span><span class='id identifier rubyid_background_color'>background_color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
560
|
+
<span class='id identifier rubyid_colours'>colours</span> <span class='op'><<</span> <span class='id identifier rubyid_shading'>shading</span><span class='period'>.</span><span class='id identifier rubyid_foreground_color'>foreground_color</span> <span class='kw'>unless</span> <span class='id identifier rubyid_shading'>shading</span><span class='period'>.</span><span class='id identifier rubyid_foreground_color'>foreground_color</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
561
|
+
<span class='kw'>end</span>
|
562
|
+
<span class='kw'>end</span></pre>
|
563
|
+
</td>
|
564
|
+
</tr>
|
565
|
+
</table>
|
566
|
+
</div>
|
567
|
+
|
568
|
+
<div class="method_details ">
|
569
|
+
<h3 class="signature " id="push_fonts-instance_method">
|
570
|
+
|
571
|
+
#<strong>push_fonts</strong>(fonts) ⇒ <tt>Object</tt>
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
|
577
|
+
</h3><div class="docstring">
|
578
|
+
<div class="discussion">
|
579
|
+
|
580
|
+
<div class="note notetag">
|
581
|
+
<strong>Note:</strong>
|
582
|
+
<div class='inline'>
|
583
|
+
<p>All fonts used in an RTF document must appear in the document's header
|
584
|
+
as a font table. This method assists in generating that table.</p>
|
585
|
+
</div>
|
586
|
+
</div>
|
587
|
+
|
588
|
+
|
589
|
+
<p>Pushes the font objects present in formatting attributes onto the supplied
|
590
|
+
font table.</p>
|
591
|
+
|
592
|
+
|
593
|
+
</div>
|
594
|
+
</div>
|
595
|
+
<div class="tags">
|
596
|
+
<p class="tag_title">Parameters:</p>
|
597
|
+
<ul class="param">
|
598
|
+
|
599
|
+
<li>
|
600
|
+
|
601
|
+
<span class='name'>fonts</span>
|
602
|
+
|
603
|
+
|
604
|
+
<span class='type'>(<tt><span class='object_link'><a href="FontTable.html" title="RRTF::FontTable (class)">FontTable</a></span></tt>)</span>
|
605
|
+
|
606
|
+
|
607
|
+
|
608
|
+
—
|
609
|
+
<div class='inline'>
|
610
|
+
<p>the table in which the character formatting fonts will be stored.</p>
|
611
|
+
</div>
|
612
|
+
|
613
|
+
</li>
|
614
|
+
|
615
|
+
</ul>
|
616
|
+
|
617
|
+
<p class="tag_title">Since:</p>
|
618
|
+
<ul class="since">
|
619
|
+
|
620
|
+
<li>
|
621
|
+
|
622
|
+
|
623
|
+
|
624
|
+
|
625
|
+
|
626
|
+
<div class='inline'>
|
627
|
+
<p>1.0.0</p>
|
628
|
+
</div>
|
629
|
+
|
630
|
+
</li>
|
631
|
+
|
632
|
+
</ul>
|
633
|
+
|
634
|
+
</div><table class="source_code">
|
635
|
+
<tr>
|
636
|
+
<td>
|
637
|
+
<pre class="lines">
|
638
|
+
|
639
|
+
|
640
|
+
69
|
641
|
+
70
|
642
|
+
71</pre>
|
643
|
+
</td>
|
644
|
+
<td>
|
645
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/style/anonymous_style.rb', line 69</span>
|
646
|
+
|
647
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_push_fonts'>push_fonts</span><span class='lparen'>(</span><span class='id identifier rubyid_fonts'>fonts</span><span class='rparen'>)</span>
|
648
|
+
<span class='id identifier rubyid_fonts'>fonts</span> <span class='op'><<</span> <span class='id identifier rubyid_font'>font</span> <span class='kw'>unless</span> <span class='id identifier rubyid_font'>font</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
649
|
+
<span class='kw'>end</span></pre>
|
650
|
+
</td>
|
651
|
+
</tr>
|
652
|
+
</table>
|
653
|
+
</div>
|
654
|
+
|
655
|
+
<div class="method_details ">
|
656
|
+
<h3 class="signature " id="rtf_formatting-instance_method">
|
657
|
+
|
658
|
+
#<strong>rtf_formatting</strong> ⇒ <tt>Object</tt>
|
659
|
+
|
660
|
+
|
661
|
+
|
662
|
+
|
663
|
+
|
664
|
+
</h3><div class="docstring">
|
665
|
+
<div class="discussion">
|
666
|
+
<div class="note abstract">
|
667
|
+
<strong>This method is abstract.</strong>
|
668
|
+
<div class='inline'></div>
|
669
|
+
</div>
|
670
|
+
|
671
|
+
<p>Generates a string containing an RTF sequence that describes the formatting
|
672
|
+
present in the style. Override in derived classes.</p>
|
673
|
+
|
674
|
+
|
675
|
+
</div>
|
676
|
+
</div>
|
677
|
+
<div class="tags">
|
678
|
+
|
679
|
+
<p class="tag_title">Since:</p>
|
680
|
+
<ul class="since">
|
681
|
+
|
682
|
+
<li>
|
683
|
+
|
684
|
+
|
685
|
+
|
686
|
+
|
687
|
+
|
688
|
+
<div class='inline'>
|
689
|
+
<p>1.0.0</p>
|
690
|
+
</div>
|
691
|
+
|
692
|
+
</li>
|
693
|
+
|
694
|
+
</ul>
|
695
|
+
|
696
|
+
</div><table class="source_code">
|
697
|
+
<tr>
|
698
|
+
<td>
|
699
|
+
<pre class="lines">
|
700
|
+
|
701
|
+
|
702
|
+
32
|
703
|
+
33
|
704
|
+
34</pre>
|
705
|
+
</td>
|
706
|
+
<td>
|
707
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/style/anonymous_style.rb', line 32</span>
|
708
|
+
|
709
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_rtf_formatting'>rtf_formatting</span>
|
710
|
+
<span class='kw'>nil</span>
|
711
|
+
<span class='kw'>end</span></pre>
|
712
|
+
</td>
|
713
|
+
</tr>
|
714
|
+
</table>
|
715
|
+
</div>
|
716
|
+
|
717
|
+
<div class="method_details ">
|
718
|
+
<h3 class="signature " id="suffix-instance_method">
|
719
|
+
|
720
|
+
#<strong>suffix</strong>(document) ⇒ <tt>Object</tt>
|
721
|
+
|
722
|
+
|
723
|
+
|
724
|
+
|
725
|
+
|
726
|
+
</h3><div class="docstring">
|
727
|
+
<div class="discussion">
|
728
|
+
<div class="note abstract">
|
729
|
+
<strong>This method is abstract.</strong>
|
730
|
+
<div class='inline'></div>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
<p>This method retrieves the command suffix text associated with a Style
|
734
|
+
object. This method always returns nil and should be overridden by derived
|
735
|
+
classes as needed.</p>
|
736
|
+
|
737
|
+
|
738
|
+
</div>
|
739
|
+
</div>
|
740
|
+
<div class="tags">
|
741
|
+
|
742
|
+
<p class="tag_title">Since:</p>
|
743
|
+
<ul class="since">
|
744
|
+
|
745
|
+
<li>
|
746
|
+
|
747
|
+
|
748
|
+
|
749
|
+
|
750
|
+
|
751
|
+
<div class='inline'>
|
752
|
+
<p>1.0.0</p>
|
753
|
+
</div>
|
754
|
+
|
755
|
+
</li>
|
756
|
+
|
757
|
+
</ul>
|
758
|
+
|
759
|
+
</div><table class="source_code">
|
760
|
+
<tr>
|
761
|
+
<td>
|
762
|
+
<pre class="lines">
|
763
|
+
|
764
|
+
|
765
|
+
25
|
766
|
+
26
|
767
|
+
27</pre>
|
768
|
+
</td>
|
769
|
+
<td>
|
770
|
+
<pre class="code"><span class="info file"># File 'lib/rrtf/style/anonymous_style.rb', line 25</span>
|
771
|
+
|
772
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_suffix'>suffix</span><span class='lparen'>(</span><span class='id identifier rubyid_document'>document</span><span class='rparen'>)</span>
|
773
|
+
<span class='kw'>nil</span>
|
774
|
+
<span class='kw'>end</span></pre>
|
775
|
+
</td>
|
776
|
+
</tr>
|
777
|
+
</table>
|
778
|
+
</div>
|
779
|
+
|
780
|
+
</div>
|
781
|
+
|
782
|
+
</div>
|
783
|
+
|
784
|
+
<div id="footer">
|
785
|
+
Generated on Mon Jul 31 21:49:01 2017 by
|
786
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
787
|
+
0.9.9 (ruby-2.3.3).
|
788
|
+
</div>
|
789
|
+
|
790
|
+
</div>
|
791
|
+
</body>
|
792
|
+
</html>
|