diff --git a/build.py b/build.py index 992a1f5..e9a30d7 100755 --- a/build.py +++ b/build.py @@ -15,7 +15,7 @@ from mako.lookup import TemplateLookup def myapp(environ, start_response): start_response("200 OK", [("Content-Type", "text/html")]) - lookup = TemplateLookup(directories=["{{support_dir}}"]) + lookup = TemplateLookup(directories=["{{pages_dir}}"]) template = Template(filename="{{src}}", module_directory="{{temp_dir}}", lookup=lookup) return [template.render(environ=environ).encode("utf8")] @@ -37,7 +37,7 @@ class Builder(object): self.build_dir = "www" self.static_dir = "static" self.pages_dir = "pages" - self.support_dir = "support" + self.support_dir = "pages/support" self.temp_dir = "temp" self.rs_file = "rewrite.script" @@ -63,7 +63,7 @@ class Builder(object): logger.debug("build {0} -> {1}".format(src, dest)) content = page_src.replace("{{src}}", src) - content = content.replace("{{support_dir}}", self.support_dir) + content = content.replace("{{pages_dir}}", self.pages_dir) content = content.replace("{{temp_dir}}", self.temp_dir) with open(dest, "w") as fp: fp.write(content) @@ -94,6 +94,8 @@ class Builder(object): logger = self.root.getChild("pages") pages = os.listdir(self.pages_dir) for page in pages: + if not os.path.isfile(os.path.join(self.pages_dir, page)): + continue self._gen_page(page, logger) def gen_zws(self): diff --git a/pages/hello.mako b/pages/hello.mako deleted file mode 100644 index 980a0d5..0000000 --- a/pages/hello.mako +++ /dev/null @@ -1 +0,0 @@ -Hello World! diff --git a/pages/index.mako b/pages/index.mako index 60a3543..d61a1ad 100644 --- a/pages/index.mako +++ b/pages/index.mako @@ -1,3 +1,3 @@ -<%include file="header.mako" args="title='Index Page'"/> +<%include file="/support/header.mako" args="title='Index Page'"/>

Earwig!

-<%include file="footer.mako"/> +<%include file="/support/footer.mako"/> diff --git a/pages/support/footer.mako b/pages/support/footer.mako new file mode 100644 index 0000000..2ab5c0d --- /dev/null +++ b/pages/support/footer.mako @@ -0,0 +1,2 @@ + + diff --git a/pages/support/header.mako b/pages/support/header.mako new file mode 100644 index 0000000..670949e --- /dev/null +++ b/pages/support/header.mako @@ -0,0 +1,8 @@ +<%page args="title"/> + + + + + ${title} - earwig@toolserver + + diff --git a/support/footer.mako b/support/footer.mako deleted file mode 100644 index 308b1d0..0000000 --- a/support/footer.mako +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/support/header.mako b/support/header.mako deleted file mode 100644 index f8eecb9..0000000 --- a/support/header.mako +++ /dev/null @@ -1,5 +0,0 @@ - - -${title} - -