JSON Parser and Collection for Render Engine
Project description
Render Engine JSON
JSON Parser and Collection Module for Render Engine
Installation
pip install render_engine_json
Usage
The render-engine-json
extends render-engine to allow you to build pages and collections using JSON.
The JSONPageParser
class can be used to parse a single JSON page and the JSONCollection
class can be used to parse a single collection of JSON pages.
NOTE The
JSONCollection
class is designed to work with a single JSON file that contains an array of JSON Objects or a JSON Hash where the keys are the slugs. If you want to work with multiple JSON files you can use a regularCollection
and theJSONPageParser
as the parser.
Single JSON Page Entry
To create a json entry you will need the JSONPageParser
class as the Parser for your Page
Object.
You can pass the page a json string or a json file path.
As a string
from render_engine import Page, Site
from render_engine_json import JSONPageParser
site = Site()
json_page = """
{
"title": "My JSON Page",
"content": "This is my json page"
}
"""
@site.page
class JSONStringPage(Page):
parser = JSONPageParser
content = json_page
As a file
@site.page
class JSONFilePage(Page):
parser = JSONPageParser
content_path = "path/to/json/file.json"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for render_engine_json-2024.1.1a1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f03b4a6a78d6f0d8f7c0c7456aebb528d6a1531dce35ba6383376bc0e9cee87c |
|
MD5 | 8a142143114eb91e6cf81f13fd6ee542 |
|
BLAKE2b-256 | de60b1aadd16d81b32ae156017d8c5872b8b2b5b5e0c05d0ee5441f427ec4cfa |
Hashes for render_engine_json-2024.1.1a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c922eee9bc1053cf36ee93fd75c8a5554dc0d24b940dff66e34afee08eeefdf5 |
|
MD5 | fc711d422a014e0946e6b1c499a22eda |
|
BLAKE2b-256 | 2fbb2016fe2a084cd0dd8b5e92cad5e559cd3883e4931df76a75c324c2b04c8a |