DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:odtsupport

odtsupport Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" yes
  • 2020-07-29 "Hogfather" yes

plugin Provides helpers that can be useful when creating ODT files with the odt plugin. For example, the plugin can pipe wiki page metadata into a field within the ODT result.

Last updated on
2023-01-31
Provides
Syntax
Repository
Source
Requires
odt, text

Tagged with export, odt

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

:!: External requirements: This plugin requires the following additional components that must be installed separately:

  • text (optional: allows to use the search for generated pagecodes)
  • fields (mandatory for some commands)

If you installed the text plugin, the following syntax elements will give their results to be included within the dokuwiki search: hash, pagehash, pagehash4, pagehashtofield, pagehashtofield4.

metadatatofield, pagehashtofield, pagehashtofield4 will silently fail, unless you installed the fields plugin.

What's it for?

Take a look at the following image. It shows a footer of a generated ODT file. The code “b41f” on the left has been generated by this plugin, and the change date on the right hand side has been taken from the original wiki page's metadata.

The code “b41f” is a short name for the page it was generated for. In addition to being generated into the ODT file, this code can be used within the dokuwiki search as a helper to quickly find said page.

How am I using that? At my work we produce documents that are reviewed by independent external reviewers that check for regulatory adherence. For that purpose, we need paper copies of wiki pages. We use the odt plugin to create such documents.

In order to be able to quickly access the original wiki page of a paper document, I added that 4-chars quickcode that can be entered into the dokuwiki search.

In order to be able to check the version/modification date of a paper document, I added the wiki page's modification date to the ODT file.

An addition introduced with version v0.85 is the possibility to use 'serverurl'. This function allows to create links to a specific server address, with some adjustment that can be made to the specific subdirectory and presentation string. Access to the pagehash is available, too. This allows to create links to locations that were specifically made available for the current dokuwiki page.

Syntax

hash

{{hash>string}}

Example:

{{hash>TEST}}

will result in the following output: a96df14f8b5ccb567eede45bdddf189f

pagehash

{{pagehash}}

Take the page's namespace(s) and pagename to create an MD2 hash value and output it.

pagehash4

{{pagehash4}}

Take the page's namespace(s) and pagename to create an MD2 hash value and output it's first 4 characters. Since that's rather short, it's possible that two distinct pages share the same short hash.

metadatatofield

{{metadatatofield>string}}

Relay a properly addressed metadata value of the wiki page into a field in an exported ODT file. (Replace “string” with the correct address.)

Refer to data_structure to see how to address metadata. The field that is created will always be named like the addressing metadata string stripped by white spaces and non-alphanumeric chars (except for an underscore, this one will be allowed). E.g.: “last_change date” will result in a field named “last_changedate”.

If the metadata address contains the string 'date', the field will be filled with a formatted date.

Example:

{{metadatatofield>last_change date}}

takes the metadata value addressed by “last_change date” (that's the page's “timestamp, date of last modification”) and writes it into the field “last_changedate” within the exported ODT file.

pagehashtofield

{{pagehashtofield>string}}

Take the page's namespace(s) and pagename to create an MD2 hash value and write it to an exported ODT file into the field named like the given “string”.

Example:

{{pagehashtofield>pagecode}}

will result in an ODT field with the name “pagecode” containing the corresponding hash value of the wiki page's address.

pagehashtofield4

{{pagehashtofield4>string}}

Same as pagehashtofield, but will only output the first 4 characters.

serverurl

{{serverurl>string:string2}}

Inserts a link to an URL defined in the configuration key 'serverurl' (see configuration). The provided string will be appended to the file link. The presentation text is defined by string2.

You can use the keywords <PAGEHASH> and <PAGEHASH4> to insert page hashes within string and string2.

Example: (given that the serverurl configuration setting is set to 'file:\\\\\SERVER\documents', and the page's 4-hash is 'abbt')

{{serverurl>\subfolder:My <PAGEHASH4> subfolder}}

will result in a link to the following url: file:\\\\\SERVER\documents\subfolder and the presentation text will be My abbt subfolder.

Configuration and Settings

  • dateformat - Date format string compliant with the PHP function date(). It's used for the command 'metadatatofield', in case a date is read from the metadata.
  • serverurl - URL to a server location. See serverurl syntax description.
  • firstdefinitionwins - When using 'metadatatofield' or 'pagehashtofield', this configuration option allows to specify that only the first occurence of them will result in setting a field within an ODT file.

Development

Sources on github.

Change Log

  • 2021-03-13
    • v0.82-alpha (Initial release)
  • 2021-03-22
    • v0.83 (Added structured dependency to the fields plugin.)
  • 2021-05-27
    • v0.84 Smaller fixes
  • 2022-01-28
    • v0.85 Added serverurl functionality
  • 2022-12-15
    • v0.86 Added possibility to use hash4 pattern
      • Also, the repository had to be recreated. The reason for the loss on github.com is unknown.
  • 2023-01-31
    • v0.87 Added optional usage of the usecounter plugin and the config option 'firstdefinitionwins'.

Known Bugs and Issues

See issue tracker on github.

FAQ

None, yet.

Discussion

Start here.

plugin/odtsupport.txt · Last modified: 2023-01-31 08:44 by thomas-schaefer-nh

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki