Subversion Repositories Applications.papyrus

Rev

Rev 224 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 224 Rev 247
Line 19... Line 19...
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: Wikini.class.php,v 1.4 2004-12-07 12:17:41 jpm Exp $
24
// CVS : $Id: Wikini.class.php,v 1.5 2005-01-20 19:39:43 jpm Exp $
25
/**
25
/**
26
* Classe configurant le formatage pour Wikini.
26
* Classe configurant le formatage pour Wikini.
27
*
27
*
28
* Ce fichier contient une classe configurant les règles de formatage de Wikini.
28
* Ce fichier contient une classe configurant les règles de formatage de Wikini.
29
* Nécessite que l'application appelant ce fichier est précédement inclu le fichier de Pear:
29
* Nécessite que l'application appelant ce fichier est précédement inclu le fichier de Pear:
Line 34... Line 34...
34
//Auteur original :
34
//Auteur original :
35
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
35
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
36
//Autres auteurs :
36
//Autres auteurs :
37
*@author        Aucun
37
*@author        Aucun
38
*@copyright     Tela-Botanica 2000-2004
38
*@copyright     Tela-Botanica 2000-2004
39
*@version       $Revision: 1.4 $ $Date: 2004-12-07 12:17:41 $
39
*@version       $Revision: 1.5 $ $Date: 2005-01-20 19:39:43 $
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
41
*/
41
*/
Line 42... Line 42...
42
 
42
 
43
// +------------------------------------------------------------------------------------------------------+
43
// +------------------------------------------------------------------------------------------------------+
44
// |                                            ENTETE du PROGRAMME                                       |
44
// |                                            ENTETE du PROGRAMME                                       |
Line -... Line 45...
-
 
45
// +------------------------------------------------------------------------------------------------------+
45
// +------------------------------------------------------------------------------------------------------+
46
 
46
 
47
 
47
// +------------------------------------------------------------------------------------------------------+
48
// +------------------------------------------------------------------------------------------------------+
48
// |                                            CORPS du PROGRAMME                                        |
49
// |                                            CORPS du PROGRAMME                                        |
49
// +------------------------------------------------------------------------------------------------------+
50
// +------------------------------------------------------------------------------------------------------+
Line 72... Line 73...
72
    */
73
    */
73
    var $rules = array(
74
    var $rules = array(
74
        'Table', // Tableaux
75
        'Table', // Tableaux
75
        'Code', // Inclusion de code avec coloration syntaxique
76
        'Code', // Inclusion de code avec coloration syntaxique
76
        'Emphasis', // Italique
77
        'Emphasis', // Italique
-
 
78
        'Strong',// Gras
77
        'Freelink', // Nom de Page qui ne sont pas au format Wiki
79
        'Freelink', // Nom de Page qui ne sont pas au format Wiki
78
        'Heading', // Titre
80
        'Heading', // Titre
79
        'Horiz', // Ligne horizontale
81
        'Horiz', // Ligne horizontale
80
        'Interwiki', // Affichage de page d'un autre Wiki. Modifié par rapport à l'original de Text_Wiki
82
        'Interwiki', // Affichage de page d'un autre Wiki. Modifié par rapport à l'original de Text_Wiki
81
        'List', // Affichage de listes. Modifié par rapport à l'original de Text_Wiki
83
        'List', // Affichage de listes. Modifié par rapport à l'original de Text_Wiki
Line 83... Line 85...
83
        'Paragraph', // Nouveau paragraphe avec une ligne vide.
85
        'Paragraph', // Nouveau paragraphe avec une ligne vide.
84
        'Tighten', // Réduit les lignes vide si on en a 3 ou plus consécutives
86
        'Tighten', // Réduit les lignes vide si on en a 3 ou plus consécutives
85
        'Raw', // Inclusion de HTML et non traitement du contenu par les règles de formatage. Modifié par rapport à l'original de Text_Wiki
87
        'Raw', // Inclusion de HTML et non traitement du contenu par les règles de formatage. Modifié par rapport à l'original de Text_Wiki
86
        'Revise', // Suppression de texte. Modifié par rapport à l'original de Text_Wiki
88
        'Revise', // Suppression de texte. Modifié par rapport à l'original de Text_Wiki
87
        'Tt', // Texte à espacement fixe
89
        'Tt', // Texte à espacement fixe
88
        'Url', // Inclusion d'url dont les url d'images
90
        'Url' // Inclusion d'url dont les url d'images
89
        'Strong'// Gras
-
 
90
    );
91
    );
91
    /**
92
    /**
92
    * 
93
    * 
93
    * The delimiter for token numbers of parsed elements in source text.
94
    * The delimiter for token numbers of parsed elements in source text.
94
    * 
95
    * 
Line 97... Line 98...
97
    * @var string
98
    * @var string
98
    * 
99
    * 
99
    */
100
    */
100
    var $delim = 12;
101
    var $delim = 12;
Line 101... Line 102...
101
    
102
    
102
    function Text_Wikini()
103
    function Text_Wikini($rules = null)
103
    {
104
    {
104
        Text_Wiki::Text_Wiki();
-
 
105
        
105
        //Text_Wiki::Text_Wiki();
106
        $this->addPath(
106
        if (is_array($rules)) {
107
            'parse',
-
 
108
            $this->fixPath(dirname(__FILE__)) . 'Parse/'
107
            $this->rules = $rules;
109
        );
-
 
-
 
108
        }
110
        
109
        // Nous devons sortir les fichiers de Text_Wiki du dépot Pear car la fonction file_exists de PHP utilisée dans
-
 
110
        // la méthode findfile de Text_Wiki renvoie false.
-
 
111
        $this->addPath('parse', $this->fixPath(dirname(__FILE__)) .'../../pear/Text/Wiki/Parse/');
111
        $this->addPath(
112
        $this->addPath('render', $this->fixPath(dirname(__FILE__)) .'../../pear/Text/Wiki/Render/');
112
            'render',
113
        // Pour les règles spécifiques à Wikini:
113
            $this->fixPath(dirname(__FILE__)) . 'Render/'
114
        $this->addPath('parse', $this->fixPath(dirname(__FILE__)) . 'Parse/');
114
        );
115
        $this->addPath('render', $this->fixPath(dirname(__FILE__)) . 'Render/');
Line 115... Line 116...
115
    }
116
    }
116
    
117
    
117
    /**
118
    /**
Line 169... Line 170...
169
                if ($char == chr($this->delim)) {
170
                if ($char == chr($this->delim)) {
Line 170... Line 171...
170
                    
171
                    
171
                    // yes, get the replacement text for the delimited
172
                    // yes, get the replacement text for the delimited
172
                    // token number and unset the flag.
173
                    // token number and unset the flag.
-
 
174
                    $key = (int)$key;
-
 
175
                    $rule = null;
173
                    $key = (int)$key;
176
                    if (isset($this->tokens[$key][0])) {
-
 
177
                        $rule = $this->tokens[$key][0];
-
 
178
                    }
-
 
179
                    $opts = null;
174
                    $rule = $this->tokens[$key][0];
180
                    if (isset($this->tokens[$key][1])) {
-
 
181
                        $opts = $this->tokens[$key][1];
-
 
182
                    }
175
                    $opts = $this->tokens[$key][1];
183
                    if (isset($this->renderObj[$rule]) && is_object($this->renderObj[$rule])) {
-
 
184
                        $output .= $this->renderObj[$rule]->token($opts);
176
                    $output .= $this->renderObj[$rule]->token($opts);
185
                    }
Line 177... Line 186...
177
                    $in_delim = false;
186
                    $in_delim = false;
Line 178... Line 187...
178
                    
187
                    
Line 268... Line 277...
268
 
277
 
269
 
278
 
270
/* +--Fin du code ----------------------------------------------------------------------------------------+
279
/* +--Fin du code ----------------------------------------------------------------------------------------+
-
 
280
*
-
 
281
* $Log: not supported by cvs2svn $
-
 
282
* Revision 1.4  2004/12/07 12:17:41  jpm
271
*
283
* Correction message d'erreur.
272
* $Log: not supported by cvs2svn $
284
*
273
* Revision 1.3  2004/11/25 15:53:24  jpm
285
* Revision 1.3  2004/11/25 15:53:24  jpm
274
* Suppression action inclure, migrer dans Papyrus.
286
* Suppression action inclure, migrer dans Papyrus.
275
*
287
*