Class: Texd::Document
- Inherits:
-
Object
- Object
- Texd::Document
- Defined in:
- lib/texd/document.rb
Overview
Document handles compiling of templates into TeX sources.
Defined Under Namespace
Classes: Compilation
Instance Attribute Summary collapse
-
#attachments ⇒ Object
readonly
Returns the value of attribute attachments.
Class Method Summary collapse
-
.compile(**kwargs) ⇒ Object
Shorthand for ‘new.compile`.
Instance Method Summary collapse
-
#compile(template:, locals: {}, layout: true) ⇒ Compilation
Compile converts templates into TeX sources and collects file references (created with ‘texd_attach` and `texd_reference` helpers).
-
#initialize ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize ⇒ Document
Returns a new instance of Document.
13 14 15 16 |
# File 'lib/texd/document.rb', line 13 def initialize context = LookupContext.new(Texd.config.lookup_paths) @attachments = AttachmentList.new(context) end |
Instance Attribute Details
#attachments ⇒ Object (readonly)
Returns the value of attribute attachments.
6 7 8 |
# File 'lib/texd/document.rb', line 6 def @attachments end |
Class Method Details
.compile(**kwargs) ⇒ Object
Shorthand for ‘new.compile`.
9 10 11 |
# File 'lib/texd/document.rb', line 9 def self.compile(**kwargs) new.compile(**kwargs) end |
Instance Method Details
#compile(template:, locals: {}, layout: true) ⇒ Compilation
Compile converts templates into TeX sources and collects file references (created with ‘texd_attach` and `texd_reference` helpers).
29 30 31 32 33 34 35 36 37 |
# File 'lib/texd/document.rb', line 29 def compile(template:, locals: {}, layout: true) helper_mod = ::Texd.helpers(, locals) tex_source = Class.new(ApplicationController) { helper helper_mod }.render(template: template, format: :tex, layout: layout) main = .main_input(tex_source) Compilation.new(main.name, ) end |