Outils pour utilisateurs

Outils du site


info:dokuwiki

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
info:dokuwiki [2019/07/10 15:07] – créée froginfo:dokuwiki [2019/07/10 15:11] (Version actuelle) frog
Ligne 5: Ligne 5:
  
 Plug In de coloration syntaxique: [[https://github.com/crazy-max/dokuwiki-plugin-syntaxhighlighter4]] Plug In de coloration syntaxique: [[https://github.com/crazy-max/dokuwiki-plugin-syntaxhighlighter4]]
 +<code sxh>
 +<sxh php; first-line: 89; highlight: [106,107]; title: New title attribute in action>
 +    /**
 +     * Render xhtml output or metadata
 +     *
 +     * @param string         $mode      Renderer mode (supported modes: xhtml)
 +     * @param Doku_Renderer  $renderer  The renderer
 +     * @param array          $data      The data from the handler() function
 +     * @return bool If rendering was successful.
 +     */
 +    public function render($mode, Doku_Renderer &$renderer, $data) {
 +        if($mode != 'xhtml') return false;
 +
 +        if (count($data) != 3) {
 +            return true;
 +        }
 +
 +        list($syntax, $attr, $content) = $data;
 +        if ($syntax == 'sxh') {
 +            $title = $this->procTitle($attr);
 +            $highlight = $this->procHighlight($attr);
 +            $renderer->doc .= '<pre class="brush: ' . strtolower($attr . $highlight) . '"' . $title . '>' . $renderer->_xmlEntities($content) . '</pre>';
 +        } else {
 +            $renderer->file($content);
 +        }
 +
 +        return true;
 +    }
 +</sxh>
 +</code>
 +<sxh php; first-line: 89; highlight: [106,107]; title: New title attribute in action>
 +    /**
 +     * Render xhtml output or metadata
 +     *
 +     * @param string         $mode      Renderer mode (supported modes: xhtml)
 +     * @param Doku_Renderer  $renderer  The renderer
 +     * @param array          $data      The data from the handler() function
 +     * @return bool If rendering was successful.
 +     */
 +    public function render($mode, Doku_Renderer &$renderer, $data) {
 +        if($mode != 'xhtml') return false;
 +
 +        if (count($data) != 3) {
 +            return true;
 +        }
 +
 +        list($syntax, $attr, $content) = $data;
 +        if ($syntax == 'sxh') {
 +            $title = $this->procTitle($attr);
 +            $highlight = $this->procHighlight($attr);
 +            $renderer->doc .= '<pre class="brush: ' . strtolower($attr . $highlight) . '"' . $title . '>' . $renderer->_xmlEntities($content) . '</pre>';
 +        } else {
 +            $renderer->file($content);
 +        }
 +
 +        return true;
 +    }
 +</sxh>
info/dokuwiki.1562764052.txt.gz · Dernière modification : de frog