User Tools

Site Tools


dokuwiki

Differences

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

Link to this comparison view

Next revision
Previous revision
dokuwiki [2012/04/04 20:36] – created javapimpdokuwiki [2023/08/18 18:15] (current) – external edit 127.0.0.1
Line 7: Line 7:
 ... ...
 </code> </code>
 +
 +====== ASCIIMathML.js ======
 +
 +Incorporating [[https://github.com/asciimath/asciimathml|ASCIIMathML.js]] requires disabling JavaScript compression in the configuration settings.
 +
 +  * Copy ''ASCIIMathML.js'' to the ''conf/'' directory.
 +  * Create or update ''userscript.js'' to include ''ASCIIMathML.js''.
 +<code javascript>
 +/* DOKUWIKI:include ASCIIMathML.js */
 +</code>
 +  * Update ''local.php'' to disable JavaScript compression:
 +<code php>
 +$conf['compress'] = 0;   // for ASCIIMathML.js
 +</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.1333571769.txt.gz · Last modified: 2023/08/18 18:15 (external edit)