line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package oEdtk::TexDoc; |
2
|
|
|
|
|
|
|
our $VERSION = 0.7004; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use base 'oEdtk::Doc'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
620
|
|
5
|
1
|
|
|
1
|
|
6
|
use oEdtk::Config (config_read); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
6
|
1
|
|
|
1
|
|
6
|
use oEdtk::Dict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
7
|
1
|
|
|
1
|
|
1138
|
use oEdtk::TexTag; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
99
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
17
|
use strict; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
59
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
524
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub mktag { |
14
|
0
|
|
|
0
|
0
|
|
my ($self, $name, $value) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
return oEdtk::TexTag->new($name, $value); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub append_table { |
21
|
0
|
|
|
0
|
0
|
|
my ($self, $name, @values) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
$self->append($name, \@values); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub line_break { |
28
|
0
|
|
|
0
|
0
|
|
return "%\n"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $_CFG = config_read(); |
33
|
|
|
|
|
|
|
# ON OUVRE LE DICTIONNAIRE EN STATIQUE POUR ÉVITER LES ACCÈS MULTIPLES AU FICHIER CORRESPONDANT |
34
|
|
|
|
|
|
|
my $_DICO_TEX_CHAR = oEdtk::Dict->new($_CFG->{'EDTK_DICO_XLAT'}, , { section => 'LATEX' }); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# http://woufeil.developpez.com/tutoriels/perl/poo/ |
37
|
|
|
|
|
|
|
sub escape { |
38
|
0
|
|
|
0
|
0
|
|
my $str = shift; |
39
|
|
|
|
|
|
|
# ESCAPE SPECIAL CARACTERS FOR TEXTAGS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Deal with backslashes and curly braces first and at the same |
42
|
|
|
|
|
|
|
# time, because escaping backslashes introduces curly braces, and, |
43
|
|
|
|
|
|
|
# inversely, escaping curly braces introduces backslashes. |
44
|
|
|
|
|
|
|
# see http://detexify.kirelabs.org/classify.html |
45
|
0
|
|
|
|
|
|
my $new = ''; |
46
|
0
|
|
|
|
|
|
foreach my $s (split(/([{}\\])/, $str)) { |
47
|
0
|
0
|
|
|
|
|
if ($s eq "{") { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
$new .= "\\textbraceleft{}"; |
49
|
|
|
|
|
|
|
} elsif ($s eq "}") { |
50
|
0
|
|
|
|
|
|
$new .= "\\textbraceright{}"; |
51
|
|
|
|
|
|
|
} elsif ($s eq "\\") { |
52
|
0
|
|
|
|
|
|
$new .= "\\textbackslash{}"; |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
$new .= $s; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
|
|
|
$new =~s/([%&\$_#])/\\$1/g; |
58
|
|
|
|
|
|
|
# warn "DEBUG : \$_DICO_TEX_CHAR = $_DICO_TEX_CHAR\n"; |
59
|
0
|
|
|
|
|
|
$new = $_DICO_TEX_CHAR->substitue($new); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# \\"{} => PROVOQUE DES ERREURS TEX DANS LE PROCESSUS D'INDEXATION (POUR INJECTION EN SGBD) |
62
|
0
|
|
|
|
|
|
$new =~ s/\\\"\{\}/\\textquotestraightdblbase{}/g; |
63
|
0
|
|
|
|
|
|
$new =~ s/\\\"/\\textquotestraightdblbase{}/g; |
64
|
|
|
|
|
|
|
# 01...@A...yz{}|~ 1° |
65
|
0
|
|
|
|
|
|
return $new; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |