Coding with SPIP 2.1
SPIP 2.1 Technical Documentation

> > > > pre_typo

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.

  1. $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 "©":

  1. function typoenluminee_pre_typo($texte) {
  2. // ...
  3. $chercher_raccourcis = array(
  4. // ...
  5. /* 19 */ "/\(c\)/Si",
  6. /* 20 */ "/\(r\)/Si",
  7. /* 21 */ "/\(tm\)/Si",
  8. /* 22 */ "/\.\.\./S",
  9. );
  10.  
  11. $remplacer_raccourcis = array(
  12. // ...
  13. /* 19 */ "©",
  14. /* 20 */ "®",
  15. /* 21 */ "™",
  16. /* 22 */ "…",
  17. );
  18. // ...
  19. $texte = preg_replace($chercher_raccourcis, $remplacer_raccourcis, $texte);
  20. // ...
  21. return $texte;
  22. }

Download

  • Author :
  • Published :
  • Updated : 29/05/10
  • Translations : English, français