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.1a2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ce9535b46536c8a510eb62f3e780d4d88cb002bf1e9c1bae1f7f42f247dafb3b |
|
MD5 | 4a90b10c7f41a37e9a1c9cefef634a5f |
|
BLAKE2b-256 | 7a8ab91578b1749495e04d3258f32a2f103fb7383f07817a2a44204350828c34 |
Hashes for render_engine_json-2024.1.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d52accfc32ff2a2d8842a6a88f788fd7a9dafad82e3aede8fc29af659a468565 |
|
MD5 | c9080e75a13d772172fdb3d8e872e682 |
|
BLAKE2b-256 | e091320cb4de56caff688505bb39feba057d5ed6623a1e2d3600860a79add354 |