pnbp

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 1f5e9a1e96d7f25d4f8611647cb7bc8dc27ef5e4
parent 75c96ac168348a4e781f92cda72c3ffb4f0121b7
Author: Paul Longtine <paullongtine@gmail.com>
Date:   Fri Jun 13 16:21:44 2014

Using YAML instead of JSON for configuring pages

Diffstat:
 about              | 21 ---------------------
 example/pages      | 37 +++++++++++++++++++++++++++++++++++++
 example/pages.json | 11 -----------
 src/build.py       |  8 ++++----
 4 files changed, 41 insertions(+), 36 deletions(-)

diff --git a/about b/about @@ -1,21 +0,0 @@ -pnbp - pnbp is not a blogging platform (p = python). - -pnbp is a static content manager that does things with configurability and obscurity. - -pnbp should NOT: - - - suggest the way things should be done - - - not be able to do something purely because it can't be configured to do so - -pnbp should DO: - - - easy API for generator - widget interactions - - - report issues in compiling site with clear, concise results. - -pnbp flow of compiling: - -compile.py -> reads config.json -> iterate through pages -> generates page template -> run pagevar - -compiled pages in .data in pages directory, along with index.php and subpages.conf- \ No newline at end of file diff --git a/example/pages b/example/pages @@ -0,0 +1,37 @@ +--- + index: + template: "templates/std.html" + pagevar: + :header: "./includes/header.html" + title: "This is a test page" + pagemod: + content: + mod: "blog" + settings: + defaultPostCount: "0" + data: "./data/index.json" + archive: + template: "templates/archive.html" + pagevar: + :header: "./includes/header.html" + title: "This is a test page" + pagemod: + archive: + mod: "page" + settings: + pagevar: + :archive: "./includes/archive.html" + location: "" + template: "templates/archive.html" + test: + template: "templates/std.html" + pagevar: + :header: "./includes/header.html" + title: "This is THE test page" + pagemod: + content: + mod: "blog" + settings: + description: 1 + defaultPostCount: "1" + data: "./data/test.json" diff --git a/example/pages.json b/example/pages.json @@ -1,11 +0,0 @@ -{ -"index":{"template":"templates/std.html", - "pagevar":{":header":"./includes/header.html","title":"This is a test page"}, - "pagemod":{"content":{"mod":"blog","settings":{"defaultPostCount":"0","data":"./data/index.json"}}}}, -"archive":{"template":"templates/archive.html", - "pagevar":{":header":"./includes/header.html","title":"This is a test page"}, - "pagemod":{"archive":{"mod":"page","settings":{"pagevar":{":archive":"./includes/archive.html"},"location":"","template":"templates/archive.html"}}}}, -"test":{"template":"templates/std.html", - "pagevar":{":header":"./includes/header.html","title":"This is THE test page"}, - "pagemod":{"content":{"mod":"blog","settings":{"description":1,"defaultPostCount":"1","data":"./data/test.json"}}}} -} diff --git a/src/build.py b/src/build.py @@ -6,7 +6,7 @@ ' ' For documentation, please visit http://static.nanner.co/pnbp ''' -import os, sys, shutil, module, json, time +import os, sys, shutil, module, json, yaml, time def main(): site = {} @@ -185,13 +185,13 @@ if __name__ == "__main__": print("Going through pages...") start = time.time() try: - pages = open("pages.json") + pages = open("pages") except: - print("Can't open file 'pages.json'") + print("Can't open file 'pages'") sys.exit() - pagedata = json.load(pages) + pagedata = yaml.load(pages) pages.close() try: main()