It's better when it's simple

User Tools

Site Tools


French Typography plugin

Compatible with DokuWiki


plugin Respect French typographical rules for non-breaking spaces.

Last updated on

The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on Recommended are public repository hosts like GitHub, GitLab or Bitbucket.

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Extension name contains underscore, will not generate popularity points.

Tagged with language, typography

Details and Download


This source code may not be up to date. This is posted here, just in case the link above will be broken.

File: syntax.php

 * French typography plugin
 * Adds non-breaking spaces where needed by French typography rules .
 * GPL 2 (
 * Philippe Debar
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
class syntax_plugin_frenchtypo extends DokuWiki_Syntax_Plugin {
    function getInfo(){
        return array(
            'author' => 'Philippe Debar',
            'date'   => '2007-01-27',
            'name'   => 'French Typography',
            'desc'   => 'Adds non-breaking spaces where needed by French typography rules .',
            'url'    => '',
    // Substitution type - with required back-compatibility typo ;o)
    function getType(){ return 'substition'; }
   // No nested modes allowed -> use default getAllowedTypes() {return array();}
   // Can be used inside paragraphs -> use defautl getPType() {return 'normal';}
    // When to apply - should experiment with this ?
    function getSort(){
        return 245;
    function connectTo($mode) {
      $this->Lexer->addSpecialPattern(' (?=[!?:;»])',$mode,'plugin_frenchtypo');
      $this->Lexer->addSpecialPattern(' (?=»)',$mode,'plugin_frenchtypo');
      $this->Lexer->addSpecialPattern('(?<=«) ',$mode,'plugin_frenchtypo');
      $this->Lexer->addSpecialPattern('(?<=«) ',$mode,'plugin_frenchtypo');
      $this->Lexer->addSpecialPattern('[<]{2} ',$mode,'plugin_frenchtypo');
      $this->Lexer->addSpecialPattern(' >>',$mode,'plugin_frenchtypo');
    function handle($match, $state, $pos, &$handler){
        if ($state==DOKU_LEXER_SPECIAL){
            switch ($match) {
              case ' ':
                return 'Â ';
              case '<< ':
                return '« ';
              case ' >>':
                return ' »';
        return $match;
    function render($mode, &$renderer, $data) {
        if($mode == 'xhtml'){
            $renderer->doc .= $data;
            return true;
        return false;
plugin/french_typography.txt · Last modified: 2023-10-30 22:56 by Klap-in

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