lib/asciidoctor-latex/node_processors.rb
# Write preamble for tex file, write closing
# \end{document}
#
# This method reads several files:
#
# - preamble: required boilerplate
#
# - asciidoc_tex_macros: needed to translate certain
#   asciidoc constructs, e.g., quotes, into tex
#   construct -- one TeX defintion per asciidoc construct
#
# - macros: supplied by the user.  We need a good
#   mechanism for identifying and reading the user's
#   macro definitions.  In noteshare there is a database
#   field 
#
Write preamble for tex file, write closing
\end{document}

This method reads several files.

required boilerplate

needed to translate certain
asciidoc constructs, e.g., quotes, into tex
construct -- one TeX defintion per asciidoc construct

supplied by the user.  We need a good
mechanism for identifying and reading the user's
macro definitions.  In noteshare there is a database
field
Write preamble for tex file write closing \ end { document } This method reads several files . required boilerplate needed to translate certain asciidoc constructs e . g . quotes into tex construct -- one TeX defintion per asciidoc construct supplied by the user . We need a good mechanism for identifying and reading the user ' s macro definitions . In noteshare there is a database field
def tex_process    
    data_dir = File.join File.dirname(__FILE__), '..', '..', 'data'
    warn "Node: #{self.class}".blue if $VERBOSE
    doc = "%% Preamble %%\n"
    doc << File.open(File.join(data_dir, 'preamble.tex'), 'r') { |f| f.read }
    doc << "%% Asciidoc TeX Macros %%\n"
    doc << File.open(File.join(data_dir, 'asciidoc_tex_macros.tex'), 'r') { |f| f.read }
    doc << "%% User Macros %%\n"
    doc << File.open(File.join(data_dir, 'macros.tex'), 'r') { |f| f.read }
    doc << "%% Front Matter %%"
    doc << "\n\n\\title\{#{self.doctitle}\}\n"
    doc << "\\author\{#{self.author}\}\n"
    doc << "\\date\{#{self.revdate}\}\n\n\n"
    doc << "%% Begin Document %%"
    doc << "\n\n\\begin\{document\}\n"
    doc << "\\maketitle\n"
    if self.attributes["toc"]
      doc << "\\tableofcontents\n"
    end
    doc << "%% Begin Document Text %%\n"
    processed_content = TeXBlock.process_environments self.content
    doc << processed_content
    warn "Writing environment definitions to file: new_environments.tex" if $VERBOSE
    definitions = ""
    $latex_environment_names.each do |name|
      puts name
      definitions << "\\newtheorem\{#{name}\}\{#{name}\}" << "\n"
    end
    File.open('new_environments.tex', 'w') { |f| f.write(definitions) }
    doc << "\n\n\\end{document}\n\n" 
  end
def tex_process data_dir = File . join File . dirname ( __FILE__ ) , '..' , '..' , 'data' warn "Node: #{self.class}" . blue if $VERBOSE doc = "%% Preamble %%\n" doc << File . open ( File . join ( data_dir , 'preamble.tex' ) , 'r' ) { | f | f . read } doc << "%% Asciidoc TeX Macros %%\n" doc << File . open ( File . join ( data_dir , 'asciidoc_tex_macros.tex' ) , 'r' ) { | f | f . read } doc << "%% User Macros %%\n" doc << File . open ( File . join ( data_dir , 'macros.tex' ) , 'r' ) { | f | f . read } doc << "%% Front Matter %%" doc << "\n\n\\title\{#{self.doctitle}\}\n" doc << "\\author\{#{self.author}\}\n" doc << "\\date\{#{self.revdate}\}\n\n\n" doc << "%% Begin Document %%" doc << "\n\n\\begin\{document\}\n" doc << "\\maketitle\n" if self . attributes [ "toc" ] doc << "\\tableofcontents\n" end doc << "%% Begin Document Text %%\n" processed_content = TeXBlock . process_environments self . content doc << processed_content warn "Writing environment definitions to file: new_environments.tex" if $VERBOSE definitions = "" $latex_environment_names . each do | name | puts name definitions << "\\newtheorem\{#{name}\}\{#{name}\}" << "\n" end File . open ( 'new_environments.tex' , 'w' ) { | f | f . write ( definitions ) } doc << "\n\n\\end{document}\n\n" end
Write preamble for tex file, write closing
\end{document}
Write preamble for tex file write closing \ end { document }
# warn "Attributes: #{self.attributes}".yellow # warn "#{self.methods}".magenta # Now write the defnitions of the new environments # discovered to file # Output