Documentation du Dr FRAPPE

Ce wiki regroupe les résultats de mes expériences en informatique accumulés au cours de mes recherches sur le net.

Dans la mesure du possible, j'ai cité mes sources ; il en manque certainement… :-)

Ceci est une ancienne révision du document !


Numérotation des titres par CSS uniquement (remplace numberedheadings)

Voici la numérotation des titres basée uniquement sur les CSS (remplace le plugin numberedheadings)

Le code CSS suivant numérote tous les titres du wiki, ainsi que ceux de la table des matières.

Mettez-le :

  • soit dans un fichier CSS de votre modèle (et une deuxième fois dans print.css, si vous voulez que la numérotation soit imprimable)
  • ou dans un userstyle.css dans votre répertoire ./conf (ou userall.css s'il le faut) également utilisé pour la version imprimée):

Pour le modèle par défaut :

/lib/tpl/dokuwiki/css/userstyle.css
.dokuwiki .page {counter-reset: level1;}
.dokuwiki #dw__toc:before, .dokuwiki #dw__toc:after {counter-reset: level1; content: "";}
.dokuwiki #dw__toc h3:before{content: ""}

.dokuwiki .page h1, .dokuwiki ul.toc li.level1 {counter-reset: level2;}
.dokuwiki .page h2, .dokuwiki ul.toc li.level2 {counter-reset: level3;}
.dokuwiki .page h3, .dokuwiki ul.toc li.level3 {counter-reset: level4;}
.dokuwiki .page h4, .dokuwiki ul.toc li.level4 {counter-reset: level5;}
.dokuwiki .page h5, .dokuwiki ul.toc li.level5 {}

.dokuwiki .page h1:before,
.dokuwiki ul.toc li.level1 a:before {
    content: counter(level1) " ";
    counter-increment: level1;
}
.dokuwiki .page h2:before,
.dokuwiki ul.toc li.level2 a:before {
    content: counter(level1) "." counter(level2) " ";
    counter-increment: level2;
}
.dokuwiki .page h3:before,
.dokuwiki ul.toc li.level3 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) " ";
    counter-increment: level3;
}
.dokuwiki .page h4:before,
.dokuwiki ul.toc li.level4 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) " ";
    counter-increment: level4;
}
.dokuwiki .page h5:before,
.dokuwiki ul.toc li.level5 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) " ";
    counter-increment: level5;
}

Cela fonctionne pour le modèle par défaut.

Pour les autres modèles, chaque occurrence de .page doit être remplacée par la boîte entourant le contenu du modèle (probablement #content ou similaire).

/doc/lib/tpl/monobook/user/screen.css
.dokuwiki #content {counter-reset: level1;}
.dokuwiki #dw__toc:before, .dokuwiki #dw__toc:after {counter-reset: level1; content: "";}
.dokuwiki #dw__toc h3:before{content: ""}

.dokuwiki #content h1, .dokuwiki ul.toc li.level1 {counter-reset: level2;}
.dokuwiki #content h2, .dokuwiki ul.toc li.level2 {counter-reset: level3;}
.dokuwiki #content h3, .dokuwiki ul.toc li.level3 {counter-reset: level4;}
.dokuwiki #content h4, .dokuwiki ul.toc li.level4 {counter-reset: level5;}
.dokuwiki #content h5, .dokuwiki ul.toc li.level5 {}

.dokuwiki #content h1:before,
.dokuwiki ul.toc li.level1 a:before {
    content: counter(level1) " ";
    counter-increment: level1;
}
.dokuwiki #content h2:before,
.dokuwiki ul.toc li.level2 a:before {
    content: counter(level1) "." counter(level2) " ";
    counter-increment: level2;
}
.dokuwiki #content h3:before,
.dokuwiki ul.toc li.level3 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) " ";
    counter-increment: level3;
}
.dokuwiki #content h4:before,
.dokuwiki ul.toc li.level4 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) " ";
    counter-increment: level4;
}
.dokuwiki #content h5:before,
.dokuwiki ul.toc li.level5 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) " ";
    counter-increment: level5;
}

Pré-requis

Installation

Modification pour exclure de la numérotation le premier h1 (titre de la page)

/lib/tpl/monobook/user/screen.css
.dokuwiki #content {counter-reset: level1;}
.dokuwiki #dw__toc:before,
.dokuwiki #dw__toc:after {counter-reset: level1; content: "";}
.dokuwiki #dw__toc h3:before{content: ""}
 
.dokuwiki #content h1, .dokuwiki ul.toc li.level1 {counter-reset: level2;}
.dokuwiki #content h2, .dokuwiki ul.toc li.level2 {counter-reset: level3;}
.dokuwiki #content h3, .dokuwiki ul.toc li.level3 {counter-reset: level4;}
.dokuwiki #content h4, .dokuwiki ul.toc li.level4 {counter-reset: level5;}
.dokuwiki #content h5, .dokuwiki ul.toc li.level5 {}
 
.dokuwiki #content h1:before,
.dokuwiki ul.toc li.level1 a:before {
    content: counter(level1) " ";
    counter-increment: level1;
}
.dokuwiki #content h1.sectionedit1:before,
.dokuwiki ul.toc li.level1:first-child a:before {
    content: none;
}
.dokuwiki #content h2:before,
.dokuwiki ul.toc li.level2 a:before {
    content: counter(level1) "." counter(level2) " ";
    counter-increment: level2;
}
.dokuwiki #content h3:before,
.dokuwiki ul.toc li.level3 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) " ";
    counter-increment: level3;
}
.dokuwiki #content h4:before,
.dokuwiki ul.toc li.level4 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) " ";
    counter-increment: level4;
}
.dokuwiki #content h5:before,
.dokuwiki ul.toc li.level5 a:before {
    content: counter(level1) "." counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) " ";
    counter-increment: level5;
}

Variante

Placez le fichier suivant dans l'un des CSS de votre thème (template) (ainsi que dans le print.css pour avoir la numérotation lors de l'impression) ou dans un userstyle.css dans votre répertoire ./conf :

Pour le thème monobook :

/doc/lib/tpl/monobook/user/screen.css
/*
   Place for user defined CSS rules (screen media) - this file can safely be
   preserved when updating. See README for details.

   Note: All example files are delivered with the ".dist" extensions to make
         sure your changes do not get overwritten when updating the template.
         Just remove the ".dist" extension to use them.
*/

/* headlines */
div#content .dokuwiki h1,
div#content .dokuwiki h2 {
  font-weight: bold;
}
div#content .dokuwiki h3,
div#content .dokuwiki h4,
div#content .dokuwiki h5,
div#content .dokuwiki h6 {
  font-weight: normal;
}

div#content .dokuwiki {counter-reset: level1;}
.dokuwiki #dw__toc:before,
.dokuwiki #dw__toc:after {counter-reset: level1; content: "";}
.dokuwiki #dw__toc h3:before{content: ""}
 
div#content .dokuwiki h1, .toc-body ul.toc li.level1 {counter-reset: level2;}
div#content .dokuwiki h2, .toc-body ul.toc li.level2 {counter-reset: level3;}
div#content .dokuwiki h3, .toc-body ul.toc li.level3 {counter-reset: level4;}
div#content .dokuwiki h4, .toc-body ul.toc li.level4 {counter-reset: level5;}
div#content .dokuwiki h5, .toc-body ul.toc li.level5 {}
 
div#content .dokuwiki h1:before,
.dokuwiki ul.toc li.level1 a:before {
    content: counter(level1) ". ";
    counter-increment: level1;
}
div#content .dokuwiki h1.sectionedit1:before,
.dokuwiki ul.toc li.level1 a:before {
    content: none;
}
div#content .dokuwiki h2:before,
.dokuwiki ul.toc li.level2 a:before {
    content: counter(level2) ". ";
    counter-increment: level2;
}
div#content .dokuwiki h3:before,
.dokuwiki ul.toc li.level3 a:before {
    content: counter(level2) "." counter(level3) ". ";
    counter-increment: level3;
}
div#content .dokuwiki h4:before,
.dokuwiki ul.toc li.level4 a:before {
    content: counter(level2) "." counter(level3) "." counter(level4) ". ";
    counter-increment: level4;
}
div#content .dokuwiki h5:before,
.dokuwiki ul.toc li.level5 a:before {
    content: counter(level2) "." counter(level3) "." counter(level4) "." counter(level5) ". ";
    counter-increment: level5;
}

Configuration

Utilisation

Désinstallation

Voir aussi