aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/template.pm
Commit message (Collapse)AuthorAge
* protect $@ whenever a block using $@ is non-trivialSimon McVittie2014-02-21
| | | | | | | | | | | | | | | | | | | | | | | | As noted in the Try::Tiny man page, eval/$@ can be quite awkward in corner cases, because $@ has the same properties and problems as C's errno. While writing a regression test for definetemplate in which it couldn't find an appropriate template, I received <span class="error">Error: failed to process template <span class="createlink">deftmpl</span> </span> instead of the intended <span class="error">Error: failed to process template <span class="createlink">deftmpl</span> template deftmpl not found</span> which turned out to be because the "catch"-analogous block called gettext before it used $@, and gettext can call define_gettext, which uses eval. This commit alters all current "catch"-like blocks that use $@, except those that just do trivial things with $@ (string interpolation, string concatenation) and call a function (die, error, print, etc.)
* template_depends: throw nice error message when template cannot be foundJoey Hess2010-09-27
| | | | | | | | | | | | plovs reported a crash when templates were not installed properly, with a non-useful error about the template object not being defined. I've audited all uses of template_depends(), and template(), and it makes sense for them to throw an error if the template cannot be found. All code with a user-supplied template catches errors already, to handle template parse failures. It did not make sense for template_file to throw errors, as some code uses it to probe if a template file is available.
* remove unnecessary and troublesome filter callsJoey Hess2010-07-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This better defines what the filter hook is passed, to only be the raw, complete text of a page. Not some snippet, or data read in from an unrelated template. Several plugins that filtered text that originates from an (already filtered) page were modified not to do that. Note that this was not done very consistently before; other plugins that receive text from a page called preprocess on it w/o first calling filter. The template plugin gets text from elsewhere, and was also changed not to filter it. That leads to one known regression -- the embed plugin cannot be used to embed stuff in templates now. But that plugin is deprecated anyway. Later we may want to increase the coverage of what is filtered. Perhaps a good goal would be to allow writing a filter plugin that filters out unwanted words, from any input. We're not there yet; not only does the template plugin load unfiltered text from its templates now, but so can the table plugin, and other plugins that use templates (like inline!). I think we can cross that bridge when we come to it. If I wanted such a censoring plugin, I'd probably make it use a sanitize hook instead, for the better coverage. For now I am concentrating on the needs of the two non-deprecated users of filter. This should fix bugs/po_vs_templates, and it probably fixes an obscure bug around txt's use of filter for robots.txt.
* template: Fix typo.Joey Hess2010-04-27
|
* chomp template valuesJoey Hess2010-04-24
| | | | Before the template reorg, this was done by a template filter.
* updateJoey Hess2010-04-23
|
* improved error messageJoey Hess2010-04-23
|
* switch to using template_dependsJoey Hess2010-04-23
| | | | | It now handles all the details of finding a page template that this used to need to implement.
* qualify template_fileJoey Hess2010-04-02
|
* template: Search for templates in the templatedir, if they are not found as ↵Joey Hess2010-04-02
| | | | pages in the wiki.
* setup file orderingJoey Hess2010-02-12
|
* template: Preprocess parameters before htmlizing.Joey Hess2010-01-26
| | | | | | | | | | | | | | | | | | | | | | | Consider a template like: [[!template type=note text=""" [[!inline pages="*foo*"]] """]] The text parameter is htmlized before being passed into the template (in case the template wraps it in a <span> that prevents markdown from htmlizing it later). But, when markdown sees "*foo*", it turns that into <em>foo</em>. Later, when preprocessing the inline directive, that leads to suprising results. To fix this, I made template parameters be preprocessed (and filtered) before being htmlized. Note that I left in the preprocessing (and filtering) of the template output at the end. That's still relevant when the template itself contains preprocessor directives.
* When loading a template in scan mode, let preprocess know it only needs to scan.Joey Hess2009-03-08
| | | | | | | | This makes wikis such as zack's much faster in the scan pass. In that pass, when a template contains an inline, there is no reason to process the entire inline and all its pages. I'd forgotten to pass along the flag to let preprocess() know it was in scan mode, leading to much unncessary churning.
* template: Load templates in scan modeJoey Hess2009-02-17
| | | | | | This is potentially expensive, but is necessary so that meta and tag directives, and other links on templates affect the page using the template reliably.
* Revert "comments" (stupid commit)Joey Hess2009-02-17
| | | | This reverts commit bb8b8787ef9477c027b9e5d8b7b5e1addfd1ca32.
* commentsJoey Hess2009-02-17
|
* finalise version 3.00 of the plugin apiJoey Hess2008-12-23
|
* Coding style change: Remove explcit vim folding markers.Joey Hess2008-12-17
|
* template: Make edit link for new templates ensure the page is located under ↵Joey Hess2008-09-27
| | | | toplevel templates directory.
* add plugin safe/rebuild info (part 3 of 3)Joey Hess2008-08-03
|
* switch preprocess hooks to use error functionJoey Hess2008-07-13
|
* template: Add support for a BASENAME variable.Joey Hess2008-07-10
|
* Pass a destpage parameter to the sanitize hook.Joey Hess2008-06-04
| | | | | | | | Because the search plugin needed it, also because it's one of the few plugins that didn't already have it. I also considered adding it to htmlize, but I really cannot imagine caring what the destpage is when htmlizing. (I'll probably be poven wrong later.)
* * template: Remove bogus htmlize pass added in 2.16.Joey Hess2008-01-09
| | | | | * template: Htmlize template variables, but also provide a raw version via `<TMPL_VAR raw_variable>`.
* * Htmlize parameters passed to the template preprocessor directive beforeJoey Hess2007-12-12
| | | | | | | inserting them into the html template. This ensures that markdown acts on them, even if the value is expanded inside a block-level html element in the html template. Closes: #454058 * Use a div in the note template rather than a span.
* * Add a destpage parameter to the filter hook.joey2007-05-17
| | | | | * Fix links to smilies generated by the smiley plugin for inlined pages. The old links were often wrong, but often still worked by accident.
* * pagespec_match() has changed to take named parameters, to better allowjoey2007-04-27
| | | | | | | | | for extended pagespecs. The old calling convention will still work for back-compat for now. * The calling convention for functions in the IkiWiki::PageSpec namespace has changed so they are passed named parameters. * Plugin interface version increased to 2.00 since I don't anticipate any more interface changes before 2.0.
* more i18n improvementsjoey2007-03-07
|
* * Fix the template, toggle, and conditional plugins to filter text beforejoey2007-02-14
| | | | | | preprocessing it. * Fix smiley plugin to support smileys at the very beginning or end of the content.
* * Initial work on internationalization of the program code. po/ikiwiki.potjoey2006-12-29
| | | | | is available for translation. * Export gettext() from IkiWiki module.
* * Avoid syntax errors in templates used by the template plugin crashingjoey2006-11-05
| | | | ikiwiki.
* * Yet another fix for those poor case-insensative `OSX users.joey2006-09-18
| | | | | | * chomp trailing newlines at the end of templates read in by the template plugin, to allow use of the template preprocessor directive in whitespace-sensative situations. Closes: #387073
* * Work on firming up the plugin interface:joey2006-09-09
| | | | | | | | | | | | | | | | | | | - Plugins should not need to load IkiWiki::Render to get commonly used functions, so moved some functions from there to IkiWiki. - Picked out the set of functions and variables that most plugins use, documented them, and made IkiWiki export them by default, like a proper perl module should. - Use the other functions at your own risk. - This is not quite complete, I still have to decide whether to export some other things. * Changed all plugins included in ikiwiki to not use "IkiWiki::" when referring to stuff now exported by the IkiWiki module. * Anyone with a third-party ikiwiki plugin is strongly enrouraged to make like changes to it and avoid use of non-exported symboles from "IkiWiki::". * Link debian/changelog and debian/news to NEWS and CHANGELOG. * Support hyperestradier version 1.4.2, which adds a new required phraseform setting.
* fixesjoey2006-08-23
|
* * Allow preprocessor directives to contain python-like triple-quotedjoey2006-08-23
text blocks, for easy nesting of quotes inside. * Add a template plugin. * Use the template plugin to add infoboxes to each plugin page listing basic info about the plugin.