diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2009-05-19 13:07:47 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-05-19 13:07:47 -0400 |
commit | ef003f48f4a3fe8fb67fda62c70a299b07d75976 (patch) | |
tree | cb5972026e6beed91b5eca2fa4962790244062bd /doc/tips | |
parent | 53b1c6f559c1d09fbdbc28c8e4d5090dd455cd26 (diff) | |
parent | 4c5987d150b26f638494638f7861fb7646542a37 (diff) |
Merge branch 'master' into po
Conflicts:
debian/changelog
Diffstat (limited to 'doc/tips')
-rw-r--r-- | doc/tips/DreamHost/discussion.mdwn | 2 | ||||
-rw-r--r-- | doc/tips/Importing_posts_from_Wordpress/discussion.mdwn | 19 | ||||
-rw-r--r-- | doc/tips/add_chatterbox_to_blog/discussion.mdwn | 18 | ||||
-rw-r--r-- | doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn | 2 | ||||
-rw-r--r-- | doc/tips/dot_cgi.mdwn | 6 | ||||
-rw-r--r-- | doc/tips/dot_cgi/discussion.mdwn | 36 | ||||
-rw-r--r-- | doc/tips/importing_posts_from_wordpress/ikiwiki-wordpress-import.mdwn | 136 |
7 files changed, 191 insertions, 28 deletions
diff --git a/doc/tips/DreamHost/discussion.mdwn b/doc/tips/DreamHost/discussion.mdwn index 03ed78700..74f48938e 100644 --- a/doc/tips/DreamHost/discussion.mdwn +++ b/doc/tips/DreamHost/discussion.mdwn @@ -1,3 +1,5 @@ I managed to install ikiwiki on eggplant farms, with most basic features except markdown. I think ikiwiki is more suitable for VPS/dedicated server. Shared hosting doesn't fit. + +I just (2009/04/27) installed ikiwiki on DreamHost and the CPAN instructions here are unnecessarily complicated. I used "cpan" instead of "perl -MCPAN -e shell" and had no trouble with that portion of the install. --[[schmonz]] diff --git a/doc/tips/Importing_posts_from_Wordpress/discussion.mdwn b/doc/tips/Importing_posts_from_Wordpress/discussion.mdwn index 55e04d9cb..09e6f6742 100644 --- a/doc/tips/Importing_posts_from_Wordpress/discussion.mdwn +++ b/doc/tips/Importing_posts_from_Wordpress/discussion.mdwn @@ -24,21 +24,6 @@ git-fast-import statistics: etc. +(Removed now dead info and blah blah.) -> Well, if this really is a script error, it's not really the script, but the wordpress XML dump, referring to a -> possible malformed or invalid unicode character in the dump file. This is what I can gather from other scripts. -> I'll be checking my dump file shortly. - ->> This is only part of the problem... I'm not exactly sure what's going on, and it's get late/early for me.... - ->>> I used --force for fast-import, but then everything seems deleted, so you end up doing a reset, checkout, add, *then* commit. ->>> Seems really odd. I edited the script however, maybe this is why... this is my changes: - - -print "data %d" % len(data) - +print "data %d merge refs/heads/%s" % (len(data), branch) - ->>> That control character is a ^q^0 in emacs, see git fast-import --help for more info. ->>> I'll be trying an import *without* that change, to see what happens. - ->>>> I still have to do the above to preserve the changes done by this script... (removed previous note). - +> It works fine.... The script is picky about having everything in proper UTF-8, **and** proper XML and HTML escaping. You need that to have a successful import. I let Emacs remove DOS line endings, and it works OK (if on *nix of some sort, of course). Thing is with this `git fast-import`, is that you have to `git reset` afterwards, (let's say you put them in posts/) `git checkout posts`, `git add posts`, then commit. I don't know if this a characteristic with `git fast-import`, but this is the way I get my posts to exist on the filesystem. If I don't do this, then I lose the data. If you get that "Not updating..." error, then just --force the import in. --[[users/simonraven]] diff --git a/doc/tips/add_chatterbox_to_blog/discussion.mdwn b/doc/tips/add_chatterbox_to_blog/discussion.mdwn index bf7c9b1c3..a3d686409 100644 --- a/doc/tips/add_chatterbox_to_blog/discussion.mdwn +++ b/doc/tips/add_chatterbox_to_blog/discussion.mdwn @@ -23,3 +23,21 @@ On the [[/ikiwiki/pagespec]] page, it says "internal" pages aren't "first-class" >> Oooh, I see, it's referring to an absolute path (relative to the site), right? >> Thanks :). + +>>> Right, PageSpecs are always absolute paths unless prefixed with `./` +>>> (somewhat confusingly since WikiLinks are always realtive unless +>>> previxed with `/` ...) --[[Joey]] + +>> This is not working for me at all, all I get is some SHA1 hash all the time. I've tried variants of the `internal()` arg, and nothing gets spit out. --[[simonraven]] + +>>> Sounds like [[!debbug 380212]]? +>>> If so, the fix is to use Text::Markdown, or markdown 1.0.2 instead of buggy +>>> old markdown 1.0.1. --[[Joey]] + +>> `ii libtext-markdown-perl 1.0.21-1 Markdown and MultiMarkdown markup languages library` +>> +>> I'm using `Text::Markdown` due to its "multi-markdown" support. Yes, it does seem exactly like [[!debbug 380212]] . +>> Maybe update it from CPAN + dh-make-perl (if there's a new one, that is) --[[simonraven]] +>> I've just built and installed `libtext-markdown-perl 1.0.21-1` from dh-make-perl & CPAN, and regenerated that page.. let's see what happens... no hashes, but nothing else either: +>> +>> "kijkaqawej: last checked 10 minutes ago (25 posts)" -- inside of a box, no display of posts. diff --git a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn index 15ddccb92..b3fe9f86c 100644 --- a/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn +++ b/doc/tips/convert_mediawiki_to_ikiwiki/discussion.mdwn @@ -63,6 +63,8 @@ The iki-fast-load ruby script from the u32 page is given below: pipe.puts end +> Would be nice to know where you could get "node-callbacks"... this thing is useless without it. --[[users/simonraven]] + Mediawiki.pm - A plugin which supports mediawiki format. diff --git a/doc/tips/dot_cgi.mdwn b/doc/tips/dot_cgi.mdwn index 04d7a9721..64d7a0757 100644 --- a/doc/tips/dot_cgi.mdwn +++ b/doc/tips/dot_cgi.mdwn @@ -52,6 +52,6 @@ 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. +**Warning:** I only use this lighttpd configuration 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/dot_cgi/discussion.mdwn b/doc/tips/dot_cgi/discussion.mdwn new file mode 100644 index 000000000..124b9edff --- /dev/null +++ b/doc/tips/dot_cgi/discussion.mdwn @@ -0,0 +1,36 @@ +## warning: lighttpd only or both? + +Is your warning at the bottom (you don't know how secure it is) only about +lighttpd or it's about apache2 configuration as well? + +> The latter. (Although I don't know why using lighttpd would lead +> to any additional security exposure anyway.) --[[Joey]] + +I'm asking this because right now I want to setup an httpd solely for the +public use of ikiwiki on a general purpose computer (there are other things +there), and so I need to choose the more secure solution. --Ivan Z. + +> AFAIU, my main simplest security measure should be running the public +> ikiwiki's cgi under a special user, but then: how do I push to the repo +> owned by that other user? I see, probably I should setup the public wiki +> under the special user (so that it was able to create the cgi-script with +> the desired permission), and then give my personal user the required +> permissions to make a git-push by, say, creating a special Unix group for +> this. + +> Shouldn't there be a page here which would document a secure public and +> multi-user installation of ikiwiki (by "multi-user" I mean writable by a +> group of local Unix users)? If there isn't such yet, I started writing it +> with this discussion.--Ivan Z. + +> I see, perhaps a simpler setup would not make use of a Unix group, but +> simply allow pushing to the public wiki (kept under a special user) through +> git+ssh. --Ivan Z. + +>> Yes, it's certianly possible to configure git (and svn, etc) repositories so that +>> two users can both push to them. There should be plenty of docs out there +>> about doing that. +>> +>> The easiest way though is probably +>> to add your ssh key to the special user's `.ssh/authorized_keys` +>> and push that way. --[[Joey]] diff --git a/doc/tips/importing_posts_from_wordpress/ikiwiki-wordpress-import.mdwn b/doc/tips/importing_posts_from_wordpress/ikiwiki-wordpress-import.mdwn index 5d7a266ec..0c0527f2c 100644 --- a/doc/tips/importing_posts_from_wordpress/ikiwiki-wordpress-import.mdwn +++ b/doc/tips/importing_posts_from_wordpress/ikiwiki-wordpress-import.mdwn @@ -2,7 +2,7 @@ I modified the script a bit so categories and tags would actually show up in the output file. - +----- <pre> #!/usr/bin/env python @@ -29,7 +29,7 @@ I modified the script a bit so categories and tags would actually show up in the Usage: run --help as an argument with this script. Notes: - I added some extra bits to include the [[!tag foo]] stuff in the post, + I added some extra bits to include the \[[!tag foo]] stuff in the post, as it wasn't before, at all. I'll diff the versions out so you can see the mess I made :). @@ -66,7 +66,7 @@ def main(name, email, subdir, branch='master'): commit_msg = """Importing WordPress post "%s" [%s]""" % (x.title.string, x.guid.string) timestamp = time.mktime(time.strptime(x.find('wp:post_date_gmt').string, "%Y-%m-%d %H:%M:%S")) - content = '[[!meta title="%s"]]\n\n' % (x.title.string.replace('"', r'\"')) + content = '\[[!meta title="%s"]]\n\n' % (x.title.string.replace('"', r'\"')) content += x.find('content:encoded').string.replace('\r\n', '\n') # categories = x.findAll('category') @@ -76,8 +76,120 @@ def main(name, email, subdir, branch='master'): """ We do it differently here because we have duplicates otherwise. Take a look: - <category><![CDATA[Health]]></category> - <category domain="category" nicename="health"><![CDATA[Health]]></category> + <category><![CDATA[Health]]></category> + <category domain="category" nicename="health"><![CDATA[Health]]></category> + + If we do the what original did, we end up with all tags and cats doubled. + Therefore we only pick out nicename="foo". Our 'True' below is our 'foo'. + I'd much rather have the value of 'nicename', and tried, but my + python skillz are extremely limited.... + """ + categories = x.findAll('category', nicename=True) + if categories: + content += "\n" + for cat in categories: + # remove 'tags/' because we have a 'tagbase' set. + # your choice: 'tag', or 'taglink' + # content += "\n\[[!tag %s]]" % (cat.string.replace(' ', '-')) + content += "\n\[[!taglink %s]]" % (cat.string.replace(' ', '-')) + # print >>sys.stderr, cat.string.replace(' ', '-') + + # moved this thing down + data = content.encode('ascii', 'html_replace') + print "commit refs/heads/%s" % branch + print "committer %s <%s> %d +0000" % (name, email, timestamp) + print "data %d" % len(commit_msg) + print commit_msg + print "M 644 inline %s" % os.path.join(subdir, "%s.mdwn" % stub) + print "data %d" % len(data) + print data + +if __name__ == "__main__": + if len(sys.argv) not in (4, 5): + print >>sys.stderr, "%s: usage: %s name email subdir [branch] < wordpress-export.xml | git-fast-import " % (sys.argv[0], sys.argv[0]) + else: + main(*sys.argv[1:]) + +</pre> +----- + +I have another version of the script, which uses the `timestamp` from the script, and inserts that as a \[[!meta date="foodate"]]. I'm posting it here just in case I happen to be doing something to the httpd. + +(Hopefully I've escaped everything properly; if I missed something, check the source.) + +----- +<pre> +#!/usr/bin/env python + +""" + Purpose: + Wordpress-to-Ikiwiki import tool + + Copyright: + Copyright (C) 2007 Chris Lamb <chris@chris-lamb.co.uk> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + Usage: run --help as an argument with this script. + + Notes: + I added some extra bits to include the \[[!tag foo]] stuff in the post, + as it wasn't before, at all. I'll diff the versions out so you can see + the mess I made :). + +""" + +import os, sys +import time +import re + +from datetime import datetime +from BeautifulSoup import BeautifulSoup + +import codecs, htmlentitydefs + +codecs.register_error('html_replace', lambda x: (''.join([u'&%s;' \ + % htmlentitydefs.codepoint2name[ord(c)] for c in x.object[x.start:x.end]]), x.end)) + +def main(name, email, subdir, branch='master'): + soup = BeautifulSoup(sys.stdin.read()) + + # Regular expression to match stub in URL. + stub_pattern = re.compile(r'.*\/(.+)\/$') + + for x in soup.findAll('item'): + # Ignore draft posts + if x.find('wp:status').string != 'publish': continue + + match = stub_pattern.match(x.guid.string) + if match: + stub = match.groups()[0] + else: + # Fall back to our own stubs + stub = re.sub(r'[^a-zA-Z0-9_]', '-', x.title.string).lower() + + commit_msg = """Importing WordPress post "%s" [%s]""" % (x.title.string, x.guid.string) + timestamp = time.mktime(time.strptime(x.find('wp:post_date_gmt').string, "%Y-%m-%d %H:%M:%S")) + content = '\[[!meta title="%s"]]\n' % (x.title.string.replace('"', r'\"')) + content += "\[[!meta date=\"%s\"]]\n" % datetime.fromtimestamp(timestamp) + content += x.find('content:encoded').string.replace('\r\n', '\n') + + """ + We do it differently here because we have duplicates otherwise. + Take a look: + <category><![CDATA[Health]]></category> + <category domain="category" nicename="health"><![CDATA[Health]]></category> If we do the what original did, we end up with all tags and cats doubled. Therefore we only pick out nicename="foo". Our 'True' below is our 'foo'. @@ -90,14 +202,15 @@ def main(name, email, subdir, branch='master'): for cat in categories: # remove 'tags/' because we have a 'tagbase' set. # your choice: 'tag', or 'taglink' - # content += "\n[[!tag %s]]" % (cat.string.replace(' ', '-')) - content += "\n[[!taglink %s]]" % (cat.string.replace(' ', '-')) + # content += "\n\[[!tag %s]]" % (cat.string.replace(' ', '-')) + content += "\n\[[!taglink %s]]" % (cat.string.replace(' ', '-')) + # this is just debugging, and for fun # print >>sys.stderr, cat.string.replace(' ', '-') # moved this thing down data = content.encode('ascii', 'html_replace') print "commit refs/heads/%s" % branch - print "committer %s <%s> %d +0000" % (name, email, timestamp) + print "committer %s <%s> %d +0000" % (name, email, timestamp) print "data %d" % len(commit_msg) print commit_msg print "M 644 inline %s" % os.path.join(subdir, "%s.mdwn" % stub) @@ -111,3 +224,10 @@ if __name__ == "__main__": main(*sys.argv[1:]) </pre> +----- + + +[[!tag wordpress]] +[[!tag python]] +[[!tag conversion]] +[[!tag ikiwiki]] |