Skip to content

Adds cookiecutter.json and updates README.md #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 13 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,24 @@
# Render Engine `BasePageParser`
# Cookiecutter Render Engine Custom Parsers

## Installation
You can install this using pip
This [cookiecutter](https://github.com/cookiecutter/cookiecutter) template helps you generate a custom parser for the [Render Engine](https://github.com/render-engine/render-engine).

```sh
pip install {{cookiecutter.project_slug}}
```
{% if frontmatter %}
## Using Frontmatter

[Frontmatter](https://github.com/eyeseast/python-frontmatter) is used to pull in attributes from a generated page.

Some pages will be looking for information that is provided in the frontmatter. All of the attributes defined can be used in the template (which itself can also be defined in the frontmatter or the class itself.

> **NOTE**
> These attributes **CANNOT** be used in the content itself, but you can use them in the template generation.
## Usage

{% endif %}
1. Install cookiecutter

## Parsing the Data
```bash
pip install cookiecutter
```

The base parser doesn't is a pass-thru parser meaning the content input will be passed through.
2. Run cookiecutter

```md
# TODO: EXAMPLE OF HOW YOUR DATA IS PARSED
```bash
cookiecutter gh:render-engine/cookiecutter-render-engine-custom-parser
```

If you generate the page with the following template
3. Answer the questions

```html
<div>
# TODO: EXAMPLE OF A TEMPLATE
</div>
```
4. Replace areas marked with `TODO` in the generated code

it would generate.
We recommend using [VSCode](https://code.visualstudio.com/) with the [TODO Tree](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.todo-tree) extension to keep track of the `TODO` comments.

```html
# TODO: EXAMPLE OF A GENERATED REPORT
```
5 changes: 5 additions & 0 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"project_name": "Your Project Name",
"project_slug": "{{cookiecutter.project_name|lower|replace(' ', '_')|replace('-', '_')}}",
"parser_class": "{{cookiecutter.project_name|title()|replace(' ', '')|replace('-', '')|}}PageParser"
}
3 changes: 0 additions & 3 deletions render_engine_parser/__init__.py

This file was deleted.

41 changes: 41 additions & 0 deletions {{cookiecutter.project_slug}}/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Render Engine `BasePageParser`

## Installation
You can install this using pip

```sh
pip install {{cookiecutter.project_slug}}
```
{% if frontmatter %}
## Using Frontmatter

[Frontmatter](https://github.com/eyeseast/python-frontmatter) is used to pull in attributes from a generated page.

Some pages will be looking for information that is provided in the frontmatter. All of the attributes defined can be used in the template (which itself can also be defined in the frontmatter or the class itself.

> **NOTE**
> These attributes **CANNOT** be used in the content itself, but you can use them in the template generation.

{% endif %}

## Parsing the Data

The base parser doesn't is a pass-thru parser meaning the content input will be passed through.

```md
# TODO: EXAMPLE OF HOW YOUR DATA IS PARSED
```

If you generate the page with the following template

```html
<div>
# TODO: EXAMPLE OF A TEMPLATE
</div>
```

it would generate.

```html
# TODO: EXAMPLE OF A GENERATED REPORT
```
3 changes: 3 additions & 0 deletions {{cookiecutter.project_slug}}/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .parse import {{cookiecutter.parser_name}}

__all__ = ["BasePageParser"]