示例#1
0
 def write(self, content=""):
     '''
     Writes the page template.
     '''
     writer.render(paths.page_template, self.path,
             { "title": self.title,
               "content": content })
示例#2
0
 def write(self, content=""):
     '''
     Writes the page template.
     '''
     writer.render(paths.page_template, self.path,
             { "title": self.title,
               "content": content })
示例#3
0
def create(title, template=None):
    '''
    Creates a new post draft.
    '''
    name = utils.name_from_title(title)
    template = template or paths.post_template

    path = os.path.join(
        utils.get_path(paths.root, "drafts"),
        name + tinkerer.source_suffix,
    )

    if os.path.exists(path):
        raise Exception("Draft '%s' already exists at '%s" % (title, path))

    writer.render(
        template, path, {
            "title": title,
            "content": "",
            "author": "default",
            "categories": "none",
            "tags": "none"
        })

    return path
示例#4
0
def create(title, template=None):
    '''
    Creates a new post draft.
    '''
    name = utils.name_from_title(title)
    template = template or paths.post_template

    path = os.path.join(
                    utils.get_path(
                        paths.root, 
                        "drafts"), 
                    name + tinkerer.source_suffix)

    if os.path.exists(path):
        raise Exception("Draft '%s' already exists at '%s" %
                        (title, path))

    writer.render(template, path,
            { "title"     : title,
              "content"   : "",
              "author"    : "default",
              "categories": "none",
              "tags"      : "none"})

    return path
示例#5
0
 def write(self, content="", template=None):
     '''
     Writes the page template.
     '''
     template = template or paths.page_template
     writer.render(template, self.path,
                   {"title": self.title,
                    "content": content})
示例#6
0
 def write(self, content="", template=None):
     '''
     Writes the page template.
     '''
     template = template or paths.page_template
     writer.render(template, self.path, {
         "title": self.title,
         "content": content
     })
示例#7
0
文件: post.py 项目: civalin/tinkerer
 def write(self, content="", author="default", 
         categories="none", tags="none"):
     '''
     Writes the post template with given arguments.
     '''
     writer.render(paths.post_template, self.path,
            { "title"     : self.title,
              "content"   : content,
              "author"    : author,
              "categories": categories,
              "tags"      : tags})
示例#8
0
文件: post.py 项目: ymt2/tinkerer
 def write(self, content="", author="default",
           categories="none", tags="none",
           template=None):
     '''
     Writes the post template with given arguments.
     '''
     template = template or paths.post_template
     writer.render(template, self.path,
                   {"title":      self.title,
                    "content":    content,
                    "author":     author,
                    "categories": categories,
                    "tags":       tags})
示例#9
0
def create(title):
    '''
    Creates a new post draft.
    '''
    name = utils.name_from_title(title)

    path = os.path.join(
                    utils.get_path(
                        paths.root, 
                        "drafts"), 
                    name + tinkerer.source_suffix)

    writer.render(paths.post_template, path,
            { "title"     : title,
              "content"   : "",
              "author"    : "default",
              "categories": "none",
              "tags"      : "none"})

    return path