Wiki Filter

From Okapi Framework
Jump to: navigation, search

Overview

The Wiki Filter is an Okapi component for extracting translatable text from wiki markup. Currently the only supported style of markup is Dokuwiki.

 === Header ===
 Paragraph
  * List item
   * List item
 
 {{image.jpg|Image caption}}
 
 ^ Table header 1 ^ Table header 2 |
 | Table cell 1 | Table cell 2 |

Processing Details

Input Encoding

The filter decides which encoding to use for the input document using the following logic:

  • If the file has a Unicode Byte-Order-Mark:
    • Then, the corresponding encoding (e.g. UTF-8, UTF-16, etc.) is used.
  • Otherwise, the input encoding used is the default encoding that was specified when opening the document.

Inline Codes

All Dokuwiki syntax described here is supported.

Parameters

Prevent the filter from collapsing whitespace by setting preserve_whitespace: true.

You may define custom inline codes as follows:

 custom_codes:
   - pattern: "REGEX_PATTERN"
   - {start_pattern: "REGEX_PATTERN", end_pattern: "REGEX_PATTERN"}

Specify just pattern for a placeholder tag; specify a start_pattern and end_pattern for opening/closing tag pairs.

Item Description Example value
REGEX_PATTERN Any valid regex that matches non-zero-width runs of text within the comment. Matches will be turned into codes according to the parameters as described above. \[(path|menu)[^\]]*\]

Limitations

  • Attributes of inline codes (link and image URLs, etc.) are not exposed for translation or special processing.
  • Embedded HTML, PHP, etc., is not extracted.