User Tools

Site Tools


dokuwiki

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
dokuwiki [2016/05/14 20:52] javapimpdokuwiki [2023/08/18 18:15] (current) – external edit 127.0.0.1
Line 21: Line 21:
 $conf['compress'] = 0;   // for ASCIIMathML.js $conf['compress'] = 0;   // for ASCIIMathML.js
 </code> </code>
 +
 +====== Tiny Diagram ======
 +
 +Incorporating the [[http://www.fourthwoods.com/utils/tinydiagram/tinydiagram.js|Tiny Diagram]] JavaScript renderer requires the following changes:
 +
 +  * Add ''diag'' to the list of formatting modes in ''inc/parserutils.php''.
 +
 +<code php>
 +    // add formatting modes
 +    $fmt_modes = array('strong','emphasis','underline','monospace','diag',
 +            'subscript','superscript','deleted');
 +</code>
 +
 +  * Add the following function to ''inc/parser/handler.php''.
 +
 +<code php>
 +    function diag($match, $state, $pos) {
 +        $this->_nestingTag($match, $state, $pos, 'diag');
 +        return true;
 +    }
 +
 +</code>
 +
 +  * Add the following functions to ''/inc/parser/xhtml.php''.
 +
 +<code php>
 +    /**
 +     * Start diag formatting
 +     */
 +    function diag_open() {
 +        $this->doc .= '<div class="diag">';
 +    }
 +
 +    /**
 +     * Stop diag formatting
 +     */
 +    function diag_close() {
 +        $this->doc .= '</div>';
 +    }
 +</code>
 +
 +  * Add ''diag'' to the ''formatting'' modes in ''src/parser/parser.php''.
 +
 +<code php>
 +    // modes for styling text -- footnote behaves similar to styling
 +    'formatting'   => array('strong', 'emphasis', 'underline', 'monospace','diag',
 +                            'subscript', 'superscript', 'deleted', 'footnote'),
 +</code>
 +
 +  * and the following entry in the formatting array:
 +
 +<code php>
 +        'diag'=> array (
 +            'entry'=>'<diag>(?=.*</diag>)',
 +            'exit'=>'</diag>',
 +            'sort'=>140
 +            ),
 +</code>
 +
 +  * Add the following functions to ''inc/parser/renderer.php''.
 +
 +<code php>
 +    /**
 +     * Start diag formatting
 +     */
 +    function diag_open() {
 +    }
 +
 +    /**
 +     * Stop diag formatting
 +     */
 +    function diag_close() {
 +    }
 +</code>
 +
 +  * Copy ''tinydiagram.js'' to the ''conf/'' directory.
 +  * Create or update ''userscript.js'' to include ''tinydiagram.js''.
 +<code javascript>
 +/* DOKUWIKI:include tinydiagram.js */
 +</code>
 +  * Dokuwiki tries to convert quotes to "smart quotes". This breaks the diagram JSON. Update ''local.php'' to disable quotation character conversion:
 +<code php>
 +$conf['typography'] = 0; // for Tiny Diagram
 +</code>
 +
  
dokuwiki.1463259156.txt.gz · Last modified: 2023/08/18 18:15 (external edit)