Class: DeplateString

Inherits:
String
  • Object
show all
Defined in:
lib/deplate/deplate-string.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ DeplateString



23
24
25
26
# File 'lib/deplate/deplate-string.rb', line 23

def initialize(*args)
    @deplate_options = self.class.deplate_options.dup
    super
end

Class Attribute Details

.deplate_optionsObject (readonly)

Returns the value of attribute deplate_options.



16
17
18
# File 'lib/deplate/deplate-string.rb', line 16

def deplate_options
  @deplate_options
end

Instance Attribute Details

#deplate_converterObject (readonly)

Returns the value of attribute deplate_converter.



21
22
23
# File 'lib/deplate/deplate-string.rb', line 21

def deplate_converter
  @deplate_converter
end

#deplate_optionsObject (readonly)

Returns the value of attribute deplate_options.



19
20
21
# File 'lib/deplate/deplate-string.rb', line 19

def deplate_options
  @deplate_options
end

#deplate_variablesObject (readonly)

Returns the value of attribute deplate_variables.



20
21
22
# File 'lib/deplate/deplate-string.rb', line 20

def deplate_variables
  @deplate_variables
end

Instance Method Details

#deplate(fmt) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/deplate/deplate-string.rb', line 32

def deplate(fmt)
    @deplate_converter = Deplate::Converter.new(fmt,
                                 :options => @deplate_options)
    rv = @deplate_converter.convert_string(self)
    @deplate_variables = @deplate_converter.deplate.variables
    rv
end

#to_dbkObject



60
61
62
# File 'lib/deplate/deplate-string.rb', line 60

def to_dbk
    deplate('dbk-article')
end

#to_htmlObject



40
41
42
# File 'lib/deplate/deplate-string.rb', line 40

def to_html
    deplate('html')
end

#to_latexObject



48
49
50
# File 'lib/deplate/deplate-string.rb', line 48

def to_latex
    deplate('latex')
end

#to_texObject



52
53
54
# File 'lib/deplate/deplate-string.rb', line 52

def to_tex
    deplate('latex')
end

#to_textObject



56
57
58
# File 'lib/deplate/deplate-string.rb', line 56

def to_text
    deplate('plain')
end

#to_xhtmlObject



44
45
46
# File 'lib/deplate/deplate-string.rb', line 44

def to_xhtml
    deplate('xhtml10t')
end

#with_deplate_options(&block) ⇒ Object



28
29
30
# File 'lib/deplate/deplate-string.rb', line 28

def with_deplate_options(&block)
    block.call(@deplate_options)
end