X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/2c05a34be17c805d929f0ad563acf857eba1d46b..12c5786df4e74c143f24398b8d0028000b61daba:/doc/plugins/write/tutorial.mdwn diff --git a/doc/plugins/write/tutorial.mdwn b/doc/plugins/write/tutorial.mdwn index 94b72c763..5b810a18f 100644 --- a/doc/plugins/write/tutorial.mdwn +++ b/doc/plugins/write/tutorial.mdwn @@ -5,7 +5,7 @@ What should the plugin do? Let's make it calculate and output the Fibonacci sequence. To output the next number in the sequence, all a user has to do is write this on a wiki page: - [[fib ]] + [[!fib ]] When the page is built, the [[ikiwiki/PreProcessorDirective]] will be replaced by the next number in the sequence. @@ -44,7 +44,7 @@ that "fib" has shown up again. It doesn't actually have to match the module name this time, but it generally will. This "fib" is telling ikiwiki what kind of PreprocessorDirective to handle, namely one that looks like this: - [[fib ]] + [[!fib ]] Notice the `\&preprocess`? This is how you pass a reference to a function, and the `preprocess` function is the one that ikiwiki will call to expand @@ -98,7 +98,7 @@ And let's change the `preprocess` sub to use it: Feel free to try it out with a simple page like this: - [[fib ]], [[fib ]], [[fib ]], [[fib ]], [[fib ]] + [[!fib ]], [[!fib ]], [[!fib ]], [[!fib ]], [[!fib ]] Looks like it works ok, doesn't it? That creates a page that lists: @@ -139,7 +139,7 @@ Ok, one more enhancement. Just incrementing the numbers is pretty boring. It would be nice to be able to jump directly to a given point in the sequence: - \[[fib seed=20]], [[fib ]], [[fib ]] + \[[!fib seed=20]], [[!fib ]], [[!fib ]] Just insert these lines of code inside `preprocess`, in the appropriate spot: