rrtf 1.0.0 → 1.3.1

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.
Files changed (87) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +29 -0
  4. data/documentation/RRTF.html +5 -5
  5. data/documentation/RRTF/AnonymousStyle.html +2 -2
  6. data/documentation/RRTF/BorderFormatting.html +48 -48
  7. data/documentation/RRTF/BorderStyle.html +1 -1
  8. data/documentation/RRTF/CharacterFormatting.html +1 -1
  9. data/documentation/RRTF/CharacterStyle.html +1 -1
  10. data/documentation/RRTF/Colour.html +1 -1
  11. data/documentation/RRTF/ColourTable.html +1 -1
  12. data/documentation/RRTF/CommandNode.html +333 -93
  13. data/documentation/RRTF/ContainerNode.html +1 -1
  14. data/documentation/RRTF/Converters.html +1 -1
  15. data/documentation/RRTF/Converters/HTML.html +1 -1
  16. data/documentation/RRTF/Converters/HTML/Helpers.html +1 -1
  17. data/documentation/RRTF/Converters/HTML/Node.html +1 -1
  18. data/documentation/RRTF/Converters/HTML/NodeSet.html +1 -1
  19. data/documentation/RRTF/Document.html +2 -2
  20. data/documentation/RRTF/DocumentFormatting.html +48 -48
  21. data/documentation/RRTF/DocumentProperties.html +8 -3
  22. data/documentation/RRTF/Font.html +1 -1
  23. data/documentation/RRTF/FontTable.html +1 -1
  24. data/documentation/RRTF/FooterNode.html +2 -2
  25. data/documentation/RRTF/GeometryNode.html +2 -2
  26. data/documentation/RRTF/GeometryProperties.html +9 -9
  27. data/documentation/RRTF/HeaderNode.html +2 -2
  28. data/documentation/RRTF/ImageNode.html +64 -61
  29. data/documentation/RRTF/Information.html +1 -1
  30. data/documentation/RRTF/LinkNode.html +2 -2
  31. data/documentation/RRTF/ListLevel.html +1 -1
  32. data/documentation/RRTF/ListLevelNode.html +2 -2
  33. data/documentation/RRTF/ListMarker.html +1 -1
  34. data/documentation/RRTF/ListNode.html +2 -2
  35. data/documentation/RRTF/ListTable.html +1 -1
  36. data/documentation/RRTF/ListTemplate.html +1 -1
  37. data/documentation/RRTF/ListTextNode.html +2 -2
  38. data/documentation/RRTF/Node.html +1 -1
  39. data/documentation/RRTF/Page.html +1 -1
  40. data/documentation/RRTF/Page/Margin.html +1 -1
  41. data/documentation/RRTF/Page/Size.html +1 -1
  42. data/documentation/RRTF/PageFormatting.html +184 -195
  43. data/documentation/RRTF/ParagraphFormatting.html +75 -48
  44. data/documentation/RRTF/ParagraphNode.html +2 -2
  45. data/documentation/RRTF/ParagraphStyle.html +1 -1
  46. data/documentation/RRTF/PositionFormatting.html +48 -48
  47. data/documentation/RRTF/PositionStyle.html +1 -1
  48. data/documentation/RRTF/Properties.html +1 -1
  49. data/documentation/RRTF/RTFError.html +1 -1
  50. data/documentation/RRTF/SectionFormatting.html +750 -0
  51. data/documentation/RRTF/SectionNode.html +383 -0
  52. data/documentation/RRTF/SectionStyle.html +830 -0
  53. data/documentation/RRTF/ShadingFormatting.html +48 -48
  54. data/documentation/RRTF/ShadingStyle.html +1 -1
  55. data/documentation/RRTF/Style.html +2 -2
  56. data/documentation/RRTF/Stylesheet.html +1 -1
  57. data/documentation/RRTF/TabStyle.html +698 -0
  58. data/documentation/RRTF/TableCellNode.html +2 -2
  59. data/documentation/RRTF/TableNode.html +1 -1
  60. data/documentation/RRTF/TableRowNode.html +1 -1
  61. data/documentation/RRTF/TextNode.html +1 -1
  62. data/documentation/RRTF/Utilities.html +1 -1
  63. data/documentation/_index.html +33 -5
  64. data/documentation/class_list.html +1 -1
  65. data/documentation/file.README.html +32 -1
  66. data/documentation/index.html +32 -1
  67. data/documentation/method_list.html +499 -355
  68. data/documentation/top-level-namespace.html +1 -1
  69. data/examples/08.rtf +2 -2
  70. data/examples/09.rtf +9 -13
  71. data/examples/09_shapes.rb +2 -1
  72. data/examples/11.rtf +19 -0
  73. data/examples/11_sections.rb +11 -0
  74. data/examples/12.rtf +19 -0
  75. data/examples/12_tabs.rb +21 -0
  76. data/lib/rrtf/formatting.rb +155 -22
  77. data/lib/rrtf/node.rb +1 -0
  78. data/lib/rrtf/node/command_node.rb +38 -4
  79. data/lib/rrtf/node/image_node.rb +26 -32
  80. data/lib/rrtf/node/section_node.rb +21 -0
  81. data/lib/rrtf/properties/geometry_properties.rb +4 -4
  82. data/lib/rrtf/style.rb +2 -0
  83. data/lib/rrtf/style/section_style.rb +66 -0
  84. data/lib/rrtf/style/tab_style.rb +55 -0
  85. data/lib/rrtf/version.rb +1 -1
  86. data/rrtf.gemspec +4 -4
  87. metadata +30 -20
@@ -100,7 +100,7 @@
100
100
  </div>
101
101
 
102
102
  <div id="footer">
103
- Generated on Mon Jul 31 21:48:57 2017 by
103
+ Generated on Wed Aug 2 23:05:14 2017 by
104
104
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
105
105
  0.9.9 (ruby-2.3.3).
106
106
  </div>
@@ -7,11 +7,11 @@
7
7
  \red255\green0\blue0;
8
8
  }
9
9
  {\info
10
- {\createim\yr2017\mo7\dy30\hr23\min44}
10
+ {\createim\yr2017\mo8\dy1\hr11\min6}
11
11
  }
12
12
 
13
13
  \hyphauto1\paperw12247\paperh15819\margl1440\margr1440\margt1440\margb1440
14
- {\pict \box\brdrdot\brdrw100\brsp240\brdrcf1\picwgoal2880\pichgoal2880\picw500\pich500\bliptag3007171\pngblip
14
+ {\pict \box\brdrdot\brdrw100\brsp240\brdrcf1\picwgoal2880\pichgoal2880\picw500\pich500\bliptag0108171\pngblip
15
15
  89504e470d0a1a0a0000000d49484452000001f4000001f40806000000cbd6df8a00000009704859
16
16
  73000016250000162501495224f00000200049444154785eec5d077c5455f6fe26939e50549a2288
17
17
  8282aeae2b56545ceb2a8a34459705114511e952a45705040ba0880a289d208a8a7f51b161050545
@@ -7,7 +7,7 @@
7
7
  \red255\green255\blue255;
8
8
  }
9
9
  {\info
10
- {\createim\yr2017\mo7\dy31\hr20\min2}
10
+ {\createim\yr2017\mo8\dy1\hr11\min8}
11
11
  }
12
12
 
13
13
  \hyphauto1\paperw12247\paperh15819\margl1440\margr1440\margt1440\margb1440
@@ -22,10 +22,6 @@
22
22
  {\sp{\sn fFilled}{\sv 1}}
23
23
  {\sp{\sn fillColor}{\sv 13421772}}
24
24
  {\sp{\sn fLine}{\sv 0}}
25
- {\sp{\sn geoLeft}{\sv 0}}
26
- {\sp{\sn geoTop}{\sv 0}}
27
- {\sp{\sn geoRight}{\sv 30000}}
28
- {\sp{\sn geoBottom}{\sv 30000}}
29
25
  {\sp{\sn fLineOK}{\sv 1}}
30
26
  {\sp{\sn fFillOK}{\sv 1}}
31
27
  {\sp{\sn f3DOK}{\sv 1}}
@@ -43,10 +39,10 @@
43
39
  {\sp{\sn fLine}{\sv 1}}
44
40
  {\sp{\sn lineColor}{\sv 0}}
45
41
  {\sp{\sn lineWidth}{\sv 38100}}
46
- {\sp{\sn geoLeft}{\sv 0}}
47
- {\sp{\sn geoTop}{\sv 0}}
48
- {\sp{\sn geoRight}{\sv 30000}}
49
- {\sp{\sn geoBottom}{\sv 30000}}
42
+ {\sp{\sn dxTextLeft}{\sv 457200}}
43
+ {\sp{\sn dxTextRight}{\sv 457200}}
44
+ {\sp{\sn dyTextTop}{\sv 457200}}
45
+ {\sp{\sn dyTextBottom}{\sv 457200}}
50
46
  {\sp{\sn fLineOK}{\sv 1}}
51
47
  {\sp{\sn fFillOK}{\sv 1}}
52
48
  {\sp{\sn f3DOK}{\sv 1}}
@@ -72,11 +68,11 @@ red
72
68
  {\sp{\sn lineColor}{\sv 10027008}}
73
69
  {\sp{\sn geoLeft}{\sv 0}}
74
70
  {\sp{\sn geoTop}{\sv 0}}
75
- {\sp{\sn geoRight}{\sv 30000}}
76
- {\sp{\sn geoBottom}{\sv 30000}}
77
- {\sp{\sn pVerticies}{\sv 8;6;(0,0);(20000,0);(30000,0);(30000,15000);(30000,30000);(0,0)}}
71
+ {\sp{\sn geoRight}{\sv 21600}}
72
+ {\sp{\sn geoBottom}{\sv 21600}}
73
+ {\sp{\sn pVerticies}{\sv 8;6;(0,0);(14400,0);(21600,0);(21600,10800);(21600,21600);(0,0)}}
78
74
  {\sp{\sn pSegmentInfo}{\sv 2;6;16384;1;8193;1;24577;32768}}
79
- {\sp{\sn pConnectionSites}{\sv 8;4;(0,0);(20000,0);(30000,30000);(0,0)}}
75
+ {\sp{\sn pConnectionSites}{\sv 8;4;(0,0);(14400,0);(21600,21600);(0,0)}}
80
76
  {\sp{\sn fLineOK}{\sv 1}}
81
77
  {\sp{\sn fFillOK}{\sv 1}}
82
78
  {\sp{\sn f3DOK}{\sv 1}}
@@ -23,7 +23,8 @@ rtf.geometry(
23
23
  "width" => "3in",
24
24
  "height" => "3in",
25
25
  "horizontal_reference" => "PAGE",
26
- "vertical_reference" => "PAGE"
26
+ "vertical_reference" => "PAGE",
27
+ "text_margin" => "0.5in"
27
28
  ) do |box|
28
29
  box.paragraph("foreground_color" => '#ffffff') do |p|
29
30
  p << "Should you ever find yourself on a spacefaring vessel wearing a "
@@ -0,0 +1,19 @@
1
+ {\rtf1\ansi\deff0\deflang1033\plain\fs24\fet1
2
+ {\fonttbl
3
+ {\f0\fswiss Helvetica;}
4
+ }
5
+ {\info
6
+ {\createim\yr2017\mo8\dy2\hr22\min31}
7
+ }
8
+
9
+ \hyphauto1\paperw12247\paperh15819\margl1440\margr1440\margt1440\margb1440
10
+ {\pard\ql\ltrpar\rqr\tldot\tx2880
11
+ Engineers
12
+ {\tab}
13
+ 10
14
+ {\line}
15
+ Redshirts
16
+ {\tab}
17
+ 100
18
+ \par}
19
+ }
@@ -0,0 +1,11 @@
1
+ require 'rrtf'
2
+
3
+ DIR = File.dirname(__FILE__)
4
+
5
+ rtf = RRTF::Document.new
6
+
7
+ rtf.paragraph << "Redshirt Pocket Guide"
8
+ rtf.section("columns" => 2)
9
+ rtf.paragraph << "Section Text"
10
+
11
+ File.open(DIR+'/11.rtf', 'w') { |file| file.write(rtf.to_rtf) }
@@ -0,0 +1,19 @@
1
+ {\rtf1\ansi\deff0\deflang1033\plain\fs24\fet1
2
+ {\fonttbl
3
+ {\f0\fswiss Helvetica;}
4
+ }
5
+ {\info
6
+ {\createim\yr2017\mo8\dy2\hr22\min32}
7
+ }
8
+
9
+ \hyphauto1\paperw12247\paperh15819\margl1440\margr1440\margt1440\margb1440
10
+ {\pard\ql\ltrpar\rqr\tldot\tx2880
11
+ Engineers
12
+ {\tab}
13
+ 10
14
+ {\line}
15
+ Redshirts
16
+ {\tab}
17
+ 100
18
+ \par}
19
+ }
@@ -0,0 +1,21 @@
1
+ require 'rrtf'
2
+
3
+ DIR = File.dirname(__FILE__)
4
+
5
+ rtf = RRTF::Document.new
6
+
7
+ rtf.paragraph("tabs" => {
8
+ "leader" => "DOT",
9
+ "type" => "FLUSH_RIGHT",
10
+ "position" => "2in"
11
+ }) do |p|
12
+ p << "Engineers"
13
+ p.tab
14
+ p << "10"
15
+ p.line_break
16
+ p << "Redshirts"
17
+ p.tab
18
+ p << "100"
19
+ end
20
+
21
+ File.open(DIR+'/12.rtf', 'w') { |file| file.write(rtf.to_rtf) }
@@ -332,6 +332,33 @@ module RRTF::ParagraphFormatting
332
332
  end # case
333
333
  end,
334
334
  "to_rtf" => lambda{ |value, document| value.rtf_formatting(document) unless value.nil? }
335
+ },
336
+ "tabs" => {
337
+ "default" => nil,
338
+ "from_user" => lambda do |value|
339
+ case value
340
+ when Array
341
+ value.collect do |t|
342
+ case t
343
+ when Hash
344
+ RRTF::TabStyle.new(t)
345
+ when RRTF::TabStyle
346
+ t
347
+ else
348
+ RRTF::RTFError.fire("Invalid tab '#{t}'.")
349
+ end # case
350
+ end # collect
351
+ when Hash
352
+ [RRTF::TabStyle.new(value)]
353
+ when RRTF::TabStyle
354
+ [value]
355
+ else
356
+ RRTF::RTFError.fire("Invalid border '#{value}'.")
357
+ end # case
358
+ end,
359
+ "to_rtf" => lambda do |value, document|
360
+ value.collect{ |tab| tab.rtf_formatting }.join(' ') unless value.nil?
361
+ end
335
362
  }
336
363
  }.freeze
337
364
 
@@ -872,6 +899,91 @@ module RRTF::DocumentFormatting
872
899
  end
873
900
  end # module DocumentFormatting
874
901
 
902
+ # Section formatting attributes and methods.
903
+ # @author Wesley Hileman
904
+ # @since 1.0.0
905
+ module RRTF::SectionFormatting
906
+ # Formatting attributes that can be applied to an RTF document section.
907
+ # @return [Hash<String, Hash>] a hash mapping each attribute to a hash that
908
+ # describes (1) the attribute's default value, (2) how to parse the attribute
909
+ # from the user, and (3) how to convert the attribute to an RTF sequence.
910
+ SECTION_ATTRIBUTES = {
911
+ "columns" => {
912
+ "default" => nil,
913
+ "to_rtf" => lambda{ |value| "\\cols#{value}" unless value.nil? }
914
+ },
915
+ "column_spacing" => {
916
+ "default" => nil,
917
+ "from_user" => lambda{ |value| RRTF::Utilities.value2twips(value) },
918
+ "to_rtf" => lambda{ |value| "\\colsx#{value}" unless value.nil? }
919
+ },
920
+ "mirror_margins" => {
921
+ "default" => nil,
922
+ "to_rtf" => lambda{ |value| "\\margmirrorsxn" if value }
923
+ }
924
+ }.freeze
925
+
926
+ # Generates attribute accessors for all section attributes when the module
927
+ # is included in another module or class.
928
+ def self.included(base)
929
+ # define accessors in base for document attributes
930
+ base.class_eval do
931
+ SECTION_ATTRIBUTES.each do |key, options|
932
+ attr_accessor :"#{key}"
933
+ end # each
934
+ end # class_eval
935
+ end
936
+
937
+ # Initializes section formatting attributes.
938
+ #
939
+ # @param [Hash] options the section formatting options.
940
+ # @option options [Integer] "columns" (nil) the number of columns in the section.
941
+ # @option options [String, Integer] "column_spacing" (nil) the column spacing in twips (can also be a string, see {Utilities.value2twips}).
942
+ # @option options [Boolean] "mirror_margins" (nil) whether or not to enable mirrored margins (when facing pages is enabled) in the document.
943
+ def initialize_section_formatting(options = {})
944
+ # load default attribute values
945
+ SECTION_ATTRIBUTES.each do |key, options|
946
+ send("#{key}=", options["default"])
947
+ end # each
948
+ # overwrite default attribute values with given values
949
+ set_section_formatting_from_hashmap(options)
950
+ end
951
+
952
+ # Sets section formatting attributes according to the supplied hashmap.
953
+ # @see #initialize_section_formatting
954
+ def set_section_formatting_from_hashmap(hash)
955
+ hash.each do |attribute, value|
956
+ # skip unreconized attributes
957
+ next unless(SECTION_ATTRIBUTES.keys.include?(attribute))
958
+ # preprocess value if nessesary
959
+ if SECTION_ATTRIBUTES[attribute].has_key?("from_user")
960
+ value = SECTION_ATTRIBUTES[attribute]["from_user"].call(value)
961
+ elsif SECTION_ATTRIBUTES[attribute].has_key?("dictionary") && value.is_a?(String)
962
+ value = SECTION_ATTRIBUTES[attribute]["dictionary"][value]
963
+ end # if
964
+ # set attribute value
965
+ send("#{attribute}=", value)
966
+ end # each
967
+ end
968
+
969
+ # Generates an RTF string representing all applied section formatting.
970
+ #
971
+ # @return [String] RTF string.
972
+ def section_formatting_to_rtf
973
+ text = StringIO.new
974
+
975
+ # accumulate RTF representations of section attributes
976
+ SECTION_ATTRIBUTES.each do |key, options|
977
+ if options.has_key?("to_rtf")
978
+ rtf = options["to_rtf"].call(send(key))
979
+ text << rtf unless rtf.nil?
980
+ end # if
981
+ end # each
982
+
983
+ text.string
984
+ end
985
+ end # module SectionFormatting
986
+
875
987
  # Page formatting attributes and methods.
876
988
  # @author Wesley Hileman
877
989
  # @since 1.0.0
@@ -888,25 +1000,60 @@ module RRTF::PageFormatting
888
1000
  "PORTRAIT" => :portrait,
889
1001
  "LANDSCAPE" => :landscape
890
1002
  },
891
- "to_rtf" => lambda{ |value| "\\landscape" if value == :landscape }
1003
+ "to_rtf" => lambda do |value, targ|
1004
+ case targ
1005
+ when :document
1006
+ "\\landscape" if value == :landscape
1007
+ when :section
1008
+ "\\lndscpsxn" if value == :landscape
1009
+ end # case
1010
+ end
892
1011
  },
893
1012
  "size" => {
894
1013
  "default" => RRTF::Page::Size.new,
895
1014
  "from_user" => lambda{ |value| RRTF::Page::Size.new(value) },
896
- "to_rtf" => lambda{ |value| "\\paperw#{value.width}\\paperh#{value.height}" }
1015
+ "to_rtf" => lambda do |value, targ|
1016
+ case targ
1017
+ when :document
1018
+ "\\paperw#{value.width}\\paperh#{value.height}"
1019
+ when :section
1020
+ "\\pgwsxn#{value.width}\\pghsxn#{value.height}"
1021
+ end # case
1022
+ end
897
1023
  },
898
1024
  "margin" => {
899
1025
  "default" => RRTF::Page::Margin.new,
900
1026
  "from_user" => lambda{ |value| RRTF::Page::Margin.new(value) },
901
- "to_rtf" => lambda{ |value| "\\margl#{value.left}\\margr#{value.right}\\margt#{value.top}\\margb#{value.bottom}" }
1027
+ "to_rtf" => lambda do |value, targ|
1028
+ case targ
1029
+ when :document
1030
+ "\\margl#{value.left}\\margr#{value.right}\\margt#{value.top}\\margb#{value.bottom}"
1031
+ when :section
1032
+ "\\marglsxn#{value.left}\\margrsnx#{value.right}\\margtsxn#{value.top}\\margbsnx#{value.bottom}"
1033
+ end # case
1034
+ end
902
1035
  },
903
1036
  "gutter" => {
904
1037
  "default" => nil,
905
1038
  "from_user" => lambda{ |value| RRTF::Utilities.value2twips(value) },
906
- "to_rtf" => lambda{ |value| "\\gutter#{value}" unless value.nil? }
1039
+ "to_rtf" => lambda do |value, targ|
1040
+ case targ
1041
+ when :document
1042
+ "\\gutter#{value}" unless value.nil?
1043
+ when :section
1044
+ "\\guttersxn#{value}" unless value.nil?
1045
+ end # case
1046
+ end
907
1047
  }
908
1048
  }.freeze
909
1049
 
1050
+ PAGE_FORMATTING_TARGET_DICTIONARY = {
1051
+ "DOCUMENT" => :document,
1052
+ "SECTION" => :section
1053
+ }.freeze
1054
+
1055
+ attr_accessor :target
1056
+
910
1057
  # Generates attribute accessors for all page attributes when the module
911
1058
  # is included in another module or class.
912
1059
  def self.included(base)
@@ -927,7 +1074,9 @@ module RRTF::PageFormatting
927
1074
  # @option options [String, Page::Size] "size" (Page::Size.new) the size of the paper (object or string; see {Page::Size#initialize}).
928
1075
  # @option options [String, Page::Margin] "margin" (Page::Margin.new) the paper margin (object or string; see {Page::Margin#initialize}).
929
1076
  # @option options [String] "gutter" (nil) the page gutter width (specify a string, see {Utilities.value2twips}).
930
- def initialize_page_formatting(options = {})
1077
+ def initialize_page_formatting(options = {}, target = "DOCUMENT")
1078
+ @target = PAGE_FORMATTING_TARGET_DICTIONARY[target]
1079
+
931
1080
  # load default attribute values
932
1081
  PAGE_ATTRIBUTES.each do |key, options|
933
1082
  send("#{key}=", options["default"])
@@ -962,27 +1111,11 @@ module RRTF::PageFormatting
962
1111
  # accumulate RTF representations of page attributes
963
1112
  PAGE_ATTRIBUTES.each do |key, options|
964
1113
  if options.has_key?("to_rtf")
965
- rtf = options["to_rtf"].call(send(key))
1114
+ rtf = options["to_rtf"].call(send(key), @target)
966
1115
  text << rtf unless rtf.nil?
967
1116
  end # if
968
1117
  end # each
969
1118
 
970
1119
  text.string
971
1120
  end
972
-
973
- def body_width
974
- if orientation == :portrait
975
- size.width - (margin.left + margin.right)
976
- else
977
- size.height - (margin.top + margin.bottom)
978
- end
979
- end
980
-
981
- def body_height
982
- if orientation == :portrait
983
- size.height - (margin.top + margin.bottom)
984
- else
985
- size.width - (margin.left + margin.right)
986
- end
987
- end
988
1121
  end
@@ -2,6 +2,7 @@ require 'rrtf/node/node'
2
2
  require 'rrtf/node/text_node'
3
3
  require 'rrtf/node/container_node'
4
4
  require 'rrtf/node/command_node'
5
+ require 'rrtf/node/section_node'
5
6
  require 'rrtf/node/paragraph_node'
6
7
  require 'rrtf/node/list_node'
7
8
  require 'rrtf/node/list_level_node'
@@ -68,6 +68,24 @@ module RRTF
68
68
  text.string
69
69
  end
70
70
 
71
+ def section(style = nil)
72
+ # parse style
73
+ case style
74
+ when Hash
75
+ style = SectionStyle.new(style)
76
+ when SectionStyle
77
+ # use without modification
78
+ when nil
79
+ # allow nil style
80
+ else
81
+ RTFError.fire("Invalid section style '#{style}'.")
82
+ end # case
83
+
84
+ node = SectionNode.new(self, style)
85
+ yield node if block_given?
86
+ self.store(node)
87
+ end
88
+
71
89
  # This method provides a short cut means of creating a paragraph command
72
90
  # node. The method accepts a block that will be passed a single parameter
73
91
  # which will be a reference to the paragraph node created. After the
@@ -84,7 +102,7 @@ module RRTF
84
102
  # rtf.paragraph("bold" => true, "font" => "SWISS:Arial") do |p|
85
103
  # p << "Paragraph formatted with an anonymous style."
86
104
  # end
87
- def paragraph(style=nil)
105
+ def paragraph(style = nil)
88
106
  # parse style
89
107
  case style
90
108
  when Hash
@@ -101,9 +119,9 @@ module RRTF
101
119
  style.push_colours(root.colours) unless style.nil?
102
120
  style.push_fonts(root.fonts) unless style.nil?
103
121
 
104
- node = ParagraphNode.new(self, style)
105
- yield node if block_given?
106
- self.store(node)
122
+ node = ParagraphNode.new(self, style)
123
+ yield node if block_given?
124
+ self.store(node)
107
125
  end
108
126
 
109
127
  # This method provides a short cut means of creating a new ordered or
@@ -146,6 +164,22 @@ module RRTF
146
164
  nil
147
165
  end
148
166
 
167
+ # This method provides a short cut means of creating a column break command
168
+ # node. This command node does not take a block and may possess no other
169
+ # content.
170
+ def column_break
171
+ self.store(CommandNode.new(self, '\column', nil, false))
172
+ nil
173
+ end
174
+
175
+ # This method provides a short cut means of creating a tab command
176
+ # node. This command node does not take a block and may possess no other
177
+ # content.
178
+ def tab
179
+ self.store(CommandNode.new(self, '\tab', nil, false))
180
+ nil
181
+ end
182
+
149
183
  # This method inserts a footnote at the current position in a node.
150
184
  #
151
185
  # ==== Parameters