mirror of
https://github.com/alvierahman90/gronk.git
synced 2024-12-22 12:01:59 +00:00
rename to gronk
This commit is contained in:
parent
5bb40a57d1
commit
bef8aeda52
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,5 @@
|
||||
env
|
||||
n
|
||||
web
|
||||
planning.txt
|
||||
__pycache__
|
||||
|
10
Makefile
10
Makefile
@ -1,9 +1,9 @@
|
||||
install:
|
||||
cp n2w_add_uuid.py /usr/local/bin
|
||||
sed "s/N2W_COMMIT = \"dev\"/N2W_COMMIT = \"$$(git rev-parse --short HEAD)\"/" notes2web.py > /usr/local/bin/notes2web.py
|
||||
mkdir -p /opt/notes2web
|
||||
cp -r templates js css /opt/notes2web
|
||||
cp gronk_add_uuid.py /usr/local/bin
|
||||
sed "s/GRONK_COMMIT = \"dev\"/GRONK_COMMIT = \"$$(git rev-parse --short HEAD)\"/" gronk.py > /usr/local/bin/gronk.py
|
||||
mkdir -p /opt/gronk
|
||||
cp -r templates js css /opt/gronk
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
uninstall:
|
||||
rm -rf /usr/local/bin/notes2web.py /usr/local/bin/n2w_add_uuid.py /opt/notes2web
|
||||
rm -rf /usr/local/bin/gronk.py /usr/local/bin/gronk_add_uuid.py /opt/gronk
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
notes2web --- view your notes as a static html site
|
||||
gronk --- view your notes as a static html site
|
||||
"""
|
||||
|
||||
|
||||
@ -21,17 +21,17 @@ import requests
|
||||
from fileproperties import FileMap
|
||||
|
||||
|
||||
N2W_COMMIT = "dev"
|
||||
GRONK_COMMIT = "dev"
|
||||
|
||||
PANDOC_SERVER_URL = os.getenv("PANDOC_SERVER_URL", r"http://localhost:3030/")
|
||||
PANDOC_TIMEOUT = int(os.getenv("PANDOC_TIMEOUT", "120"))
|
||||
CSS_DIR = Path(os.getenv("CSS_DIR", "/opt/notes2web/css"))
|
||||
JS_DIR = Path(os.getenv("JS_DIR", "/opt/notes2web/js"))
|
||||
TEMPLATES_DIR = Path(os.getenv("TEMPLATES_DIR", "/opt/notes2web/templates"))
|
||||
CSS_DIR = Path(os.getenv("CSS_DIR", "/opt/gronk/css"))
|
||||
JS_DIR = Path(os.getenv("JS_DIR", "/opt/gronk/js"))
|
||||
TEMPLATES_DIR = Path(os.getenv("TEMPLATES_DIR", "/opt/gronk/templates"))
|
||||
|
||||
|
||||
JINJA_ENV = jinja2.Environment(
|
||||
loader=jinja2.PackageLoader("notes2web", str(TEMPLATES_DIR)),
|
||||
loader=jinja2.PackageLoader("gronk", str(TEMPLATES_DIR)),
|
||||
autoescape=jinja2.select_autoescape
|
||||
)
|
||||
|
||||
@ -191,7 +191,7 @@ def process_home_index(args, notes_git_head_sha1=None):
|
||||
post['content'] = render_markdown(post['content'])
|
||||
|
||||
html = JINJA_TEMPLATE_HOME_INDEX.render(
|
||||
n2w_commit = N2W_COMMIT,
|
||||
gronk_commit = GRONK_COMMIT,
|
||||
search_data = FILEMAP.to_search_data(),
|
||||
notes_git_head_sha1 = notes_git_head_sha1,
|
||||
post=post
|
@ -12,10 +12,6 @@ def get_args():
|
||||
import argparse
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('filename', type=pathlib.Path)
|
||||
parser.add_argument('--template',
|
||||
default=pathlib.Path("/opt/notes2web/templates/n2w_add_uuid_frontmatter_template"),
|
||||
type=pathlib.Path
|
||||
)
|
||||
parser.add_argument('-w', '--write', action='store_true',
|
||||
help='write to file instead of stdout')
|
||||
return parser.parse_args()
|
||||
@ -23,8 +19,13 @@ def get_args():
|
||||
|
||||
def main(args):
|
||||
""" Entry point for script """
|
||||
with open(args.template) as fp:
|
||||
template_str=fp.read()
|
||||
template_str= [
|
||||
"author: {{ author }}"
|
||||
"date: {{ date }}"
|
||||
"title: {{ title }}"
|
||||
"tags: {{ tags }}"
|
||||
"uuid: {{ uuid }}"
|
||||
].join("\n")
|
||||
|
||||
with open(args.filename) as fp:
|
||||
fm_pre = frontmatter.load(fp)
|
26
readme.md
26
readme.md
@ -1,4 +1,4 @@
|
||||
# notes2web
|
||||
# gronk
|
||||
|
||||
View your notes as a static html site. Browse a live sample of it [here](https://notes.alv.cx).
|
||||
|
||||
@ -9,15 +9,10 @@ Tested with [pandoc v2.19.2](https://github.com/jgm/pandoc/releases/tag/2.19.2).
|
||||
|
||||
## Why?
|
||||
|
||||
I want to be able to view my notes in a more convenient way.
|
||||
I was already writing them in Pandoc markdown and could view them as PDFs but that wasn't quite
|
||||
doing it for me:
|
||||
|
||||
- It was inconvenient to flick through multiple files of notes to find the right PDF
|
||||
- It was annoying to sync to my phone
|
||||
- PDFs do not scale so they were hard to read on smaller screens
|
||||
- Probably more reasons I can't think of right now
|
||||
- Fun
|
||||
- View notes as a website, on any device
|
||||
- Write notes with pandoc markdown
|
||||
- Easily share notes
|
||||
- Lightweight html generated
|
||||
|
||||
|
||||
## Install
|
||||
@ -27,10 +22,9 @@ doing it for me:
|
||||
|
||||
## Other Things to Know
|
||||
|
||||
- notes2web indexes [ATX-style headings](https://pandoc.org/MANUAL.html#atx-style-headings) for
|
||||
- gronk indexes [ATX-style headings](https://pandoc.org/MANUAL.html#atx-style-headings) for
|
||||
searching
|
||||
- notes2web attempts to display file history through the `git log` command
|
||||
- notes2web looks for the plaintext file `LICENSE` in the root directory of your notes
|
||||
- gronk looks for the plaintext file `LICENSE` in the root directory of your notes
|
||||
|
||||
|
||||
## Custom Directory Index
|
||||
@ -50,7 +44,7 @@ You can set the following frontmatter variables to customise the directory index
|
||||
|
||||
## Notes Metadata
|
||||
|
||||
notes2web reads the following YAML [frontmatter](https://jekyllrb.com/docs/front-matter/) variables for metadata:
|
||||
gronk reads the following YAML [frontmatter](https://jekyllrb.com/docs/front-matter/) variables for metadata:
|
||||
|
||||
| variable | description |
|
||||
|------------------|---------------------------------------------------------------------------------------|
|
||||
@ -97,10 +91,10 @@ these notes are probably wrong
|
||||
## CLI Usage
|
||||
|
||||
```
|
||||
$ notes2web.py notes_directory
|
||||
$ gronk.py notes_directory
|
||||
```
|
||||
|
||||
Output of `notes2web.py --help`:
|
||||
Output of `gronk.py --help`:
|
||||
|
||||
TODO add cli output
|
||||
|
||||
|
14
requirements-dev.txt
Normal file
14
requirements-dev.txt
Normal file
@ -0,0 +1,14 @@
|
||||
beautifulsoup4==4.9.3
|
||||
editfrontmatter==0.0.1
|
||||
greenlet==2.0.2
|
||||
Jinja2==3.0.3
|
||||
MarkupSafe==2.1.0
|
||||
msgpack==1.0.5
|
||||
oyaml==1.0
|
||||
pynvim==0.4.3
|
||||
pypandoc==1.5
|
||||
python-frontmatter==1.0.0
|
||||
python-magic==0.4.24
|
||||
regex==2021.11.10
|
||||
soupsieve==2.2.1
|
||||
PyYAML==6.0.1
|
@ -55,7 +55,7 @@
|
||||
colors
|
||||
</p>
|
||||
<p class="smallText metadata">
|
||||
page generated by <a href="https://git.alv.cx/alvierahman90/notes2web">notes2web</a>
|
||||
page generated by <a href="https://git.alv.cx/alvierahman90/gronk">gronk</a>
|
||||
</p>
|
||||
{% if license %}
|
||||
<details id="license">
|
||||
|
@ -19,7 +19,7 @@ Browse <a href="/notes">here</a> or by tag <a href="/tags">here</a>.
|
||||
<div id="results">
|
||||
</div>
|
||||
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a> (commit {{ n2w_commit }}) {% if notes_git_head_sha1 %}notes commit {{ notes_git_head_sha1 }}{% endif %}</p>
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a> (commit {{ n2w_commit }}) {% if notes_git_head_sha1 %}notes commit {{ notes_git_head_sha1 }}{% endif %}</p>
|
||||
</div>
|
||||
<script src="/js/fuse.js"> </script>
|
||||
<script> const search_data = {{ search_data|tojson }} </script>
|
||||
|
@ -35,10 +35,10 @@
|
||||
{% if content_after_search %}
|
||||
{{ content }}
|
||||
{% endif %}
|
||||
<p style="font-size: 0.7em;"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a></p>
|
||||
<p style="font-size: 0.7em;"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a></p>
|
||||
</div>
|
||||
<script src="/js/fuse.js"> </script>
|
||||
<script> const search_data = {{ index_entries }} </script>
|
||||
<script> const search_data = {{ index_entries|tojson }} </script>
|
||||
<script src="/js/indexsearch.js"> </script>
|
||||
</body>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
author: {{ author }}
|
||||
date: {{ date }}
|
||||
title: {{ title }}
|
||||
tags: {{ tags }}
|
||||
uuid: {{ uuid }}
|
@ -12,8 +12,8 @@ You should be being redirected...
|
||||
Otherwise, click <a id="manual_redirect">here</a>.
|
||||
</p>
|
||||
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/notes2web">notes2web</a></p>
|
||||
<p class="smallText"> page generated by <a href="https://github.com/alvierahman90/gronk">gronk</a></p>
|
||||
</div>
|
||||
<script> const data = $data$ </script>
|
||||
<script> const data = {{ data|tojson }} </script>
|
||||
<script src="/js/permalink.js"> </script>
|
||||
</body>
|
||||
|
@ -1,6 +1,6 @@
|
||||
{% extends "article.html" %}
|
||||
{% block body %}
|
||||
<p> This file was not rendered by notes2web because it is a plaintext file, not a markdown
|
||||
<p> This file was not rendered by gronk because it is a plaintext file, not a markdown
|
||||
file.
|
||||
You access the raw file <a href="{{ raw_link }}">here</a>.
|
||||
Below is an unformatted representation of the file:
|
||||
|
Loading…
Reference in New Issue
Block a user