This repository has been archived by the owner on Jan 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
''' | ||
post.py | ||
copyright 2009 j.c.sackett | ||
Defines a post object which contains the file information of the base text file and | ||
converts it into an html post. | ||
''' | ||
from jinja2 import Environment, PackageLoader | ||
import markdown2 | ||
import os | ||
|
||
ENV = Environment(loader=PackageLoader('puffin', 'templates')) | ||
|
||
class post: | ||
def __init__(self, file_path, dest): | ||
self.read, self.write = self.build_paths(file_path) | ||
self.title = self.make_title(file_path) | ||
self.content = | ||
|
||
def build_paths(self, file_path): | ||
r = file_path | ||
w = file_path.replace(dest, '').replace('//', '/').replace('.txt', '.html')d | ||
return r,w | ||
|
||
def make_title(self, file_path): | ||
return os.path.split(file_path)[-1].split('.')[0].replace('_', ' ') | ||
|
||
def make_url(self): | ||
if self.write_path.startswith('/'): | ||
return self.write_path[1:] | ||
else: | ||
return self.write_path | ||
|
||
def build_page(self): | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters