Commit Graph

511 Commits (7d1cc3a0209980bdbec59ffd0b6171898a1cc066)

Author SHA1 Message Date
Joey Hess c923e0ba33 Allow globs to be used in user() pagespecs. 2010-02-11 20:39:10 -05:00
Joey Hess e11876b700 httpauth: Add httpauth_pagespec setting that can be used to limit pages to only being edited via users authed with httpauth. 2010-02-11 18:25:10 -05:00
Joey Hess 03777230ea update comment re openid library version 2010-02-06 15:29:25 -05:00
Joey Hess 8380a9d000 factor out a userpage function
Not yet exported, as only 4 quite core plugins use it.
2010-02-04 18:24:15 -05:00
Joey Hess cfcb3d1880 remove userlink()
That was dead code; changes to lockedit and recentchanges removed the last
callers.
2010-02-04 15:17:21 -05:00
David Riebenbauer bd1e29b8c4 Revert "Make srcfile() return undef, if the file isn't there."
This reverts commit 1bde208ec9b915db0187030c33450b5accb4892c.
2010-02-03 07:34:04 +01:00
David Riebenbauer 25741100b0 Export add_autofile() for use in Plugins. 2010-02-02 14:04:39 +01:00
David Riebenbauer f58f3e1bec Revert the effects of find_del_files() for (re)autoadded files.
This also means that if autoadded files are deleted they will just be
recreated.
2010-02-02 14:04:39 +01:00
David Riebenbauer b18fde2bde Add a function add_autofiles().
The objective is to provide a sensible way to let plugins add files during the
"scan stage" of the build.

Currently does a little verification and adds the file to the global array
@add_autofiles.
2010-02-02 14:04:28 +01:00
David Riebenbauer 4af4d26582 Make srcfile() return undef, if the file isn't there.
This has the advantage that it's now possible to check for the existence of a
sourcefile with that function.
2010-02-02 14:04:28 +01:00
intrigeri 88c6e28915 moved selflink test to its own isselflink (overridable) sub 2010-01-09 22:53:45 +01:00
Joey Hess c0e938e972 fix typo
This was probably not noticed because it only results in a warning, and in
the checkcontent diff having some unchanged lines in it.
2009-12-14 18:20:11 -05:00
Joey Hess f1ddf4bd98 fix bestlink to not return just-deleted pages
bestlink was looking at whether %links existed for a page in order to tell
if the page exists, but just-deleted pages still have entries in there (for
reasons it may be best not to explore). So bestlink would return
just-deleted pages. Instead, make bestlink use %pagesources.

Also, when finding a deleted page, %pagecase was not cleared of that page.
This, again, made bestlink return just-deleted pages. Now that is cleared.

Fixing bestlink exposed another issue though. The backlink calculation code
uses bestlink. So when a page was deleted, no backlinks to it are found,
and pages that really did backlink to it were not updated, and had broken
links.

To fix that, the code that actually removes deleted pages had to be split
out from find_del_files, so it can run a bit later. It is run just after
backlinks are calculated. This way, backlink calculation still sees the
deleted pages, but everything afterwards does not.

However, it does not address the original bug report that started this
whole thing, [[bugs/bestlink_returns_deleted_pages]]. Because there
bestlink is run in the needsbuild hook. And that happens before backlink
calculation, and so bestlink still returns deleted pages then. Also in the
scan hook.

If bestlink needs to work consistently during those hooks, a more involved
fix will be needed.
2009-11-30 17:34:29 -05:00
Joey Hess 2255a6a0bb calendar: Add title attributes for all links in the calendars. 2009-11-26 14:58:35 -05:00
Joey Hess 268a2dd54c htmllink: allow a title attribute to be specified 2009-11-26 14:10:21 -05:00
Joey Hess 046ac5fec5 remove debugging and cruft 2009-10-13 15:00:07 -04:00
Joey Hess a20bc7a3fc influence blocker implementation
This avoids unnecessary influences being recorded from pagespecs
such as "link(done) and bugs/*", when a page cannot ever possibly
match.

A pagespec term that returns a value without influence is an influence
blocker. If such a blocker has a false value (possibly due to being
negated) and is ANDed with another term, it blocks that term's influence
from propigating out.

If the term is ORed, or has a true value, it does not block influence.
(Consider "link(done) or bugs/*" and "link(done) and !nosuchpage")

In the implementation in merge_influence, I had to be careful to never
negate $this or $other when testing if they are an influence blocker,
since negation mutates the object. Thus the slightly weird if statement.
2009-10-13 14:37:14 -04:00
Joey Hess 5e4e43e2c7 match_link: dynamic influence needed for page that currently has no links 2009-10-13 13:33:51 -04:00
Joey Hess 74409f940d add_depends: optimise influence calculation
I made match_* functions whose influences can vary depending on the page
matched set a special "" influence to indicate this.

Then add_depends can try just one page, and if static influences are found,
stop there.
2009-10-09 17:15:40 -04:00
Joey Hess 4ef0b2d77b rework influence calculation
Thought of a cleaner way to accumulate all influences in
pagespec_match_list, using the pagespec_match result object as an
accumulator.

(This also accumulates all influences from failed matches, rather than just
one failed match. I'm not sure if the old method was correct.)
2009-10-09 14:27:11 -04:00
Joey Hess 3807aa298c fix pagespec_match_list handling of list parameter 2009-10-09 13:28:41 -04:00
Joey Hess 6f2cc5ac8c pagespec_match_list: change limit to filter 2009-10-09 13:20:41 -04:00
Joey Hess 769b78df07 pagespec_match_list allow additional pagespec limit parameters again 2009-10-09 13:02:10 -04:00
Joey Hess b7351daacd conditional: use yesno 2009-10-09 12:54:35 -04:00
Joey Hess 5e7b2dea84 rename use_pagespec to pagespec_match_list
To avoid breaking plugins, also support the old pagespec_match_list
calling convention, with a deprecation warning.
2009-10-08 23:51:06 -04:00
Joey Hess 37ec6a8243 Merge branch 'master' into dependency-types
Conflicts:
	IkiWiki.pm
	IkiWiki/Render.pm
	debian/changelog
2009-10-08 20:33:58 -04:00
Joey Hess 3bb00d142a Optimize away most expensive file prune calls, when refreshing
Benchmarking refresh of a a wiki with 25 thousand pages showed
file_pruned() using most of the time. But, when refreshing, ikiwiki already
knows about nearly all the files. So we can skip calling file_pruned() for
those it knows about. While tricky to do, this sped up a refresh (that
otherwise does no work) by 10-50%.
2009-10-08 20:27:56 -04:00
Joey Hess d5f0144495 use_pagespec: do not fail with error when unable to match, unless it fails
with an ErrorReason
2009-10-08 18:47:48 -04:00
Joey Hess 5e236f5d25 add use_pagespec and deptype functions 2009-10-08 17:53:20 -04:00
Joey Hess f2b3d13414 fix handling of influences of pagespecs that fail to match
If a pagespec fails to match, I had been throwing the influences away, but
that is not right. Consider `backlink(foo)`, where foo does not exist.
It still needs to be added as an influence, because if it is created, it
will influence the pagespec to match.

But with that fix, `link(bar)` had as influences all pages, whether they
link to bar or not. Which is not necessary, because modifiying a page to
add a link to bar will directly cause the pagespec to match.

So, in match_link (and all the match_* functions for page metadata),
only return an influence if the match succeeds.

match_backlink had been implemented as the inverse of match_link, but that
is no longer completly true. While match_link does not return an influence
on failure, match_backlink does.

match_created_before/after also return the influence on failure, this way
if created_after(foo) currently fails because foo does not exist, it will
still update the page with the pagespec if foo is created.
2009-10-08 13:38:46 -04:00
Joey Hess 0cb08c9a4b bugfix 2009-10-07 22:08:19 -04:00
Joey Hess 5f9860e65c add type info to influence information 2009-10-07 21:52:37 -04:00
Joey Hess bb389a5ae2 convert add_depends to use influences
No more horrible special-case pagespec parsing.

OTOH, matching over all pages to determine influences is a lot of work.
2009-10-07 21:17:57 -04:00
Joey Hess 4002d7c1a4 add influence info to match_*
Also update docs, test suite.
2009-10-07 20:31:13 -04:00
Joey Hess c72fda7d69 make success and failreason objects carry an influences hash
The hash will be used used to record a set of pages that influenced the
result of a pagespec match.

The influences are merged together when boolean and/or are encountered
in a pagespec. That means using a non-short-circuiting OR operator. And
so I use & and | when translating pagespecs, since those bitwise operators
can be overloaded. ("and" and "or" cannot, apparently).
2009-10-07 19:59:26 -04:00
Joey Hess 7a8b492bcc add_depends should default to content dependencies if unknown type specified 2009-10-06 19:07:52 -04:00
Joey Hess e45e23a7f1 oops!! 2009-10-06 19:03:23 -04:00
Joey Hess 03ae087b43 support backlink() in pagespecs for links dependencies 2009-10-06 18:44:59 -04:00
Joey Hess 666a9613a1 implement links dependencies
Involved some code refactoring so that same code that detects
link changes for backlinks updating can be used for link dependency
checking. The nice thing is that link dep checking is thus
comopletly free!
2009-10-05 14:33:23 -04:00
Joey Hess 36c605cada add test suite for add_depends
and found a bug in my bitmath..
2009-10-04 23:27:00 -04:00
Joey Hess d3e0a54344 Merge branch 'master' into dependency-types 2009-10-04 20:37:09 -04:00
Joey Hess d797b9ab0e remove /i from regexp
Nothing case-oriented going on in here.
2009-10-04 20:35:02 -04:00
Joey Hess be032a7b87 rework dependency types code
Simplify, change default content depends number to 1,
change interface to make more sense.
2009-10-04 20:30:21 -04:00
Joey Hess da5c12e9eb expand the set of things that can be matched contentless 2009-10-04 16:01:56 -04:00
Joey Hess daafdf1acb optimise add_depends for simple pagespecs
We don't need to check if the pagespec is contentless; all simple ones are.
2009-10-04 15:43:38 -04:00
Joey Hess 5fd230f968 detect pagespecs that require content dependencies
When adding a contentless dependency, the pagespec also needs to be one
that does not look at any page content information.

As a first approximation of that, only allow glob-based pagespecs in
contentless dependencies. While there are probably a few other types of
pagespecs that can match contentless, this will work for most of them.
2009-10-04 15:42:24 -04:00
Joey Hess 743f69c675 add dependency type parameters to add_depends
Dependency types are represented by bits in the values of the %depends
and %depends_simple hashes.

Change the dependslist array saved to the index to a depends hash.
depends_simple is also converted from an array to a hash.

Note that the depends field used to be a string, and we still
have compat code to handle upgrades from that, as well as from the arrays.
I didn't use ikiwiki-transition because I don't want ikiwiki to break if
users forget to run it; also we're going to recommend a full rebuild on
upgrade to this version to get the improved dependency handling. So
this compat code can be removed or moved to ikiwiki-transition later.
2009-10-03 15:31:51 -04:00
Joey Hess ffa73790b5 Fix a bug that could lead to duplicate links being recorded for tags.
Here I was bitten by perl's aliasing of foreach variables
to the loop array contents, and match_link accidentially changed
the contents of %links.

In Jon's testcase, a tag added an absolute link, which was
made relative by the above bug, and then the link was added
again in preprocess, and turned into a duplicate.
2009-10-03 14:16:28 -04:00
Joey Hess e4eca63767 do not need to qualify %links 2009-10-03 14:01:19 -04:00
Joey Hess 81a9b5feff Merge branch 'master' into cvs 2009-09-10 13:44:27 -04:00
Joey Hess 98ed7cb1d7 Fix parsing web commits from ipv6 addresses.
I weakended the regexp, so this matches ipv6 addresses too. It does not
ensure that the address is valid, but that should not matter here.

Note that addresses ending in "::" are not matched, so eg, the unspecified
address will not match -- but should never appear here anyway.
2009-09-10 13:32:13 -04:00
Joey Hess 2a99ebf276 underlay: Also allow configuring additional directories to search for template files in. 2009-09-08 17:27:37 -04:00
Joey Hess 93ab004cc2 memoize template_file
This avoids a lot of unncessary stats, and trims about 1 second
off a docwiki rebuild here.
2009-09-08 17:20:04 -04:00
Amitai Schlair c36d2fa896 Merge branch 'master' of git://github.com/joeyh/ikiwiki 2009-08-30 03:02:15 -04:00
Joey Hess 125c6ec650 <pedant>rename depends_exact to depends_simple
It's not "exact" since case munging has to be done, and I think
"simple" captures the optimisation better.</pedant>

With apologies to smcv, who probably has to rebuild his wiki now.
2009-08-28 15:13:45 -04:00
Simon McVittie 2a7f3b91d4 Force %depends_exact to lower case, fixing incorrect case-sensitivity 2009-08-28 15:42:04 +01:00
Simon McVittie b6992ec566 Auto-detect "simple dependencies" instead of requiring callers to use add_depends_exact() 2009-08-28 15:41:26 +01:00
Simon McVittie c80a3cbcfd Add depends_exact: simplified dependency tracking for dependencies on a single page
Let E be the number of dependencies per page of the form "A depends on B and
nothing else", let D be the number of other dependencies per page,
let P be the total number of pages, and let C be the number of changed
pages in a refresh.

This patch should speed up a refresh from O(E*C*P + D*C*P) to
O(C + E*P + D*C*P), assuming that hash lookups are O(1).

In practice, plugins like inline and map produce a lot of these very simple
dependencies, and my album plugin's combination of inline with a large
number of pages causes it to suffer particularly badly.

In testing on a wiki with about 7000 objects (3500 full pages, 3500
images), a full rebuild continued to take about 5:30, and a refresh
after touching about 350 pages and 350 images reduced from 5:30 to 1:30.

As with my previous optimizations, this change will result in downgrades not
working correctly until the wiki is rebuilt.
2009-08-28 15:34:35 +01:00
Joey Hess b3d65aee18 Merge commit 'remotes/smcv/ready/remove-pagespec-merge' 2009-08-25 17:21:19 -04:00
Joey Hess 5bcdc39999 Revert "Allow add_depends to take an arrayref"
This reverts commit e4cd168ebe.

There was no benefit to this change.
2009-08-25 17:11:29 -04:00
Simon McVittie 1ea8580a5f Remove now-unused function pagespec_merge
Now that dependencies are a list of pagespecs with an implicit "or"
operation, there's no need to try to merge pagespecs under normal use.

ikiwiki-transition contains the only use of the function, so move
it there rather than deleting it entirely (it's used to concatenate all
admins' lists of locked pages).
2009-08-25 00:31:40 +01:00
Simon McVittie 275dd5c4ea IkiWiki::pagename: memoize results
This relies for its correctness on %config, %hooks and pagetype() not
changing.
2009-08-25 00:31:24 +01:00
Simon McVittie e4cd168ebe Allow add_depends to take an arrayref 2009-08-25 00:31:24 +01:00
Simon McVittie 7227c2debf Use a hash to de-duplicate dependencies 2009-08-25 00:31:16 +01:00
Simon McVittie 2cf26fd709 Don't bother to save {depends} to the index
As per Joey's review.
2009-08-24 23:18:19 +01:00
Simon McVittie fe4f176f72 Optimize the dependencies list
On a large wiki you can spend a lot of time reading through large lists
of dependencies to see whether files need to be rebuilt (album, with its
one-page-per-photo arrangement, suffers particularly badly from this).

The dependency list is currently a single pagespec, but it's not used like
a normal pagespec - in practice, it's a list of pagespecs joined with the
"or" operator.

Accordingly, change it to be stored as a list of pagespecs. On a wiki
with many tagged photo albums, this reduces the time to refresh after
`touch tags/*.mdwn` from about 31 to 25 seconds.

Getting the benefit of this change on an existing wiki requires a rebuild.
2009-08-24 23:18:10 +01:00
Joey Hess e8fd858340 created_before/after: throw error if specified page does not exist
This assumes that no ctime means the page doesn't exist, which seems
reasonable.
2009-08-16 13:47:04 -04:00
Joey Hess 46a6e27347 fix error message display
The gettext call can clear $@ in at least some cases.
2009-08-16 13:43:31 -04:00
Joey Hess 830c9e59b2 Add discussionpage configuration setting
By adding this setting, we get both more configurability, and a minor
optimisation too, since gettext does not need to be called continually
to get the Discussion value.
2009-08-13 21:41:33 -04:00
Amitai Schlair 2b7a003794 Add my CVS plugin and related patches. 2009-08-13 16:56:26 -04:00
Joey Hess ec965fc92c Merge branch 'master' into po
Conflicts:
	debian/changelog
2009-07-19 12:36:01 +02:00
Simon McVittie e12b7f5e54 Move OpenID pretty-printing from openid plugin to core
On various sites I have two IkiWiki instances running from the same
repository: one accessible via http and only accepting openid logins,
and one accessible via authenticated https and only accepting httpauth.
The https version should still pretty-print OpenIDs seen in git history,
even though it does not itself accept OpenID logins.
2009-07-10 18:41:16 +01:00
Joey Hess 5418385336 Optimise use of gettext, and avoid ugly warnings if Locale::gettext is not available.
The test suite was emitting a lot of ugly gettext warnings;
setting LC_ALL didn't solve the problem for all locale setups
(since ikiwiki remaps it to LANG, and ikiwiki didn't know about
the C locale).

People also seem generally annoyed by the messages when
Locale::Gettext is not installed, and I suspect will be
generally happier if it just silently doesn't localize.

The optimisation came about when I noticed that the gettext
sub was doing rather a lot of work each call just to see
if localisation is needed. We can avoid that work by caching,
and the best thing to cache is a version of the gettext sub
that does exactly the right thing.

This was slightly complicated by the locale setting,
which might need to override the original locale (or lack
thereof) after gettext has been called. So it needs to invalidate
the cache in that case. It used to do it via a global variable,
which I am happy to have also gotten rid of.
2009-06-08 18:33:54 -04:00
intrigeri 86edd73d16 Merge commit 'upstream/master' into pub/po
Conflicts:

	debian/changelog
	debian/control

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-06-06 14:03:40 +02:00
Joey Hess bd78168f71 Tighten up matching of bare words inside directives
Do not allow an unterminated """ string to be treated as a series of bare
words. Fixes runaway regexp recursion/backtracking in strange situations.

(See 1d57a21c98 for test case.)
2009-06-05 16:14:51 -04:00
Joey Hess ef003f48f4 Merge branch 'master' into po
Conflicts:
	debian/changelog
2009-05-19 13:07:47 -04:00
Joey Hess 23a4ee6d15 Allow curly braces to be used in pagespecs
And avoid a whole class of potential security problems (though
none that I know of actually existing..), by avoiding
performing any string interpolation on user-supplied data when translating
pagespecs.
2009-05-18 15:25:10 -04:00
Joey Hess 4291f2e3d7 Allow underlaydir to be overridden without messing up inclusion of other underlays via add_underlay. 2009-05-07 14:02:52 -04:00
Joey Hess 2a7721febd Avoid %links accumulating duplicates. (For TOVA)
This is sorta an optimisation, and sorta a bug fix. In one
test case I have available, it can speed a page build up from 3
minutes to 3 seconds.

The root of the problem is that $links{$page} contains arrays of
links, rather than hashes of links. And when a link is found,
it is just pushed onto the array, without checking for dups.

Now, the array is emptied before scanning a page, so there
should not be a lot of opportunity for lots of duplicate links
to pile up in it. But, in some cases, they can, and if there
are hundreds of duplicate links in the array, then scanning it
for matching links, as match_link and some other code does,
becomes much more expensive than it needs to be.

Perhaps the real right fix would be to change the data structure
to a hash. But, the list of links is never accessed like that,
you always want to iterate through it.

I also looked at deduping the list in saveindex, but that does
a lot of unnecessary work, and doesn't completly solve the problem.

So, finally, I decided to add an add_link function that handles deduping,
and make ikiwiki-transition remove the old dup links.
2009-05-06 00:27:24 -04:00
Joey Hess 85ae48b21e Revert "pagespec_match_list * optimisation"
This reverts commit 2f96c49bd1.

I forgot about internal pages. We don't want * matching them!

I left the optimisation in pagecount, where it used to live.
Internal pages probably don't matter when they're just being
counted.
2009-04-23 16:35:56 -04:00
Joey Hess 2f96c49bd1 pagespec_match_list * optimisation
Add an optimisation for the semi-common case of a "*" pagespec. Can
avoid doing any real processing in this case.
2009-04-23 16:20:18 -04:00
Joey Hess aa306957ba pagespec_match_list added and used in most appropriate places
* pagespec_match_list: New API function, matches pages in a list
  and throws an error if the pagespec is bad.
* inline, brokenlinks, calendar, linkmap, map, orphans, pagecount,
  pagestate, postsparkline: Display a handy error message if the pagespec
  is erronious.
2009-04-23 15:45:30 -04:00
Joey Hess 748aa7af77 pagespec error/failure distinction and error display by inline
* Add IkiWiki::ErrorReason objects, and modify pagespecs to return
  them in cases where they fail to match due to a configuration or syntax
  error.
* inline: Display a handy error message if the inline cannot display any
  pages due to such an error.

This is perhaps somewhat incomplete, as other users of pagespecs do not
display the error, and will eventually need similar modifications to inline.
I should probably factor out a pagespec_match_all function and make it throw
ErrorReasons.
2009-04-23 14:07:28 -04:00
intrigeri 4558457402 Merge commit 'upstream/master' into pub/po
Conflicts:

	debian/changelog
	debian/control
2009-04-20 12:21:18 +02:00
Joey Hess f3207cddc1 add _darcs to prune list 2009-04-04 18:49:57 -04:00
Joey Hess 825e2b1378 Merge branch 'master' into po
Conflicts:
	debian/control
2009-03-27 15:09:41 -04:00
Joey Hess c176dcde98 Fix bug that caused weird things to appear as page types.
The problem was introduced by the recent noextension patches.
Object autovivification caused junk to get into %htmlize,
and all keys of that showed up as page types.
2009-03-15 17:39:14 -04:00
Joey Hess f10f9e6f73 unknown option wording tweak
Because getopt::long is used in passthrough mode, if a known
option like --wikiname that needs a parameter is specified w/o
the parameter, it will not be processed, and passed on through.
So in this case the "unknown option" message is innaccurate.
Make it slightly better by noting that the problem can be a missing
parameter.
2009-03-13 16:27:24 -04:00
intrigeri 8fed4206cb brought back checkcontent hook full-content compat.
This modification was initially done in editpage, in commit
a3726968bc, but was then lost while merging
upstream/master branch.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-03-08 16:02:10 +01:00
Joey Hess 66dc253437 Add noextension parameter to htmlize hooks to support, eg, Makefile. 2009-02-19 18:38:45 -05:00
Joey Hess 2c51b18aec move check_canedit, check_content to IkiWiki library from editpage
It no longer makes sense to keep these functions in editpage, because
serveral plugins now exist that use them, and users may want to disable
editpage, while leaving those plugins enabled.

Most notably, comments uses both functions, and it's entirely appropriate
to disable editpage but still want to have comments enabled.

Less likely, attachments, rename, and remove all use check_canedit -- but
it would be unusual indeed to want to use these w/o editpage.
2009-02-12 16:33:35 -05:00
Joey Hess caa6a784b0 clarify description of verbose
It enables debug prints, so not just during building, but at runtime.
2009-01-24 13:04:59 -05:00
Joey Hess b4bbddbf3e add human-readable error when unknown pagespec function is called
It used to replace unknown functions with "0" when translating a pagespec.
Instead, replace it with a FailReason object. This way, the pagespec will
still evaluate as before (possibly successfully if other terminals exist),
but a human-readable error will be shown if the result is displayed.

Also, an empty pagespec used to be replaced with "0", to avoid a eval
error. Also use a FailReason here.
2009-01-20 16:35:18 -05:00
Joey Hess 3eaa5c91d7 export installdir
For use by Setup/Automator
2009-01-12 18:55:56 -05:00
Joey Hess 7a8ea68fc0 Consistently allow use of relative paths in all PageSpecs that take a page name parameter. Previously, match_created_before(), match_created_after(), match_sourcepage(), and match_destpage() did not support that, and the docs were not clear. 2009-01-10 14:36:03 -05:00
Joey Hess 8fd086cb8a refactor pagespec derelevitisation code 2009-01-10 14:24:21 -05:00
Joey Hess b0a03fef65 yesno: Always accept English even when localised.
It seems to be a failing of i18n in unix that the translation stops at the
commands and the parameters to them, and ikiwiki is no exception with its
currently untranslated directives. So the little bit that's translated sticks
out like a sore thumb. It also breaks building of wikis if a different locale
happens to be set.

I suppose the best thing to do is either give up on the localisation of this
part completly, or make it recognise English in addition to the locale. I've
tenatively chosen the latter.

(Also accept 1 and 0 as input.)
2009-01-03 12:52:47 -05:00
Joey Hess c4f3d0554a Merge branch 'master' into next 2008-12-26 16:11:13 -05:00
Joey Hess 7da319efc6 inline: Run format hook first
inline has a format hook that is an optimisation hack. Until this hook
runs, the inlined content is not present on the page. This can prevent
other format hooks, that process that content, from acting on inlined
content. In bug ##509710, we discovered this happened commonly for the
embed plugin, but it could in theory happen for many other plugins (color,
cutpaste, etc) that use format to fill in special html after sanitization.

The ordering was essentially random (hash key order). That's kinda a good
thing, because hooks should be independent of other hooks and able to run
in any order. But for things like inline, that just doesn't work.

To fix the immediate problem, let's make hooks able to be registered as
running "first". There was already the ability to make them run "last".

Now, this simple first/middle/last ordering is obviously not going to work
if a lot of things need to run first, or last, since then we'll be back to
being unable to specify ordering inside those sets. But before worrying about
that too much, and considering dependency ordering, etc, observe how few
plugins use last ordering: Exactly one needs it. And, so far, exactly one
needs first ordering. So for now, KISS.

Another implementation note: I could have sorted the plugins with
first/last/middle as the primary key, and plugin name secondary, to get a
guaranteed stable order. Instead, I chose to preserve hash order. Two
opposing things pulled me toward that decision:

1. Since has order is randomish, it will ensure that no accidental
   ordering assumptions are made.
2. Assume for a minute that ordering matters a lot more than expected.
   Drastically changing the order a particular configuration uses could
   result in a lot of subtle bugs cropping up. (I hope this assumption is
   false, partly due to #1, but can't rule it out.)
2008-12-26 16:09:23 -05:00
Joey Hess f65311bddb hack to avoid globlist deprecaton message false positive 2008-12-23 17:19:27 -05:00
Joey Hess c8cde4858e Add deprecation warning for GlobLists, which will stop working in 3.0. 2008-12-23 17:13:57 -05:00
Joey Hess c07a95ed8e remove globlist support
No transition code implemented, but I will probably make a 2.x release that
warns about found globlists.
2008-12-23 17:11:04 -05:00
Joey Hess 678d467a40 finalise version 3.00 of the plugin api 2008-12-23 16:34:19 -05:00
Joey Hess 70fa222d06 enable prefix_directives by default 2008-12-23 16:24:43 -05:00
Simon McVittie 5b1cf21a35 beautify_urlpath: if path already starts with ./, don't add another ./ 2008-12-21 15:24:42 +00:00
Simon McVittie 0844bd0b15 beautify_urlpath: add ./ before checking for /index.html
This fixes a bug: when a page links to its own #comments anchor you would
get a link like "index.html#comments" rather than "./#comments".
2008-12-21 15:23:59 +00:00
Joey Hess 65c4ae1ac1 clarify 2008-12-18 14:49:24 -05:00
Joey Hess 9f141841ef don't rely on $@
A malformed pagespec will cause $@ to be set when translated, but if
it is used a second time, the memoization will defeat that check. Better to
check for the result not being defined.
2008-12-17 18:56:32 -05:00
Joey Hess bb93fccf06 Coding style change: Remove explcit vim folding markers. 2008-12-17 15:22:16 -05:00
Joey Hess b67632cdcd inline: Support feedfile option to change the filename of the feed generated. 2008-12-11 15:01:26 -05:00
Joey Hess 7cc14ddf44 fix handling of wrappergroup option
Had forgot to include it in the option list.
2008-11-26 13:28:16 -05:00
Joey Hess dca6c835fe avoid adding ./ to urls unnecessarily
This avoids constructing urls like "./../foo/".
The leading "../" avoids any colon confusion already.

I noticed in my logs that certain badly written web spiders (hello again,
Yahoo!) fail to follow urls like ikiwiki was constructing to the right
place (instead ending up at "./foo/")
2008-11-20 12:55:57 -05:00
Joey Hess 716560b7f1 check for invalid utf-8, and toss it back to avoid crashes
Since ikiwiki uses open :utf8, perl assumes that files contain valid utf-8.
If it turns out to be malformed it may later crash while processing strings
read from them, with 'Malformed UTF-8 character (fatal)'.

As at least a quick fix, use utf8::valid as soon as data is read, and if
it's not valid, call encode_utf8 on the string, thus clearing the utf-8
flag. This may cause follow-on encoding problems, but will avoid this
crash, and the input file was broken anyway, so GIGO is a reasonable
response. (I looked at calling decode_utf8 after, but it seemed to cause
more trouble than it was worth. BTW, use open ':encoding(utf8)' avaoids
this problem, but the corrupted data later causes Storable to crash when
writing the index.)

This is a quick fix, clearly imperfect:
- It might be better to explicitly call decode_utf8 when reading files,
  rather than using the IO layer.
- Data read other than by readfile() can still sneak in bad utf-8. While
  ikiwiki does very little file input not using it, stdin for the CGI
  would be one way.
2008-11-12 17:30:54 -05:00
Joey Hess ecd4f0ee55 make unlockwiki drop the cgilock
This is necessary so that things that fork to the background,
like pinger, and inline ping, don't block other cgis from running.

Note that websetup also calls unlockwiki, before refreshing / rebuilding
the wiki. It makes perfect sense for that not to block other cgis.
2008-11-11 20:48:02 -05:00
Joey Hess d1b22b2524 lockwiki changes
* Stop busy-waiting in lockwiki, as this could delay ikiwiki from waking up
  for up to one second. The bailout code is no longer needed.
* Remove support for unused optional wait parameter from lockwiki.
2008-11-11 15:54:52 -05:00
Joey Hess 7f80e52543 Fix the link() pagespec to match links that are internally recorded as absolute.
This fixes a problem exposed by the recent change to tags
(a2839de936). That recorded tag links as
absolute by including a leading slash in the link. The same could also be
done with an absolute wikilink.

In either case, link() would not match such links, unless the leading slash
was included in the link to match. But that's not right, because pagespecs
match absolute by default. So strip the leading slash.

Note that to keep any existing `link(/foo)` pagespecs working after this
change, the leading slash is removed from there, too.
2008-11-09 15:31:57 -05:00
Joey Hess fb89bfd26b document wikistatedir, though it's still internal 2008-11-07 12:23:30 -05:00
Joey Hess db5ea4d4f0 meta: Plugin is now enabled by default since the basewiki uses it. 2008-11-06 16:08:11 -05:00
Joey Hess 7237fc7f2e allow_symlinks_before_srcdir is a boolean 2008-10-29 14:11:09 -04:00
Joey Hess 85f4b99710 untrusted committers code seems to be fully working
Still need to investigate possible races, and test some more.
2008-10-23 18:05:57 -04:00
Joey Hess 4669eab596 more work on untrusted committers
Wired up check_canedit and check_canremove, still need to deal with
check_canattach, and test.
2008-10-23 16:29:50 -04:00
Joey Hess 094af3d113 initial support for git repos with untrusted committers
Still need to wire up the calls to check_* , but it's cold out here and my
hands are going numb, so enough for now.
2008-10-22 20:52:34 -04:00
Joey Hess e75818572f function injection overhaul
Add an inject function, that can be used by plugins that want to replace
one of ikiwiki's functions with their own version. (This is a scary thing
that grubs through the symbol table, and replaces all exported occurances
of a function with the injected version.)

external: RPC functions can be injected to replace exported functions.

Removed the stupid displaytime hook, and use injection instead.
2008-10-21 17:57:19 -04:00
Joey Hess fd9393ef85 add displaytime hook
Need to use a hook because an exported function cannot be reliably
overridden. The replacement verstion was actually only affecting plugins
loaded after it.

formattime doesn't need a hook, since there's no reason to export it.
2008-10-19 20:12:37 -04:00
Joey Hess 2b569f99d9 fix relativedate timezone inclusion
The machine parseable date needs to include a timezone.

Also, simplified the interface for date display.
2008-10-19 19:21:44 -04:00
Joey Hess 16d51e67a7 add_underlay: avoid adding the same underlay twice 2008-10-17 19:53:04 -04:00
Joey Hess d3ca495e61 lockedit: Support specifying which users (and IP addresses) a page is locked for. This supports most of the ACL type things users have been wanting to be done. Closes: #443346 (It does not control who can read a page, but that's out of scope for ikiwiki.) 2008-10-08 17:47:38 -04:00
Joey Hess 6310b05e22 typo 2008-10-01 15:55:50 -04:00
Joey Hess 2d45a303e2 add newpagefile function 2008-09-29 18:51:16 -04:00
Joey Hess a9d7c5453a Add indexpages option
This is the easy part of supporting foo/index.mdwn sources for page foo.

Note that if foo.mdwn exists too, there will be a warning about multiple
sources for the same page, and which is used is indeterminate.

indexpages should also cause web based editing to create index source pages
by default; this and other fallout of the option not yet implemented.
2008-09-29 17:30:30 -04:00
Joey Hess 2ff3c8aee7 editpage: Be more aggressive (and less buggy) about cleaning up temporary files rendered during page preview. 2008-09-27 18:02:33 -04:00
Joey Hess a5d3acd37c Add %wikistate, which is like %pagestate except not specific to a given page, and is preserved across rebuilds. 2008-09-27 16:45:27 -04:00
Joey Hess 61426a7186 Reorganize index file, add a format version field.
Upgrades to the new index format should be transparent.

The version field is 3, because 1 was the old textual index, 2 was the
pre-versioned format.

This also includes some efficiency improvements to index loading, by
not copying a hash and using a reference.
2008-09-27 16:35:56 -04:00
Joey Hess 9ec9d6901d Export pagetitle, titlepage, linkpage. 2008-09-27 14:27:42 -04:00
Joey Hess dfe55e8956 Add keepextension parameter to htmlize hook. (Willu) 2008-09-23 13:39:21 -04:00
Joey Hess a87cfbcb8d Improve error message if external plugin fails to load. Closes: #498458 2008-09-11 01:41:55 -04:00
Joey Hess 7a680431ed Add allow_symlinks_before_srcdir to config so websetup doesn't eat it. 2008-09-09 14:50:37 -04:00
Joey Hess 0f67e7d969 editpage: New core plugin factoring out page editing to allow disabling it if desired. 2008-09-05 13:57:25 -04:00
Joey Hess d2679de965 For fine control over what characters are allowed, unescaped in source filenames, the wiki_file_chars setting is added. For example, set to "-[:alnum:]+/._" to disable colons from being used in source files (which can cause trouble om Windows). 2008-09-04 14:13:10 -04:00
Joey Hess 75a096d056 Work around perl $_ scoping nonsense that caused breakage when loading external plugins. 2008-08-29 18:40:41 -04:00
Joey Hess adc2eb3d8c Options set in the setup file are now immediatly loaded by ikiwiki -setup. This allows later switches to override them. Previously, setup file options overrode most command line options. 2008-08-06 01:58:04 -04:00
Joey Hess 182edf291b typo 2008-08-05 19:39:50 -04:00
Joey Hess 4b4bce5006 Revert "typo"
This reverts commit c8d3626c51.
2008-08-05 19:39:30 -04:00
Joey Hess c8d3626c51 typo 2008-08-05 19:30:09 -04:00
Joey Hess 4f22989be1 don't set values for verbose and syslog by default
Setting the values in the setup file by default makes it annoyingly hard to
override them at the command line (since setup files override the command
line).

Both default to off if no value is set.
2008-08-05 19:16:24 -04:00
Joey Hess 6f2d1536b8 improve fix to DTRT for a param of "0" 2008-08-04 14:58:21 -04:00
Simon McVittie 4c2f46e3fa Suppress warning about uninitialized value if directives look like [[!foo]]
(cherry picked from commit cf58eefaa56eb17c227d97d129bf95e3dab54fd3)
2008-08-04 14:56:23 -04:00
Joey Hess 6fb0226a55 reorg settings 2008-08-03 17:02:00 -04:00
Joey Hess 4405cebd0a add advanced and basic modes 2008-08-03 14:57:24 -04:00
Joey Hess 11a9853d4b reword 2008-08-03 00:05:49 -04:00