Class: Orgmode::RevealJsHtmlBuffer

Inherits:
HtmlOutputBuffer
  • Object
show all
Defined in:
lib/org2slides.rb

Instance Method Summary collapse

Instance Method Details

#insert(line) ⇒ Object



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/org2slides.rb', line 232

def insert(line)
  # Prepares the output buffer to receive content from a line.
  # As a side effect, this may flush the current accumulated text.
  @logger.debug "Looking at #{line.paragraph_type}|#{line.assigned_paragraph_type}(#{current_mode}) : #{line.to_s}"

  # We try to get the lang from #+BEGIN_SRC blocks
  @block_lang = line.block_lang if line.begin_block?
  unless should_accumulate_output?(line)
    flush!
    maintain_mode_stack(line)
  end


  # Adds the current line to the output buffer
  case
  when line.assigned_paragraph_type == :comment
  # Don't add to buffer
  when line.title?
    @buffer << line.output_text
  when line.raw_text?
    @buffer << "\n" << line.output_text if line.raw_text_tag == @buffer_tag
  when preserve_whitespace?
    @buffer << "\n" << line.output_text unless line.block_type
  when line.assigned_paragraph_type == :code
  # If the line is contained within a code block but we should
  # not preserve whitespaces, then we do nothing.
  when (line.kind_of? Headline)
    add_line_attributes line
    @buffer << "\n" << line.output_text.strip
  when ([:definition_term, :list_item, :table_row, :table_header,
         :horizontal_rule].include? line.paragraph_type)
    @buffer << "\n" << line.output_text.strip
  when line.paragraph_type == :paragraph
    @buffer << "\n"
    buffer_indentation
    @buffer << line.output_text.strip
  end

  if mode_is_code? current_mode and not line.block_type
    # Determines the amount of whitespaces to be stripped at the
    # beginning of each line in code block.
    if line.paragraph_type != :blank
      if @code_block_indent
        @code_block_indent = [@code_block_indent, line.indent].min
      else
        @code_block_indent = line.indent
      end
    end
  end

  @output_type = line.assigned_paragraph_type || line.paragraph_type
end

#insert_slide_startObject



224
225
226
# File 'lib/org2slides.rb', line 224

def insert_slide_start
  @buffer << "START-SLIDE"
end

#insert_slide_stopObject



228
229
230
# File 'lib/org2slides.rb', line 228

def insert_slide_stop
  @buffer << "END-SLIDE"
end