summaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
AgeCommit message (Collapse)Author
2010-09-10Pass array of names of files that have been deleted to needsbuild hook as ↵Joey Hess
second parameter, to allow for plugins that needs access to this information earlier than the delete hook.
2010-09-07needsbuild hook interface changed; the hooks should now return the modified ↵Joey Hess
array of things that need built. (Backwards compatability code keeps plugins using the old interface working.)
2010-08-02Run the preprocess hooks in scan mode *before* the scan hooks.intrigeri
2010-08-02Revert "Added a rescan hook."intrigeri
This reverts commit 25447bccae0439ea56da7a788482a4807c7c459d.
2010-07-30Added a rescan hook.intrigeri
This is needed for the po plugin vs. e.g. meta titles. In order to get rid of the ugly "rebuilding all pages to fix meta titles" thing, Joey suggested to make "po, at scan time, re-run the scan hooks, passing them modified content (either converted from po to mdwn or with the escaped stuff cheaply de-escaped)". This would unfortunately not work, as the meta plugin gathers its data using the preprocess hook in scan mode: it would overwrite with buggy data the correct data we would have forced it to gather in po's scan hook. We then need a hook that runs *after* the preprocess hook has been run in scan mode, but *before* any page rendering is started. Hence this one.
2010-06-23rcs_getctime and rcs_getmtime take relative filenamesJoey Hess
There was some confusion about whether the filename was relative to srcdir or not. Some test cases, and the bzr plugin assumed it was relative to the srcdir. Most everything else assumed it was absolute. Changed it to relative, for consistency with the rest of the rcs_ functions.
2010-06-17avoid dying if cannot chdir to an underlaydirJoey Hess
2010-06-15Make --gettime be honored after initial setup.Joey Hess
Bugfix in passing: New files not treated as such when no rcs is used.
2010-06-15fix other cases of unicode mixing issueJoey Hess
and fix underlaydir override attack guard when srcdir is non-absolute
2010-06-15Fix issues with combining unicode srcdirs and source files.Joey Hess
A short story: Once there was a unicode string, let's call him Srcdir. Along came a crufy old File::Find, who went through a tree and pasted each of the leaves in turn onto Srcdir. But this 90's relic didn't decode the leaves -- despite some of them using unicode! Poor Srcdir, with these leaves stuck on him, tainted them with his nice unicode-ness. They didn't look like leaves at all, but instead garbage. (In other words, perl's unicode support sucks mightily, and drives us all to drink and bad storytelling. But we knew that..) So, srcdir is not normally flagged as unicode, because typically it's pure ascii. And in that case, things work ok; File::Find finds filenames, which are not yet decoded to unicode, and appends them to the srcdir, and then decode_utf8 happily converts the whole thing. But, if the srcdir does contain utf8 characters, that breaks. Or, if a Yaml setup file is used, Yaml::Syck's implicitunicode sets the unicode flag of *all* strings, even those containing only ascii. In either case, srcdir has the unicode flag set; a non-decoded filename is appended, and the flag remains set; and decode_utf8 sees the flag and does *nothing*. The result is that the filename is not decoded, so looks valid and gets skipped. File::Find only sticks the directory and filenames together in no_chdir mode .. but we need that mode for security. In order to retain the security, and avoid the problem, I made it not pass srcdir to File::Find. Instead, chdir to the srcdir, and pass ".". Since "." is ascii, the problem is avoided. Note that chdir srcdir is safe because we check for symlinks in the srcdir path. Note that it takes care to chdir back to the starting location. Because the user may have specified relative paths and so staying in the srcdir might break. A relative path could even be specifed for an underlay dir, so it chdirs back after each.
2010-06-15Fix issues with combining unicode srcdirs and source files.Joey Hess
A short story: Once there was a unicode string, let's call him Srcdir. Along came a crufy old File::Find, who went through a tree and pasted each of the leaves in turn onto Srcdir. But this 90's relic didn't decode the leaves -- despite some of them using unicode! Poor Srcdir, with these leaves stuck on him, tainted them with his nice unicode-ness. They didn't look like leaves at all, but instead garbage. In other words, perl's unicode support sucks mightily, and drives us all to drink and bad storytelling. But we knew that.. So, srcdir is not normally flagged as unicode, because typically it's pure ascii. And in that case, things work ok; File::Find finds filenames, which are not yet decoded to unicode, and appends them to the srcdir, and then decode_utf8 happily converts the whole thing. But, if the srcdir does contain utf8 characters, that breaks. Or, if a Yaml setup file is used, Yaml::Syck's implicitunicode sets the unicode flag of *all* strings, even those containing only ascii. In either case, srcdir has the unicode flag set; a non-decoded filename is appended, and decode_utf8 sees the flag and does *nothing*. The result is that the filename is not decoded, so looks valid and gets skipped. File::Find only sticks the directory and filenames together in no_chdir mode .. but we need that mode for security. In order to retain the security, and avoid the problem, I made it not pass srcdir to File::Find. Instead, chdir to the srcdir, and pass ".". Since "." is ascii, the problem is avoided. Note that it takes care to chdir back to the starting location. Because the user may have specified relative paths and so staying in the srcdir might break. A relative path could even be specifed for an underlay dir, so it chdirs back after each.
2010-05-18Fix a bug that prevented matching deleted comments, and so did not update ↵Joey Hess
pages that had contained them. Problem is that by the time rendering calls render_dependent, %pagesources has had deleted files removed from it. So match_comment's lookup of files in there to see if they had the _comment extension failed. I had to introduce a hash that temporarily holds filenames of deleted pages to fix this. Note that unlike comment(), internal() had avoided this pitfall by being defined to match both internal and non-internal pages.
2010-05-14refactor template actionsJoey Hess
2010-05-07nasty update to ugly hack to allow comment() pagespecs to workJoey Hess
2010-05-07call delete hook even if only internal pages are deletedJoey Hess
2010-05-06Delete hooks are passed deleted internal pages.Joey Hess
Necessary so search can remove its indexes for internal pages. But also, it seems it was an omission not to pass the deleted pages before.
2010-05-06inline: Call indexhtml when inlining internal pages, so their text can be ↵Joey Hess
indexed for searching.
2010-05-06Renamed postscan hook to indexhtml, to reflect its changed position.Joey Hess
Probably only the search plugin uses it, so this seemed safe.
2010-05-05rename ispage variableJoey Hess
2010-05-05remove unusedJoey Hess
2010-05-05add ISPAGE variable to page.tmplJoey Hess
Plugins will also be able to use this to tell if the template is being used to generate a wiki page, when misctemplate starts also using page.tmpl.
2010-05-04Fixes a bug in skipping of illegal source files introduced in 3.20100427.Joey Hess
2010-05-03Add ACTIONS variable to page.tmpl, which allows plugins to add arbitrary ↵Joey Hess
links to the action bar without modifying the template further. (COMMENTSLINK and DISCUSSIONLINK could be folded into this, but are kept separate for now to avoid breaking modified templates.)
2010-05-02Add parameter to displaytime to specify that it is a pubdate, and in html5 ↵Joey Hess
mode, use time tag.
2010-05-01html5 optionJoey Hess
* Ikiwiki can be configured to generate html5 instead of the default xhtml 1.0. The html5 output mode is experimental, not yet fully standards compliant, and will be subject to rapid change.
2010-04-26loop on pagesources, not ctimeJoey Hess
2010-04-26Fix removal of rendered files in rebuild mode.Joey Hess
Needed to handle the move of the .js files into ikiwiki/, but also this is a longstanding bug. Old pagemtime is not remembered in rebuild mode, and changing that would need a lot of changes. So instead, loop on pagectime, which is remembered. Change to remembering old pagesources info in rebuild mode. This seems safe enough.
2010-04-24rebuild on template removalJoey Hess
2010-04-24bugfixesJoey Hess
2010-04-24add support for mass dependenciesJoey Hess
Registered by passing "" as page name to add_depends.
2010-04-23special case for page.tmpl dependency handlingJoey Hess
Rather than wasting resources recording that every page depends on page.tmpl, add a special case. The special case curretly rebuilds non-page files too when page.tmpl changes, but that's minor.
2010-04-22look for templates in srcdir and underlays, firstJoey Hess
This entailed changing template_params; it no longer takes the template filename as its first parameter. Add template_depends to api and replace calls to template() with template_depends() in appropriate places, where a dependency should be added on the template. Other plugins don't use template(), so will need further work. Also, includes are disabled for security. Enabling includes only when using templates from the templatedir would be nice, but would add a lot of complexity to the implementation.
2010-04-21Merge branch 'master' into autotagJoey Hess
Conflicts: IkiWiki/Plugin/tag.pm
2010-04-21fix false positive in link_types_changedJoey Hess
loadindex does not bother populating oldtypedlinks if there is no link type. However, the code in link_types_changed assumed that if oldtypedlinks is not defined, and typedlinks is, they must differ.
2010-04-21remember autofiles that were tried and failed to be addedJoey Hess
This way, if an autofile is registered for a file that already exists, it is remembered that it was tried, and it doesn't get recreated when removed.
2010-04-21remember autofiles alwaysJoey Hess
This fixes the problem that it did not remember if an autofile is deleted, unless a plugin happened to register the autofile at the same time. With the new code, we just never recreate an autofile more than once. Only downside is that the list of autofiles is never pruned either. And I don't really see a way to prune it.
2010-04-21bugfixesJoey Hess
2010-04-21remove verify_src_fileJoey Hess
Splitting out this function bothered me. It is conceptially similar to file_pruned, and yet also very specific to exactly the security needs of find_src_files. I liked that it got rid of duplicate code in the latter function. So instead, put a helper sub in that, which I think allows refactoring things more cleanly, and with less boilerplate. As to the needs of gen_autofile, I'm not convinced this needs to handle the same set of problems that verify_src_file did. So I sat down and wrote a custom validator for autofiles, which turned out to seem to just need three things: Make sure the candidate filename is not something that would be pruned; untaint the candidate filename; and make sure that srcdir doesn't already have something with its name. (Plus, of course, all the other checks that were already in gen_autofile.) (In passing, also fixed a bunch of bugs I had introduced in this branch.)
2010-04-20Merge branch 'master' into autotagJoey Hess
2010-04-20fix minor bug if a page's name is "0"Joey Hess
2010-04-19change wordingJoey Hess
This is more accurate when a file that is not a page is what is removed.
2010-04-19move message into if blockJoey Hess
2010-04-17move File::Find control back into its code blocksJoey Hess
Ok, this is longer, but features less scary action at a distance.
2010-04-17move decode_utf8 closer to reason for itJoey Hess
Filenames need to be decoded, as File::Find does not provide them in decoded form, but other callers of verify_src_file will be using utf8.
2010-04-17refactor autofilesJoey Hess
Made add_autofile take a generator function, and just register the autofile, for later possible creation. The testing is moved into Render, which allows cleaning up some stuff.
2010-04-17whitespaceJoey Hess
2010-04-17Merge remote branch 'davrieb/autotag' into autotagJoey Hess
Conflicts: IkiWiki.pm IkiWiki/Plugin/tag.pm
2010-04-16automatically run --gettime, and optimise it for gitJoey Hess
* Automatically run --gettime the first time ikiwiki is run on a given srcdir. * Optimise --gettime for git, so it's appropriatly screamingly fast. (This could be done for other backends too.) * However, --gettime for git no longer follows renames. * Use above to fix up timestamps on docwiki, as well as ensure that timestamps on basewiki files shipped in the deb are sane.
2010-04-16--gettime revampJoey Hess
* Rename --getctime to --gettime. (The old name still works for backwards compatability.) * --gettime now also looks up last modification time. * Add rcs_getmtime to plugin API; currently only implemented for git.
2010-04-04Fix some typos that would break Render during changed-link calculationSimon McVittie