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:readSetting (key) Reads a setting.
DocSettings:saveSetting (key, value) Saves a setting.
DocSettings:delSetting (key) Deletes a setting.
DocSettings:flush () Serializes settings and writes them to metadata.lua.
DocSettings:purge () 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:readSetting (key)
Reads a setting.

Parameters:

  • key
DocSettings:saveSetting (key, value)
Saves a setting.

Parameters:

  • key
  • value
DocSettings:delSetting (key)
Deletes a setting.

Parameters:

  • key
DocSettings:flush ()
Serializes settings and writes them to metadata.lua.
DocSettings:purge ()
Purges (removes) sidecar directory.
generated by LDoc 1.4.6 Last updated 2017-08-17 09:26:49