Class: WritersRoom::Formatters::TranscriptFormatter

Inherits:
BaseFormatter
  • Object
show all
Defined in:
lib/writers_room/formatters/transcript_formatter.rb

Overview

Formats dialog/transcript projects.

Instance Attribute Summary

Attributes inherited from BaseFormatter

#medium, #metadata, #project_path

Instance Method Summary collapse

Methods inherited from BaseFormatter

#export, #format, #initialize

Constructor Details

This class inherits a constructor from WritersRoom::Formatters::BaseFormatter

Instance Method Details

#body_sectionsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/writers_room/formatters/transcript_formatter.rb', line 7

def body_sections
  sections = []

  # Include scene transcripts
  transcripts_dir = File.join(@project_path, "transcripts")
  if Dir.exist?(transcripts_dir)
    Dir.glob(File.join(transcripts_dir, "*.{txt,md}")).sort.each do |file|
      sections << "### #{File.basename(file)}\n\n#{File.read(file)}"
    end
  end

  sections
end