1 # Copyright (C) 2013 Alex Schroeder <alex@gnu.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/fractions.pl">fractions.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Fractions">Fractions</a></p>';
18 push(@MyRules, \
&FractionsRule
);
22 if (/\G\^([0-9]+)\/([0-9]+)/cg
) {
23 if ($1 == 1 and $2 == 4) { return "\¼"; }
24 elsif ($1 == 1 and $2 == 2) { return "\½"; }
25 elsif ($1 == 3 and $2 == 4) { return "\¾"; }
26 elsif ($1 == 1 and $2 == 7) { return "\⅐"; }
27 elsif ($1 == 1 and $2 == 9) { return "\⅑"; }
28 elsif ($1 == 1 and $2 == 10) { return "\⅒"; }
29 elsif ($1 == 1 and $2 == 3) { return "\⅓"; }
30 elsif ($1 == 2 and $2 == 3) { return "\⅔"; }
31 elsif ($1 == 1 and $2 == 5) { return "\⅕"; }
32 elsif ($1 == 2 and $2 == 5) { return "\⅖"; }
33 elsif ($1 == 3 and $2 == 5) { return "\⅗"; }
34 elsif ($1 == 4 and $2 == 5) { return "\⅘"; }
35 elsif ($1 == 1 and $2 == 6) { return "\⅙"; }
36 elsif ($1 == 5 and $2 == 6) { return "\⅚"; }
37 elsif ($1 == 1 and $2 == 8) { return "\⅛"; }
38 elsif ($1 == 3 and $2 == 8) { return "\⅜"; }
39 elsif ($1 == 5 and $2 == 8) { return "\⅝"; }
40 elsif ($1 == 7 and $2 == 8) { return "\⅞"; }
44 for my $char (split(//, $1)) {
45 if ($char eq '1') { $html .= "\¹"; }
46 elsif ($char eq '2') { $html .= "\²"; }
47 elsif ($char eq '3') { $html .= "\³"; }
48 else { $html .= "\ȇ$char;"; }
53 for my $char (split(//, $2)) {
54 $html .= "\Ȉ$char;";