declaring a variable and having to pass it by reference to
GetHistoryLine.
(GetHistoryLine): Simplified. Also, don't set a revision if
comparing an older revision with the current one.
(InitCookie, CookieUsernameFix, CookieRollbackFix, GetParam)
(SetParam): Get rid of $NewCookie.
(CookieUsernameFix): Make sure that with $FreeLinks and $WikiLinks
unset, single words are still allowed.
from $q->param -- this will make SetParam have the intended effect.
(DoBrowseRequest): Fake a search action before calling DoSearch;
since the action is now explicitly not browse, GetRobots will
produce a NOFOLLOW header.
(@MyBeforeApplyRules, @MyAfterApplyRules): Removed.
(ApplyRules): Removed call of code on @MyBeforeApplyRules.
(PrintWikiToHTML): Removed call of code on @MyAfterApplyRules.
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.
upload links produced by this function, for CSS stylization.
(BrowsePage): Calls the new "PrintPageContent" function.
(PrintPageContent): New function, whose implementation has been
extracted from the "BrowsePage" function. This permits external
modules -- like the new Crossbar module -- to override this
function and thereby print page content in a module-specific
manner.
significant, typo.
* modules/sidebar.pl: Reverted. I underestimated the scope of
changes needed to bring this module in line with recent, other
changes to the Table of Contents module. The good news is that the
reverted Sidebar module now works as expected for all modules except
the Table of Contents module; of course, the bad news is that the
reverted Sidebar module no longer works for the Table of Contents
module. (Unfortunately, we can't have both, here.) I will be
recommitting my changes to this module as a new module, therefore,
named "modules/crossbar.pl" -- sometime, soon. That new module
will (probably) break backwards compatibility with this module, but
will otherwise behave as expected... with all modules.
* t/sidebar.t: Prevented testing against the Table of Contents
module, as the Sidebar module is now known not to work with that
module.
Probably not a genuine issue... but one can never tell.
* modules/creole.pl (CloseHtmlEnvironmentsCreole): Removed.
* modules/creoleaddition.pl (CloseHtmlEnvironmentsCreoleAddition):
Removed.
* modules/poetry.pl (CloseHtmlEnvironmentsPoetry): Removed.
subroutine references, much like @MyRules. Unlike @MyRules, whose
subroutines are called by ApplyRules() while iterating through wiki
page markup, @MyAfterApplyRules subroutines are called by
PrintWikiToHTML(), iteratively, after all calls to ApplyRules().
This may not sound like much -- certainly, no deep invention.
Actually, however, it permits post-processing of all emitted HTML.
This, in turn, allows us to reimplement the Table of Contents
module ("toc.pl"), so as to remove the hacks upon which that
module formerly depended. This is a good thing. Perhaps, even a
great thing! As Alex can attest, "toc.pl" (and its retinue of
oddball hacks) has given Oddmuse some dire trouble, over time.
That's all past now...thanks be to the Nordic Gods.
(@MyBeforeApplyRules): New global list. This is a list of
subroutine references, much like @MyRules. Like @MyAfterApplyRules,
above, @MyBeforeApplyRules subroutines are not called by
ApplyRules() while iterating through wiki page markup but rather by
PrintWikiToHTML(), iteratively, before all calls to ApplyRules().
This, also, may not sound like much. However, it permits pre-
processing of all emitted HTML. This, in turn, allows us to
reimplement the Sidebar module ("sidebar.pl"), so as to remove the
hacks upon which that module formerly depended. (Praise be to Odin.)
(%BlockLevelElements): New global hash. This hash should not be
assigned to directly, but through the new
RegisterBlockLevelElement() function. Its keys are HTML tags:
'table', 'blockquote', 'div', and so. Its values are regular
expressions matching HTML tag attributes: 'class="poem"',
'align="right"', and so on. That's the structure. Here's how it
works: this hash has one key for each HTML tag to be considered a
"block-level element." Block-level elements are not closed when
closing HTML environments with CloseHtmlEnvironments(). Instead,
they must be explicitly closed with, say,
CloseHtmlEnvironment('table'). CloseHtmlEnvironments() now closes
all environments up to but not including those whose HTML tag
matches a key in %BlockLevelElements and whose HTML tag attributes
match a value in %BlockLevelElements. Thus, if Oddmuse is currently
in a "<table>...</table>" environment, calling
CloseHtmlEnvironments() now closes all environments up to but not
including the table. This is a good thing. This allows modules
to define block-level markup that can, itself, contain block-level
markup -- say, markup for a "<blockquotes>...</blockquotes>"
environment containing markup for a "<pre class='poem'>...</pre>"
environment containing markup for a "<ol>...</ol>" environment.
Prior to the introduction of this hash, block-level markup could
not contain other block-level markup -- since most modules "open" a
new HTML environment for such markup by first calling
CloseHtmlEnvironments(), which, of course, closes the HTML
environments of all "parent" block-level markup of this markup.
Slightly mind-bending, isn't it?
(RegisterBlockLevelElement): New function. (I'm not entirely happy
with the verb 'register', here, but could think of nothing better.)
(CloseHtmlEnvironments): Use the %BlockLevelElements hash to ensure
block-level element HTML environments are not closed. (Of course,
this is an amortized constant-time lookup. No efficiency concern,
here!)
(PrintWikiToHTML): Use the @MyBeforeApplyRules and
@MyAfterApplyRules lists, to perform HTML pre- and post-processing.
the InElement() and [Add|Close]HtmlEnvironment() family of
functions to add, remove, and search against HTML tag attributes
for all recently stacked HTML tag environments. Previously, tag
attributes were not retained; they were simply returned as text
from the AddHtmlEnvironment() function. Markup modules producing
complex HTML -- particularly, complex HTML having deeply nested
span or div tags -- can leverage the newly rewritten functions,
below, to simplify, streamline, and "clean up" their markup code.
(InElement): Rewritten to use this new variable.
(AddHtmlEnvironment): Rewritten to use this new variable.
(CloseHtmlEnvironment): Rewritten to use this new variable.
(CloseHtmlEnvironments): Rewritten to use this new variable.
(CloseHtmlEnvironmentUntil): Rewritten to use this new variable.
(AddOrCloseHtmlEnvironment): New function. Added so as to avoid
duplicate redefinition in the Creole, Creole Addition, and Usemod
modules.
* modules/usemod.pl (UsemodRule): Corrected erroneous usage of the
InElement() function. (I don't think UsemodRule() was ever quite
right, really; it's a bit surprising it worked this long!)
by delegating that closure to the "CloseHtmlEnvironments" function.
This permits other extensions (namely, the Creole Markup extension)
to redefine the "CloseHtmlEnvironments" function and thereby
precisely override just when and how list markup is closed.
* modules/creole.pl ($CreoleDashStyleUnorderedLists): New option.
(RunMyRules): New function.
(CreoleRule): Improved conformance to the Wiki Creole standard by
strictly requiring, among other notable things, that horizontal
rules consist of four and only four dashes, that all image links
to images on the Wiki (e.g., image "FreeLinks") be marked as dirty
blocks, that the nowiki markup strictly require the opening and
closing three braces to reside on their own lines having no other
markup, and that preformatted code not extend over multiple blocks.
(CreoleListAndNewLineRule): Avoid handling dash-style unordered
list markup unless explicitly requested by the new
"$CreoleDashStyleUnorderedLists" option being set to 1 (since
that markup is non-standard, and explicitly contradicts the Wiki
Creole standard).
* t/creole.t: Adjusted tests broken by the above modifications;
these were, typically, tests for nowiki and preformatted markup
that assumed a less conformant, gentler handling of that markup.
position returns the length of the matched string on finishing
application of all rules. ("creole.pl" and "creoleaddition.pl" now
depend on this; it notifies them that rules are now finished.)
* modules/creoleaddition.pl (CreoleAdditionRule): Injected a sanity
check, to ensure closure of blockquotes at the end of a page.
* modules/creole.pl ($CreoleTableCellsAllowBlockLevelElements): New
option.
* modules/creole.pl (CreoleRule): The last, one hopes, of all Creole
table markup modifications (for the moment). The rather complex
table markup code has been modified so as to use the new option, has
been refactored for robustness and strict conformance to the Wiki
Creole standard, and has been well-documented.
* modules/creole.pl (CreoleGetTableHtmlAttributes): Deleted function.
of Wiki Creole syntax within Wiki Creole syntax. (Yes... This is confusing?)
* modules/creole.pl (CreoleRule): Used the new function. Specifically, you
can now embed Creole and CreoleAddition syntax (such as bold, italics, small
caps, and so on) within URL and Wiki link text, ala
"[[Some_Page|Wow! **Quite** an //%%interesting page%%// page, here]]."
* modules/creoleaddition.pl (CreoleAdditionRule): Renamed function from
"CreoleAdditionRules" to this.
(SearchTitleAndBody): Use GrepFiltered.
(GrepFiltered): New code to filter AllPagesList using grep if
$UseGrep is set.
(ReadFile): Slight rearranging of the lines.