From 943a4ff520d42b41af466e5626b96ee0e2ac13c5 Mon Sep 17 00:00:00 2001 From: "http://hendry.iki.fi/" Date: Sat, 18 Oct 2008 09:21:24 -0400 Subject: google plugin linked --- doc/tips/Google_custom_search.mdwn | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/Google_custom_search.mdwn b/doc/tips/Google_custom_search.mdwn index 7e8ac951c..1093029f5 100644 --- a/doc/tips/Google_custom_search.mdwn +++ b/doc/tips/Google_custom_search.mdwn @@ -5,3 +5,8 @@ Instead of the [[plugins/search]] plugin you could embed [Google Custom Search]( Once you've created your "custom search engine", just drop in the search box html like I've done in my [Debian tips and tricks](http://dabase.com/tips/) [source](http://git.webconverger.org/?p=faq.git;a=blob;f=tips.mdwn). If you have odd "save failed" error messages in Google's CSE's control panel, try `/usr/lib/WebKit/GtkLauncher` from [webkit](http://packages.qa.debian.org/w/webkit.html). + + +# Alternatively + +You could use the [[Google_plugin|plugins/google]] from version 2.67. -- cgit v1.2.3 From cf84dc5d2b33e86f5ddcef4346e9714167a989d2 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 19 Oct 2008 18:33:59 -0400 Subject: initial tip submission --- ...pository_and_web_server_on_different_hosts.mdwn | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn (limited to 'doc/tips') diff --git a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn new file mode 100644 index 000000000..20c6cf1d3 --- /dev/null +++ b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn @@ -0,0 +1,61 @@ +One may want to provide ikiwiki hosting with git+ssh access and web +server located at different hosts. Here's a description for such +a setup, using password-less SSH as a way of communication between +these two hosts. + +Git server +========== + +Let's create a user called `ikiwiki_example`. This user gets SSH +access restricted to GIT pull/push, using `git-shell` as a shell. + +The root (bare) repository: + +- is stored in `~ikiwki_example/ikiwiki_example.git` +- is owned by `ikiwiki_example:ikiwiki_example` +- has permissions 0700 + +The master repository's post-update hook connects via SSH to +`webserver` as user `ikiwiki_example`, in order to run +`~/bin/ikiwiki.update` on `webserver`; this post-update hook, located +in `~ikiwki_example/ikiwiki_example.git/hooks/post-update`, is +executable and contains: + + #!/bin/sh + /usr/bin/ssh ikiwiki_amnesia@www bin/ikiwiki.update + +Password-less SSH must be setup to make this possible; one can +restrict `gitserver:ikiwiki_example` to be able to run only the needed +command on the web server, using such a line in +`webserver:~ikiwiki_example/.ssh/authorized_keys`: + + command="bin/ikiwiki.update",from="vcs.example.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ... + +Web server +========== + +Let's create a user called `ikiwiki_example` on `webserver`. She needs +to have write permission to the destination directory. + +The working tree repository (`srcdir`): + +- is stored in `~ikiwki_example/src` +- is owned by `ikiwiki_example:ikiwiki_example` +- has permissions 0700 +- has the following origin: `ikiwiki_example@gitserver:ikiwiki_example.git` + +The CGI wrapper is generated with ownership set to +`ikiwiki_example:ikiwiki_example` and permissions `06755`. + +Password-less SSH must be setup so that `ikiwiki_example@webserver` is +allowed to push to the master repository. As told earlier, SSH access +to `ikiwiki_example@gitserver` is restricted to GIT pull/push, which +is just what we need. + +The Git wrapper is generated in `~ikiwiki_example/bin/ikiwiki.update`: + + git_wrapper => '/home/ikiwiki_example/bin/ikiwiki.update' + +As previously explained, this wrapper is run over SSH by the master +repository's post-update hook; it pulls updates from the master +repository and triggers a wiki refresh. -- cgit v1.2.3 From 9f7298d4fe172d54bcdd94ed43e42aee08aecb8f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 19 Oct 2008 18:45:38 -0400 Subject: linked to rcs/git to be in the backlinks --- doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn index 20c6cf1d3..eb1583b08 100644 --- a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn +++ b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn @@ -1,4 +1,4 @@ -One may want to provide ikiwiki hosting with git+ssh access and web +One may want to provide ikiwiki hosting with [[rcs/git]]+ssh access and web server located at different hosts. Here's a description for such a setup, using password-less SSH as a way of communication between these two hosts. -- cgit v1.2.3 From d8e653e6847aa626ca18cb5444f96dbc5325aaae Mon Sep 17 00:00:00 2001 From: "http://xma.myopenid.com/" Date: Sun, 19 Oct 2008 19:20:19 -0400 Subject: Webserver, why ? --- doc/tips/laptop_wiki_with_git/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/laptop_wiki_with_git/discussion.mdwn b/doc/tips/laptop_wiki_with_git/discussion.mdwn index 234833ca7..3f2643a65 100644 --- a/doc/tips/laptop_wiki_with_git/discussion.mdwn +++ b/doc/tips/laptop_wiki_with_git/discussion.mdwn @@ -5,3 +5,5 @@ Or, was this last remark about rebuilding after pulling meant to apply to rebuil [[DavidBremner]] * *Updated* Now that I play with this a bit, this seems not so important. Having a seperate sync operation that I run from the laptop is no big deal, and lets me update the parts of my site not yet managed by ikiwiki at the same time. + +* Ok, I have finally finished to set this up. I have a question for you :) Is it mandatory to have a locally running webserver on the laptop ? I mean, do I need to setup the CGI wrapper on the laptop ? Is it possible to just add/edit/delete/whatever, git commit all the stuff and git push back to the server ? Thank you. --[[xma]] -- cgit v1.2.3 From 3f8eb12b5f3a807ccfcc17fb6dca4788a8284029 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 19 Oct 2008 19:28:25 -0400 Subject: response --- doc/tips/laptop_wiki_with_git/discussion.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/laptop_wiki_with_git/discussion.mdwn b/doc/tips/laptop_wiki_with_git/discussion.mdwn index 3f2643a65..6ce72ae7b 100644 --- a/doc/tips/laptop_wiki_with_git/discussion.mdwn +++ b/doc/tips/laptop_wiki_with_git/discussion.mdwn @@ -7,3 +7,6 @@ Or, was this last remark about rebuilding after pulling meant to apply to rebuil * *Updated* Now that I play with this a bit, this seems not so important. Having a seperate sync operation that I run from the laptop is no big deal, and lets me update the parts of my site not yet managed by ikiwiki at the same time. * Ok, I have finally finished to set this up. I have a question for you :) Is it mandatory to have a locally running webserver on the laptop ? I mean, do I need to setup the CGI wrapper on the laptop ? Is it possible to just add/edit/delete/whatever, git commit all the stuff and git push back to the server ? Thank you. --[[xma]] + +> Of course you don't need a web server on the laptop. It is useful for +> previewing pages before publishing them though. --[[Joey]] -- cgit v1.2.3 From 3d8a6fa447587be7023d24319c5f775919777bad Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 19 Oct 2008 19:47:19 -0400 Subject: fix example --- doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn index eb1583b08..7fb883b10 100644 --- a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn +++ b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn @@ -22,7 +22,7 @@ in `~ikiwki_example/ikiwiki_example.git/hooks/post-update`, is executable and contains: #!/bin/sh - /usr/bin/ssh ikiwiki_amnesia@www bin/ikiwiki.update + /usr/bin/ssh ikiwiki_example@www bin/ikiwiki.update Password-less SSH must be setup to make this possible; one can restrict `gitserver:ikiwiki_example` to be able to run only the needed -- cgit v1.2.3 From 991c1b096b3f21e99352e43e6c2615df9dae1331 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 19 Oct 2008 19:48:14 -0400 Subject: some more example bugfixes --- doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn index 7fb883b10..58940b89f 100644 --- a/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn +++ b/doc/tips/Git_repository_and_web_server_on_different_hosts.mdwn @@ -22,14 +22,14 @@ in `~ikiwki_example/ikiwiki_example.git/hooks/post-update`, is executable and contains: #!/bin/sh - /usr/bin/ssh ikiwiki_example@www bin/ikiwiki.update + /usr/bin/ssh ikiwiki_example@webserver bin/ikiwiki.update Password-less SSH must be setup to make this possible; one can restrict `gitserver:ikiwiki_example` to be able to run only the needed command on the web server, using such a line in `webserver:~ikiwiki_example/.ssh/authorized_keys`: - command="bin/ikiwiki.update",from="vcs.example.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ... + command="bin/ikiwiki.update",from="gitserver.example.com",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ... Web server ========== -- cgit v1.2.3 From 47294262929f6bcb1f25bf25504d53a3b864da43 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 16:55:38 -0400 Subject: pull together info on converting to ikiwiki from other systems --- doc/convert.mdwn | 7 +++++++ doc/index/discussion.mdwn | 4 ++++ doc/plugins/contrib/mediawiki,mdwn | 5 +++++ doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn | 3 +++ doc/tips/convert_mediawiki_to_ikiwiki.mdwn | 4 ++++ 5 files changed, 23 insertions(+) create mode 100644 doc/convert.mdwn create mode 100644 doc/plugins/contrib/mediawiki,mdwn create mode 100644 doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn create mode 100644 doc/tips/convert_mediawiki_to_ikiwiki.mdwn (limited to 'doc/tips') diff --git a/doc/convert.mdwn b/doc/convert.mdwn new file mode 100644 index 000000000..871cd31fe --- /dev/null +++ b/doc/convert.mdwn @@ -0,0 +1,7 @@ +Do you have an existing wiki or blog using other software, and would like +to convert it to ikiwiki? Various tools and techniques have been developed +to handle such conversions. + +* [[tips/convert_mediawiki_to_ikiwiki]] +* [[tips/convert_MoinMoin_and_TWiki_to_ikiwiki]] +* [[tips/convert_blogger_blogs_to_ikiwiki]] diff --git a/doc/index/discussion.mdwn b/doc/index/discussion.mdwn index 89e12e6c2..d52cb0a2d 100644 --- a/doc/index/discussion.mdwn +++ b/doc/index/discussion.mdwn @@ -288,6 +288,10 @@ easily, perl is possible (but I'm not strong in perl). >>> It appears the scripts were never posted? I recently imported my Mediawiki site into Iki. If it helps, my notes are here: --[[sabr]] +>>>>> The scripts have been posted now, see [[joshtriplett]]'s user page, +>>>>> and I've pulled together all ways I can find to [[convert]] other +>>>>> systems into ikiwiki. --[[Joey]] + ---- # LaTeX support? diff --git a/doc/plugins/contrib/mediawiki,mdwn b/doc/plugins/contrib/mediawiki,mdwn new file mode 100644 index 000000000..162937ed9 --- /dev/null +++ b/doc/plugins/contrib/mediawiki,mdwn @@ -0,0 +1,5 @@ +[[!template id=plugin name=sar author="[[sabr]]"]] +[[!tag type/format]] + +[The Mediawiki plugin](http://u32.net/Mediawiki_Plugin/) allows ikiwiki to +process pages written using MediaWiki markup. diff --git a/doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn b/doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn new file mode 100644 index 000000000..5565dbd8a --- /dev/null +++ b/doc/tips/convert_MoinMoin_and_TWiki_to_ikiwiki.mdwn @@ -0,0 +1,3 @@ +[[JoshTriplett]] has developed scripts to convert MoinMoin and TWiki wikis +to ikiwikis backed by a git repository, including full history. For +details, see [[his_user_page|JoshTriplett]]. diff --git a/doc/tips/convert_mediawiki_to_ikiwiki.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki.mdwn new file mode 100644 index 000000000..f03703b46 --- /dev/null +++ b/doc/tips/convert_mediawiki_to_ikiwiki.mdwn @@ -0,0 +1,4 @@ +[[sabr]] explains how to [import MediaWiki content into +git](http://u32.net/Mediawiki_Conversion/index.html?updated), including +full edit hostory. The [[plugins/contrib/mediawiki]] plugin can then be +used by ikiwiki to build the wiki. -- cgit v1.2.3 From 2af90681c713c4b54d1dfb7f1cc94cd8bc78a751 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Oct 2008 20:32:07 -0400 Subject: re-encode to utf-8 I noticed the Fedora package doing this as part of its build. --- doc/tips/vim_syntax_highlighting/ikiwiki.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/vim_syntax_highlighting/ikiwiki.vim b/doc/tips/vim_syntax_highlighting/ikiwiki.vim index fd87f49a2..bbcad4239 100644 --- a/doc/tips/vim_syntax_highlighting/ikiwiki.vim +++ b/doc/tips/vim_syntax_highlighting/ikiwiki.vim @@ -1,6 +1,6 @@ " Vim syntax file " Language: Ikiwiki (links) -" Maintainer: Recai Oktaţ (roktasATdebian.org) +" Maintainer: Recai OktaĹź (roktasATdebian.org) " Last Change: 2007 May 29 " Instructions: -- cgit v1.2.3 From 86ea8adaf3263babd401b7c2d73a1824b99ea908 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Oct 2008 15:47:18 -0400 Subject: new tip on setting up anonymous push --- doc/tips/untrusted_git_push.mdwn | 119 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 doc/tips/untrusted_git_push.mdwn (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push.mdwn b/doc/tips/untrusted_git_push.mdwn new file mode 100644 index 000000000..48024566b --- /dev/null +++ b/doc/tips/untrusted_git_push.mdwn @@ -0,0 +1,119 @@ +This tip will describe how to allow anyone on the planet to `git push` +changes into your wiki, without needing a special account. All a user needs +to know is: + + git clone git://your.wiki/path + # now modify any of the files the wiki would let you modify on the web + git push + +This is a wonderful thing to set up for users, because then they can work +on the wiki while offline, and they don't need to mess around with web +browsers. + +## security + +But, you might be wondering, how can this possibly be secure. Won't users +upload all sorts of garbage, change pages you don't want them to edit, and so +on. + +The key to making it secure is configuring ikiwiki to run as your git +repository's `pre-receive` hook. There it will examine every change that +untrusted users push into the wiki, and reject pushes that contain changes +that cannot be made using the web interface. + +So, unless you have the [[ikiwiki/plugin/attachment]] plugin turned on, +non-page files cannot be added. And if it's turned on, whatever +`allowed_attachments` checks you have configured will also check files +pushed into git. + +And, unless you have the [[ikiwiki/plugin/remove]] plugin turned on, no +files can be deleted. + +And if you have `locked_pages` configured, then it will also affect what's +pushed into git. + +Untrusted committers will also not be able to upload files with strange +modes, or push to any branch except for the configured `gitorigin_branch`, +or manipulate tags. + +One thing to keep an eye on is uploading large files. It may be easier to +do this via git push than using the web, and that could be abused. + +## user setup + +Add a dedicated user who will push in untrusted commits. This user should have +a locked password, and `git-shell` as its shell. + + root@bluebird:/home/joey>adduser --shell=/usr/bin/git-shell--disabled-password anon + Adding user `anon' ... + +## ikiwiki setup + +You should set up ikiwiki before turning on anonymous push in git. + +Edit your wiki's setup file, and uncomment the lines for +`git_test_receive_wrapper` and `untrusted_committers`. + + # git pre-receive hook to generate + git_test_receive_wrapper => '/srv/git/ikiwiki.info/.git/hooks/pre-receive', + # unix users whose commits should be checked by the pre-receive hook + untrusted_committers => ['anon'], + +The `git_test_receive_wrapper` will become the git `pre-receive` hook. The +`untrusted_committers` list is the list of unix users who will be pushing in +untrusted changes. It should *not* include the user that ikiwiki normally runs +as. + +Once you're done modifying the setup file, don't forget to run +`ikiwiki -setup --refresh --wrappers` on it. + +## git setup + +You'll need to arrange the permissions on your bare git repository so that +user anon can write to it. One way to do it is to create a group, and put +both anon and your regular user in that group. Then make make the bare git +repository owned and writable by the group. See [[rcs/git]] for some more +tips on setting up a git repository with multiple committers. + +Note that anon should *not* be able to write to the `srcdir`, *only* to the bare git +repository for your wiki. + +If you want to allow git over `ssh`, generate a ssh key for anon, and +publish the *private* key for other people to use. This is optional; you +can use `git-daemon` instead and not worry about keys. + +Now set up `git-daemon`. It will need to run as user `anon`, and be +configured to export your wiki's bare git repository. I set it up as +follows in `/etc/inetd.conf`, and ran `/etc/init.d/openbsd-inetd restart`. + + git stream tcp nowait anon /usr/bin/git-daemon git-daemon --inetd --export-all --interpolated-path=/srv/git/%H%D /srv/git + +At this point you should be able to `git clone git://your.wiki/path` from +anywhere, and check out the source to your wiki. But you won't be able to +push to it yet, one more change is needed to turn that on. Edit the +`config` file of your bare git repository, and allow `git-daemon` to +receive pushes: + + [daemon] + receivepack = true + +Now pushes should be accepted, and your wiki immediatly be updated. If it +doesn't, check your git repo's permissions, and make sure that the +`post-update` and `pre-receive` hooks are suid so they run as the user who +owns the `srcdir`. + +## infelicities + +If a user tries to push a changeset that ikiwiki doesn't like, it will +abort the push before refs are updated. However, the changeset will still +be present in your repository, wasting space. Since nothing refers to it, +it will be expired eventually. You can speed up the expiry by running `git +prune`. + +When aborting a push, ikiwiki displays an error message about why it didn't +accept it. If using git over ssh, the user will see this error message, +which is probably useful to them. But `git-daemon` is buggy, and hides this +message from the user. This can make it hard for users to figure out why +their push was rejected. (If this happens to you, look at "'git log --stat +origin/master..`" and think about whether your changes would be accepted +over the web interface.) -- cgit v1.2.3 From 0538498ed05f4abf3cb5102c299392d4b4c0086d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Oct 2008 16:21:22 -0400 Subject: links --- doc/tips/untrusted_git_push.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push.mdwn b/doc/tips/untrusted_git_push.mdwn index 48024566b..958e04e77 100644 --- a/doc/tips/untrusted_git_push.mdwn +++ b/doc/tips/untrusted_git_push.mdwn @@ -21,12 +21,12 @@ repository's `pre-receive` hook. There it will examine every change that untrusted users push into the wiki, and reject pushes that contain changes that cannot be made using the web interface. -So, unless you have the [[ikiwiki/plugin/attachment]] plugin turned on, +So, unless you have the [[plugins/attachment]] plugin turned on, non-page files cannot be added. And if it's turned on, whatever `allowed_attachments` checks you have configured will also check files pushed into git. -And, unless you have the [[ikiwiki/plugin/remove]] plugin turned on, no +And, unless you have the [[plugins/remove]] plugin turned on, no files can be deleted. And if you have `locked_pages` configured, then it will also affect what's -- cgit v1.2.3 From 8b1313825c7316fccc0f098f8669c3f74df3df28 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 24 Oct 2008 16:31:51 -0400 Subject: note about spoofing --- doc/tips/untrusted_git_push.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push.mdwn b/doc/tips/untrusted_git_push.mdwn index 958e04e77..b7dba74c6 100644 --- a/doc/tips/untrusted_git_push.mdwn +++ b/doc/tips/untrusted_git_push.mdwn @@ -39,6 +39,9 @@ or manipulate tags. One thing to keep an eye on is uploading large files. It may be easier to do this via git push than using the web, and that could be abused. +Also, no checking is done that the authors of commits are right, so people +can make a commit that pretends to be done by someone else. + ## user setup Add a dedicated user who will push in untrusted commits. This user should have -- cgit v1.2.3 From 62d25b61f99796d85ad1dde016cb446594bcbb3a Mon Sep 17 00:00:00 2001 From: Jason Blevins Date: Fri, 24 Oct 2008 17:11:11 -0400 Subject: Fix typo --- doc/tips/untrusted_git_push.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push.mdwn b/doc/tips/untrusted_git_push.mdwn index b7dba74c6..aef67a3db 100644 --- a/doc/tips/untrusted_git_push.mdwn +++ b/doc/tips/untrusted_git_push.mdwn @@ -47,7 +47,7 @@ can make a commit that pretends to be done by someone else. Add a dedicated user who will push in untrusted commits. This user should have a locked password, and `git-shell` as its shell. - root@bluebird:/home/joey>adduser --shell=/usr/bin/git-shell--disabled-password anon + root@bluebird:/home/joey>adduser --shell=/usr/bin/git-shell --disabled-password anon Adding user `anon' ... ## ikiwiki setup -- cgit v1.2.3 From 4287a0206953b96711138d29d4c783922a56deff Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 10 Nov 2008 13:19:22 -0500 Subject: reorganize vim syntax highlighting info There was already a tip about it; move the plasticboy version to there. --- doc/ikiwiki/markdown.mdwn | 3 +-- doc/tips/vim_syntax_highlighting/discussion.mdwn | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'doc/tips') diff --git a/doc/ikiwiki/markdown.mdwn b/doc/ikiwiki/markdown.mdwn index 3bebaef65..94864c489 100644 --- a/doc/ikiwiki/markdown.mdwn +++ b/doc/ikiwiki/markdown.mdwn @@ -6,8 +6,7 @@ email messages. It is the markup language used by this wiki by default. For documentation about the markdown syntax, see [[formatting]] and [Markdown: syntax](http://daringfireball.net/projects/markdown/syntax). A [markdown mode](http://jblevins.org/projects/markdown-mode/) for -emacs can help in editing, as can this -[syntax file](http://plasticboy.com/markdown-vim-mode/) for vim. +emacs can help in editing, as can the [[vim_syntax_highlighting]] file. Note that [[WikiLinks|WikiLink]] and [[directives|directive]] are not part of the markdown syntax, and are the only bit of markup that this wiki diff --git a/doc/tips/vim_syntax_highlighting/discussion.mdwn b/doc/tips/vim_syntax_highlighting/discussion.mdwn index b1637e758..038854b9f 100644 --- a/doc/tips/vim_syntax_highlighting/discussion.mdwn +++ b/doc/tips/vim_syntax_highlighting/discussion.mdwn @@ -1 +1,8 @@ I'm going to look at merging this with potwiki.vim (a vim-based personal wiki) so that you can follow wiki-links and auto-create pages etc., direct from vim. (I'm writing this incase I don't get around to it) -- [[JonDowland]] + +---- + +Another attempt at the same thing is here: + + +In my tests, [[ikiwiki.vim]] works better than that one, YMMV. --[[Joey]] -- cgit v1.2.3 From d5853f3e33f70ac82c8a77519a4e1c4781da83eb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 10 Nov 2008 17:40:03 -0500 Subject: reorg to avoid broken link in basewiki ikiwiki/markdown is a basewiki page and shouldn't link to pages in tips. Instead, make the tips link to it, so backlinks will point back to them. While I'm at it, move the info about the emacs mode to a tip. --- doc/ikiwiki/markdown.mdwn | 4 +--- doc/tips/emacs_syntax_highlighting.mdwn | 3 +++ doc/tips/vim_syntax_highlighting.mdwn | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 doc/tips/emacs_syntax_highlighting.mdwn (limited to 'doc/tips') diff --git a/doc/ikiwiki/markdown.mdwn b/doc/ikiwiki/markdown.mdwn index 94864c489..684191929 100644 --- a/doc/ikiwiki/markdown.mdwn +++ b/doc/ikiwiki/markdown.mdwn @@ -4,9 +4,7 @@ is a minimal markup language that resembles plain text as used in email messages. It is the markup language used by this wiki by default. For documentation about the markdown syntax, see [[formatting]] and -[Markdown: syntax](http://daringfireball.net/projects/markdown/syntax). A -[markdown mode](http://jblevins.org/projects/markdown-mode/) for -emacs can help in editing, as can the [[vim_syntax_highlighting]] file. +[Markdown: syntax](http://daringfireball.net/projects/markdown/syntax). Note that [[WikiLinks|WikiLink]] and [[directives|directive]] are not part of the markdown syntax, and are the only bit of markup that this wiki diff --git a/doc/tips/emacs_syntax_highlighting.mdwn b/doc/tips/emacs_syntax_highlighting.mdwn new file mode 100644 index 000000000..941cf5415 --- /dev/null +++ b/doc/tips/emacs_syntax_highlighting.mdwn @@ -0,0 +1,3 @@ +A [markdown mode](http://jblevins.org/projects/markdown-mode/) for +emacs can help in editing of ikiwiki +[[ikiwiki/markdown]] files. diff --git a/doc/tips/vim_syntax_highlighting.mdwn b/doc/tips/vim_syntax_highlighting.mdwn index 453efa8d1..172b763c3 100644 --- a/doc/tips/vim_syntax_highlighting.mdwn +++ b/doc/tips/vim_syntax_highlighting.mdwn @@ -1,2 +1,4 @@ -[[ikiwiki.vim]] is a vim syntax highlighting file for ikiwiki. Installation -instructions are at the top of the file. +[[ikiwiki.vim]] is a vim syntax highlighting file for ikiwiki +[[ikiwiki/markdown]] files. + +Installation instructions are at the top of the file. -- cgit v1.2.3 From 91315207cf288b581ff0654225f5ebd111240ea2 Mon Sep 17 00:00:00 2001 From: "http://alcopop.org/me/openid/" Date: Mon, 10 Nov 2008 18:30:08 -0500 Subject: specifying the user in recentchanges for anon git pushes --- doc/tips/untrusted_git_push/discussion.mdwn | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 doc/tips/untrusted_git_push/discussion.mdwn (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push/discussion.mdwn b/doc/tips/untrusted_git_push/discussion.mdwn new file mode 100644 index 000000000..0c9bd679f --- /dev/null +++ b/doc/tips/untrusted_git_push/discussion.mdwn @@ -0,0 +1,23 @@ +I've just tried this (commit c1fa07a). Recent changes shows: + + + +Note that the user for the commit is 'jon', and the link points at cgi to create users/jon. I was wondering if that is configurable for users pushing via git. It would be nice perhaps to specify it in some way, perhaps via a git-config setting (user.name?). I'm not too familiar with exactly what the changeset contains. -- [[JonDowland]] -- cgit v1.2.3 From f28069a05c063c8583b207333a14ed353874d89c Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Mon, 10 Nov 2008 23:34:09 +0000 Subject: add discussion on this tip --- doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn (limited to 'doc/tips') diff --git a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn new file mode 100644 index 000000000..6e5f1668a --- /dev/null +++ b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn @@ -0,0 +1,14 @@ +The u32 page is excellent, but I wonder if documenting the procedure here +would be worthwhile. Who knows, the remote site might disappear. But also +there are some variations on the approach that might be useful: + + * using a python script and the dom library to extract the page names from + Special:Allpages (such as + ) + * Or, querying the mysql back-end to get the names + * using WWW::MediaWiki for importing/exporting pages from the wiki, instead + of Special::Export + +Also, some detail on converting mediawiki transclusion to ikiwiki inlines... + +-- [[JonDowland]] -- cgit v1.2.3 From 183270a8453c0f504578f0c6b9ad72c6eb5bcc6a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 10 Nov 2008 18:34:35 -0500 Subject: response --- doc/tips/untrusted_git_push/discussion.mdwn | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push/discussion.mdwn b/doc/tips/untrusted_git_push/discussion.mdwn index 0c9bd679f..d433d61d4 100644 --- a/doc/tips/untrusted_git_push/discussion.mdwn +++ b/doc/tips/untrusted_git_push/discussion.mdwn @@ -20,4 +20,12 @@ I've just tried this (commit c1fa07a). Recent changes shows: 18:24:22 11/10/08 -Note that the user for the commit is 'jon', and the link points at cgi to create users/jon. I was wondering if that is configurable for users pushing via git. It would be nice perhaps to specify it in some way, perhaps via a git-config setting (user.name?). I'm not too familiar with exactly what the changeset contains. -- [[JonDowland]] +Note that the user for the commit is 'jon', and the link points at cgi to +create users/jon. I was wondering if that is configurable for users pushing +via git. It would be nice perhaps to specify it in some way, perhaps via a +git-config setting (user.name?). I'm not too familiar with exactly what the +changeset contains. -- [[JonDowland]] + +> All ikiwiki can do it look at who git has recorded as the author of +> the change (and it looks at the username part of the email address). +> You can set `user.email` in `.git/config`. --[[Joey]] -- cgit v1.2.3 From 17731892ec458ee6b1b68ce62bf30ad129c87e79 Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Mon, 10 Nov 2008 23:38:45 +0000 Subject: reply --- doc/tips/untrusted_git_push/discussion.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push/discussion.mdwn b/doc/tips/untrusted_git_push/discussion.mdwn index d433d61d4..e85625a1b 100644 --- a/doc/tips/untrusted_git_push/discussion.mdwn +++ b/doc/tips/untrusted_git_push/discussion.mdwn @@ -29,3 +29,5 @@ changeset contains. -- [[JonDowland]] > All ikiwiki can do it look at who git has recorded as the author of > the change (and it looks at the username part of the email address). > You can set `user.email` in `.git/config`. --[[Joey]] + +> > Ah, excellent. In which case this *should* DTRT... -- [[JonDowland]] -- cgit v1.2.3 From 2ab3132d3b88afa4b23dec3bf2a38f185e7f2fed Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 11 Nov 2008 21:01:16 -0500 Subject: document other files in .ikiwiki --- doc/tips/inside_dot_ikiwiki.mdwn | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/inside_dot_ikiwiki.mdwn b/doc/tips/inside_dot_ikiwiki.mdwn index b649636dc..1f76ce4bd 100644 --- a/doc/tips/inside_dot_ikiwiki.mdwn +++ b/doc/tips/inside_dot_ikiwiki.mdwn @@ -63,3 +63,28 @@ To remove that user: I've not written actual utilities to do this yet because I've only needed to do it rarely, and the data I've wanted has been different each time. --[[Joey]] + +## the session database + +`.ikiwiki/sessions.db` is the session database. See the [[cpan CGI::Session]] +documentation for more details. + +## lockfiles + +In case you're curious, here's what the various lock files do. + +* `.ikiwiki/lockfile` is the master ikiwiki lock file. Ikiwiki takes this + lock before reading/writing state. +* `.ikiwiki/commitlock` is locked as a semophore, to disable the commit hook + from doing anything. +* `.ikiwiki/cgilock` is locked by the cgi wrapper, to ensure that only + one ikiwiki process is run at a time to handle cgi requests. + +## plugin state files + +Some plugins create other files to store their state. + +* `.ikiwiki/aggregate` is a plain text database used by the aggregate plugin + to record feeds and known posts. +* `.ikiwiki/xapian/` is created by the search plugin, and contains xapian-omega + configuration and the xapian database. -- cgit v1.2.3 From 1a0147b6b35ae57db9b0e4f4db49e0af24f77a65 Mon Sep 17 00:00:00 2001 From: Blanko Date: Tue, 2 Dec 2008 08:21:02 -0500 Subject: --- doc/tips/inside_dot_ikiwiki/discussion.mdwn | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/inside_dot_ikiwiki/discussion.mdwn b/doc/tips/inside_dot_ikiwiki/discussion.mdwn index c05e7a3e0..8ff3ad552 100644 --- a/doc/tips/inside_dot_ikiwiki/discussion.mdwn +++ b/doc/tips/inside_dot_ikiwiki/discussion.mdwn @@ -16,3 +16,47 @@ No idea how this happened. I've blown it away and recreated it but, for future >>> --getctime does. --[[Joey]] >> Alas, I seem to have lost the bad index file to periodic /tmp wiping; I'll send it to you if it happens again. --[[sabr]] + + + +## Lost password for an user + +This morning, a person has lost its password. I was able to do something to make another password. This is the way I take : + +### Locate the user database + +As tips show us, the user database is in the source file, for an example : + + src/.ikiwiki/userdb + +### See which user to modify + +Because I don't know the real login of the user, I have to read all the database : + + perl -le 'use Storable; my $index=Storable::retrieve("userdb"); use Data::Dumper; print Dumper $index' + +Then I was able to find this : + + 'Utilisateur' => { + 'email' => 'user@pl.fr', + 'cryptresettoken' => '$2a$10$cfVeOoVbFw9VzMlgEbPMsu34pwHIFP84mWlkrs2RCKknZYPZkPffm', + 'password' => '', + 'resettoken' => '', + 'cryptpassword' => '$2a$10$H8bYq.dlb68wpnfJgVZQhOdsF9JQ06cteRfhPQPB5eHKnD5Y3u7au', + 'regdate' => '1226574052' + }, + +Let's have a look to modify lines. + +### Modify the line + +When you have found the line to modify, take the user name, and change its password to **sc** (for an example) : + + perl -le 'use Storable; my $userinfo=Storable::retrieve("userdb"); $userinfo->{"Utilisateur"}->{cryptpassword}=q{$2a$10$7viOHCrUkdAVL135Kr6one1mpZQ/FWYC773G1yZ0EtQciI11sSDRS}; Storable::lock_nstore($userinfo, "userdb")' + perl -le 'use Storable; my $userinfo=Storable::retrieve("userdb"); $userinfo->{"Utilisateur"}->{cryptresettoken}=q{}; Storable::lock_nstore($userinfo, "userdb")' + +Because I don't know how suppress cryptresettoken and resettoken fields, I change their content with *null*. + +After all these modifications, the user *Utilisateur* could connect to its account with the password **sc**, and go to Preferences, then change its password. + + -- cgit v1.2.3 From d3984de8a113a28c7806cdfe82c470a22c20dda4 Mon Sep 17 00:00:00 2001 From: "http://alcopop.org/me/openid/" Date: Tue, 2 Dec 2008 10:00:27 -0500 Subject: update for rename of users/jondowland.mdwn to users/jon.mdwn --- doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn index 6e5f1668a..cde761a44 100644 --- a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn +++ b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn @@ -11,4 +11,4 @@ there are some variations on the approach that might be useful: Also, some detail on converting mediawiki transclusion to ikiwiki inlines... --- [[JonDowland]] +-- [[users/Jon]] -- cgit v1.2.3 From 157f1842622c0094d1d4625725194feee1b46129 Mon Sep 17 00:00:00 2001 From: "http://alcopop.org/me/openid/" Date: Tue, 2 Dec 2008 10:00:28 -0500 Subject: update for rename of users/jondowland.mdwn to users/jon.mdwn --- doc/tips/untrusted_git_push/discussion.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/untrusted_git_push/discussion.mdwn b/doc/tips/untrusted_git_push/discussion.mdwn index e85625a1b..d95c01ecf 100644 --- a/doc/tips/untrusted_git_push/discussion.mdwn +++ b/doc/tips/untrusted_git_push/discussion.mdwn @@ -24,10 +24,10 @@ Note that the user for the commit is 'jon', and the link points at cgi to create users/jon. I was wondering if that is configurable for users pushing via git. It would be nice perhaps to specify it in some way, perhaps via a git-config setting (user.name?). I'm not too familiar with exactly what the -changeset contains. -- [[JonDowland]] +changeset contains. -- [[users/Jon]] > All ikiwiki can do it look at who git has recorded as the author of > the change (and it looks at the username part of the email address). > You can set `user.email` in `.git/config`. --[[Joey]] -> > Ah, excellent. In which case this *should* DTRT... -- [[JonDowland]] +> > Ah, excellent. In which case this *should* DTRT... -- [[users/Jon]] -- cgit v1.2.3 From 3cf1e3931d6a486dc25d83496c5d88e7760f86f5 Mon Sep 17 00:00:00 2001 From: "http://alcopop.org/me/openid/" Date: Tue, 2 Dec 2008 10:00:36 -0500 Subject: update for rename of users/jondowland.mdwn to users/jon.mdwn --- doc/tips/vim_syntax_highlighting/discussion.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/vim_syntax_highlighting/discussion.mdwn b/doc/tips/vim_syntax_highlighting/discussion.mdwn index 038854b9f..72cb52aab 100644 --- a/doc/tips/vim_syntax_highlighting/discussion.mdwn +++ b/doc/tips/vim_syntax_highlighting/discussion.mdwn @@ -1,4 +1,4 @@ -I'm going to look at merging this with potwiki.vim (a vim-based personal wiki) so that you can follow wiki-links and auto-create pages etc., direct from vim. (I'm writing this incase I don't get around to it) -- [[JonDowland]] +I'm going to look at merging this with potwiki.vim (a vim-based personal wiki) so that you can follow wiki-links and auto-create pages etc., direct from vim. (I'm writing this incase I don't get around to it) -- [[users/Jon]] ---- -- cgit v1.2.3 From 6e9ec937fadd1b12d13f2fb4a5c7fea20ab4bb13 Mon Sep 17 00:00:00 2001 From: Jon Dowland Date: Tue, 2 Dec 2008 15:02:24 +0000 Subject: u32.net disappeared --- doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn index cde761a44..0a332f8ba 100644 --- a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn +++ b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn @@ -12,3 +12,6 @@ there are some variations on the approach that might be useful: Also, some detail on converting mediawiki transclusion to ikiwiki inlines... -- [[users/Jon]] + +> "Who knows, the remote site might disappear.". Right now, it appears to +> have done just that. -- [[users/Jon]] -- cgit v1.2.3 From fa130859dc6d2f6912b68d353f68d330893d014b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 3 Dec 2008 15:37:48 -0500 Subject: response --- doc/tips/inside_dot_ikiwiki/discussion.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/inside_dot_ikiwiki/discussion.mdwn b/doc/tips/inside_dot_ikiwiki/discussion.mdwn index 8ff3ad552..34d5b9252 100644 --- a/doc/tips/inside_dot_ikiwiki/discussion.mdwn +++ b/doc/tips/inside_dot_ikiwiki/discussion.mdwn @@ -23,6 +23,9 @@ No idea how this happened. I've blown it away and recreated it but, for future This morning, a person has lost its password. I was able to do something to make another password. This is the way I take : +> You can certianly do that, but do note that ikiwiki will offer to mail a +> user a password reset link if they lost their password. --[[Joey]] + ### Locate the user database As tips show us, the user database is in the source file, for an example : -- cgit v1.2.3 From d7855474fdf6002711ef3d0411ece375ce44015d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 18 Dec 2008 20:20:42 -0500 Subject: document how to make a global comments feed --- doc/tips/comments_feed.mdwn | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doc/tips/comments_feed.mdwn (limited to 'doc/tips') diff --git a/doc/tips/comments_feed.mdwn b/doc/tips/comments_feed.mdwn new file mode 100644 index 000000000..68513901e --- /dev/null +++ b/doc/tips/comments_feed.mdwn @@ -0,0 +1,10 @@ +You've enabled the [[plugins/comments]] plugin, so a set of pages on your +blog can have comments added to them. Pages with comments even have special +feeds that can be used to subscribe to those comments. But you'd like to +add a feed that contains all the comments posted to any page. Here's how: + + \[[!inline pages="internal(*/comment_*)" template=comments_display]] + +The special [[ikiwiki/PageSpec]] matches all comments. The +[[template|wikitemplates]] causes the comments to be displayed formatted +nicely. -- cgit v1.2.3 From ddabb010b2c45556046fd1ba982893395c7a46f6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 19 Dec 2008 14:03:26 -0500 Subject: rename comments_display to comment --- IkiWiki/Plugin/comments.pm | 4 ++-- doc/tips/comments_feed.mdwn | 2 +- doc/todo/comments.mdwn | 2 +- doc/wikitemplates.mdwn | 2 +- templates/comment.tmpl | 36 ++++++++++++++++++++++++++++++++++++ templates/comments_display.tmpl | 36 ------------------------------------ 6 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 templates/comment.tmpl delete mode 100644 templates/comments_display.tmpl (limited to 'doc/tips') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index fd9f0acb4..705ba340b 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -447,7 +447,7 @@ sub sessioncgi ($$) { content => $preview); }); - my $template = template("comments_display.tmpl"); + my $template = template("comment.tmpl"); $template->param(content => $preview); $template->param(title => $form->field('subject')); $template->param(ctime => displaytime(time)); @@ -538,7 +538,7 @@ sub pagetemplate (@) { if ($shown) { $comments = IkiWiki::preprocess_inline( pages => "internal($page/$config{comments_pagename}*)", - template => 'comments_display', + template => 'comment', show => 0, reverse => 'yes', page => $page, diff --git a/doc/tips/comments_feed.mdwn b/doc/tips/comments_feed.mdwn index 68513901e..6f8137256 100644 --- a/doc/tips/comments_feed.mdwn +++ b/doc/tips/comments_feed.mdwn @@ -3,7 +3,7 @@ blog can have comments added to them. Pages with comments even have special feeds that can be used to subscribe to those comments. But you'd like to add a feed that contains all the comments posted to any page. Here's how: - \[[!inline pages="internal(*/comment_*)" template=comments_display]] + \[[!inline pages="internal(*/comment_*)" template=comment]] The special [[ikiwiki/PageSpec]] matches all comments. The [[template|wikitemplates]] causes the comments to be displayed formatted diff --git a/doc/todo/comments.mdwn b/doc/todo/comments.mdwn index 2bcec69ba..ee2ba7ea0 100644 --- a/doc/todo/comments.mdwn +++ b/doc/todo/comments.mdwn @@ -46,7 +46,7 @@ Known issues with the [[plugins/comments]] plugin: > a good feature to have, though. --[[smcv]] * One can use inline to set up a feed of all comments posted to any page. - Using template=comments_display they are displayed right. Only problem + Using template=comment they are displayed right. Only problem is there is no indication in that template of what page each comment in the feed is a comment on. So, if a comment is inlined into a different page, I think it should show a link back to the page commented on. diff --git a/doc/wikitemplates.mdwn b/doc/wikitemplates.mdwn index 6fb4d5f49..63735193b 100644 --- a/doc/wikitemplates.mdwn +++ b/doc/wikitemplates.mdwn @@ -29,7 +29,7 @@ located in /usr/share/ikiwiki/templates by default. form to wiki pages. * `searchquery.tmpl` - This is an omega template, used by the [[plugins/search]] plugin. -* `comments_display.tmpl` - This template is used to display a comment +* `comment.tmpl` - This template is used to display a comment by the [[plugins/comments]] plugin. * `comments_form.tmpl` - This template is the comment post form for the [[plugins/comments]] plugin. diff --git a/templates/comment.tmpl b/templates/comment.tmpl new file mode 100644 index 000000000..e7e283bbf --- /dev/null +++ b/templates/comment.tmpl @@ -0,0 +1,36 @@ +
+ +
+Posted by + + + + + + + + + + + + + + +unknown IP address + + + +() + + + +() +
+ +
+ +
+ +
+ +
diff --git a/templates/comments_display.tmpl b/templates/comments_display.tmpl deleted file mode 100644 index e7e283bbf..000000000 --- a/templates/comments_display.tmpl +++ /dev/null @@ -1,36 +0,0 @@ -
- -
-Posted by - - - - - - - - - - - - - - -unknown IP address - - - -() - - - -() -
- -
- -
- -
- -
-- cgit v1.2.3 From 3d7d29791ea5ede8838fc53a5cb17a88b2c8f6c3 Mon Sep 17 00:00:00 2001 From: "http://weakish.int.eu.org/" Date: Sat, 20 Dec 2008 04:18:56 -0500 Subject: vimperator can do this, too. --- doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn b/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn index d696bacdb..1c9ecdc8c 100644 --- a/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn +++ b/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn @@ -4,3 +4,5 @@ you to use a real text editor like Emacs or Vim to edit the contents of text areas. This allows you to edit ikiwiki pages with a real text editor through the ikiwiki web interface, rather than only with direct commit access. --[[JoshTriplett]] + +For Firefox or Iceweasel users, the vimperator extension is also a good idea. You can press Ctrl-I in the insert mode of vimperator and switch to an external editor, e.g. Vim. --[[WeakishJiang]] -- cgit v1.2.3 From 39e5de4e336d261cd370b24395f6a25f585b0a2e Mon Sep 17 00:00:00 2001 From: brush Date: Sat, 20 Dec 2008 05:56:04 -0500 Subject: added details on cgi wrapper creation --- doc/tips/DreamHost.mdwn | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/DreamHost.mdwn b/doc/tips/DreamHost.mdwn index 6670f8090..7e483962a 100644 --- a/doc/tips/DreamHost.mdwn +++ b/doc/tips/DreamHost.mdwn @@ -150,6 +150,8 @@ Next, add your installed Perl module directory to the *libdir* parameter. It sh libdir => "/home/.server/user/site/perl/lib/perl5/", # CGI Wrapper +The CGI wrapper file will be created automatically by "ikiwiki --setup path/to/setup", as long as you have inserted a valid filename to be created. On DreamHost, be careful about putting the ikiwiki.cgi file in a directory that has different owner/group than the file itself (such as the main site.domain.tld/ directory): this will cause suexec to fail. + The wrapper mode of "06755" doesn't seem to work. "755" appears to. However, this may be completely insecure and/or buggy, so if you know better than I, edit this doc and add it here. # Pre-created SVN repository -- cgit v1.2.3 From 4176c3483ddd3a12d57676c5ed6dfcc49796fbc0 Mon Sep 17 00:00:00 2001 From: brush Date: Sat, 20 Dec 2008 05:58:00 -0500 Subject: minor edits --- doc/tips/DreamHost.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/DreamHost.mdwn b/doc/tips/DreamHost.mdwn index 7e483962a..070638e3e 100644 --- a/doc/tips/DreamHost.mdwn +++ b/doc/tips/DreamHost.mdwn @@ -150,7 +150,7 @@ Next, add your installed Perl module directory to the *libdir* parameter. It sh libdir => "/home/.server/user/site/perl/lib/perl5/", # CGI Wrapper -The CGI wrapper file will be created automatically by "ikiwiki --setup path/to/setup", as long as you have inserted a valid filename to be created. On DreamHost, be careful about putting the ikiwiki.cgi file in a directory that has different owner/group than the file itself (such as the main site.domain.tld/ directory): this will cause suexec to fail. +The CGI wrapper file will be created automatically by "ikiwiki --setup path/to/setup", as long as you have inserted a valid filename to be created into the setup file. On DreamHost, be careful not to put the ikiwiki.cgi file in a directory that has different owner/group than the file itself (such as the main site.domain.tld/ directory): this will cause suexec to fail. The wrapper mode of "06755" doesn't seem to work. "755" appears to. However, this may be completely insecure and/or buggy, so if you know better than I, edit this doc and add it here. -- cgit v1.2.3 From 6828cd84a118e647b617d7fb2ef437587d83bd16 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 20 Dec 2008 11:04:45 -0500 Subject: note --- doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn b/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn index 1c9ecdc8c..cf9327395 100644 --- a/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn +++ b/doc/tips/using_the_web_interface_with_a_real_text_editor.mdwn @@ -5,4 +5,9 @@ areas. This allows you to edit ikiwiki pages with a real text editor through the ikiwiki web interface, rather than only with direct commit access. --[[JoshTriplett]] -For Firefox or Iceweasel users, the vimperator extension is also a good idea. You can press Ctrl-I in the insert mode of vimperator and switch to an external editor, e.g. Vim. --[[WeakishJiang]] +For Firefox or Iceweasel users, the vimperator extension is also a good +idea. You can press Ctrl-I in the insert mode of vimperator and switch to +an external editor, e.g. Vim. --[[WeakishJiang]] + +Finally, with wikis configured to allow, [[untrusted_git_push]], you can +ditch the browser altogether. --[[Joey]] -- cgit v1.2.3 From db7983c846097d3ad1929250600872139e45bb78 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 16:20:37 -0500 Subject: beginning docs for 3.0 --- debian/NEWS | 9 ++++++ doc/roadmap.mdwn | 23 +++++++------- doc/tips/upgrade_to_3.0.mdwn | 72 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+), 12 deletions(-) create mode 100644 doc/tips/upgrade_to_3.0.mdwn (limited to 'doc/tips') diff --git a/debian/NEWS b/debian/NEWS index a7a145d9b..1c9763d1a 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,12 @@ +ikiwiki (3.0) unstable; urgency=low + + The 3.0 release of ikiwiki changes several defaults and makes + some transitions. You will need to modify your wikis to work with + ikiwiki 3.0. A document explaining the process is available + in + + -- Joey Hess Tue, 23 Dec 2008 16:14:18 -0500 + ikiwiki (2.62) unstable; urgency=low TexImg standard preamble changed diff --git a/doc/roadmap.mdwn b/doc/roadmap.mdwn index 9ed5742eb..c85c6de5b 100644 --- a/doc/roadmap.mdwn +++ b/doc/roadmap.mdwn @@ -7,10 +7,7 @@ This is the roadmap for ikiwiki development. Released 29 April 2006. -The 1.x series changed a great deal over the more than 50 releases in its -lifetime. It is now in maintenance mode, only security issues or really bad -bugs will be fixed in 1.x going forward. 1.x will stop being supported with -the release of 3.0. +The 1.x series is no longer supported. ---- @@ -32,20 +29,18 @@ the release of 3.0. Released 30 April 2007. -The 2.x series is expected to undergo continuing development for some time, -adding improvements and new features, but avoiding changes that break -backwards compatability. +The 2.x series is now in maintenance mode. Only security fixes and fixes for +really bad bugs will be applied going forward. ---- # 3.0 -Version 3.0 will be an opportunity to make significant transitions. +Version 3.0 is an opportunity to make significant transitions, and also adds +many new features. -* Default to using `prefix_directives`. -* Default to using `aggregateinternal`. -* Remove deprecated prefs form settings for `allowed_attachments` and - `locked_pages`. +* See [[tips/upgrade_to_3.0]] for the steps you will need to follow + when upgrading to this version. * Finalise a new version of the plugin API, exporting additional commonly used functions from IkiWiki.pm. See [[todo/firm_up_plugin_interface]] @@ -54,6 +49,10 @@ improvements, far too many to list here. Release is planned for fall^Wlate, 2008. +The 3.x series is expected to undergo continuing development for some time, +adding improvements and new features, but avoiding changes that break +backwards compatability. + ---- # future goals diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn new file mode 100644 index 000000000..6c74d4fc9 --- /dev/null +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -0,0 +1,72 @@ +Version 3.0 of ikiwiki makes some significant configuration changes, which +you will need to deal with when upgrading from ikiwiki 2.x. + +[[!toc ]] + +# moving settings from Preferences page + +The admin preferences page used to have settings for allowed attachments, +locked pages, and banned users. These three settings have moved to the +setup file: + + allowed_attachments => "", + locked_pages => "", + banned_users => "", + +If you have not yet upgraded to ikiwiki 3.0, you can look at the admin +preferences page to see if any of these values is shown there, and copy +them into the setup file. + +## setup file format change + +The layout of the setup file changed in a significant way in version 2.60 +of ikiwiki. If you have not changed yours to the new format, now would be a +good time to do so. Some new features, like the [[plugins/websetup]] interface, +need the new format setup file. + +You can convert old setup files into the new format by running +`ikiwiki-transition setupformat your.setup` + +## prefix directives + +In 3.0, the syntax ikiwiki uses for [[directives|ikiwiki/directive]] has +changed, requiring that the directive start with a bang: + + \[[!directive ...]] + +If you would like to keep the old syntax, it is still supported, add the +following to your setup file: + + prefix_directives => 0, + +But it's not hard to convert your wiki to the new syntax. You can use +[[ikiwiki-transition]]. It will convert preprocessor directives in all +files given on the command line. To convert an entire wiki: + + find wikidir/ -type f -name '*.mdwn' -print0 | xargs -0 ikiwiki-transition prefix_directives + +Be sure to modify the find to list all pages in the wiki if you're using +other markup than markdown. You will probably want to commit the changes +when you're done too. + +## aggregateinternal + +If your wiki uses the [[aggregate|plugins/aggregate]] plugin, it will start +to aggregate feeds to special "internal" pages. + +If you don't want this change, you can add the following to your setup +file: + + aggregateinternal => 0, + +Otherwise, follow this procedure to upgrade a wiki using the aggregate plugin: + +1. Update all [[PageSpecs|ikiwiki/PageSpec]] that refer to the aggregated + pages -- such as those in inlines. Put "internal()" around globs + in those PageSpecs. For example, if the PageSpec was `foo/*`, it should + be changed to `internal(foo/*)`. This has to be done because internal + pages are not matched by regular globs. +2. Use [[ikiwiki-transition]] to rename all existing aggregated `.html` + files in the srcdir. The command to run is + `ikiwiki-transition aggregateinternal your.setup`, +3. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`) -- cgit v1.2.3 From ecf2408bf64de1aee3bb8b79f6e28c14b52cf1c4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 16:25:52 -0500 Subject: fix a few directives using the old syntax I'm turning on prefix_directives for the live wiki now. --- doc/plugins/aggregate/discussion.mdwn | 2 +- doc/tips/inside_dot_ikiwiki.mdwn | 2 +- doc/todo/support_creole_markup.mdwn | 2 +- doc/todo/syntax_highlighting.mdwn | 8 ++++---- doc/users/xma.mdwn | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'doc/tips') diff --git a/doc/plugins/aggregate/discussion.mdwn b/doc/plugins/aggregate/discussion.mdwn index 1db6240d5..1a9844577 100644 --- a/doc/plugins/aggregate/discussion.mdwn +++ b/doc/plugins/aggregate/discussion.mdwn @@ -35,7 +35,7 @@ Two things aren't working as I'd expect: > problem. You can see the feed validator complain about it here: > > -> It's sorta unfortunate that [[cpan XML::Feed]] doesn't just assume the +> It's sorta unfortunate that [[!cpan XML::Feed]] doesn't just assume the > un-esxaped html is part of the description field. Probably other feed > parsers are more lenient. --[[Joey]] diff --git a/doc/tips/inside_dot_ikiwiki.mdwn b/doc/tips/inside_dot_ikiwiki.mdwn index 1f76ce4bd..b81ffae8d 100644 --- a/doc/tips/inside_dot_ikiwiki.mdwn +++ b/doc/tips/inside_dot_ikiwiki.mdwn @@ -66,7 +66,7 @@ to do it rarely, and the data I've wanted has been different each time. ## the session database -`.ikiwiki/sessions.db` is the session database. See the [[cpan CGI::Session]] +`.ikiwiki/sessions.db` is the session database. See the [[!cpan CGI::Session]] documentation for more details. ## lockfiles diff --git a/doc/todo/support_creole_markup.mdwn b/doc/todo/support_creole_markup.mdwn index b0ebf5b9e..5a1e1286d 100644 --- a/doc/todo/support_creole_markup.mdwn +++ b/doc/todo/support_creole_markup.mdwn @@ -12,7 +12,7 @@ And there is a perl module: Text::WikiCreole Syntax file for vim: http://www.peter-hoffmann.com/code/vim/ (Since a typical ikiwiki user usually use external editors. :)) -> Should be pretty easy to add a plugin to do it using [[cpan +> Should be pretty easy to add a plugin to do it using [[!cpan > Text::WikiCreole]]. --[[Joey]] [[done]] diff --git a/doc/todo/syntax_highlighting.mdwn b/doc/todo/syntax_highlighting.mdwn index 3de3032b3..d9a791c6f 100644 --- a/doc/todo/syntax_highlighting.mdwn +++ b/doc/todo/syntax_highlighting.mdwn @@ -7,16 +7,16 @@ pages, as well as doing syntax highlighting as a preprocessor directive ## The big list of possibilities -* [[plugins/contrib/highlightcode]] uses [[cpan Syntax::Highlight::Engine::Kate]], +* [[plugins/contrib/highlightcode]] uses [[!cpan Syntax::Highlight::Engine::Kate]], operates on whole source files only, has a few bugs (see [here](http://u32.net/Highlight_Code_Plugin/), and needs to be updated to support [[bugs/multiple_pages_with_same_name]]. -* [[cpan IkiWiki-Plugin-syntax]] only operates as a directive. +* [[!cpan IkiWiki-Plugin-syntax]] only operates as a directive. Interestingly, it supports multiple highlighting backends, including Kate and Vim. * [[plugins/contrib/syntax]] only operates as a directive ([[not_on_source_code_files|automatic_use_of_syntax_plugin_on_source_code_files]]), - and uses [[cpan Text::VimColor]]. + and uses [[!cpan Text::VimColor]]. * [[plugins/contrib/sourcehighlight]] uses src-highlight, and operates on whole source files only. Needs to be updated to support [[bugs/multiple_pages_with_same_name]]. @@ -43,7 +43,7 @@ pages, as well as doing syntax highlighting as a preprocessor directive inside source files. Doing this probably means post-processing the results of the highlighting engine, to find places where it's highlighted comments, and then running them through the ikiwiki rendering pipeline. - This seems fairly doable with [[cpan Syntax::Highlight::Engine::Kate]], + This seems fairly doable with [[!cpan Syntax::Highlight::Engine::Kate]], at least. * The whole-file plugins tend to have a problem that things that look like wikilinks in the source code get munged into links by ikiwiki, which can diff --git a/doc/users/xma.mdwn b/doc/users/xma.mdwn index 97a8ef869..89f2ff74c 100644 --- a/doc/users/xma.mdwn +++ b/doc/users/xma.mdwn @@ -9,7 +9,7 @@ Anyway, [[ikiwiki]] is really *awesome* ! ## More about me -I am CLI user living in the linux console. More precisely, I live in an [[GNU Emacs]] frame all day long. My main computer is an EeePC 901 running Slackware GNU/Linux 12.1. I do not have X installed (too lazy) but when in X, I am running an instance of [[CLFSWM]]. +I am CLI user living in the linux console. More precisely, I live in an [[GNU_Emacs]] frame all day long. My main computer is an EeePC 901 running Slackware GNU/Linux 12.1. I do not have X installed (too lazy) but when in X, I am running an instance of [[CLFSWM]]. ## Contacting me -- cgit v1.2.3 From c07a95ed8ecb84a2e7018c93c3d031f03bd25926 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 17:11:04 -0500 Subject: remove globlist support No transition code implemented, but I will probably make a 2.x release that warns about found globlists. --- IkiWiki.pm | 45 -------------------------------------------- doc/ikiwiki/pagespec.mdwn | 19 ------------------- doc/plugins/contrib.mdwn | 2 +- doc/tips/upgrade_to_3.0.mdwn | 17 +++++++++++++++++ t/pagespec_match.t | 11 +---------- t/pagespec_merge.t | 12 ++++++------ 6 files changed, 25 insertions(+), 81 deletions(-) (limited to 'doc/tips') diff --git a/IkiWiki.pm b/IkiWiki.pm index 759bfbc65..f6adb360a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -1596,37 +1596,6 @@ sub rcs_receive () { $hooks{rcs}{rcs_receive}{call}->(); } -sub globlist_to_pagespec ($) { - my @globlist=split(' ', shift); - - my (@spec, @skip); - foreach my $glob (@globlist) { - if ($glob=~/^!(.*)/) { - push @skip, $glob; - } - else { - push @spec, $glob; - } - } - - my $spec=join(' or ', @spec); - if (@skip) { - my $skip=join(' and ', @skip); - if (length $spec) { - $spec="$skip and ($spec)"; - } - else { - $spec=$skip; - } - } - return $spec; -} - -sub is_globlist ($) { - my $s=shift; - return ( $s =~ /[^\s]+\s+([^\s]+)/ && $1 ne "and" && $1 ne "or" ); -} - sub safequote ($) { my $s=shift; $s=~s/[{}]//g; @@ -1718,26 +1687,12 @@ sub pagespec_merge ($$) { my $b=shift; return $a if $a eq $b; - - # Support for old-style GlobLists. - if (is_globlist($a)) { - $a=globlist_to_pagespec($a); - } - if (is_globlist($b)) { - $b=globlist_to_pagespec($b); - } - return "($a) or ($b)"; } sub pagespec_translate ($) { my $spec=shift; - # Support for old-style GlobLists. - if (is_globlist($spec)) { - $spec=globlist_to_pagespec($spec); - } - # Convert spec to perl code. my $code=""; while ($spec=~m{ diff --git a/doc/ikiwiki/pagespec.mdwn b/doc/ikiwiki/pagespec.mdwn index d4dd265cc..86abe5745 100644 --- a/doc/ikiwiki/pagespec.mdwn +++ b/doc/ikiwiki/pagespec.mdwn @@ -72,22 +72,3 @@ filenames of the pages in the wiki, so a pagespec "foo" used on page "a/b" will not match a page named "a/foo" or "a/b/foo". To match relative to the directory of the page containing the pagespec, you can use "./". For example, "./foo" on page "a/b" matches page "a/foo". - -## Old syntax - -The old PageSpec syntax was called a "GlobList", and worked differently in -two ways: - -1. "and" and "or" were not used; any page matching any item from the list - matched. -2. If an item was prefixed with "`!`", then no page matching that item - matched, even if it matched an earlier list item. - -For example, here is the old way to match all pages except for the SandBox -and Discussion pages: - - * !SandBox !*/Discussion - -Using this old syntax is still supported. However, the old syntax is -deprecated and will be removed at some point, and using the new syntax is -recommended. diff --git a/doc/plugins/contrib.mdwn b/doc/plugins/contrib.mdwn index 7a28edaba..e22b13f71 100644 --- a/doc/plugins/contrib.mdwn +++ b/doc/plugins/contrib.mdwn @@ -2,6 +2,6 @@ Contributed [[plugins]]: (See [[install]] for installation help.) -[[!inline pages="plugins/contrib/* !*/Discussion" +[[!inline pages="plugins/contrib/* and !*/Discussion" feedpages="created_after(plugins/contrib/navbar)" archive="yes" rootpage="plugins/contrib" postformtext="Add a new plugin named:" show=0]] diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 6c74d4fc9..bd47e96e5 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -49,6 +49,23 @@ Be sure to modify the find to list all pages in the wiki if you're using other markup than markdown. You will probably want to commit the changes when you're done too. +## GlobLists + +In 3.0, the old "GlobList" syntax for [[PageSpecs|ikiwiki/PageSpec]] is no +longer supported. A GlobList contains multiple term, but does not separate +them with "and" or "or": + + sandbox !*/Discussion + +To convert this to a modern PageSpec, simply add "and" or "or" as +appropriate between terms: + + sandbox and !*/Discussion + +GlobLists have been deprecated for more than two years. If your wiki dates +to the ikiwiki 1.0 era, you should check it for any that might have lurked +unnoticed in it since back then. + ## aggregateinternal If your wiki uses the [[aggregate|plugins/aggregate]] plugin, it will start diff --git a/t/pagespec_match.t b/t/pagespec_match.t index 7c0ac235b..69cf361de 100755 --- a/t/pagespec_match.t +++ b/t/pagespec_match.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 58; +use Test::More tests => 51; BEGIN { use_ok("IkiWiki"); } @@ -77,12 +77,3 @@ ok(! pagespec_match("foo", "no_such_function(foo)"), "foo"); my $ret=pagespec_match("foo", "(invalid"); ok(! $ret, "syntax error"); ok($ret =~ /syntax error/, "error message"); - -# old style globlists -ok(pagespec_match("foo", "foo bar"), "simple list"); -ok(pagespec_match("bar", "foo bar"), "simple list 2"); -ok(pagespec_match("foo", "f?? !foz")); -ok(! pagespec_match("foo", "f?? !foo")); -ok(! pagespec_match("foo", "* !foo")); -ok(! pagespec_match("foo", "foo !foo")); -ok(! pagespec_match("foo.png", "* !*.*")); diff --git a/t/pagespec_merge.t b/t/pagespec_merge.t index cbb06219c..9e38d5761 100755 --- a/t/pagespec_merge.t +++ b/t/pagespec_merge.t @@ -28,17 +28,17 @@ ok(same("!foo", "!bar", "foo"), "double inversion failed match"); ok(same("!foo", "!bar", "bar"), "double inversion failed match 2"); ok(same("*", "!bar", "foo"), "glob+inversion match"); ok(same("*", "!bar", "bar"), "matching glob and matching inversion"); -ok(same("* !foo", "!bar", "bar"), "matching glob and matching inversion"); -ok(same("* !foo", "!bar", "foo"), "matching glob with matching inversion and non-matching inversion"); -ok(same("* !foo", "!foo", "foo"), "matching glob with matching inversion and matching inversion"); +ok(same("* and !foo", "!bar", "bar"), "matching glob and matching inversion"); +ok(same("* and !foo", "!bar", "foo"), "matching glob with matching inversion and non-matching inversion"); +ok(same("* and !foo", "!foo", "foo"), "matching glob with matching inversion and matching inversion"); ok(same("b??", "!b??", "bar"), "matching glob and matching inverted glob"); ok(same("f?? !f??", "!bar", "bar"), "matching glob and matching inverted glob"); ok(same("b??", "!b?z", "bar"), "matching glob and non-matching inverted glob"); ok(same("f?? !f?z", "!bar", "bar"), "matching glob and non-matching inverted glob"); ok(same("!foo bar baz", "!bar", "bar"), "matching list and matching inversion"); ok(pagespec_match("foo/Discussion", - IkiWiki::pagespec_merge("* !*/Discussion", "*/Discussion")), "should match"); -ok(same("* !*/Discussion", "*/Discussion", "foo/Discussion"), "Discussion merge 1"); -ok(same("*/Discussion", "* !*/Discussion", "foo/Discussion"), "Discussion merge 2"); + IkiWiki::pagespec_merge("* and !*/Discussion", "*/Discussion")), "should match"); +ok(same("* and !*/Discussion", "*/Discussion", "foo/Discussion"), "Discussion merge 1"); +ok(same("*/Discussion", "* and !*/Discussion", "foo/Discussion"), "Discussion merge 2"); ok(same("*/Discussion !*/bar", "*/bar !*/Discussion", "foo/Discussion"), "bidirectional merge 1"); ok(same("*/Discussion !*/bar", "*/bar !*/Discussion", "foo/bar"), "bidirectional merge 2"); -- cgit v1.2.3 From 149fbf97d6ed230cc14de38fd8ca145bd39d64b4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 23 Dec 2008 17:14:47 -0500 Subject: update --- doc/tips/upgrade_to_3.0.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index bd47e96e5..cf33f4d1c 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -64,7 +64,8 @@ appropriate between terms: GlobLists have been deprecated for more than two years. If your wiki dates to the ikiwiki 1.0 era, you should check it for any that might have lurked -unnoticed in it since back then. +unnoticed in it since back then. Ikiwiki version 2.72 will print warnings +about any GlobLists it sees. ## aggregateinternal -- cgit v1.2.3 From 7ba65e7f4bd53c4cbd865fa35a515ef12c183757 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Dec 2008 16:16:03 -0500 Subject: remove deprecated admin prefs A new ikiwiki-transition moveprefs subcommand can pull the old data out of the userdb and inject it into the setup file. Note that it leaves the old values behind in the userdb too. I did this because I didn't want to lose data if it fails writing the setup file for some reason, and the old data in the userdb will only use a small amount of space. Running the command multiple times will mostly not change anything. --- IkiWiki/CGI.pm | 32 +----------------------- IkiWiki/Plugin/attachment.pm | 50 -------------------------------------- IkiWiki/Plugin/lockedit.pm | 58 -------------------------------------------- IkiWiki/UserInfo.pm | 20 --------------- doc/ikiwiki-transition.mdwn | 29 +++++++++++++--------- doc/tips/upgrade_to_3.0.mdwn | 34 ++++++++++++-------------- ikiwiki-transition | 52 ++++++++++++++++++++++++++++++++++++++- 7 files changed, 85 insertions(+), 190 deletions(-) (limited to 'doc/tips') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 81cb42d13..3fadc462e 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -203,25 +203,9 @@ sub cgi_prefs ($$) { my $user_name=$session->param("name"); - # XXX deprecated, should be removed eventually - $form->field(name => "banned_users", size => 50, fieldset => "admin"); - if (! is_admin($user_name)) { - $form->field(name => "banned_users", type => "hidden"); - } if (! $form->submitted) { $form->field(name => "email", force => 1, value => userinfo_get($user_name, "email")); - if (is_admin($user_name)) { - my $value=join(" ", get_banned_users()); - if (length $value) { - $form->field(name => "banned_users", force => 1, - value => join(" ", get_banned_users()), - comment => "deprecated; please move to banned_users in setup file"); - } - else { - $form->field(name => "banned_users", type => "hidden"); - } - } } if ($form->submitted eq 'Logout') { @@ -239,17 +223,6 @@ sub cgi_prefs ($$) { error("failed to set email"); } - # XXX deprecated, should be removed eventually - if (is_admin($user_name)) { - set_banned_users(grep { ! is_admin($_) } - split(' ', - $form->field("banned_users"))) || - error("failed saving changes"); - if (! length $form->field("banned_users")) { - $form->field(name => "banned_users", type => "hidden"); - } - } - $form->text(gettext("Preferences saved.")); } @@ -262,10 +235,7 @@ sub check_banned ($$) { my $name=$session->param("name"); if (defined $name) { - # XXX banned in userinfo is deprecated, should be removed - # eventually, and only banned_users be checked. - if (userinfo_get($session->param("name"), "banned") || - grep { $name eq $_ } @{$config{banned_users}}) { + if (grep { $name eq $_ } @{$config{banned_users}}) { print $q->header(-status => "403 Forbidden"); $session->delete(); print gettext("You are banned."); diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index e1b4d4363..087c315a9 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -61,23 +61,6 @@ sub check_canattach ($$;$) { ); } - # XXX deprecated, should be removed eventually - if ($allowed) { - foreach my $admin (@{$config{adminuser}}) { - my $allowed_attachments=IkiWiki::userinfo_get($admin, "allowed_attachments"); - if (defined $allowed_attachments && - length $allowed_attachments) { - $allowed=pagespec_match($dest, - $allowed_attachments, - file => $file, - user => $session->param("name"), - ip => $ENV{REMOTE_ADDR}, - ); - last if $allowed; - } - } - } - if (! $allowed) { error(gettext("prohibited by allowed_attachments")." ($allowed)"); } @@ -120,39 +103,6 @@ sub formbuilder_setup (@) { $form->tmpl_param("attachments-class" => "toggleable-open"); } } - elsif ($form->title eq "preferences") { - # XXX deprecated, should remove eventually - my $session=$params{session}; - my $user_name=$session->param("name"); - - $form->field(name => "allowed_attachments", size => 50, - fieldset => "admin", - comment => "deprecated; please move to allowed_attachments in setup file", - ); - if (! IkiWiki::is_admin($user_name)) { - $form->field(name => "allowed_attachments", type => "hidden"); - } - if (! $form->submitted) { - my $value=IkiWiki::userinfo_get($user_name, "allowed_attachments"); - if (length $value) { - $form->field(name => "allowed_attachments", force => 1, - value => IkiWiki::userinfo_get($user_name, "allowed_attachments")); - } - else { - $form->field(name => "allowed_attachments", type => "hidden"); - } - } - if ($form->submitted && $form->submitted eq 'Save Preferences') { - if (defined $form->field("allowed_attachments")) { - IkiWiki::userinfo_set($user_name, "allowed_attachments", - $form->field("allowed_attachments")) || - error("failed to set allowed_attachments"); - if (! length $form->field("allowed_attachments")) { - $form->field(name => "allowed_attachments", type => "hidden"); - } - } - } - } } sub formbuilder (@) { diff --git a/IkiWiki/Plugin/lockedit.pm b/IkiWiki/Plugin/lockedit.pm index c2c7414c3..0fa329251 100644 --- a/IkiWiki/Plugin/lockedit.pm +++ b/IkiWiki/Plugin/lockedit.pm @@ -8,8 +8,6 @@ use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "lockedit", call => \&getsetup); hook(type => "canedit", id => "lockedit", call => \&canedit); - hook(type => "formbuilder_setup", id => "lockedit", - call => \&formbuilder_setup); } sub getsetup () { @@ -52,63 +50,7 @@ sub canedit ($$) { } } - # XXX deprecated, should be removed eventually - foreach my $admin (@{$config{adminuser}}) { - if (pagespec_match($page, IkiWiki::userinfo_get($admin, "locked_pages"), - user => $session->param("name"), - ip => $ENV{REMOTE_ADDR}, - )) { - if (! defined $user || - ! IkiWiki::userinfo_get($session->param("name"), "regdate")) { - return sub { IkiWiki::needsignin($cgi, $session) }; - } - else { - return sprintf(gettext("%s is locked and cannot be edited"), - htmllink("", "", $page, noimageinline => 1)); - } - } - } - return undef; } -sub formbuilder_setup (@) { - my %params=@_; - - # XXX deprecated, should be removed eventually - my $form=$params{form}; - if ($form->title eq "preferences") { - my $session=$params{session}; - my $cgi=$params{cgi}; - my $user_name=$session->param("name"); - - $form->field(name => "locked_pages", size => 50, - fieldset => "admin", - comment => "deprecated; please move to locked_pages in setup file" - ); - if (! IkiWiki::is_admin($user_name)) { - $form->field(name => "locked_pages", type => "hidden"); - } - if (! $form->submitted) { - my $value=IkiWiki::userinfo_get($user_name, "locked_pages"); - if (length $value) { - $form->field(name => "locked_pages", force => 1, value => $value); - } - else { - $form->field(name => "locked_pages", type => "hidden"); - } - } - if ($form->submitted && $form->submitted eq 'Save Preferences') { - if (defined $form->field("locked_pages")) { - IkiWiki::userinfo_set($user_name, "locked_pages", - $form->field("locked_pages")) || - error("failed to set locked_pages"); - if (! length $form->field("locked_pages")) { - $form->field(name => "locked_pages", type => "hidden"); - } - } - } - } -} - 1 diff --git a/IkiWiki/UserInfo.pm b/IkiWiki/UserInfo.pm index 3423dc923..0bf100a95 100644 --- a/IkiWiki/UserInfo.pm +++ b/IkiWiki/UserInfo.pm @@ -74,24 +74,4 @@ sub is_admin ($) { return grep { $_ eq $user_name } @{$config{adminuser}}; } -# XXX deprecated, should be removed eventually -sub get_banned_users () { - my @ret; - my $userinfo=userinfo_retrieve(); - foreach my $user (keys %{$userinfo}) { - push @ret, $user if $userinfo->{$user}->{banned}; - } - return @ret; -} - -# XXX deprecated, should be removed eventually -sub set_banned_users (@) { - my %banned=map { $_ => 1 } @_; - my $userinfo=userinfo_retrieve(); - foreach my $user (keys %{$userinfo}) { - $userinfo->{$user}->{banned} = $banned{$user}; - } - return userinfo_store($userinfo); -} - 1 diff --git a/doc/ikiwiki-transition.mdwn b/doc/ikiwiki-transition.mdwn index 8b7c3579f..3a3529454 100644 --- a/doc/ikiwiki-transition.mdwn +++ b/doc/ikiwiki-transition.mdwn @@ -8,11 +8,11 @@ ikiwiki-transition type ... # DESCRIPTION -`ikiwiki-transition` aids in converting wiki pages when -there's a major change in ikiwiki syntax. It also handles other transitions -not involving wiki pages. +`ikiwiki-transition` aids in converting wiki pages when there's a major +change in ikiwiki syntax. It also handles other transitions not involving +wiki pages. -# prefix_directives +# prefix_directives file ... The `prefix_directives` mode converts the specified ikiwiki page from the old preprocessor directive syntax, requiring a space, to the new @@ -25,7 +25,7 @@ Note that if the page contains wiki links with spaces, which some older versions of ikiwiki accepted, the prefix_directives transition will treat these as preprocessor directives and convert them. -# setupformat +# setupformat your.setup The `setupformat` mode converts a setup file from using a single `wrappers` block to using `cgi_wrapper`, `git_wrapper`, etc. @@ -33,25 +33,30 @@ to using `cgi_wrapper`, `git_wrapper`, etc. Note that all comments and any unusual stuff like perl code in the setup file will be lost, as it is entirely rewritten by the transition. -# aggregateinternal +# aggregateinternal your.setup The `aggregateinternal` mode moves pages aggregated by the aggregate plugin so that the `aggregateinternal` option can be enabled. -# indexdb +# moveprefs your.setup + +Moves values that used to be admin preferences into the setup file. + +Note that all comments and any unusual stuff like perl code in the setup +file will be lost, as it is entirely rewritten by the move. + +# indexdb srcdir The `indexdb` mode handles converting a plain text `.ikiwiki/index` file to -a binary `.ikiwiki/indexdb`. In this mode, you should specify the srcdir of -the wiki as the second parameter. You do not normally need to run +a binary `.ikiwiki/indexdb`. You do not normally need to run `ikiwiki-transition indexdb`; ikiwiki will automatically run it as necessary. -# hashpassword +# hashpassword srcdir The `hashpassword` mode forces any plaintext passwords stored in the `.ikiwiki/userdb` file to be replaced with password hashes. (The -Authen::Passphrase perl module is needed to do this.) In this mode, you -should specify the srcdir of the wiki as the second parameter. +Authen::Passphrase perl module is needed to do this.) If this is not done explicitly, a user's plaintext password will be automatically converted to a hash when a user logs in for the first time diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index cf33f4d1c..ef9933583 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -1,32 +1,30 @@ -Version 3.0 of ikiwiki makes some significant configuration changes, which +Version 3.0 of ikiwiki makes some significant changes, which you will need to deal with when upgrading from ikiwiki 2.x. [[!toc ]] -# moving settings from Preferences page - -The admin preferences page used to have settings for allowed attachments, -locked pages, and banned users. These three settings have moved to the -setup file: - - allowed_attachments => "", - locked_pages => "", - banned_users => "", - -If you have not yet upgraded to ikiwiki 3.0, you can look at the admin -preferences page to see if any of these values is shown there, and copy -them into the setup file. - ## setup file format change The layout of the setup file changed in a significant way in version 2.60 of ikiwiki. If you have not changed yours to the new format, now would be a -good time to do so. Some new features, like the [[plugins/websetup]] interface, -need the new format setup file. +good time to do so. Some new features, like the [[plugins/websetup]] +interface, need the new format setup file. You can convert old setup files into the new format by running `ikiwiki-transition setupformat your.setup` +# moving settings from Preferences page + +The admin preferences page used to have settings for allowed attachments, +locked pages, and banned users. These three settings have moved to the +setup file, and will no longer appear on the admin preferences page once +your wiki is upgraded to 3.0. + +You can move these preferences into the setup file by running +`ikiwiki-transition moveprefs your.setup` + +(Make sure you have converted the setuop file to the new format first.) + ## prefix directives In 3.0, the syntax ikiwiki uses for [[directives|ikiwiki/directive]] has @@ -70,7 +68,7 @@ about any GlobLists it sees. ## aggregateinternal If your wiki uses the [[aggregate|plugins/aggregate]] plugin, it will start -to aggregate feeds to special "internal" pages. +to aggregate feeds to special "internal" pages. If you don't want this change, you can add the following to your setup file: diff --git a/ikiwiki-transition b/ikiwiki-transition index 802cd643d..9a5dd1362 100755 --- a/ikiwiki-transition +++ b/ikiwiki-transition @@ -159,14 +159,49 @@ sub setupformat { IkiWiki::Setup::dump($setup); } +sub moveprefs { + my $setup=shift; + if (! defined $setup) { + usage(); + } + + require IkiWiki::Setup; + + %config = IkiWiki::defaultconfig(); + IkiWiki::Setup::load($setup); + IkiWiki::checkconfig(); + + eval q{use IkiWiki::UserInfo}; + error $@ if $@; + + foreach my $field (qw{allowed_attachments locked_pages}) { + my $orig=$config{$field}; + foreach my $admin (@{$config{adminuser}}) { + my $a=IkiWiki::userinfo_get($admin, $field); + if (defined $a && length $a && + $a ne $orig && # might already have been moved + defined $config{$field} && + length $config{$field}) { + $config{$field}=IkiWiki::pagespec_merge($config{$field}, $a); + } + } + } + + my %banned=map { $_ => 1 } @{$config{banned_users}}, IkiWiki::get_banned_users(); + $config{banned_users}=[sort keys %banned]; + + IkiWiki::Setup::dump($setup); +} + sub usage { print STDERR "Usage: ikiwiki-transition type ...\n"; print STDERR "Currently supported transition subcommands:\n"; - print STDERR "\tprefix_directives file\n"; + print STDERR "\tprefix_directives file ...\n"; print STDERR "\tindexdb srcdir\n"; print STDERR "\thashpassword srcdir\n"; print STDERR "\taggregateinternal setupfile\n"; print STDERR "\tsetupformat setupfile\n"; + print STDERR "\tmoveprefs setupfile\n"; exit 1; } @@ -188,6 +223,9 @@ elsif ($mode eq 'aggregateinternal') { elsif ($mode eq 'setupformat') { setupformat(@ARGV); } +elsif ($mode eq 'moveprefs') { + moveprefs(@ARGV); +} else { usage(); } @@ -245,3 +283,15 @@ sub oldloadindex { return close($in); } + +# Used to be in IkiWiki/UserInfo, but only used here now. +sub get_banned_users () { + my @ret; + my $userinfo=userinfo_retrieve(); + foreach my $user (keys %{$userinfo}) { + push @ret, $user if $userinfo->{$user}->{banned}; + } + return @ret; +} + +1 -- cgit v1.2.3 From 3fbe2569ff39c8e280a48c7623e325ef42ebedce Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Dec 2008 16:22:35 -0500 Subject: remove deprecated googlecalendar plugin --- IkiWiki/Plugin/googlecalendar.pm | 55 ---------------------------------------- doc/plugins/discussion.mdwn | 9 ------- doc/plugins/googlecalendar.mdwn | 20 --------------- doc/tips/upgrade_to_3.0.mdwn | 5 ++++ 4 files changed, 5 insertions(+), 84 deletions(-) delete mode 100644 IkiWiki/Plugin/googlecalendar.pm delete mode 100644 doc/plugins/googlecalendar.mdwn (limited to 'doc/tips') diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm deleted file mode 100644 index fad2ad78f..000000000 --- a/IkiWiki/Plugin/googlecalendar.pm +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -package IkiWiki::Plugin::googlecalendar; - -use warnings; -use strict; -use IkiWiki 3.00; - -sub import { - hook(type => "getsetup", id => "googlecalendar", - call => \&getsetup); - hook(type => "preprocess", id => "googlecalendar", - call => \&preprocess); - hook(type => "format", id => "googlecalendar", - call => \&format); -} - -sub getsetup () { - return - plugin => { - safe => 1, - rebuild => undef, - }, -} - -sub preprocess (@) { - my %params=@_; - - # Parse the html, looking for the url to embed for the calendar. - # Avoid XSS attacks.. - my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#; - if (! defined $url || ! length $url) { - error gettext("failed to find url in html") - } - my ($height)=$params{html}=~m#height="(\d+)"#; - my ($width)=$params{html}=~m#width="(\d+)"#; - - return "
"; -} - -sub format (@) { - my %params=@_; - - $params{content}=~s/
<\/div>/gencal($1,$2,$3)/eg; - - return $params{content}; -} - -sub gencal ($$$) { - my $url=shift; - my $height=shift; - my $width=shift; - return qq{}; -} - -1 diff --git a/doc/plugins/discussion.mdwn b/doc/plugins/discussion.mdwn index 70157f1e2..854307a98 100644 --- a/doc/plugins/discussion.mdwn +++ b/doc/plugins/discussion.mdwn @@ -34,12 +34,3 @@ Any objections to listing plugins alphabetically rather than by creation date? >> "recently changed" list with the 10 most recently changed plugins >> at the top. That would allow what you suggested, but still allow >> the main list to be alphabetical. -- [[Will]] - -How about adding a deprecated tag in order to clean up the plugin list? - -> AFAIK it's currently the only one. --[[Joey]] - -For instance [[googlecalendar]] is listed as plugin but should probably be removed from Ikiwiki in a future major version (v3?). - --- [[AlexandreDupas]] - diff --git a/doc/plugins/googlecalendar.mdwn b/doc/plugins/googlecalendar.mdwn deleted file mode 100644 index bca2ae74f..000000000 --- a/doc/plugins/googlecalendar.mdwn +++ /dev/null @@ -1,20 +0,0 @@ -[[!template id=plugin name=googlecalendar author="[[Joey]]"]] -[[!tag type/special-purpose]] - -*Note*: This plugin is deprecated. Please switch to the [[embed]] plugin. - -This plugin allows embedding a google calendar iframe in the wiki. -Normally, if the [[htmlscrubber]] is enabled, such iframes are scrubbed out -of the wiki content since they're not very safe if created by malicious -users. But some iframes are legitimate, and safe, if you trust the embedded -content. This plugin is an example of how to deal with this in ikiwiki. - -Example use: - - \[[!googlecalendar html=""" - - """]] - -The iframe should be the one provided by google. Note that it's used in a -way that avoids cross-site scripting attacks, assuming you trust google's -content. diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index ef9933583..50c420103 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -86,3 +86,8 @@ Otherwise, follow this procedure to upgrade a wiki using the aggregate plugin: files in the srcdir. The command to run is `ikiwiki-transition aggregateinternal your.setup`, 3. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`) + +## googlecalendar + +This plugin has been deprecated for a long time, and is removed in 3.0. If +your wiki used it, you should enable the [[plugins/embed]] plugin, instead. -- cgit v1.2.3 From 04f064e78aedecc234e08bd9b49ae3674cb8f7bd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 24 Dec 2008 19:43:07 -0500 Subject: 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. --- debian/NEWS | 5 +---- doc/ikiwiki-transition.mdwn | 9 ++++----- doc/plugins/write.mdwn | 2 +- doc/tips/upgrade_to_3.0.mdwn | 13 ++++--------- ikiwiki-transition | 42 ++++++++++++++++++++++++++++++++---------- 5 files changed, 42 insertions(+), 29 deletions(-) (limited to 'doc/tips') diff --git a/debian/NEWS b/debian/NEWS index 1c9763d1a..f9dfc3770 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -110,10 +110,7 @@ ikiwiki (2.40) unstable; urgency=low in their setup files. To convert your wiki to the new syntax, ikiwiki provides a new script - ikiwiki-transition. It will convert preprocessor directives in - all files given on the command line. To convert an entire wiki: - - find wikidir/ -type f -name '*.mdwn' -print0 | xargs -0 ikiwiki-transition prefix_directives + ikiwiki-transition. Even with prefix_directives disabled, ikiwiki now allows an optional '!' prefix on preprocessor directives (but still requires a space). Thus, a diff --git a/doc/ikiwiki-transition.mdwn b/doc/ikiwiki-transition.mdwn index 3a3529454..18836d5f5 100644 --- a/doc/ikiwiki-transition.mdwn +++ b/doc/ikiwiki-transition.mdwn @@ -12,16 +12,15 @@ ikiwiki-transition type ... change in ikiwiki syntax. It also handles other transitions not involving wiki pages. -# prefix_directives file ... +# prefix_directives your.setup -The `prefix_directives` mode converts the specified ikiwiki page from -the old preprocessor directive syntax, requiring a space, to the new -syntax, prefixed by '!'. +The `prefix_directives` mode converts all pages from the old preprocessor +directive syntax, requiring a space, to the new syntax, prefixed by '!'. Preprocessor directives which already use the new syntax will remain unchanged. -Note that if the page contains wiki links with spaces, which some +Note that if a page contains wiki links with spaces, which some older versions of ikiwiki accepted, the prefix_directives transition will treat these as preprocessor directives and convert them. diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index cb7571289..8992fad01 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -486,7 +486,7 @@ use the following hashes, using a page name as the key: destination file. * `%pagesources` contains the name of the source file for each page. -Also, the %IkiWiki::version variable contains the version number for the +Also, the `%IkiWiki::version` variable contains the version number for the ikiwiki program. ### Library functions diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 50c420103..3a515a61f 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -23,7 +23,7 @@ your wiki is upgraded to 3.0. You can move these preferences into the setup file by running `ikiwiki-transition moveprefs your.setup` -(Make sure you have converted the setuop file to the new format first.) +(Make sure you have converted the setup file to the new format first.) ## prefix directives @@ -37,15 +37,10 @@ following to your setup file: prefix_directives => 0, -But it's not hard to convert your wiki to the new syntax. You can use -[[ikiwiki-transition]]. It will convert preprocessor directives in all -files given on the command line. To convert an entire wiki: +To convert to the new syntax, run +`ikiwiki-transition prefix_directives your.setup` - find wikidir/ -type f -name '*.mdwn' -print0 | xargs -0 ikiwiki-transition prefix_directives - -Be sure to modify the find to list all pages in the wiki if you're using -other markup than markdown. You will probably want to commit the changes -when you're done too. +(And then commit the changes it makes to pages in your srcdir.) ## GlobLists diff --git a/ikiwiki-transition b/ikiwiki-transition index 9a5dd1362..b15d9f46b 100755 --- a/ikiwiki-transition +++ b/ikiwiki-transition @@ -1,4 +1,4 @@ -#!/usr/bin/perl -i +#!/usr/bin/perl use warnings; use strict; use IkiWiki; @@ -42,11 +42,33 @@ sub handle_directive { } sub prefix_directives { - $/=undef; # process whole files at once - - while (<>) { - s{$regex}{handle_directive($1, $2, $3, $4)}eg; - print; + my $setup=shift; + if (! defined $setup) { + usage(); + } + + require IkiWiki::Setup; + require IkiWiki::Plugin::aggregate; + + %config = IkiWiki::defaultconfig(); + IkiWiki::Setup::load($setup); + IkiWiki::loadplugins(); + IkiWiki::checkconfig(); + IkiWiki::loadindex(); + + if (! %pagesources) { + error "ikiwiki has not built this wiki yet, cannot transition"; + } + + foreach my $page (values %pagesources) { + next unless defined pagetype($page) && + -f $config{srcdir}."/".$page; + my $content=readfile($config{srcdir}."/".$page); + my $oldcontent=$content; + $content=~s{$regex}{handle_directive($1, $2, $3, $4)}eg; + if ($oldcontent ne $content) { + writefile($page, $config{srcdir}, $content); + } } } @@ -109,7 +131,7 @@ sub aggregateinternal { require IkiWiki::Plugin::aggregate; %config = IkiWiki::defaultconfig(); - IkiWiki::Setup::load(); + IkiWiki::Setup::load($setup); IkiWiki::checkconfig(); IkiWiki::Plugin::aggregate::migrate_to_internal(); @@ -196,12 +218,12 @@ sub moveprefs { sub usage { print STDERR "Usage: ikiwiki-transition type ...\n"; print STDERR "Currently supported transition subcommands:\n"; - print STDERR "\tprefix_directives file ...\n"; - print STDERR "\tindexdb srcdir\n"; - print STDERR "\thashpassword srcdir\n"; + print STDERR "\tprefix_directives setupfile ...\n"; print STDERR "\taggregateinternal setupfile\n"; print STDERR "\tsetupformat setupfile\n"; print STDERR "\tmoveprefs setupfile\n"; + print STDERR "\thashpassword srcdir\n"; + print STDERR "\tindexdb srcdir\n"; exit 1; } -- cgit v1.2.3 From c2d2ff0199f16e028431cd83961b1bff5e2caa99 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Dec 2008 15:27:49 -0500 Subject: deprecate embed plugin too I see that this plugin's lists of safe content are already well out of date, and htmlscrubber_skip offers a non whitelist based approach, so let's deprecate this plugin for 3.0. --- debian/changelog | 5 ++++- doc/plugins/embed.mdwn | 8 ++++++++ doc/plugins/htmlscrubber.mdwn | 8 ++++---- doc/tips/embedding_content.mdwn | 35 +++++++++++++++++++++++++++++++++++ doc/tips/upgrade_to_3.0.mdwn | 13 ++++++++++--- 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 doc/tips/embedding_content.mdwn (limited to 'doc/tips') diff --git a/debian/changelog b/debian/changelog index 9a96f7415..ddb979c31 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,7 +8,10 @@ ikiwiki (3.00) UNRELEASED; urgency=low admin preferences into a setup file. * prefix_directives and aggregate_internal are now turned on by default. * ikiwiki-transition prefix_directives syntax changed - * googlecalendar: removed this deprecated plugin. Use embed instead. + * googlecalendar: removed this deprecated plugin. Use htmlscrubber_skip + instead. + * embed: This plugin is deprecated, use htmlscrubber_skip instead. + Closes: ##462970. * Version 3.00 of the plugin API. -- Joey Hess Wed, 24 Dec 2008 19:49:36 -0500 diff --git a/doc/plugins/embed.mdwn b/doc/plugins/embed.mdwn index 1d43061e0..2baf07da5 100644 --- a/doc/plugins/embed.mdwn +++ b/doc/plugins/embed.mdwn @@ -13,6 +13,14 @@ In the examples below, the parts of the html that you can change are denoted with "XXX"; everything else must appear exactly as shown to be accepted by the plugin. +*This plugin is deprecated.* Rather than relying on these complex lists +of safe content, which constantly fall out of date, you're recommended to +configure the [[htmlscrubber]] to not scrub some pages, which only trusted +users can edit. Then you can embed anything from anywhere on those pages. +See [[tips/embedding_content]] for details and examples. +This plugin's lists of safe embedded content will not be maintained, and +the plugin will be removed in a future release. + ## google maps Use html like this to embed a map: diff --git a/doc/plugins/htmlscrubber.mdwn b/doc/plugins/htmlscrubber.mdwn index b9f7e6d22..c59b46e14 100644 --- a/doc/plugins/htmlscrubber.mdwn +++ b/doc/plugins/htmlscrubber.mdwn @@ -32,10 +32,10 @@ other HTML-related functionality, such as whether [[meta]] allows potentially unsafe HTML tags. The `htmlscrubber_skip` configuration setting can be used to skip scrubbing -of some pages. Set it to a [[ikiwiki/PageSpec]], such as "!*/Discussion", and pages -matching that can have all the evil CSS, JavsScript, and unsafe html -elements you like. One safe way to use this is to use [[lockedit]] to lock -those pages, so only admins can edit them. +of some pages. Set it to a [[ikiwiki/PageSpec]], such as "!*/Discussion", +and pages matching that can have all the evil CSS, JavsScript, and unsafe +html elements you like. One safe way to use this is to use [[lockedit]] to +lock those pages, so only admins can edit them. ---- diff --git a/doc/tips/embedding_content.mdwn b/doc/tips/embedding_content.mdwn new file mode 100644 index 000000000..666f4dab3 --- /dev/null +++ b/doc/tips/embedding_content.mdwn @@ -0,0 +1,35 @@ +Content from sites such as YouTube can be embedded into a web page. Maybe +you want to do this. But you'll find that the [[plugins/htmlscrubber]] +doesn't let you. It blocks the tags used to embed such content, because +they can be abused in many evil ways. + +Some plugins have been written to try to work around this problem, by +whitelisting the html needed to embed things from a few sites like Google +calendar, videos, and YouTube. The problem with these plugins is that they +have to be kept up to date to add new sites, and follow changes to the html +such sites use for embedding. + +(Digression: The real problem with the plugins is that they hide the +underlying trust relationship. If you decide to embed html from a site, +you'd better trust that site. And if ikiwiki lets you enter such html, it +needs to trust you.) + +The [[plugins/htmlscrubber]] offers a different way around this problem. +You can configure it to skip scrubbing certian pages, so that content from +elsewhere can be embedded on those pages. Then use [[plugins/lockedit]] +to limit who can edit those unscrubbed pages. + +For example, suppose your blog is all under `blog/*`, and you want +only yourself to be able to post there, and you'd like to be able to embed +youtube videos etc in your blog. Other users can edit some pages in the +wiki (Discussion pages, say), but not your blog posts. Then you could configure +ikiwiki as follows: + + htmlscrubber_skip => 'blog/* and !*/Discussion', + locked_pages => '!*/Discussion', + +More simply, you might want to allow yourself to embed content anywhere +on the wiki, but scrub content written on Discussion pages: + + htmlscrubber_skip => '!*/Discussion', + locked_pages => '!*/Discussion', diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 3a515a61f..a9664dfc3 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -82,7 +82,14 @@ Otherwise, follow this procedure to upgrade a wiki using the aggregate plugin: `ikiwiki-transition aggregateinternal your.setup`, 3. Refresh the wiki. (`ikiwiki -setup your.setup -refresh`) -## googlecalendar +## embed / googlecalendar -This plugin has been deprecated for a long time, and is removed in 3.0. If -your wiki used it, you should enable the [[plugins/embed]] plugin, instead. +The googlecalendar plugin has been deprecated for a long time, and is +removed in 3.0. + +The embed plugin is also now deprecated, though not yet removed. + +If you use either plugin to embed content from google, youtube, etc, +into your wiki, you should instead configure the [[plugins/htmlscrubber]] +to skip sanitising some pages, via the `htmlscrubber_skip` setting. +See [[embedding_content]] for examples. -- cgit v1.2.3 From 733c7592b7f7103cc73dc563e827da2a0bab8674 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 26 Dec 2008 15:29:04 -0500 Subject: update --- doc/tips/embedding_content.mdwn | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/embedding_content.mdwn b/doc/tips/embedding_content.mdwn index 666f4dab3..142acd16e 100644 --- a/doc/tips/embedding_content.mdwn +++ b/doc/tips/embedding_content.mdwn @@ -5,9 +5,9 @@ they can be abused in many evil ways. Some plugins have been written to try to work around this problem, by whitelisting the html needed to embed things from a few sites like Google -calendar, videos, and YouTube. The problem with these plugins is that they -have to be kept up to date to add new sites, and follow changes to the html -such sites use for embedding. +maps, calendar, videos, and YouTube. The problem with these plugins is that +they have to be kept up to date to add new sites, and follow changes to the +html such sites use for embedding. (Digression: The real problem with the plugins is that they hide the underlying trust relationship. If you decide to embed html from a site, -- cgit v1.2.3 From d8f16c4d9523ff315a3e66ddc8dfa8066fe5cdb3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 28 Dec 2008 22:03:34 -0500 Subject: clarify cgiurl setting --- doc/tips/nearlyfreespeech.mdwn | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/nearlyfreespeech.mdwn b/doc/tips/nearlyfreespeech.mdwn index 6715f0c29..4b3b02eac 100644 --- a/doc/tips/nearlyfreespeech.mdwn +++ b/doc/tips/nearlyfreespeech.mdwn @@ -81,7 +81,8 @@ Here is an example of how I set up a wiki: nano ikiwiki.setup # Set destdir to /home/htdocs # Set srcdir to /home/private/wiki - # Set url to http://yoursite.nfshost.com/ , set cgiurl likewise + # Set url to http://yoursite.nfshost.com/ + # Set cgiurl to http://yoursite.nfshost.com/ikiwiki.cgi # Uncomment the `rcs => "git"` line. # Set the cgi_wrapper path to /home/htdocs/ikiwiki.cgi # Set the git_wrapper path to /home/private/wiki.git/hooks/post-update -- cgit v1.2.3 From 1ac4637d4fda3bc5829b93df3f12a19c918d9407 Mon Sep 17 00:00:00 2001 From: "http://blog.mithis.net/" Date: Mon, 29 Dec 2008 01:26:34 -0500 Subject: --- .../convert_mediawiki_to_ikiwiki/discussion.mdwn | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn index 0a332f8ba..cdb817962 100644 --- a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn +++ b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn @@ -15,3 +15,51 @@ Also, some detail on converting mediawiki transclusion to ikiwiki inlines... > "Who knows, the remote site might disappear.". Right now, it appears to > have done just that. -- [[users/Jon]] + + +The iki-fast-load ruby script from the u32 page is given below: + + #!/usr/bin/env ruby + + # This script is called on the final sorted, de-spammed revision + # XML file. + # + # It doesn't currently check for no-op revisions... I believe + # that git-fast-load will dutifully load them even though nothing + # happened. I don't care to solve this by adding a file cache + # to this script. You can run iki-diff-next.rb to highlight any + # empty revisions that need to be removed. + # + # This turns each node into an equivalent file. + # It does not convert spaces to underscores in file names. + # This would break wikilinks. + # I suppose you could fix this with mod_speling or mod_rewrite. + # + # It replaces nodes in the Image: namespace with the files themselves. + + + require 'rubygems' + require 'node-callback' + require 'time' + require 'ostruct' + + + # pipe is the stream to receive the git-fast-import commands + # putfrom is true if this branch has existing commits on it, false if not. + def format_git_commit(pipe, f) + # Need to escape backslashes and double-quotes for git? + # No, git breaks when I do this. + # For the filename "path with \\", git sez: bad default revision 'HEAD' + # filename = '"' + filename.gsub('\\', '\\\\\\\\').gsub('"', '\\"') + '"' + + # In the calls below, length must be the size in bytes!! + # TODO: I haven't figured out how this works in the land of UTF8 and Ruby 1.9. + pipe.puts "commit #{f.branch}" + pipe.puts "committer #{f.username} <#{f.email}> #{f.timestamp.rfc2822}" + pipe.puts "data #{f.message.length}\n#{f.message}\n" + pipe.puts "from #{f.branch}^0" if f.putfrom + pipe.puts "M 644 inline #{f.filename}" + pipe.puts "data #{f.content.length}\n#{f.content}\n" + pipe.puts + end + -- cgit v1.2.3 From 3032909090711c86c5056987043eeff5a1f6aec2 Mon Sep 17 00:00:00 2001 From: "http://blog.mithis.net/" Date: Mon, 29 Dec 2008 02:01:49 -0500 Subject: --- .../convert_mediawiki_to_ikiwiki/discussion.mdwn | 547 +++++++++++++++++++++ 1 file changed, 547 insertions(+) (limited to 'doc/tips') diff --git a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn index cdb817962..15ddccb92 100644 --- a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn +++ b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn @@ -63,3 +63,550 @@ The iki-fast-load ruby script from the u32 page is given below: pipe.puts end + +Mediawiki.pm - A plugin which supports mediawiki format. + + #!/usr/bin/perl + # By Scott Bronson. Licensed under the GPLv2+ License. + # Extends Ikiwiki to be able to handle Mediawiki markup. + # + # To use the Mediawiki Plugin: + # - Install Text::MediawikiFormat + # - Turn of prefix_directives in your setup file. + # (TODO: we probably don't need to do this anymore?) + # prefix_directives => 1, + # - Add this plugin on Ikiwiki's path (perl -V, look for @INC) + # cp mediawiki.pm something/IkiWiki/Plugin + # - And enable it in your setup file + # add_plugins => [qw{mediawiki}], + # - Finally, turn off the link plugin in setup (this is important) + # disable_plugins => [qw{link}], + # - Rebuild everything (actually, this should be automatic right?) + # - Now all files with a .mediawiki extension should be rendered properly. + + + package IkiWiki::Plugin::mediawiki; + + use warnings; + use strict; + use IkiWiki 2.00; + use URI; + + + # This is a gross hack... We disable the link plugin so that our + # linkify routine is always called. Then we call the link plugin + # directly for all non-mediawiki pages. Ouch... Hopefully Ikiwiki + # will be updated soon to support multiple link plugins. + require IkiWiki::Plugin::link; + + # Even if T:MwF is not installed, we can still handle all the linking. + # The user will just see Mediawiki markup rather than formatted markup. + eval q{use Text::MediawikiFormat ()}; + my $markup_disabled = $@; + + # Work around a UTF8 bug in Text::MediawikiFormat + # http://rt.cpan.org/Public/Bug/Display.html?id=26880 + unless($markup_disabled) { + no strict 'refs'; + no warnings; + *{'Text::MediawikiFormat::uri_escape'} = \&URI::Escape::uri_escape_utf8; + } + + my %metaheaders; # keeps track of redirects for pagetemplate. + my %tags; # keeps track of tags for pagetemplate. + + + sub import { #{{{ + hook(type => "checkconfig", id => "mediawiki", call => \&checkconfig); + hook(type => "scan", id => "mediawiki", call => \&scan); + hook(type => "linkify", id => "mediawiki", call => \&linkify); + hook(type => "htmlize", id => "mediawiki", call => \&htmlize); + hook(type => "pagetemplate", id => "mediawiki", call => \&pagetemplate); + } # }}} + + + sub checkconfig + { + return IkiWiki::Plugin::link::checkconfig(@_); + } + + + my $link_regexp = qr{ + \[\[(?=[^!]) # beginning of link + ([^\n\r\]#|<>]+) # 1: page to link to + (?: + \# # '#', beginning of anchor + ([^|\]]+) # 2: anchor text + )? # optional + + (?: + \| # followed by '|' + ([^\]\|]*) # 3: link text + )? # optional + \]\] # end of link + ([a-zA-Z]*) # optional trailing alphas + }x; + + + # Convert spaces in the passed-in string into underscores. + # If passed in undef, returns undef without throwing errors. + sub underscorize + { + my $var = shift; + $var =~ tr{ }{_} if $var; + return $var; + } + + + # Underscorize, strip leading and trailing space, and scrunch + # multiple runs of spaces into one underscore. + sub scrunch + { + my $var = shift; + if($var) { + $var =~ s/^\s+|\s+$//g; # strip leading and trailing space + $var =~ s/\s+/ /g; # squash multiple spaces to one + } + return $var; + } + + + # Translates Mediawiki paths into Ikiwiki paths. + # It needs to be pretty careful because Mediawiki and Ikiwiki handle + # relative vs. absolute exactly opposite from each other. + sub translate_path + { + my $page = shift; + my $path = scrunch(shift); + + # always start from root unless we're doing relative shenanigans. + $page = "/" unless $path =~ /^(?:\/|\.\.)/; + + my @result = (); + for(split(/\//, "$page/$path")) { + if($_ eq '..') { + pop @result; + } else { + push @result, $_ if $_ ne ""; + } + } + + # temporary hack working around http://ikiwiki.info/bugs/Can__39__t_create_root_page/index.html?updated + # put this back the way it was once this bug is fixed upstream. + # This is actually a major problem because now Mediawiki pages can't link from /Git/git-svn to /git-svn. And upstream appears to be uninterested in fixing this bug. :( + # return "/" . join("/", @result); + return join("/", @result); + } + + + # Figures out the human-readable text for a wikilink + sub linktext + { + my($page, $inlink, $anchor, $title, $trailing) = @_; + my $link = translate_path($page,$inlink); + + # translate_path always produces an absolute link. + # get rid of the leading slash before we display this link. + $link =~ s#^/##; + + my $out = ""; + if($title) { + $out = IkiWiki::pagetitle($title); + } else { + $link = $inlink if $inlink =~ /^\s*\//; + $out = $anchor ? "$link#$anchor" : $link; + if(defined $title && $title eq "") { + # a bare pipe appeared in the link... + # user wants to strip namespace and trailing parens. + $out =~ s/^[A-Za-z0-9_-]*://; + $out =~ s/\s*\(.*\)\s*$//; + } + # A trailing slash suppresses the leading slash + $out =~ s#^/(.*)/$#$1#; + } + $out .= $trailing if defined $trailing; + return $out; + } + + + sub tagpage ($) + { + my $tag=shift; + + if (exists $config{tagbase} && defined $config{tagbase}) { + $tag=$config{tagbase}."/".$tag; + } + + return $tag; + } + + + # Pass a URL and optional text associated with it. This call turns + # it into fully-formatted HTML the same way Mediawiki would. + # Counter is used to number untitled links sequentially on the page. + # It should be set to 1 when you start parsing a new page. This call + # increments it automatically. + sub generate_external_link + { + my $url = shift; + my $text = shift; + my $counter = shift; + + # Mediawiki trims off trailing commas. + # And apparently it does entity substitution first. + # Since we can't, we'll fake it. + + # trim any leading and trailing whitespace + $url =~ s/^\s+|\s+$//g; + + # url properly terminates on > but must special-case > + my $trailer = ""; + $url =~ s{(\&(?:gt|lt)\;.*)$}{ $trailer = $1, ''; }eg; + + # Trim some potential trailing chars, put them outside the link. + my $tmptrail = ""; + $url =~ s{([,)]+)$}{ $tmptrail .= $1, ''; }eg; + $trailer = $tmptrail . $trailer; + + my $title = $url; + if(defined $text) { + if($text eq "") { + $text = "[$$counter]"; + $$counter += 1; + } + $text =~ s/^\s+|\s+$//g; + $text =~ s/^\|//; + } else { + $text = $url; + } + + return "$text$trailer"; + } + + + # Called to handle bookmarks like [[#heading]] or ?#a + sub generate_fragment_link + { + my $url = shift; + my $text = shift; + + my $inurl = $url; + my $intext = $text; + $url = scrunch($url); + + if(defined($text) && $text ne "") { + $text = scrunch($text); + } else { + $text = $url; + } + + $url = underscorize($url); + + # For some reason Mediawiki puts blank titles on all its fragment links. + # I don't see why we would duplicate that behavior here. + return "$text"; + } + + + sub generate_internal_link + { + my($page, $inlink, $anchor, $title, $trailing, $proc) = @_; + + # Ikiwiki's link link plugin wrecks this line when displaying on the site. + # Until the code highlighter plugin can turn off link finding, + # always escape double brackets in double quotes: [[ + if($inlink eq '..') { + # Mediawiki doesn't touch links like [[..#hi|ho]]. + return "[[" . $inlink . ($anchor?"#$anchor":"") . + ($title?"|$title":"") . "]]" . $trailing; + } + + my($linkpage, $linktext); + if($inlink =~ /^ (:?) \s* Category (\s* \: \s*) ([^\]]*) $/x) { + # Handle category links + my $sep = $2; + $inlink = $3; + $linkpage = IkiWiki::linkpage(translate_path($page, $inlink)); + if($1) { + # Produce a link but don't add this page to the given category. + $linkpage = tagpage($linkpage); + $linktext = ($title ? '' : "Category$sep") . + linktext($page, $inlink, $anchor, $title, $trailing); + $tags{$page}{$linkpage} = 1; + } else { + # Add this page to the given category but don't produce a link. + $tags{$page}{$linkpage} = 1; + &$proc(tagpage($linkpage), $linktext, $anchor); + return ""; + } + } else { + # It's just a regular link + $linkpage = IkiWiki::linkpage(translate_path($page, $inlink)); + $linktext = linktext($page, $inlink, $anchor, $title, $trailing); + } + + return &$proc($linkpage, $linktext, $anchor); + } + + + sub check_redirect + { + my %params=@_; + + my $page=$params{page}; + my $destpage=$params{destpage}; + my $content=$params{content}; + + return "" if $page ne $destpage; + + if($content !~ /^ \s* \#REDIRECT \s* \[\[ ( [^\]]+ ) \]\]/x) { + # this page isn't a redirect, render it normally. + return undef; + } + + # The rest of this function is copied from the redir clause + # in meta::preprocess and actually handles the redirect. + + my $value = $1; + $value =~ s/^\s+|\s+$//g; + + my $safe=0; + if ($value !~ /^\w+:\/\//) { + # it's a local link + my ($redir_page, $redir_anchor) = split /\#/, $value; + + add_depends($page, $redir_page); + my $link=bestlink($page, underscorize(translate_path($page,$redir_page))); + if (! length $link) { + return "Redirect Error: [[$redir_page]] not found."; + } + + $value=urlto($link, $page); + $value.='#'.$redir_anchor if defined $redir_anchor; + $safe=1; + + # redir cycle detection + $pagestate{$page}{mediawiki}{redir}=$link; + my $at=$page; + my %seen; + while (exists $pagestate{$at}{mediawiki}{redir}) { + if ($seen{$at}) { + return "Redirect Error: cycle found on [[$at]]"; + } + $seen{$at}=1; + $at=$pagestate{$at}{mediawiki}{redir}; + } + } else { + # it's an external link + $value = encode_entities($value); + } + + my $redir=""; + $redir=scrub($redir) if !$safe; + push @{$metaheaders{$page}}, $redir; + + return "Redirecting to $value ..."; + } + + + # Feed this routine a string containing ... sections, + # this routine calls your callback for every section not within nowikis, + # collecting its return values and returning the rewritten string. + sub skip_nowiki + { + my $content = shift; + my $proc = shift; + + my $result = ""; + my $state = 0; + + for(split(/(]*>.*?<\/nowiki\s*>)/s, $content)) { + $result .= ($state ? $_ : &$proc($_)); + $state = !$state; + } + + return $result; + } + + + # Converts all links in the page, wiki and otherwise. + sub linkify (@) + { + my %params=@_; + + my $page=$params{page}; + my $destpage=$params{destpage}; + my $content=$params{content}; + + my $file=$pagesources{$page}; + my $type=pagetype($file); + my $counter = 1; + + if($type ne 'mediawiki') { + return IkiWiki::Plugin::link::linkify(@_); + } + + my $redir = check_redirect(%params); + return $redir if defined $redir; + + # this code was copied from MediawikiFormat.pm. + # Heavily changed because MF.pm screws up escaping when it does + # this awful hack: $uricCheat =~ tr/://d; + my $schemas = [qw(http https ftp mailto gopher)]; + my $re = join "|", map {qr/\Q$_\E/} @$schemas; + my $schemes = qr/(?:$re)/; + # And this is copied from URI: + my $reserved = q(;/?@&=+$,); # NOTE: no colon or [] ! + my $uric = quotemeta($reserved) . $URI::unreserved . "%#"; + + my $result = skip_nowiki($content, sub { + $_ = shift; + + # Escape any anchors + #s/<(a[\s>\/])/<$1/ig; + # Disabled because this appears to screw up the aggregate plugin. + # I guess we'll rely on Iki to post-sanitize this sort of stuff. + + # Replace external links, http://blah or [http://blah] + s{\b($schemes:[$uric][:$uric]+)|\[($schemes:[$uric][:$uric]+)([^\]]*?)\]}{ + generate_external_link($1||$2, $3, \$counter) + }eg; + + # Handle links that only contain fragments. + s{ \[\[ \s* (\#[^|\]'"<>&;]+) (?:\| ([^\]'"<>&;]*))? \]\] }{ + generate_fragment_link($1, $2) + }xeg; + + # Match all internal links + s{$link_regexp}{ + generate_internal_link($page, $1, $2, $3, $4, sub { + my($linkpage, $linktext, $anchor) = @_; + return htmllink($page, $destpage, $linkpage, + linktext => $linktext, + anchor => underscorize(scrunch($anchor))); + }); + }eg; + + return $_; + }); + + return $result; + } + + + # Find all WikiLinks in the page. + sub scan (@) + { + my %params = @_; + my $page=$params{page}; + my $content=$params{content}; + + my $file=$pagesources{$page}; + my $type=pagetype($file); + + if($type ne 'mediawiki') { + return IkiWiki::Plugin::link::scan(@_); + } + + skip_nowiki($content, sub { + $_ = shift; + while(/$link_regexp/g) { + generate_internal_link($page, $1, '', '', '', sub { + my($linkpage, $linktext, $anchor) = @_; + push @{$links{$page}}, $linkpage; + return undef; + }); + } + return ''; + }); + } + + + # Convert the page to HTML. + sub htmlize (@) + { + my %params=@_; + my $page = $params{page}; + my $content = $params{content}; + + + return $content if $markup_disabled; + + # Do a little preprocessing to babysit Text::MediawikiFormat + # If a line begins with tabs, T:MwF won't convert it into preformatted blocks. + $content =~ s/^\t/ /mg; + + my $ret = Text::MediawikiFormat::format($content, { + + allowed_tags => [#HTML + # MediawikiFormat default + qw(b big blockquote br caption center cite code dd + div dl dt em font h1 h2 h3 h4 h5 h6 hr i li ol p + pre rb rp rt ruby s samp small strike strong sub + sup table td th tr tt u ul var), + # Mediawiki Specific + qw(nowiki), + # Our additions + qw(del ins), # These should have been added all along. + qw(span), # Mediawiki allows span but that's rather scary...? + qw(a), # this is unfortunate; should handle links after rendering the page. + ], + + allowed_attrs => [ + qw(title align lang dir width height bgcolor), + qw(clear), # BR + qw(noshade), # HR + qw(cite), # BLOCKQUOTE, Q + qw(size face color), # FONT + # For various lists, mostly deprecated but safe + qw(type start value compact), + # Tables + qw(summary width border frame rules cellspacing + cellpadding valign char charoff colgroup col + span abbr axis headers scope rowspan colspan), + qw(id class name style), # For CSS + # Our additions + qw(href), + ], + + }, { + extended => 0, + absolute_links => 0, + implicit_links => 0 + }); + + return $ret; + } + + + # This is only needed to support the check_redirect call. + sub pagetemplate (@) + { + my %params = @_; + my $page = $params{page}; + my $destpage = $params{destpage}; + my $template = $params{template}; + + # handle metaheaders for redirects + if (exists $metaheaders{$page} && $template->query(name => "meta")) { + # avoid duplicate meta lines + my %seen; + $template->param(meta => join("\n", grep { (! $seen{$_}) && ($seen{$_}=1) } @{$metaheaders{$page}})); + } + + $template->param(tags => [ + map { + link => htmllink($page, $destpage, tagpage($_), rel => "tag") + }, sort keys %{$tags{$page}} + ]) if exists $tags{$page} && %{$tags{$page}} && $template->query(name => "tags"); + + # It's an rss/atom template. Add any categories. + if ($template->query(name => "categories")) { + if (exists $tags{$page} && %{$tags{$page}}) { + $template->param(categories => [map { category => $_ }, + sort keys %{$tags{$page}}]); + } + } + } + + 1 -- cgit v1.2.3 From ee598e42f61a6afc31f49551a60dff9534f77ee1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 29 Dec 2008 14:58:54 -0500 Subject: some initial instructions for publishing wikis on github --- doc/tips/github.mdwn | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 doc/tips/github.mdwn (limited to 'doc/tips') diff --git a/doc/tips/github.mdwn b/doc/tips/github.mdwn new file mode 100644 index 000000000..cd1b479d1 --- /dev/null +++ b/doc/tips/github.mdwn @@ -0,0 +1,67 @@ +Here's how to set up a static wiki or blog using ikiwiki with no hosting +feeds. Everything is hosted on github, both the git repository and the web +site. Your laptop is used to generate and publish changes to it. + +This is possible because github now supports +[github pages](http://github.com/blog/272-github-pages). + +Note that github limits free accounts to 100 mb of git storage. It's +unlikely that a small wiki or blog will outgrow this, but we are keeping +two copies of the website in git (source and the compiled site), and all +historical versions too. So it could happen. If it does, you can pay github +for more space, or you can migrate your site elsewhere. + +## github setup + +* Go to [github](http://github.com/) and sign up for an account, if you + haven't already. +* Be sure to add your laptop's ssh key to it so you can push + to github. +* Create a repository on githib named `$YOU.github.com`, substituting your + username. This repository will be used to publish your compiled website. +* Create a repository on github named `$YOU` (or anything else you like). + This repository will be used to publish the source of your website. + This is actually optional. + +## local setup + +* On your laptop, create two empty git repositories to correspond to the + github repositories: + YOU=# your github username here + mkdir ~/$YOU.github.com + cd ~/$YOU.github.com + git init + git remote add origin git@github.com:$YOU/$YOU.github.com.git + mkdir ~/$YOU + cd ~/$YOU + git init + git remote add origin git@github.com:$YOU/$YOU.git +* Add some wiki pages, such as an `index.mdwn`, to `~/$YOU`, and check them + in and commit them to git. You need something to push to github. Run + `git push origin master` to push the source pages to github. + +## publishing to github + +* Now build your wiki with a command such as: + ikiwiki ~/$YOU ~/$YOU.github.com --refresh +* Each time you build the wiki you will need to commit the changes + to git, and push the compiled pages to github: + cd ~/YOU.github.com + git add . + git commit -a -m update + git push origin master + +Your wiki will show up at `http://$YOU.github.com/` within ten +minutes after the first push, and changes you push to it from then on +should show up immediatly. + +## enhancements + +You can follow the instructions in [[laptop_wiki_with_git]] to set up an +editable version of your wiki on your laptop. Then you can use the web +interface for editing. You'll still need to follow the instructions above +to publish your changes to github. + +It would also be possible to teach ikiwiki to push compiled pages to github +itself via a plugin, as was done with the [[plugins/amazon_s3]] plugin. Not +done yet! -- cgit v1.2.3 From 794dbd24767c8ca856af22d280e3ce3a41e0d8d7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 31 Dec 2008 14:54:22 -0500 Subject: fix moveprefs transition --- doc/tips/upgrade_to_3.0.mdwn | 2 +- ikiwiki-transition | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index a9664dfc3..8adc040a1 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -21,7 +21,7 @@ setup file, and will no longer appear on the admin preferences page once your wiki is upgraded to 3.0. You can move these preferences into the setup file by running -`ikiwiki-transition moveprefs your.setup` +`ikiwiki-transition moveprefs your.setup; ikiwiki -setup your.setup -refresh -wrappers` (Make sure you have converted the setup file to the new format first.) diff --git a/ikiwiki-transition b/ikiwiki-transition index b15d9f46b..599261a09 100755 --- a/ikiwiki-transition +++ b/ikiwiki-transition @@ -201,10 +201,15 @@ sub moveprefs { foreach my $admin (@{$config{adminuser}}) { my $a=IkiWiki::userinfo_get($admin, $field); if (defined $a && length $a && - $a ne $orig && # might already have been moved - defined $config{$field} && - length $config{$field}) { - $config{$field}=IkiWiki::pagespec_merge($config{$field}, $a); + # might already have been moved + (! defined $orig || $a ne $orig)) { + if (defined $config{$field} && + length $config{$field}) { + $config{$field}=IkiWiki::pagespec_merge($config{$field}, $a); + } + else { + $config{$field}=$a; + } } } } -- cgit v1.2.3 From 56e2854cecd4741e73826264b0752943d4426698 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 31 Dec 2008 15:27:52 -0500 Subject: formatting --- doc/tips/upgrade_to_3.0.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index 8adc040a1..b8a75aeca 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -13,7 +13,7 @@ interface, need the new format setup file. You can convert old setup files into the new format by running `ikiwiki-transition setupformat your.setup` -# moving settings from Preferences page +## moving settings from Preferences page The admin preferences page used to have settings for allowed attachments, locked pages, and banned users. These three settings have moved to the -- cgit v1.2.3 From 1c2da36274b6dba4e8bb25b71a102c0a72a2a562 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Jan 2009 19:30:22 -0500 Subject: update --- doc/tips/upgrade_to_3.0.mdwn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/upgrade_to_3.0.mdwn b/doc/tips/upgrade_to_3.0.mdwn index b8a75aeca..d22813bf2 100644 --- a/doc/tips/upgrade_to_3.0.mdwn +++ b/doc/tips/upgrade_to_3.0.mdwn @@ -37,8 +37,8 @@ following to your setup file: prefix_directives => 0, -To convert to the new syntax, run -`ikiwiki-transition prefix_directives your.setup` +To convert to the new syntax, make sure that your setup file does *not* +contain the above, then run `ikiwiki-transition prefix_directives your.setup` (And then commit the changes it makes to pages in your srcdir.) -- cgit v1.2.3 From 7b1026b1a803e160c360ee8f4d19004b466f8b7c Mon Sep 17 00:00:00 2001 From: tobias_verbeke Date: Sun, 11 Jan 2009 16:04:32 -0500 Subject: --- doc/tips/markdown_and_eclipse.mdwn | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 doc/tips/markdown_and_eclipse.mdwn (limited to 'doc/tips') diff --git a/doc/tips/markdown_and_eclipse.mdwn b/doc/tips/markdown_and_eclipse.mdwn new file mode 100644 index 000000000..9e8e9bfa9 --- /dev/null +++ b/doc/tips/markdown_and_eclipse.mdwn @@ -0,0 +1,4 @@ +For people that were not born with GNU emacs fingers, +there is a markdown editor (with preview and outline) +for [eclipse](http://www.eclipse.org) available +[here](http://www.winterwell.com/software/markdown-editor.php). -- cgit v1.2.3 From 7491b7de112cbf9c6159a03df63eb64b5100b1fc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 12 Jan 2009 19:16:12 -0500 Subject: update --- doc/tips/apache_cgi.mdwn | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/apache_cgi.mdwn b/doc/tips/apache_cgi.mdwn index f10baed2e..3ceb0e182 100644 --- a/doc/tips/apache_cgi.mdwn +++ b/doc/tips/apache_cgi.mdwn @@ -1,9 +1,9 @@ -Many ikiwiki examples name the [[cgi]] "ikiwiki.cgi", and put it somewhere +It's common to name the [[cgi]] "ikiwiki.cgi", and put it somewhere like `~/public_html/ikiwiki.cgi`, or `/var/www/wiki/ikiwiki.cgi`. -If you follow those examples, you may find that when trying to edit a page -in your wiki, you see the raw contents of the ikiwiki.cgi program. Or get a -permission denied problem. +If you do that, you may find that when trying to edit a page in your wiki, +you see the raw contents of the ikiwiki.cgi program. Or get a permission +denied problem. This is because apache is generally not configured to run cgi scripts unless they're in `/usr/lib/cgi-bin/`. While you can put ikiwiki.cgi in -- cgit v1.2.3 From 756197f30fb735f92a44527fce2689a9c0ab058e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 12 Jan 2009 20:01:03 -0500 Subject: combine two pages --- ...ki__44___gitosis_and_apache2_in_Debian_Sid.mdwn | 2 +- doc/setup.mdwn | 3 +- doc/tips/apache_cgi.mdwn | 25 ----------- doc/tips/dot_cgi.mdwn | 50 ++++++++++++++++++++++ doc/tips/laptop_wiki_with_git.mdwn | 2 +- doc/tips/lighttpd_cgi.mdwn | 15 ------- 6 files changed, 53 insertions(+), 44 deletions(-) delete mode 100644 doc/tips/apache_cgi.mdwn create mode 100644 doc/tips/dot_cgi.mdwn delete mode 100644 doc/tips/lighttpd_cgi.mdwn (limited to 'doc/tips') diff --git a/doc/forum/multi-user_setup_of_ikiwiki__44___gitosis_and_apache2_in_Debian_Sid.mdwn b/doc/forum/multi-user_setup_of_ikiwiki__44___gitosis_and_apache2_in_Debian_Sid.mdwn index d42a5c704..fa8b5010e 100644 --- a/doc/forum/multi-user_setup_of_ikiwiki__44___gitosis_and_apache2_in_Debian_Sid.mdwn +++ b/doc/forum/multi-user_setup_of_ikiwiki__44___gitosis_and_apache2_in_Debian_Sid.mdwn @@ -43,7 +43,7 @@ In the end, I did the following. I created a directory /srv/ikiwiki/ which is ow ## cgi_wrapper -I do not understand those wrappers completely. The cgi is a script, which can be called by a webserver, e. g. [[Apache_2|/tips/apache_cgi]]. But www-data is normally not allowed to write to the source directory (which is owned by gitosis or push to the repository). Therefore it should be run as the user gitosis. And because cgi scripts can not be made suid, I wrapper (in this case a C program) is created (cgi\_wrapper) which can be made suid and therefore be run as the user gitosis. Is this correct? +I do not understand those wrappers completely. The cgi is a script, which can be called by a webserver, e. g. [[Apache_2|/tips/dot_cgi]]. But www-data is normally not allowed to write to the source directory (which is owned by gitosis or push to the repository). Therefore it should be run as the user gitosis. And because cgi scripts can not be made suid, I wrapper (in this case a C program) is created (cgi\_wrapper) which can be made suid and therefore be run as the user gitosis. Is this correct? > It seems to me like you understand the wrapper pretty well. It's main reson to exist is to safely be suid, yes. diff --git a/doc/setup.mdwn b/doc/setup.mdwn index 8d4d55cab..89444c9a8 100644 --- a/doc/setup.mdwn +++ b/doc/setup.mdwn @@ -47,8 +47,7 @@ Now you can go to the url it told you, and edit pages in your new wiki using the web interface. (If the web interface doesn't seem to allow editing or login, you may -need to configure [[apache|tips/apache_cgi]] or -[[lighttpd|tips/lighttpd_cgi]].) +need to configure [[configure_the_web_server|tips/dot_cgi]].) ## Checkout and edit wiki source diff --git a/doc/tips/apache_cgi.mdwn b/doc/tips/apache_cgi.mdwn deleted file mode 100644 index 3ceb0e182..000000000 --- a/doc/tips/apache_cgi.mdwn +++ /dev/null @@ -1,25 +0,0 @@ -It's common to name the [[cgi]] "ikiwiki.cgi", and put it somewhere -like `~/public_html/ikiwiki.cgi`, or `/var/www/wiki/ikiwiki.cgi`. - -If you do that, you may find that when trying to edit a page in your wiki, -you see the raw contents of the ikiwiki.cgi program. Or get a permission -denied problem. - -This is because apache is generally not configured to run cgi scripts -unless they're in `/usr/lib/cgi-bin/`. While you can put ikiwiki.cgi in -there if you like, here's how to configure apache (version 2) to run `.cgi` -programs from anywhere. - -These instructions are for Debian systems, but the basic apache -configuration should work anywhere. - -* Edit /etc/apache2/apache2.conf and add a line like this: - - AddHandler cgi-script .cgi - -* Find the "Options" line for the directory where you've put the - ikiwiki.cgi, and add "ExecCGI" to the list of options. For example, if - ikiwiki.cgi is in /var/www/, edit `/etc/apache2/sites-enabled/000-default` - and add it to the "Options" line in the "Directory /var/www/" stanza. - Or, if you've put it in a `~/public_html`, edit - `/etc/apache2/mods-available/userdir.conf`. diff --git a/doc/tips/dot_cgi.mdwn b/doc/tips/dot_cgi.mdwn new file mode 100644 index 000000000..fbc3d8bbc --- /dev/null +++ b/doc/tips/dot_cgi.mdwn @@ -0,0 +1,50 @@ +It's common to name the [[cgi]] "ikiwiki.cgi", and put it somewhere +like `~/public_html/ikiwiki.cgi`, or `/var/www/wiki/ikiwiki.cgi`. + +If you do that, you may find that when trying to edit a page in your wiki, +you see the raw contents of the ikiwiki.cgi program. Or get a permission +denied problem. + +This is because web servers are generally not configured to run cgi scripts +unless they're in `/usr/lib/cgi-bin/`. While you can put ikiwiki.cgi in +there if you like, it's better to configure your web server to +run `.cgi` programs from anywhere. + +These instructions are for Debian systems, but the basic +configuration changes should work anywhere. + +## apache 2 + +* Edit /etc/apache2/apache2.conf and add a line like this: + + AddHandler cgi-script .cgi + +* Find the "Options" line for the directory where you've put the + ikiwiki.cgi, and add "ExecCGI" to the list of options. For example, if + ikiwiki.cgi is in /var/www/, edit `/etc/apache2/sites-enabled/000-default` + and add it to the "Options" line in the "Directory /var/www/" stanza. + Or, if you've put it in a `~/public_html`, edit + `/etc/apache2/mods-available/userdir.conf`. + +## lighttpd + +Here is how to enable cgi on [lighttpd](http://www.lighttpd.net/) and +configure it in order to execute ikiwiki.cgi wherever it is located. + +* Activate cgi by linking `/etc/lighttpd/conf-available/10-cgi.conf` into `/etc/lighttpd/conf-enabled` ([doc](http://trac.lighttpd.net/trac/wiki/Docs%3AModCGI)). + +* Create `/etc/lighttpd/conf-available/90-ikiwiki-cgi.conf` and add a line like this: + + cgi.assign = ( "ikiwiki.cgi" => "", ) + +* Activate ikiwiki-cgi by linking `/etc/lighttpd/conf-available/90-ikiwiki-cgi.conf` into `/etc/lighttpd/conf-enabled`. + +* Restart lighttpd server with something like `/etc/init.d/lighttpd restart`. + +Note that the first part enables cgi server wide but depending on default +configuration, it may be not enough. The second part creates a specific +rule that allow `ikiwiki.cgi` to be executed. + +**Warning:** I only use this on my development server (offline). I am not +sure of how secure this approach is. If you have any thought about it, feel +free to let me know. diff --git a/doc/tips/laptop_wiki_with_git.mdwn b/doc/tips/laptop_wiki_with_git.mdwn index 998ac7443..9758beb80 100644 --- a/doc/tips/laptop_wiki_with_git.mdwn +++ b/doc/tips/laptop_wiki_with_git.mdwn @@ -15,7 +15,7 @@ for setting up ikiwiki with git. Next, `git clone` the source (`$REPOSITORY`, not `$SRCDIR`) from the server to the laptop. -Now, set up a [[web_server|apache_cgi]] on your laptop, if it doesn't +Now, set up a [[web_server|dot_cgi]] on your laptop, if it doesn't already have one. Now you need to write a setup file for ikiwiki on the laptop. Mostly this diff --git a/doc/tips/lighttpd_cgi.mdwn b/doc/tips/lighttpd_cgi.mdwn deleted file mode 100644 index 5504b0658..000000000 --- a/doc/tips/lighttpd_cgi.mdwn +++ /dev/null @@ -1,15 +0,0 @@ -Here is how to enable cgi on [lighttpd](http://www.lighttpd.net/) and configure it in order to execute ikiwiki.cgi wherever it is located. - -* Activate cgi by linking `/etc/lighttpd/conf-available/10-cgi.conf` into `/etc/lighttpd/conf-enabled` ([doc](http://trac.lighttpd.net/trac/wiki/Docs%3AModCGI)). - -* Create `/etc/lighttpd/conf-available/90-ikiwiki-cgi.conf` and add a line like this: - - cgi.assign = ( "ikiwiki.cgi" => "", ) - -* Activate ikiwiki-cgi by linking `/etc/lighttpd/conf-available/90-ikiwiki-cgi.conf` into `/etc/lighttpd/conf-enabled`. - -* Restart lighttpd server with something like `/etc/init.d/lighttpd restart`. - -Note that the first part enables cgi server wide but depending on default configuration, it may be not enough. The second part creates a specific rule that allow `ikiwiki.cgi` to be executed. - -**Warning:** I only use this on my development server (offline). I am not sure of how secure this approach is. If you have any thought about it, feel free to let me know. -- cgit v1.2.3 From e5c8bc6222712fe9f465d4ac36350fd4ea729787 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 Jan 2009 19:10:48 -0500 Subject: doc updates for goto branch merge --- debian/changelog | 10 ++++++++++ debian/copyright | 4 ++++ doc/tips/dot_cgi.mdwn | 8 ++++++++ doc/todo/apache_404_ErrorDocument_handler.mdwn | 2 ++ doc/todo/generic___39__do__61__goto__39___for_CGI.mdwn | 2 ++ 5 files changed, 26 insertions(+) (limited to 'doc/tips') diff --git a/debian/changelog b/debian/changelog index 82a23212b..f3927f121 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +ikiwiki (3.04) UNRELEASED; urgency=low + + * apache404: New plugin which lets you use the IkiWiki CGI script as + an Apache 404 handler, to give the behaviour of various other wiki + engines where visiting a nonexistent page provides you with a link + to create it. (smcv) + * Factor out redundant code into goto plugin. (smcv) + + -- Joey Hess Sat, 31 Jan 2009 19:04:45 -0500 + ikiwiki (3.03) unstable; urgency=low * Avoid feeding decoded unicode to Term::ReadLine. Closes: 512169 diff --git a/debian/copyright b/debian/copyright index 71fb47013..bdfbaa573 100644 --- a/debian/copyright +++ b/debian/copyright @@ -118,6 +118,10 @@ Copyright: © 2008 Simon McVittie License: GPL-2+ +Files: apache404.pm +Copyright: © 2009 Simon McVittie +License: GPL-2+ + Files: doc/logo/* Copyright: © 2006 Recai Oktaş License: GPL-2+ diff --git a/doc/tips/dot_cgi.mdwn b/doc/tips/dot_cgi.mdwn index fbc3d8bbc..ffcbf95d4 100644 --- a/doc/tips/dot_cgi.mdwn +++ b/doc/tips/dot_cgi.mdwn @@ -26,6 +26,14 @@ configuration changes should work anywhere. Or, if you've put it in a `~/public_html`, edit `/etc/apache2/mods-available/userdir.conf`. +You may also want to enable the [[plugins/apache404]] +plugin. To make apache use it, the apache config file +will need a further modification to make it use ikiwiki's CGI +as the apache 404 handler. Something like this, with +the path adjusted to where you've put the CGI: + + ErrorDocument 404 /cgi-bin/ikiwiki.cgi + ## lighttpd Here is how to enable cgi on [lighttpd](http://www.lighttpd.net/) and diff --git a/doc/todo/apache_404_ErrorDocument_handler.mdwn b/doc/todo/apache_404_ErrorDocument_handler.mdwn index b580294ca..4ae1d1a79 100644 --- a/doc/todo/apache_404_ErrorDocument_handler.mdwn +++ b/doc/todo/apache_404_ErrorDocument_handler.mdwn @@ -21,3 +21,5 @@ error output needs to be at least 512 bytes long, so some padding might also be Implemented in the 'goto' branch in my git repository. You can see this feature in action [on my blog](http://smcv.pseudorandom.co.uk/no/such/page/). --[[smcv]] + +[[done]] diff --git a/doc/todo/generic___39__do__61__goto__39___for_CGI.mdwn b/doc/todo/generic___39__do__61__goto__39___for_CGI.mdwn index 4bf3fb449..26c5202d0 100644 --- a/doc/todo/generic___39__do__61__goto__39___for_CGI.mdwn +++ b/doc/todo/generic___39__do__61__goto__39___for_CGI.mdwn @@ -31,3 +31,5 @@ something, and moved to `IkiWiki/CGI.pm`? >>> No, good point - the `REDIRECT_STATUS` check is sufficiently unambiguous >>> already. Fixed. --[[smcv]] + +[[done]] -- cgit v1.2.3 From 3b83e520182a83e4ae6c61ab7b360b0eb939469f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 31 Jan 2009 19:26:36 -0500 Subject: rename apache404 -> 404 This may already work with other web servers that have copied apache's interface, and it should be easy to add support to it for web servers that use some other interface. So, make the name more general. --- IkiWiki/Plugin/404.pm | 77 +++++++++++++++++++++++++++++++++++++++++++++ IkiWiki/Plugin/apache404.pm | 77 --------------------------------------------- debian/changelog | 2 +- debian/copyright | 2 +- doc/plugins/404.mdwn | 11 +++++++ doc/plugins/apache404.mdwn | 11 ------- doc/plugins/goto.mdwn | 2 +- doc/tips/dot_cgi.mdwn | 9 +++--- t/404.t | 44 ++++++++++++++++++++++++++ t/apache404.t | 45 -------------------------- 10 files changed, 139 insertions(+), 141 deletions(-) create mode 100644 IkiWiki/Plugin/404.pm delete mode 100644 IkiWiki/Plugin/apache404.pm create mode 100644 doc/plugins/404.mdwn delete mode 100644 doc/plugins/apache404.mdwn create mode 100755 t/404.t delete mode 100755 t/apache404.t (limited to 'doc/tips') diff --git a/IkiWiki/Plugin/404.pm b/IkiWiki/Plugin/404.pm new file mode 100644 index 000000000..5550ea7d1 --- /dev/null +++ b/IkiWiki/Plugin/404.pm @@ -0,0 +1,77 @@ +#!/usr/bin/perl +# Copyright © 2009 Simon McVittie +# Licensed under the GNU GPL, version 2, or any later version published by the +# Free Software Foundation +package IkiWiki::Plugin::404; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "cgi", id => '404', call => \&cgi); + IkiWiki::loadplugin("goto"); +} + +sub getsetup () { + return + plugin => { + # not really a matter of safety, but enabling/disabling + # through a web interface is useless - it needs web + # server admin action too + safe => 0, + rebuild => 0, + } +} + +sub cgi_page_from_404 ($$$) { + my $path = shift; + my $baseurl = shift; + my $usedirs = shift; + + # fail if missing from environment or whatever + return undef unless defined $path; + return undef unless defined $baseurl; + + # with usedirs on, path is like /~fred/foo/bar/ or /~fred/foo/bar or + # /~fred/foo/bar/index.html + # with usedirs off, path is like /~fred/foo/bar.html + # baseurl is like 'http://people.example.com/~fred' + + # convert baseurl to ~fred + unless ($baseurl =~ s{^https?://[^/]+/?}{}) { + return undef; + } + + # convert path to /~fred/foo/bar + if ($usedirs) { + $path =~ s/\/*(?:index\.$config{htmlext})?$//; + } + else { + $path =~ s/\.$config{htmlext}$//; + } + + # remove /~fred/ + unless ($path =~ s{^/*\Q$baseurl\E/*}{}) { + return undef; + } + + # special case for the index + unless ($path) { + return 'index'; + } + + return $path; +} + +sub cgi ($) { + my $cgi=shift; + + if ($ENV{REDIRECT_STATUS} eq '404') { + my $page = cgi_page_from_404($ENV{REDIRECT_URL}, + $config{url}, $config{usedirs}); + IkiWiki::Plugin::goto::cgi_goto($cgi, $page); + } +} + +1; diff --git a/IkiWiki/Plugin/apache404.pm b/IkiWiki/Plugin/apache404.pm deleted file mode 100644 index e7ce70435..000000000 --- a/IkiWiki/Plugin/apache404.pm +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/perl -# Copyright © 2009 Simon McVittie -# Licensed under the GNU GPL, version 2, or any later version published by the -# Free Software Foundation -package IkiWiki::Plugin::apache404; - -use warnings; -use strict; -use IkiWiki 3.00; - -sub import { - hook(type => "cgi", id => 'apache404', call => \&cgi); - IkiWiki::loadplugin("goto"); -} - -sub getsetup () { - return - plugin => { - # not really a matter of safety, but enabling/disabling - # through a web interface is useless - it needs web - # server admin action too - safe => 0, - rebuild => 0, - } -} - -sub cgi_page_from_404 ($$$) { - my $path = shift; - my $baseurl = shift; - my $usedirs = shift; - - # fail if missing from environment or whatever - return undef unless defined $path; - return undef unless defined $baseurl; - - # with usedirs on, path is like /~fred/foo/bar/ or /~fred/foo/bar or - # /~fred/foo/bar/index.html - # with usedirs off, path is like /~fred/foo/bar.html - # baseurl is like 'http://people.example.com/~fred' - - # convert baseurl to ~fred - unless ($baseurl =~ s{^https?://[^/]+/?}{}) { - return undef; - } - - # convert path to /~fred/foo/bar - if ($usedirs) { - $path =~ s/\/*(?:index\.$config{htmlext})?$//; - } - else { - $path =~ s/\.$config{htmlext}$//; - } - - # remove /~fred/ - unless ($path =~ s{^/*\Q$baseurl\E/*}{}) { - return undef; - } - - # special case for the index - unless ($path) { - return 'index'; - } - - return $path; -} - -sub cgi ($) { - my $cgi=shift; - - if ($ENV{REDIRECT_STATUS} eq '404') { - my $page = cgi_page_from_404($ENV{REDIRECT_URL}, - $config{url}, $config{usedirs}); - IkiWiki::Plugin::goto::cgi_goto($cgi, $page); - } -} - -1; diff --git a/debian/changelog b/debian/changelog index f3927f121..be32d3abf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ ikiwiki (3.04) UNRELEASED; urgency=low - * apache404: New plugin which lets you use the IkiWiki CGI script as + * 404: New plugin which lets you use the IkiWiki CGI script as an Apache 404 handler, to give the behaviour of various other wiki engines where visiting a nonexistent page provides you with a link to create it. (smcv) diff --git a/debian/copyright b/debian/copyright index bdfbaa573..f589b4a8f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -118,7 +118,7 @@ Copyright: © 2008 Simon McVittie License: GPL-2+ -Files: apache404.pm +Files: 404.pm Copyright: © 2009 Simon McVittie License: GPL-2+ diff --git a/doc/plugins/404.mdwn b/doc/plugins/404.mdwn new file mode 100644 index 000000000..8d36279c8 --- /dev/null +++ b/doc/plugins/404.mdwn @@ -0,0 +1,11 @@ +[[!template id=plugin name=404 author="[[Simon_McVittie|smcv]]"]] +[[!tag type/useful]] + +This plugin lets you use the IkiWiki CGI script as an Apache 404 handler, +to give the behaviour of various other wiki engines where visiting a +nonexistent page provides you with a link to create it. + +To achieve this, put something like this in the wiki's Apache configuration +file: + + ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/doc/plugins/apache404.mdwn b/doc/plugins/apache404.mdwn deleted file mode 100644 index bab8fb59d..000000000 --- a/doc/plugins/apache404.mdwn +++ /dev/null @@ -1,11 +0,0 @@ -[[!template id=plugin name=apache404 author="[[Simon_McVittie|smcv]]"]] -[[!tag type/useful]] - -This plugin lets you use the IkiWiki CGI script as an Apache 404 handler, -to give the behaviour of various other wiki engines where visiting a -nonexistent page provides you with a link to create it. - -To achieve this, put something like this in the wiki's Apache configuration -file: - - ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/doc/plugins/goto.mdwn b/doc/plugins/goto.mdwn index 21dda16b2..9c401c5d2 100644 --- a/doc/plugins/goto.mdwn +++ b/doc/plugins/goto.mdwn @@ -2,7 +2,7 @@ [[!tag type/useful]] This plugin adds a `do=goto` mode for the IkiWiki CGI script. It's mainly -for internal use by the [[apache404]], [[comments]] and [[recentchanges]] +for internal use by the [[404]], [[comments]] and [[recentchanges]] plugins, which enable it automatically. With this plugin enabled you can link to `ikiwiki.cgi?do=goto&page=some/where` diff --git a/doc/tips/dot_cgi.mdwn b/doc/tips/dot_cgi.mdwn index ffcbf95d4..04d7a9721 100644 --- a/doc/tips/dot_cgi.mdwn +++ b/doc/tips/dot_cgi.mdwn @@ -26,11 +26,10 @@ configuration changes should work anywhere. Or, if you've put it in a `~/public_html`, edit `/etc/apache2/mods-available/userdir.conf`. -You may also want to enable the [[plugins/apache404]] -plugin. To make apache use it, the apache config file -will need a further modification to make it use ikiwiki's CGI -as the apache 404 handler. Something like this, with -the path adjusted to where you've put the CGI: +* You may also want to enable the [[plugins/404]] plugin. + To make apache use it, the apache config file will need a further + modification to make it use ikiwiki's CGI as the apache 404 handler. + Something like this, with the path adjusted to where you've put the CGI: ErrorDocument 404 /cgi-bin/ikiwiki.cgi diff --git a/t/404.t b/t/404.t new file mode 100755 index 000000000..0bb3c6063 --- /dev/null +++ b/t/404.t @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use warnings; +use strict; +use Test::More tests => 17; + +BEGIN { use_ok("IkiWiki::Plugin::404"); } + +sub cgi_page_from_404 { + return IkiWiki::Plugin::404::cgi_page_from_404(shift, shift, shift); +} + +$IkiWiki::config{htmlext} = 'html'; + +is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); +is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); +is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), + 'foo/bar'); +is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), + 'foo/bar'); + +is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), + 'foo'); +is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), + 'foo'); diff --git a/t/apache404.t b/t/apache404.t deleted file mode 100755 index 00fc35250..000000000 --- a/t/apache404.t +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -use warnings; -use strict; -use Test::More tests => 17; - -BEGIN { use_ok("IkiWiki::Plugin::apache404"); } - -sub cgi_page_from_404 { - return IkiWiki::Plugin::apache404::cgi_page_from_404(shift, shift, - shift); -} - -$IkiWiki::config{htmlext} = 'html'; - -is(cgi_page_from_404('/', 'http://example.com', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com', 0), 'index'); -is(cgi_page_from_404('/', 'http://example.com/', 1), 'index'); -is(cgi_page_from_404('/index.html', 'http://example.com/', 0), 'index'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo/bar', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/index.html', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar/', 'http://example.com/~user/', 1), - 'foo/bar'); -is(cgi_page_from_404('/~user/foo/bar.html', 'http://example.com/~user/', 0), - 'foo/bar'); - -is(cgi_page_from_404('/~user/foo', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/index.html', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo/', 'https://example.com/~user', 1), - 'foo'); -is(cgi_page_from_404('/~user/foo.html', 'https://example.com/~user', 0), - 'foo'); -- cgit v1.2.3 From 1de639aded7ca8d7b9ecd200351ad04a3dd08446 Mon Sep 17 00:00:00 2001 From: "http://dmarti.myopenid.com/" Date: Sun, 8 Feb 2009 13:32:12 -0500 Subject: fix typo --- doc/tips/github.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/tips') diff --git a/doc/tips/github.mdwn b/doc/tips/github.mdwn index cd1b479d1..974d572f1 100644 --- a/doc/tips/github.mdwn +++ b/doc/tips/github.mdwn @@ -1,5 +1,5 @@ Here's how to set up a static wiki or blog using ikiwiki with no hosting -feeds. Everything is hosted on github, both the git repository and the web +fees. Everything is hosted on github, both the git repository and the web site. Your laptop is used to generate and publish changes to it. This is possible because github now supports -- cgit v1.2.3 From 2d6bbdcf3f0878a870ce63a02f38eb8b95f0932e Mon Sep 17 00:00:00 2001 From: PaulePanter Date: Wed, 4 Mar 2009 05:48:18 -0500 Subject: typo and typography --- doc/tips/howto_avoid_flooding_aggregators.mdwn | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/howto_avoid_flooding_aggregators.mdwn b/doc/tips/howto_avoid_flooding_aggregators.mdwn index 98cef9249..e45b96689 100644 --- a/doc/tips/howto_avoid_flooding_aggregators.mdwn +++ b/doc/tips/howto_avoid_flooding_aggregators.mdwn @@ -1,27 +1,27 @@ If you have a [[blog]] that is aggregated, either on a site like Planet Debian, or just through user subscriptions, one common problem is that -changes to the guids of items in the blog can "flood" the aggregator, +changes to the guids of items in the blog can “flood” the aggregator, causing all recent blog entries to be posted to the top of it. This can happen in a lot of situations: -* Perhaps you've just switched to ikiwiki from some other blog engine and +* Perhaps you’ve just switched to ikiwiki from some other blog engine and imported your data. -* Perhaps you've turned on the `usedirs` setting, which changes all the +* Perhaps you’ve turned on the `usedirs` setting, which changes all the urls in your wiki. Even if you set up [[redirections|redirections_for_usedirs]] for the old urls, you still face the issue of flooding aggregators. -* Perhaps you've just moved stuff around in your wiki. +* Perhaps you’ve just moved stuff around in your wiki. -To avoid annoying readers in these situations, it's a good idea to remove -any existing items from your blog's news feed. That way only new items will +To avoid annoying readers in these situations, it’s a good idea to remove +any existing items from your blog’s news feed. That way only new items will show up in the aggregator. The best way to do this is to add a `feedpages` parameter to the `inline` directive for your blog, with a condition such as: feedpages=created_after(blog/posts/old_post) -Where "old_post" is the name of the last post you made to the blog before -making the change. This will limit the feed to only newer posts, while stil +Where “old_post” is the name of the last post you made to the blog before +making the change. This will limit the feed to only newer posts, while still displaying the old posts in the blog page. Alternatively, you can add the [[plugins/meta]] guid directives to pages, -- cgit v1.2.3 From 638cef639d97ff9065e8a05f1a7923c0d51d6de4 Mon Sep 17 00:00:00 2001 From: simonraven Date: Sun, 29 Mar 2009 01:28:16 -0400 Subject: minor formatting tweaks --- doc/tips/github.mdwn | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/github.mdwn b/doc/tips/github.mdwn index 974d572f1..0a76166ee 100644 --- a/doc/tips/github.mdwn +++ b/doc/tips/github.mdwn @@ -26,16 +26,16 @@ for more space, or you can migrate your site elsewhere. ## local setup * On your laptop, create two empty git repositories to correspond to the - github repositories: - YOU=# your github username here - mkdir ~/$YOU.github.com - cd ~/$YOU.github.com - git init - git remote add origin git@github.com:$YOU/$YOU.github.com.git - mkdir ~/$YOU - cd ~/$YOU - git init - git remote add origin git@github.com:$YOU/$YOU.git + github repositories:
+ `YOU = your github username here`
+ `mkdir ~/$YOU.github.com`
+ `cd ~/$YOU.github.com`
+ `git init`
+ `git remote add origin git@github.com:$YOU/$YOU.github.com.git`
+ `mkdir ~/$YOU`
+ `cd ~/$YOU`
+ `git init`
+ `git remote add origin git@github.com:$YOU/$YOU.git`
* Add some wiki pages, such as an `index.mdwn`, to `~/$YOU`, and check them in and commit them to git. You need something to push to github. Run `git push origin master` to push the source pages to github. -- cgit v1.2.3 From d9364685baf6f35af44a658ab93206afa8397c6d Mon Sep 17 00:00:00 2001 From: simonraven Date: Sun, 29 Mar 2009 01:33:40 -0400 Subject: bit more tweakiness --- doc/tips/github.mdwn | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'doc/tips') diff --git a/doc/tips/github.mdwn b/doc/tips/github.mdwn index 0a76166ee..c3fdab734 100644 --- a/doc/tips/github.mdwn +++ b/doc/tips/github.mdwn @@ -11,22 +11,19 @@ two copies of the website in git (source and the compiled site), and all historical versions too. So it could happen. If it does, you can pay github for more space, or you can migrate your site elsewhere. -## github setup +## Github Setup -* Go to [github](http://github.com/) and sign up for an account, if you - haven't already. -* Be sure to add your laptop's ssh key to it so you can push - to github. -* Create a repository on githib named `$YOU.github.com`, substituting your - username. This repository will be used to publish your compiled website. +* Go to [github](http://github.com/) and sign up for an account, if you haven't already. +* Be sure to add your laptop's ssh key to it so you can push to github. +* Create a repository on github named `$YOU.github.com`, substituting your + *username*. This repository will be used to publish your compiled website. * Create a repository on github named `$YOU` (or anything else you like). This repository will be used to publish the source of your website. This is actually optional. -## local setup +## Local Setup -* On your laptop, create two empty git repositories to correspond to the - github repositories:
+* On your laptop, create two empty git repositories to correspond to the github repositories:
`YOU = your github username here`
`mkdir ~/$YOU.github.com`
`cd ~/$YOU.github.com`
@@ -40,22 +37,22 @@ for more space, or you can migrate your site elsewhere. in and commit them to git. You need something to push to github. Run `git push origin master` to push the source pages to github. -## publishing to github +## Publishing to Github -* Now build your wiki with a command such as: - ikiwiki ~/$YOU ~/$YOU.github.com --refresh +* Now build your wiki with a command such as:
+ `ikiwiki ~/$YOU ~/$YOU.github.com --refresh` * Each time you build the wiki you will need to commit the changes - to git, and push the compiled pages to github: - cd ~/YOU.github.com - git add . - git commit -a -m update - git push origin master + to git, and push the compiled pages to github:
+ `cd ~/YOU.github.com`
+ `git add .`
+ `git commit -a -m update`
+ `git push origin master`
Your wiki will show up at `http://$YOU.github.com/` within ten minutes after the first push, and changes you push to it from then on -should show up immediatly. +should show up immediately. -## enhancements +## Enhancements You can follow the instructions in [[laptop_wiki_with_git]] to set up an editable version of your wiki on your laptop. Then you can use the web -- cgit v1.2.3