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

Returns a new instance of DeplateString.



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

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.



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

def deplate_options
  @deplate_options
end

Instance Attribute Details

#deplate_converterObject (readonly)

Returns the value of attribute deplate_converter.



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

def deplate_converter
  @deplate_converter
end

#deplate_optionsObject (readonly)

Returns the value of attribute deplate_options.



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

def deplate_options
  @deplate_options
end

#deplate_variablesObject (readonly)

Returns the value of attribute deplate_variables.



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

def deplate_variables
  @deplate_variables
end

Instance Method Details

#deplate(fmt) ⇒ Object



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

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



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

def to_dbk
    deplate('dbk-article')
end

#to_htmlObject



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

def to_html
    deplate('html')
end

#to_latexObject



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

def to_latex
    deplate('latex')
end

#to_texObject



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

def to_tex
    deplate('latex')
end

#to_textObject



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

def to_text
    deplate('plain')
end

#to_xhtmlObject



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

def to_xhtml
    deplate('xhtml10t')
end

#with_deplate_options(&block) ⇒ Object



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

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