Method: Texd::AttachmentList#reference

Defined in:
lib/texd/attachment.rb

#reference(path, rename = false) ⇒ Attachment::Reference

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Adds a file reference with the given path to the list. Similar to #attach, the file path must either be an absolute filename or be relative to app/tex/ of the host application.

File name mangling applies as well, with the same rules as in #attach.

File references allow to reduce the amount of data sent to the texd server instance, by initially only sending the file’s checksums. If the server can identify that checksum from an internal store, it’ll use the stored file. Otherwise we receive a list of unknown references, and can retry the render request with the missing content attached in full.

References will be stored on the server (for some amount of time), so you should only attach static files, which change seldomly. Do not add dynamic content.

Parameters:

  • path (String, Pathname)

    partial path

  • rename (Boolean, String) (defaults to: false)

    affects the output file name. If true, a random file name is generated for the TeX template, false will use the basename of path. When a string is given, that string is used instead. Be careful to avoid name collisions.

Returns:



107
108
109
# File 'lib/texd/attachment.rb', line 107

def reference(path, rename = false) # rubocop:disable Style/OptionalBooleanParameter
  add(Attachment::Reference, path, rename)
end