Class: Deplate::Input::Play::Heading

Inherits:
Element::Heading
  • Object
show all
Defined in:
lib/deplate/input/play.rb

Instance Method Summary collapse

Instance Method Details

#finishObject



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/deplate/input/play.rb', line 69

def finish
    # m = /^((.*?)\s*::\s*)?(.*?)(\s*--\s*((I|E|X|INT.?|EXT.?|\<|\>)\/)?(.*?))\s*?$/.match(@accum.join)
    m = /^((.*?)\s*::\s*)?(.*?)(\s*--\s*((.*?)\/)?(.*?))?\s*?$/.match(@accum.join)
    # @args['plain'] = true
    @args['playScene']    = m[2]
    @args['playLocation'] = m[3]
    @args['playIntExt']   = m[6] || ''
    @args['playTime']     = m[7] || ''
    # style = @deplate.variables['playStyle'] || @deplate.variables['class'] || 'hollywood'
    style = @deplate.variables['playStyle'] || 'hollywood'
    meth  = "style_#{style}"
    if respond_to?(meth)
        @accum = send(meth)
    else
        log(['Unknown style', style], :error)
        @accum = []
    end
    update_styles(['play'])
    # self.html_args = [self.html_args, 'class="play"'].join(' ')
    # "{text style=play-intext: #{}" unless .empty?
    # "{text style=play-location: #{m[2].gsub(/[{}]/, '\\\\\\0')}}",
    # "{text style=play-time: #{m[3].gsub(/[{}]/, '\\\\\\0')}}",
    super
end

#get_intext(ext = 'EXT.', int = 'INT.') ⇒ Object



115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/deplate/input/play.rb', line 115

def get_intext(ext='EXT.', int='INT.')
    intext = @args['playIntExt']
    case intext.upcase
    when 'I', 'INT', 'INT.', '<'
        intext = @deplate.variables['int'] || int
    when 'X', 'E', 'EXT', 'EXT.', '>', 'A'
        intext = @deplate.variables['ext'] || ext
    # else
    #     intext = @deplate.variables['int'] || int
    end
    intext
end

#get_timeObject



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/deplate/input/play.rb', line 128

def get_time
    ti = @args['playTime']
    case ti.upcase
    when 'D', 'T'
        @deplate.msg('Day')
    when 'N'
        @deplate.msg('Night')
    when 'M'
        @deplate.msg('Morning')
    when 'A', 'E'
        @deplate.msg('Evening')
    else
        ti
    end
end

#style_austriaObject



106
107
108
109
110
111
112
113
# File 'lib/deplate/input/play.rb', line 106

def style_austria
    intext = get_intext('AUSSEN', 'INNEN')
    accum = []
    accum << Deplate::Input::Play.styled_text('play-location', @args['playLocation'])
    accum << Deplate::Input::Play.styled_text('play-flexsep', '--')
    accum << Deplate::Input::Play.styled_text('play-right', [intext, '/', get_time].join)
    [accum.join(' ')]
end

#style_hollywoodObject



94
95
96
97
98
99
100
101
102
103
104
# File 'lib/deplate/input/play.rb', line 94

def style_hollywood
    intext = get_intext()
    accum = []
    accum << Deplate::Input::Play.styled_text('play-intext', intext) unless intext.empty?
    accum << Deplate::Input::Play.styled_text('play-location', @args['playLocation'])
    if (time = get_time)
        accum << Deplate::Input::Play.styled_text('play-flexsep', '--') << 
            Deplate::Input::Play.styled_text('play-right', time)
    end
    [accum.join(' ')]
end