Commit Graph

191 Commits (655e2ddc1f44236d3396be722d55a0afd755d39d)

Author SHA1 Message Date
Joey Hess 3ebd4e0b45 Add genwrapper hook, that can be used to add code into the C wrapper. 2009-09-10 14:04:46 -04:00
http://schmonz.livejournal.com/ d9fa13504d add missing backquote 2009-07-29 22:38:51 -04:00
http://schmonz.livejournal.com/ 6f88e3631e fix typo 2009-07-26 05:40:58 -04:00
Joey Hess ef003f48f4 Merge branch 'master' into po
Conflicts:
	debian/changelog
2009-05-19 13:07:47 -04:00
Jon Dowland 335462c05d document longname parameter 2009-05-16 14:01:12 +01: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 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
Joey Hess 252edaea66 clarify 2009-04-22 15:36:40 -04:00
intrigeri 8cfe428a28 rename hook: run once per file to be renamed
... as Joey suggested on todo/need_global_renamepage_hook

This hook is applied recursively to returned additional rename
hashes, so that it handles the case where two plugins use the hook:
plugin A would see when plugin B adds a new file to be renamed.

The full set of rename hashes can no longer be changed by hook functions, that
are only allowed to return any additional rename hashes it wants to add.
Rationale: the correct behavior of the recursion would be hard, if not
impossible, to define, if already considered pages were changing on the run.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-03-08 11:44:00 +01:00
intrigeri ae474d8e14 Merge commit 'upstream/master' into prv/po
Conflicts:

	IkiWiki/Plugin/editpage.pm
	debian/control
	debian/copyright
	doc/todo/need_global_renamepage_hook.mdwn

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-03-08 09:50:27 +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 3ce8a2f8b9 revert addition of several blank lines 2009-02-17 22:17:59 -05:00
AlexandreDupas 6f9c18f7cb correct WikiLinks to the WikiLink page 2009-02-16 08:00:18 -05:00
Joey Hess 9a84181ad9 document writefile symlink checks 2009-02-09 16:04:33 -05:00
intrigeri 51badc960d rename hook: instead of modifying the passed-by-name array, return a copy
This is intended to solve Joey's concerns expressed on
http://ikiwiki.info/todo/need_global_renamepage_hook/, i.e. the need to make it
possible to use this hook from external plugins.

A plugin using this hook still can add/modify/remove elements of the
@torename array.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-27 17:08:55 +01:00
intrigeri 03ab262319 revert renamepage's hook original name
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-27 00:00:00 +01:00
intrigeri 78a095aa42 only pass named parameters to the canremove hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-26 23:07:19 +01:00
intrigeri f02672c113 only pass named parameters to the canrename hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-26 23:02:31 +01:00
Joey Hess 53be24789e don't add new exported warning function
Nothing in the po plugin actually uses this function.

The benefit of adding the function in general is debatable, but I'd
prefer to keep the changes involved in merging po at a minimum.
2009-01-26 13:37:57 -05:00
intrigeri f8c306a21b remove cansave plugin, now replaced by Joey's checkcontent one
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-19 19:53:32 +01:00
intrigeri a3726968bc make checkcontent compatible with hooks that need the full content
Always pass the full (modified) content in `content` named parameter. When the
user edits an existing wiki page, also pass a `diff` named parameter, which
includes only the lines that they added to the page, or modified.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-19 19:44:39 +01:00
intrigeri 832d4d31d1 Merge commit 'upstream/master' into prv/po
Conflicts:

	IkiWiki/Plugin/editpage.pm
	IkiWiki/Plugin/skeleton.pm.example
	doc/plugins/write.mdwn
	t/syntax.t
2009-01-17 14:01:53 +01:00
Joey Hess f7b2cfcf50 checkcontent: New hook, can be used to implement arbitrary content filters, including spam filters. 2009-01-16 20:46:55 -05:00
intrigeri 1c53179e97 add a warning (exported) function to the core
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-16 15:06:42 +01:00
intrigeri d69fdf6445 editpage: added a cansave hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-01 19:48:27 +01:00
intrigeri e895157397 Pass src, srcfile, dest and destfile to the canrename hook.
This is not needed by the use I'm doing of it, but seems more consistent to me.
Future users of this hook may need this data to make their mind.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-01 18:04:37 +01:00
intrigeri a8105f6859 rename: pass the CGI and session to the rename hook
The po plugin remame + canrename hook combination will need this.

Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-01 17:47:20 +01:00
intrigeri 3316f9cc73 rename: implemented new canrename hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-01 16:52:34 +01:00
intrigeri 741b26aa17 remove: implemented a new canremove hook; use it in the po plugin
Signed-off-by: intrigeri <intrigeri@boum.org>
2009-01-01 16:44:39 +01:00
intrigeri 5c2f6cb893 Merge commit 'upstream/master' into prv/po 2009-01-01 13:34:00 +01:00
intrigeri 5738f30a29 the rename hook can now change the list of pages to rename
Signed-off-by: intrigeri <intrigeri@boum.org>
2008-12-30 22:55:04 +01:00
intrigeri c01485ae1a renamed the renamepage hook to renamelink, added rename hook
Signed-off-by: intrigeri <intrigeri@boum.org>
2008-12-30 21:36:40 +01: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 04f064e78a make ikiwiki-transition prefix_directives take a setup file
This is easier to remeber, and less error-prone than passing it all the
pages in the wiki.
2008-12-24 19:48:42 -05:00
Joey Hess 678d467a40 finalise version 3.00 of the plugin api 2008-12-23 16:34:19 -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 1a883b3c50 include temp file for attachment change too 2008-10-24 13:44:03 -04:00
tschwinge 0a081d78c4 Typo fix. 2008-10-24 05:40:52 -04:00
Joey Hess ad9e443f22 check_canattach hooked up 2008-10-23 16:56:40 -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 97b94e4e88 displaytime hook is gone 2008-10-21 20:37:49 -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 79b376f991 Add an underlay for javascript, and add ikiwiki.js containing some utility code.
* Add an underlay for javascript, and add ikiwiki.js containing some utility
  code.
* toggle: Stop embedding the full toggle code on each page using it, and
  move it to toggle.js in the javascript underlay.
2008-10-17 20:28:18 -04:00
Joey Hess 2d45a303e2 add newpagefile function 2008-09-29 18:51:16 -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 9ec9d6901d Export pagetitle, titlepage, linkpage. 2008-09-27 14:27:42 -04:00