Commits

Vlad Riscutia committed 11b9a8c

Refactor post and page template filenames to variables

  • Participants
  • Parent commits ae8fa91

Comments (0)

Files changed (5)

File tinkerer/draft.py

                         "drafts"), 
                     name + tinkerer.source_suffix)
 
-    writer.render("post.rst", path,
+    writer.render(paths.post_template, path,
             { "title"     : title,
               "content"   : "",
               "author"    : "default",

File tinkerer/page.py

         '''
         Writes the page template.
         '''
-        writer.render("page.rst", self.path,
+        writer.render(paths.page_template, self.path,
                 { "title": self.title,
                   "content": content })
 

File tinkerer/paths.py

 static = os.path.join(__package_path, "static")
 
 
+# template names
+post_template = "post.rst"
+page_template = "page.rst"
+
+
 # add "./exts" path to os search path so Sphinx can pick up any extensions
 # from there
 sys.path.append(os.path.abspath("./_exts"))

File tinkerer/post.py

         '''
         Writes the post template with given arguments.
         '''
-        writer.render("post.rst", self.path,
+        writer.render(paths.post_template, self.path,
                { "title"     : self.title,
                  "content"   : content,
                  "author"    : author,

File tinkerer/writer.py

     '''
     Copies Tinkerer post and page templates to blog _templates directory.
     '''
-    for template in ["post.rst", "page.rst"]:
+    for template in [paths.post_template, paths.page_template]:
         if not os.path.exists(os.path.join(paths.root, "_templates", template)):
             shutil.copy(
                 os.path.join(paths.__internal_templates_abs_path, template),