Commit Graph

917 Commits

Author SHA1 Message Date
Alex Schroeder
54e01ac6db (DoHistory): Handle date changes here in order to avoid
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.
2009-05-09 12:38:30 +00:00
Alex Schroeder
e974fdb08d (ApplyRules): Make sure we store $_ whenever we store
pos because of recursive calls to ApplyRules.
2009-05-07 20:04:09 +00:00
Alex Schroeder
136a5de6a8 (GrepFiltered): Short circuit if we end up with an empty
regular expression. This can happen when using tags.pl and only
specifying -tag:foo.
2009-04-05 22:07:40 +00:00
Alex Schroeder
6c91b5285b (GrepFiltered): Sort output because grep -r doesn't
produce sorted output.
2009-03-27 23:33:45 +00:00
Alex Schroeder
ba246e4c55 (GrepFiltered): Rewrite to use grep -r instead of -R. I'm not sure
which one is more widely accepted.
2009-03-27 22:42:46 +00:00
Alex Schroeder
21d800918c (GrepFiltered): Rewrite to use grep -R instead of find.
(DoShowVersion): Undo last change.
2009-03-27 21:54:41 +00:00
Alex Schroeder
771d204546 (GrepFiltered): Use find and grep because on larger
wikis the command line is too large.
(DoShowVersion): Print find version as well.
2009-03-27 21:40:20 +00:00
Alex Schroeder
3eb7a8c368 Whitespace. 2009-03-27 11:13:12 +00:00
Alex Schroeder
9349f562b2 *** empty log message *** 2009-03-21 08:29:13 +00:00
Alex Schroeder
b847aca48f *** empty log message *** 2009-03-21 08:25:13 +00:00
Alex Schroeder
e1e14adc43 (GetId): Do not return $HomePage if no id has been
specified.
(DoBrowseRequest): Don't report an invalid URL if no id has been
specified. Just browse the HomePage instead.
2009-03-16 17:11:54 +00:00
Alex Schroeder
bc6ce7085f (GetId): Fix it by no longer short-circuiting to return HomePage. 2009-03-14 20:07:01 +00:00
Alex Schroeder
7c7b22b9b3 (GetId): Use keywords when determining the default page
for the wiki, since recent versions will set parameters.
2009-03-14 19:33:15 +00:00
Alex Schroeder
efb81c3619 (InitCookie): We need to fall back on %OldCookie if no explicit
parameter was provided.
2009-03-13 17:53:53 +00:00
Alex Schroeder
7a4d2cd2e9 (GetParam): We need to fall back on %OldCookie if no explicit
parameter was provided.
2009-03-13 17:41:06 +00:00
Alex Schroeder
4bdde371c9 (DoShowVersion): Print version info for grep. 2009-03-13 17:00:58 +00:00
Alex Schroeder
40e980bf75 (GrepFiltered): Make sure matches in page content do not
duplicate matches in page names.
2009-03-13 16:57:41 +00:00
Alex Schroeder
af13f80156 ($NewCookie): Deleted.
(InitCookie, CookieUsernameFix, CookieRollbackFix, GetParam)
(SetParam): Get rid of $NewCookie.
(CookieUsernameFix): Make sure that with $FreeLinks and $WikiLinks
unset, single words are still allowed.
2009-03-12 21:20:56 +00:00
Alex Schroeder
d478eb00bb (GrepFiltered): Return pagename matches, then page
content matches.
2009-03-11 14:09:32 +00:00
Alex Schroeder
b0b5a56c4f (DoSearch, ApplyRules): Replace HighlightRegex with SearchRegexp.
(GrepFiltered): Use SearchRegexp, too. And search AllPagesList.
(HighlightRegex): Deleted.
(SearchRegexp): New.
2009-03-11 08:48:19 +00:00
Alex Schroeder
4df3a57706 Whitespace. 2009-03-10 13:06:14 +00:00
Alex Schroeder
78a94cabb7 Whitespace. 2009-03-10 07:20:58 +00:00
Alex Schroeder
28be732fc3 Whitespace changes 2009-03-07 16:21:33 +00:00
Alex Schroeder
0218f25786 (GetParam): Get result from NewCookie before getting it
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.
2009-02-22 10:07:47 +00:00
Alex Schroeder
9c797dead5 (DelayRequired): Fix an off-by one error. 2009-01-05 00:30:21 +00:00
Alex Schroeder
be95ba0f6b (GetEditForm): Remove extra closing div.
(@MyBeforeApplyRules, @MyAfterApplyRules): Removed.
(ApplyRules): Removed call of code on @MyBeforeApplyRules.
(PrintWikiToHTML): Removed call of code on @MyAfterApplyRules.
2008-12-08 01:10:03 +00:00
Alex Schroeder
40fd8bf27f (GetEditForm): Remove extra closing div. 2008-12-07 23:58:28 +00:00
Alex Schroeder
5a34b33815 (GrepFiltered): Ignore grep error messages (which happen
on an empty wiki, for example).
2008-12-06 01:57:40 +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
f064f04671 * wiki.pl: Slightly altered the CVS-enabled version notice. 2008-11-27 21:59:06 +00:00
Alex Schroeder
5329bcbe8e * modules/wiki.pl: Added a CVS-enabled version notice to this file's
header comments This should make it easier for Oddmuse users to
ascertain which Oddmuse version they're using.
2008-11-27 21:47:52 +00:00
Alex Schroeder
f478e98c52 (DoShowVersion): Print grep --version. 2008-11-24 19:27:23 +00:00
Alex Schroeder
0893744af1 * wiki.pl (GetEditForm): Added the 'upload' class attribute to
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.
2008-11-23 22:08:34 +00:00
Alex Schroeder
c8fe20a9ae * wiki.pl (SetHtmlEnvironmentContainer): Corrected a slight, but
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.
2008-11-20 11:45:45 +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
b6fda33eb8 * wiki.pl (RegisterBlockLevelElement): Renamed to
SetHtmlEnvironmentContainer (and changed in every other module,
where called).
2008-11-15 21:24:32 +00:00
Alex Schroeder
52fbc24f65 * wiki.pl (AddHtmlEnvironment): Corrected a minor regression.
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.
2008-11-15 12:53:25 +00:00
Alex Schroeder
c39d8c55ee * wiki.pl (@MyAfterApplyRules): New global list. This is a list of
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.
2008-11-15 12:40:49 +00:00
Alex Schroeder
e4f3e34e0e * wiki.pl (@HtmlAttrStack): New global variable. This permits
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!)
2008-11-05 09:42:05 +00:00
Alex Schroeder
7ccd891272 * modules/wiki.pl (OpenHtmlEnvironment): Generalized list closure
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.
2008-10-24 04:34:09 +00:00
Alex Schroeder
075e81ddf8 Apply patch from 1.874 to 1.876 minus the whitespace changes to
revision 1.874.
2008-10-12 19:46:12 +00:00
Alex Schroeder
e99cdf3cd6 * wiki.pl (ApplyRules): Ensure the regular expression match
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.
2008-10-06 06:11:20 +00:00
Alex Schroeder
d0a8ab50ab * modules/creole.pl (CreoleRuleRecursive): New function. Permits embedding
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.
2008-10-04 03:30:50 +00:00
Alex Schroeder
244f2ba464 (GrepFiltered): Handle some grep issues. 2008-10-03 09:57:35 +00:00
Alex Schroeder
4012447d90 ($UseGrep): New option. Set by default.
(SearchTitleAndBody): Use GrepFiltered.
(GrepFiltered): New code to filter AllPagesList using grep if
$UseGrep is set.
(ReadFile): Slight rearranging of the lines.
2008-10-02 22:19:21 +00:00
Alex Schroeder
808c172519 Whitespace 2008-10-01 20:43:53 +00:00
Alex Schroeder
d639d3d419 Whitespace. 2008-09-28 08:27:09 +00:00
Alex Schroeder
4354c50124 Whitespace. 2008-09-23 08:52:59 +00:00
Alex Schroeder
a65b861dca Whitespace. 2008-09-21 23:31:46 +00:00
Alex Schroeder
ad0bf5d3b3 (GetRcRss): Since this sub no longer takes RC lines as
parameters, there's no point in passing @_ to ProcessRcLines.
2008-09-21 22:07:45 +00:00