Commit Graph

79 Commits

Author SHA1 Message Date
Alex Schroeder
2588e5e835 toc.pl: use ToString and don't double-decode
ToString now takes more arguments.
2016-06-22 16:24:07 +02:00
Alex Schroeder
678baec68b Moving modules from utf8::encode to encode_utf8 2016-06-22 15:37:04 +02:00
Alex Schroeder
1fbbfd422e Workaround for utf8::decode bug (sometimes utf8 chars were not decoded)
Remember the problem with toc.pl when the whole page was *sometimes* not
utf8-decoded? There were some thoughts that it might be associated with
memory files, and it is correct. Although I was not able to narrow it down
last time, now I did (simply because this problem appeared elsewhere).

If you look at $output variable after utf8::decode with Devel::Peek, you
will see two variants of flags. This one looks good:
   FLAGS = (PADMY,POK,pPOK,UTF8)
And this one is wrong:
   FLAGS = (PADMY,POK,pPOK)
This problem is weird because it works inconsistently. Most of the time
you will get correct output, but sometimes it will be broken.

Someone has to golf it down to something short in order to submit perl
bug report. This, however, does not look like a simple task.

Current workaround is as stupid as it looks like, but it works.
Somehow assigning it to another variable solves the problem (which, by the
way, is similar to solving other perl string-related problems).
2015-09-16 04:13:02 +03:00
Alex Schroeder
5f019a6ce2 No more /o, modifiers sorted alphabetically 2015-08-23 21:22:12 +03:00
Alex Schroeder
0ec8dd44e6 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Alex Schroeder
10c641b6ab Fixed a bunch of stuff 2015-04-28 00:03:11 +03:00
Alex Schroeder
482888cfaf No more "*Sub = *NewSub", \&NewSub used instead. (Partial progress) 2015-04-11 23:41:33 +03:00
Alex Schroeder
5d2db4b547 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
a4e0e5a9be "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Alex Schroeder
6b1c65bc8d '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
ac3c89228e Fail less dramatically if h1 appears. 2014-10-02 16:29:45 +03:00
Alex Schroeder
601fb7ea84 toc.pl: Treat h2 as the first header when Creole Extension is active. 2014-10-02 16:23:00 +03:00
Alex Schroeder
e6d3ad8382 Fixed typo in AddModuleDescription sub name 2014-08-21 22:23:23 +02:00
Alex Schroeder
17bd795ef0 Automatically reformatted modules 2014-08-21 07:29:46 +03:00
Alex Schroeder
ab624787c4 Changed \x{ffff} to \x{fffd} in all regular expressions.
Using Perl 5.8.8 resulted in a crash when compiling regular expressions referring to \x{ffff}.
2012-07-19 06:01:30 -04:00
Alex Schroeder
2c6428e652 On some encoding problems
The TOC extension causes problems when including non-ASCII Text.
2012-07-04 21:36:56 +02:00
Alex Schroeder
70fcfa1356 Fix UTF-8 decoding issue when using toc.pl
The output of ApplyRules is no explicitly decoded as UTF8.
2012-06-22 02:54:29 +02:00
Alex Schroeder
1495a29fd3 More UTF-8 fixes
All the source files containing non-ASCII characters needed to have
utf8 added. This will be necessary for user config files as well! The
regular expressions identifying page names had to be changed.
UrlEncode translates the string back to bytes before encoding it.
Cached RSS files are saved with UTF-8 encoding and therefore need
their meta-data changed (using the XML::RSS module to do this
correctly didn't work for some of the test files). The CGI object's
parameters, keywords and info_path are decoded correctly. File access
uses the UTF-8 layer (reading, writing, appending, access to the log
of recent changes, running sub processes with grep and diff).

The mac compatibility extension will also disable the use of grep if
non-ASCII characters are searched for because of an unexplained
problem with grep.
2012-05-24 18:08:42 +02:00
Alex Schroeder
c9e39a4c19 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
Alex Schroeder
b44202933a (TocAfterApplyRule): Removed as a rule to be on
@MyAfterApplyRules.
(NewTocApplyRules): Moved code here and rewrote such as not to use
references where necessary.
2008-12-08 01:13:16 +00:00
Alex Schroeder
96d9b888e5 * wiki.pl (PrintWikiToHTML): Moved "@MyBeforeApplyRules"-specific
code into the ApplyRules() routine. This corrects a number of
subtle issues with the Crossbar module: especially, the Crossbar
module's erroneous handling of uploaded files. (Thanks, Ingo
Belka!)
* modules/crossbar.pl (CrossbarBeforeApplyRule): Corrected this
module's erroneous handling of uploaded files.
(RunMyRulesTocCrossbar): New function, offloading a Crossbar-
specific hack from "toc.pl" into this file. (This is still...
slightly hacky, but a bit better.)
* modules/toc.pl (TocRule): Allowed more than one table of contents
per page. Before, this module only recognized the first "<toc...>"
markup for a Wiki page: all subsequent "<toc...>" markup for that
page was studiously ignored. Correcting this improves integration
with the Crossbar module.
(RunMyRulesToc): Removed a Crossbar-specific hack.
(TocAfterApplyRule): Allowed more than one table of contents.
($TocIsApplyingAutomaticRules): New option, providing slightly
finer-grained control over Table of Contents handling.
2008-12-03 11:46:48 +00:00
Alex Schroeder
67e80f3960 * modules/toc.pl (TocRule): Corrected a minor issue re: integration
with the Sidebar and Crossbar modules.
2008-11-24 03:48:17 +00:00
Alex Schroeder
bbfdf96d5b * modules/crossbar.pl: New module. Provides a sustainable
replacement for the Sidebar module, for all Sidebar users
requiring a cleaner integration of that module with other modules
such as "toc.pl" and "footnotes.pl". This new module also improves
Sidebar customizability by permitting users to place the "Crossbar"
at any position in any page.
* modules/forms.pl (FormsRules): Generalized so as to support both
the Sidebar and Crossbar modules.
* modules/toc.pl (RunMyRulesToc): Generalized so as to support both
the Sidebar and Crossbar modules.
* t/crossbar.t: New test suite, testing the Crossbar module.
2008-11-23 22:13:29 +00:00
Alex Schroeder
dca2a6af50 * wiki.pl (PrintWikiToHTML): Slightly reordered function calls,
so as to optimize a few edge cases.
2008-11-16 01:00:04 +00:00
Alex Schroeder
d1f0e9ebe4 * modules/sidebar.pl: Refactored. This is a complete rewrite
removing all previous module-specific hacks. However, as it is a
rewrite, it may still have issues. (Fortunately, time is the mother
of invention and bug fixes.)
* modules/toc.pl: Refactored. This is a complete rewrite
removing all previous module-specific hacks. As with "sidebar.pl",
it may still have issues. That said -- I'm relatively proud of it,
and confident that it (should) stand up under rigorous scrutinies,
utilization, and brutalization.
* modules/forms.pl (FormsRule): Slightly revised, so as to comply
with the "sidebar.pl" refactoring.
2008-11-15 12:48:13 +00:00
Alex Schroeder
1bddaf7b93 * modules/toc.pl (TocInit): Context-sensitively set the
"$TocConvertH1TagsToH2Tags" option, if not already set.
Basically, we only need the option enabled when the Usemod
markup module is also installed.
2008-11-05 10:11:48 +00:00
Alex Schroeder
03de875729 * modules/toc.pl ($TocIsConvertingH1TagsToH2Tags): Renamed from
"$TocConvertH1TagsToH2Tags".
2008-11-05 06:19:18 +00:00
Alex Schroeder
9e1905b9dd * modules/toc.pl ($TocConvertH1TagsToH2Tags): New option.
(TocRule): Use the new option; principally, this permits Wiki
administrators to prevent this module from converting
"<h1>...</h1>" tags "<h2>...</h2>" tags.
2008-11-05 03:30:04 +00:00
Alex Schroeder
347abd8dba (TocRule, TocHeadings): Make sure no h1 headers
can be generated. This makes sure that the headings work just like
they do in the UseMod markup extension.
2008-10-25 16:31:26 +00:00
Alex Schroeder
217b9e22f7 * modules/toc.pl: New perldoc-style documentation.
($TocHeaderText): New option.
(TocPageHtml): Introduced a Footnotes extension-specific hack, so
as to circumvent footnote indexing errors after generating the
table of contents.
2008-09-29 03:14:39 +00:00
Alex Schroeder
9000850599 (TocHeadings): No idea why this solves the
problem with disappearing TOC. TocProcessing is allowed one more
level of recursion.
2007-11-14 22:06:05 +00:00
Alex Schroeder
b4c0f0a9ec Fix $ModulesDescription 2007-10-29 02:27:15 +00:00
Alex Schroeder
dfb1751748 (TocHeadings, TocPageHtml): Use TocPageHtml
instead of PageHtml. There, localize the HTML cache to make sure
the updated cache will in fact get saved.
2007-08-29 13:51:36 +00:00
Alex Schroeder
e1128e32d3 (TocRule): Add explanation. Renamed $key to
$id_required.
(TocHeadings): Use $TocPage as the template for the TOC.
2007-08-17 16:03:09 +00:00
Alex Schroeder
578c8fd179 Fix license. 2007-08-17 00:31:33 +00:00
Alex Schroeder
cce733196c Switch to GPLv3 2007-08-17 00:28:10 +00:00
Alex Schroeder
5f6abd07ab (TocInit): Moved some init code here. 2007-08-17 00:24:14 +00:00
Alex Schroeder
90511ec5a8 (TocHeadings): Major overhaul using a call to
PageHtml() to generate the HTML of the page without table of
contents, extracting the generated HTML headings, producing the
table of contents, and finish generating the real HTML of the
page.
2007-08-12 23:43:15 +00:00
Alex Schroeder
f341742315 (TocRule, TocHeadings): Accept classes for <toc>
tag.
2007-02-15 21:58:02 +00:00
Alex Schroeder
7c0bdbe25b (TocInit): New.
(TocRule, TocHeadings): Simplify the code so that id attributes
are only generated for the "main" page (the one returned by
GetId).
2007-02-09 21:52:45 +00:00
Alex Schroeder
37b13207c3 Updated copyright year. 2007-01-14 16:30:09 +00:00
Alex Schroeder
3f8c2acca9 (TocRule): Make it compatible with creole.pl. 2007-01-12 20:57:48 +00:00
Alex Schroeder
2a2da63d1a ($TocAutomatic): Reset the default to 1, so that
all the relevant tests don't fail.
2006-12-27 22:06:30 +00:00
Alex Schroeder
185839112a Typo in german-utf8.pl 2006-10-30 11:19:17 +00:00
Alex Schroeder
c6363fb87a set $key.
(TocHeadings): Use $key.
2006-08-06 23:18:14 +00:00
Alex Schroeder
29d74cb970 (TocRule): Support headers markup headers if
headers.pl is loaded. Only support usemod markup headers if
usemod.pl is loaded.
(TocHeadings): Transform headers.pl headers into
usemod.pl headers so that the TOC can be generated correctly.
2006-07-14 07:16:59 +00:00
Alex Schroeder
b596a62919 update copyright years 2006-06-04 21:31:27 +00:00
Alex Schroeder
6c26b38619 (TocHeadings): Add markup module escaping rules. 2006-05-26 07:48:33 +00:00
Alex Schroeder
367d5ca826 (TocHeadings): Fix usemod escaping rules. 2006-05-26 07:35:43 +00:00
Alex Schroeder
b15c0eac5f (TocRule): Skip the a element inside headings. 2006-03-16 19:22:53 +00:00