Sha256: 263c6a7b9b05f2356a70ec84c329e7a4c4835441e52ff81079f6bb9a6ec8283c

Contents?: true

Size: 1.16 KB

Versions: 1

Compression:

Stored size: 1.16 KB

Contents

require 'rrtf'
require 'JSON'

DIR = File.dirname(__FILE__)

raw_styles = JSON.parse File.read(DIR+'/resources/json/redshirt_styles.json')

rtf = RRTF::Document.new("stylesheet" => raw_styles)
styles = rtf.stylesheet.styles

rtf.paragraph(styles['TITLE']) << "RedShirts 101"
rtf.paragraph(styles['BODY']) do |p|
  p << "Should you ever find yourself on a spacefaring vessel wearing a"
  p.apply(styles['EMPH']) << " red "
  p << "shirt, take heed and be on guard, for danger is immanent and you are "
  p << "likely expendable among the crew..."
end
rtf.paragraph(styles['H1']) << "1. The Danger of Away Missions"
rtf.paragraph(styles['BODY']) do |p|
  p << "If you're ever assigned an away mission, it's almost certain to be your doom. "
  p << "The optimal strategy is to avoid away missions to begin with..."
end
rtf.paragraph(styles['H1']) << "2. Avoiding High-Ranking Officers"
rtf.paragraph(styles['BODY']) do |p|
  p << "You're likely to notice an influx of unfortunate outcomes around "
  p << "certain high-ranking officers. Its to your advantage to quickly identify and "
  p << "avoid these officers..."
end

File.open(DIR+'/01.rtf', 'w') do |file|
   file.write(rtf.to_rtf)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rrtf-0.1.2 examples/01_styles_and_paragraphs.rb