From 880c97ba31289e1c898e8bc7ec4ab795c5594f02 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 13 Oct 2010 14:29:54 -0400 Subject: [PATCH] Add gitrepo template and use it in ChemDB published post. The template is based on ikiwiki's doc/templates/gitbranch.mdwn. This turned out to be more complicated than I expected, mostly due to the need for the template to both work and be appropriate Markdown. The way to do this seems to be to use the htmlscrubber plugin to strip the tags from the rendered version. I'd disabled the htmlscrubber plugin because it had been stripping out my MathML. Now it's re-enabled, but only for template/* posts. It would be nice if there was a way to force posts to evaluate themselves as templates when rendered directly... I also added a git tag for the gitrepo template to use. --- ikiwiki.setup | 6 +++++- posts/ChemDB_published.mdwn | 2 +- tags/git.mdwn | 3 +++ templates.mdwn | 5 +++++ templates/gitrepo.mdwn | 16 ++++++++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 tags/git.mdwn create mode 100644 templates.mdwn create mode 100644 templates/gitrepo.mdwn diff --git a/ikiwiki.setup b/ikiwiki.setup index 665e53e..9982a47 100644 --- a/ikiwiki.setup +++ b/ikiwiki.setup @@ -31,7 +31,7 @@ use IkiWiki::Setup::Standard { # plugins to add to the default configuration add_plugins => [qw{goodstuff linktoimgonly lockedit mdwn_itex org sidebar}], # plugins to disable - disable_plugins => [qw{editpage htmlscrubber passwordauth smiley}], + disable_plugins => [qw{editpage passwordauth smiley}], # location of template files templatedir => '/home/wking/.ikiwiki/templates', # base wiki source location @@ -99,6 +99,10 @@ use IkiWiki::Setup::Standard { # branch that the wiki is stored in #gitmaster_branch => 'master', + # htmlscrubber plugin + # PageSpec specifying pages not to scrub + htmlscrubber_skip => "!templates/*", + # inline plugin # enable rss feeds by default? rss => 1, diff --git a/posts/ChemDB_published.mdwn b/posts/ChemDB_published.mdwn index 781069f..0f8b5c2 100644 --- a/posts/ChemDB_published.mdwn +++ b/posts/ChemDB_published.mdwn @@ -3,7 +3,7 @@ I wrote a little app in Python to make managing our lab's list of chemicals less painful. I think it is now ready for people other than me :p. -[code](http://www.physics.drexel.edu/~wking/code/index.shtml#chemdb) +[[!template id=gitrepo repo=chemdb]] [[!tag tags/code]] [[!tag tags/linux]] diff --git a/tags/git.mdwn b/tags/git.mdwn new file mode 100644 index 0000000..4d11d0c --- /dev/null +++ b/tags/git.mdwn @@ -0,0 +1,3 @@ +Software versioned in Git or Git-related posts. + +[[!inline pages="link(tags/git)" show=10 actions=yes]] diff --git a/templates.mdwn b/templates.mdwn new file mode 100644 index 0000000..5232b03 --- /dev/null +++ b/templates.mdwn @@ -0,0 +1,5 @@ +The `templates/` directory contains customized templates for this +wiki. + +[[!inline pages="./templates/*" archive=yes feeds=no sort=title + template=titlepage]] diff --git a/templates/gitrepo.mdwn b/templates/gitrepo.mdwn new file mode 100644 index 0000000..7719dd2 --- /dev/null +++ b/templates/gitrepo.mdwn @@ -0,0 +1,16 @@ + +Available in a [[!taglink tags/git]] repository.
+Repository:
+Author: W. Trevor King
+
+ + +This template is used to create an infobox for a git repository. It +uses these parameters: + +* repo - the name of the repository. +* url - repository url. Defaults to `/~wking/code/git/git.php?p=.git`. +* author - the author of the branch. Defaults to `W. Trevor King`. + +It also automatically tags the branch with `tags/git`. + -- 2.26.2