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 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 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