pre_typo

The pre_typo pipeline is used to modify the text before the typographical processes envisaged by SPIP are executed. It is called by the corriger_typo() function in ecrire/inc/texte.php, a function which is itself called when using the propre() or typo() functions.

$letexte = pipeline('pre_typo', $letexte);

The modifications proposed must only apply processes to the elements that can be displayed on a single (inline) line. For processes that modify or create blocks or paragraphs, you must use the pre_propre pipeline.

Example

The "Enluminures Typographiques" plugin automatically modifies how some character strings are displayed, e.g. transforming "(c)" into "©":

function typoenluminee_pre_typo($texte) {
    // ...
    $chercher_raccourcis = array(
        // ...
        /* 19 */    "/\(c\)/Si",
        /* 20 */    "/\(r\)/Si",
        /* 21 */    "/\(tm\)/Si",
        /* 22 */    "/\.\.\./S",
    );

    $remplacer_raccourcis = array(
        // ...
        /* 19 */    "©",
        /* 20 */    "®",
        /* 21 */    "™",
        /* 22 */    "…",
    );
    // ...
    $texte = preg_replace($chercher_raccourcis, $remplacer_raccourcis, $texte);
    // ...
    return $texte;
}

Author Mark Baber Published : Updated : 29/05/10

Translations : English, français