Module docsettings

This module is responsible for reading and writing metadata.lua files in the so-called sidecar directory (Wikipedia definition).

Functions

DocSettings:getSidecarDir (doc_path) Returns path to sidecar directory (filename.sdr).
DocSettings:getSidecarFile (doc_path) Returns path to metadata.lua file.
DocSettings:hasSidecarFile (doc_path) Returns true if there is a metadata.lua file.
DocSettings:open (docfile) Opens a document's individual settings (font, margin, dictionary, etc.)
DocSettings:flush () Serializes settings and writes them to metadata.lua.
DocSettings:purge (full) Purges (removes) sidecar directory.


Functions

DocSettings:getSidecarDir (doc_path)
Returns path to sidecar directory (filename.sdr).

Sidecar directory is the file without last suffix.

Parameters:

  • doc_path string path to the document (e.g., /foo/bar.pdf)

Returns:

    string path to the sidecar directory (e.g., /foo/bar.sdr)
DocSettings:getSidecarFile (doc_path)
Returns path to metadata.lua file.

Parameters:

  • doc_path string path to the document (e.g., /foo/bar.pdf)

Returns:

    string path to /foo/bar.sdr/metadata.lua file
DocSettings:hasSidecarFile (doc_path)
Returns true if there is a metadata.lua file.

Parameters:

  • doc_path string path to the document (e.g., /foo/bar.pdf)

Returns:

    bool
DocSettings:open (docfile)
Opens a document's individual settings (font, margin, dictionary, etc.)

Parameters:

  • docfile string path to the document (e.g., /foo/bar.pdf)

Returns:

    DocSettings object
DocSettings:flush ()
Serializes settings and writes them to metadata.lua.
DocSettings:purge (full)
Purges (removes) sidecar directory.

Parameters:

  • full Remove any of the old ones we may consider as candidates in DocSettings open()
generated by LDoc 1.4.6 Last updated 2023-01-23 20:53:04