Class: Brandish::Processors::All::Import
- Inherits:
-
Brandish::Processor::Base
- Object
- Brandish::Processor::Base
- Brandish::Processors::All::Import
- Includes:
- Brandish::Processor::Command
- Defined in:
- lib/brandish/processors/all/import.rb
Overview
Be careful when using :remote_allowed
- this can cause possible
security issues if the remote is not trusted.
"Imports" another file into this current file. This takes the file,
parses it, and inserts it directly into the position that the import
was placed. By default, this forces the file to be in the source
directory, doing some awkward joining to make it work. This takes
one pair - "name"
, "link"
, or "file"
- which contains the name of
the file to import. It takes two options: :absolute_allowed
, which
allows imports to be outside of the source directory; and
:remote_allowed
, which allows remote files to be imported, using any
of the protocols supported by open-uri.
For local file imports, if no extensions were provided, an extension
of .br
is automatically added. For remote files, extensions are
always required.
Imports are handled as if the entire imported file was copy and pasted into the source document.
Options:
:absolute_allowed
- Optional. Despite its name, if this value istrue
, imports can be used with any file that is outside of the source directory. Otherwise, the files will be forced to be inside the source directory, as if the source directory is the root of the file system.:remote_allowed
- Optional. Whether remote imports should be allowed.
Pairs:
"src"
,"file"
,"name"
, or"link"
- Required. These all do the same thing - it provides the name of the file to import.
Instance Attribute Summary
Attributes inherited from Brandish::Processor::Base
Instance Method Summary collapse
-
#perform ⇒ Parser::Node
Accepts the root node of the parsed file, processing the result as if it were an extension of the original source tree.
Methods included from Brandish::Processor::Command
Methods inherited from Brandish::Processor::Base
#accept, #call, #initialize, #postprocess, #process_block, #process_command, #process_root, #process_text, register, #setup
Constructor Details
This class inherits a constructor from Brandish::Processor::Base
Instance Method Details
#perform ⇒ Parser::Node
Accepts the root node of the parsed file, processing the result as if it were an extension of the original source tree.
59 60 61 |
# File 'lib/brandish/processors/all/import.rb', line 59 def perform accept(parse_file) end |