1.1 --- a/moinsetup.py Fri Apr 15 23:08:37 2011 +0200
1.2 +++ b/moinsetup.py Sat May 28 21:42:15 2011 +0200
1.3 @@ -301,6 +301,7 @@
1.4 "install_plugins",
1.5 "install_actions",
1.6 "install_macros",
1.7 + "install_parsers",
1.8 "install_theme_resources",
1.9 "edit_theme_stylesheet",
1.10
1.11 @@ -981,6 +982,12 @@
1.12
1.13 self.install_plugins(macros_dir, "macro")
1.14
1.15 + def install_parsers(self, parsers_dir):
1.16 +
1.17 + "Install Wiki macros provided in the given 'parsers_dir'."
1.18 +
1.19 + self.install_plugins(parsers_dir, "parser")
1.20 +
1.21 def install_theme_resources(self, theme_resources_dir, theme_name=None):
1.22
1.23 """
1.24 @@ -1101,8 +1108,26 @@
1.25 script = ["MoinMoinPackage|1"]
1.26
1.27 for filename in os.listdir(page_directory):
1.28 - package.write(join(page_directory, filename), filename)
1.29 - script.append("AddRevision|%s|%s" % (filename, filename))
1.30 + pathname = join(page_directory, filename)
1.31 +
1.32 + # Add files as pages having the filename as page name.
1.33 +
1.34 + if os.path.isfile(pathname):
1.35 + package.write(pathname, filename)
1.36 + script.append("AddRevision|%s|%s" % (filename, filename))
1.37 +
1.38 + # Add directories ending with "-attachments" as collections of
1.39 + # attachments for a particular page.
1.40 +
1.41 + elif os.path.isdir(pathname) and filename.endswith("-attachments"):
1.42 + parent = filename[:-len("-attachments")]
1.43 +
1.44 + # Add each file as an attachment.
1.45 +
1.46 + for attachment in os.listdir(pathname):
1.47 + zipname = "%s_%s" % (filename, attachment)
1.48 + package.write(join(pathname, attachment), zipname)
1.49 + script.append("AddAttachment|%s|%s|%s||" % (zipname, attachment, parent))
1.50
1.51 package.writestr("MOIN_PACKAGE", "\n".join(script))
1.52