Commit Graph

35 Commits

Author SHA1 Message Date
Alex Schroeder
a91ef8602f Moving modules from utf8::encode to encode_utf8 2016-06-22 15:37:04 +02:00
Alex Schroeder
ca974a902d latex.pl: Globbing nil requires double quotes to work 2016-06-19 15:55:46 +02:00
Alex Schroeder
c121607f61 All open and tie calls need utf8::encode 2016-06-19 13:51:11 +02:00
Alex Schroeder
032c7aea73 bsd_glob replaced with Glob 2016-06-19 11:55:58 +02:00
Alex Schroeder
83f13a9a1a Use helper functions for accessing the file system
As we derive a lot of filenames from strings in UTF-8 encoded files, we
need to make sure that any filename that might might be set by a user –
including all the filenames containing a directory deriving from
$DataDir – are passed through utf8::encode. That is, every character
gets replaced with a sequence of one or more characters that represent
the individual bytes of the character and the UTF8 flag is turned off.

In other words, -d $DataDir might not work if $DataDir contains a UTF-8
encoded string. The solution is to use the following replacements:

-f $name            IsFile($name)
-e $name            IsFile($name)
-d $name            IsDir($name)
(stat($name))[9]    Modified($name)
-M $name            $Now - Modified($name)
-z $name            ZeroSize($name)
unlink $name        Unlink($name)
mkdir $name         CreateDir($name)
rmdir $name         RemoveDir($name)

(Using IsFile for -e is probably not ideal?)

If you don’t, and Oddmuse gets used with Mojolicious, and you use the
Namespaces Extension, and a namespace contains non-ASCII characters such
as ä, ö, or ü, these characters will end up as part of $DataDir and
trigger the problem.

I also wonder whether we should be using some other Perl library.
2016-06-17 14:49:34 +02:00
Aleks-Daniel Jakimenko
4eef4d2d76 No more /o, modifiers sorted alphabetically 2015-08-23 21:22:12 +03:00
Alex Schroeder
58e9a1e240 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Alex Schroeder
dfa71cb2e3 Revert "Changed EN DASH to - in copyright lines"
This reverts commit 06c7fedec0.
2015-07-28 22:44:53 +02:00
Alex Schroeder
06c7fedec0 Changed EN DASH to - in copyright lines
The EN DASH is not really required in year ranges such as 2012–2015 when
we're talking about comments in source code that is probably being
displayed in a fixed font anyway. Changing back to an ordinary hypen
allows us to make a meaningful test for use utf8.
2015-07-28 22:14:37 +02:00
Aleks-Daniel Jakimenko
2894a4b381 latex.pl: correct eval usage 2015-05-02 04:19:09 +03:00
Aleks-Daniel Jakimenko
26b0853e13 No more two-arg open 2015-05-02 03:19:25 +03:00
Aleks-Daniel Jakimenko
7112f1c170 No more trailing whitespace (this time for sure) 2015-04-17 01:43:19 +03:00
Aleks-Daniel Jakimenko
c7bd5617ff No more trailing whitespace 2015-04-17 01:39:47 +03:00
Aleks-Daniel Jakimenko
6f8d281d79 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
1c32e0d45c latex.pl uses strict
This should make sure that we do in fact run the cleanup code even if
an error occured. Also, whitespace changes because it was a pain to
read.
2015-03-29 14:56:52 +02:00
Aleks-Daniel Jakimenko
4492ede096 "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Aleks-Daniel Jakimenko
62c7553d82 'return undef' changed to 'return'
This command was used:
find . -type f -print0 | xargs -0 sed -i 's/return undef/return/g'

The idea behind this commit is described on http://oddmuse.org/wiki/Refactoring page.
In short: 'return undef' returns (undef) in list context (a list with one element),
which is wrong.
2015-02-27 12:10:18 +02:00
Alex Schroeder
5aba2ae56f Fixed typo in AddModuleDescription sub name 2014-08-21 22:23:23 +02:00
Alex Jakimenko
ee932dee37 Automatically reformatted modules 2014-08-21 07:29:46 +03:00
Alex Schroeder
7ca0f6172b Use bsd_glob instead of glob.
Glob will split patterns on whitespace and non-breaking spaces are now
treated as whitespace.
2012-07-21 00:40:42 +02:00
Alex Schroeder
f11e2a8731 getting rid of $Id$ tags in $WikiDescription
Replaced the $Id$ tags in $WikiDescription for all the modules and wiki.pl itself with a link to the source and an appropriate wiki page, if possible. This is shown in action=version and should help users figure out what another wiki has installed.
2012-04-19 02:18:45 +02:00
Todd Neal
97f68192aa Added option to allow displaying of LaTeX errors inline in the page 2005-03-15 14:50:04 +00:00
Todd Neal
24622eb432 * Equation labeling with \[(mylabel) some equation \] and then local reference
with EQ(mylabel)

* Equation counter and css to format it's display
2004-10-04 21:27:14 +00:00
Todd Neal
9f11b5fbdb Added option to allow ImageMagick convert instead of dvipng .
Should work on most servers now with no configuration changes
2004-10-04 15:25:12 +00:00
Todd Neal
081aa602fe Added $allowPlainLaTeX option to allow $[ and ]$ to delimit plain LaTeX commands.
Disabled by default because of possible security risk
2004-10-04 04:15:18 +00:00
Todd Neal
edb251afe4 Added $useMD5 option to allow user to use MD5 hashes instead, it automatically falls back to urlencode if $useMD5 is set but the Digest::MD5 module is not available 2004-10-04 03:58:22 +00:00
Todd Neal
33c891e2a8 Specify path to dvipng, prevents a possible security hole and allows for better error checking 2004-10-04 02:58:29 +00:00
Todd Neal
32a147b649 Fixed comments about dvipng and modified HTML output to validate correctly. 2004-10-03 19:56:01 +00:00
Alex Schroeder
3d9c7c804b (LatexRule): Don't require newlines when using
the $$ and $ rules.
2004-09-29 21:50:32 +00:00
Alex Schroeder
14b763f3c7 Fix for wiki.pl 1.419: Important change in handling rules! Rules are
expected to return undef when they did not match, and the empty string
if a dirty block was produced.
2004-06-17 01:13:18 +00:00
Alex Schroeder
f7f6bf0a7e Introduced $LatexSingleDollars 2004-04-25 15:32:45 +00:00
Alex Schroeder
80c4308a72 New version by Haixing Hu 2004-04-25 15:17:24 +00:00
Alex Schroeder
f2543cb242 $LatexExtendPath = ':/usr/share/texmf/bin'; 2004-02-13 19:54:25 +00:00
Alex Schroeder
6af3bbbd99 bugfix, tested with dvi2bitmap-0.12-1 2004-02-13 19:30:12 +00:00
Alex Schroeder
d0afc405d1 new 2004-02-13 18:34:18 +00:00