commit 637fb9bba5b38a8de58e56f738a9a1fe5d8dfc13 Author: Francesco Luzzana Date: Tue Dec 13 01:58:42 2022 +0100 test toast diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8bc348e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +venv/ +__pycache__ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e5e137a --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# flat bonfire framework + +![fuoco](cover.jpg) + +A small framework to document project on the soupboat using a shared flat markup list as source. diff --git a/bonfire.py b/bonfire.py new file mode 100644 index 0000000..7525238 --- /dev/null +++ b/bonfire.py @@ -0,0 +1,24 @@ +import os +from flask import Flask, render_template +from prefix import PrefixMiddleware +from flat import parse +from dotenv import load_dotenv + +load_dotenv() +prefix = os.environ.get("URL_PREFIX", '') +port = os.environ.get("PORT", 3000) +debug = os.environ.get("DEBUG", True) +fireplace = os.environ.get("FIREPLACE", 'list.1dl') + + +app = Flask(__name__) +app.wsgi_app = PrefixMiddleware(app.wsgi_app, prefix=prefix) + + +@app.route('/') +def bonfire(): + content = parse(fireplace) + return render_template('bonfire.html', content=content) + + +app.run(port=port, debug=debug) diff --git a/cover.jpg b/cover.jpg new file mode 100644 index 0000000..dbf91e2 Binary files /dev/null and b/cover.jpg differ diff --git a/flat.py b/flat.py new file mode 100644 index 0000000..e2e44e9 --- /dev/null +++ b/flat.py @@ -0,0 +1,53 @@ +import re + + +def syntax(): + '''regex setup for the flat syntax''' + # titles + t = re.compile('\(.*\)') + # sections + s = re.compile('\[(.*?)\]') + # notes + n = re.compile('(-->)') + # comments + c = re.compile('(>>)') + return (t, s, n, c) + + +def parse(file): + with open(file, 'r') as f: + + parsed = {} + current_title = '' + current_section = '' + + t, s, n, c = syntax() + + line = f.readline() + + while line: + if not line.rstrip('\n'): + line = f.readline() + continue + # titles + if t.match(line): + current_title = line[1:-2] + parsed[current_title] = {} + line = f.readline() + continue + # sections + if s.match(line): + current_section = line[1:-2] + parsed[current_title][current_section] = '' + line = f.readline() + continue + # notes (TBD) + if n.match(line): + parsed[current_title][current_section] += line.rstrip( + '\n') + ' \n' + line = f.readline() + continue + # normal text + parsed[current_title][current_section] += line.rstrip('\n') + ' \n' + line = f.readline() + return parsed diff --git a/list.1dl b/list.1dl new file mode 100644 index 0000000..7d5d469 --- /dev/null +++ b/list.1dl @@ -0,0 +1,152 @@ +(bonfire) + +[what] + +A small framework to document projects on the soupboat using a shared flat markup list as source. + +[where] +https://hub.xpub.nl/soupboat/bonfire/ + + +(flask-example) + +[what] + +a tutorial for setting up a flask app in the soupboat + +[where] +https://git.xpub.nl/manetta/flask-example + +[doc] +Kamo and Chae are working on the documentation! +With drawings! +And a general overview. + + + +(workbook) + +[what] +A tool to keep track and annotate configurations for different instruments +to facilitate learning process + +[where] +https://hub.xpub.nl/soupboat/workbook/ + +[doc] +organized in 6 parts +1. intro/overview +2. what/why, intentions +3. how to add a new instrument +4. how to add a new patch +5. how to add a new snippet +6. how to contribute in the development + +https://hub.xpub.nl/soupboat/workbook/documentation +https://pad.xpub.nl/p/modcms_documentation + +--> draft in progress + +[dev] +main repo +https://git.xpub.nl/supisara/workbook + +svg to interactive panel +https://git.xpub.nl/kamo/panel + +cables system +https://git.xpub.nl/kamo/spaghetti + +[links] +brainstorming pad +https://pad.xpub.nl/p/modcms + +[refs] +reference for spaghetti cables system +https://hub.xpub.nl/soupboat/~kamo/projects/spaghetti/ + +reference for interactive panel generator +https://hub.xpub.nl/soupboat/~kamo/projects/panel/ + + +(padliography2) + +[what] +an interface to archive links on the wiki +mainly used for pads +several instances of the archive can be initialized +directly from the interface +so multiple archives can coexhist together + +[where] +https://hub.xpub.nl/soupboat/padliography + +[doc] +https://git.xpub.nl/kamo/pad-bis +https://pzwiki.wdka.nl/mediadesign/Padliography + +[notes] + +--> I'd like to see more memes, they help me understanding the process more +--> I like the toads +--> more images please! +--> I wouldn't mind having more of these side-notes, why some decisions have been made or should be made +--> Hi! Great documentation! I am not a developer. So why is the "development" section much easier to follow than the "quick start"? +--> nice tool, nice colors, clear layout, but curious to hear from the maker why it is an interesting tool to use and work with? What is interesting about it for you? Also, in which context did this tool emerge? How is it embedded in that context? How did this influence your choices? Is the tool referring to other tools, can you cite them in some way? +--> I think the syntax could be more accessible by writing shorter sentences, or sentences that only focus on 1 thing. I'll elaborate after lunch + +[dev] +v2 -- current +https://git.xpub.nl/kamo/pad-bis + +v1 +https://git.xpub.nl/kamo/PADliography + + + +(SI16 API) + +[what] +Learning how to walk while catwaking +A set of functions to mess around with vernacular language processing +Published as a choral API +Sparse architecture + +[doc] +A collective work where everyone contributed with some functions +Written in Python inside Jupiter Notebooks +And documented in the very same notebooks +With description, examples and references about input and output +And then aggregated together as endpoints for the API +Multiplayer approach to documentation +That means docs with diverse voices +maybe not always clear +but really interesting way of work collaboratively +--> we didn't managed but it could make sense in a process like this to have an editorial meeting at the beginning to align a bit the intentions and then an editorial review after, to adjust contents + +Example: +Shout function +https://hub.xpub.nl/soupboat/si16/functions/shout/ + +More documentation for the backend is available +https://hub.xpub.nl/soupboat/~kamo/projects/si16-backend/ + +[where] +https://hub.xpub.nl/soupboat/si16/ + +[dev] +main repo +https://git.xpub.nl/grgr/si16-cat-walking/ + +[links] +si16 manifesto +https://hub.xpub.nl/soupboat/si16/intro/ + +si16 previous prototypes +https://hub.xpub.nl/soupboat/~kamo/projects/si16-API-strapi-nuxt-prototype/ +https://hub.xpub.nl/soupboat/~kamo/projects/si16-API-express-prototype/ +https://hub.xpub.nl/soupboat/~kamo/projects/si16-structure-proposal/ +https://hub.xpub.nl/soupboat/~kamo/projects/si16-frontend-design/ + + + diff --git a/prefix.py b/prefix.py new file mode 100644 index 0000000..8a7b9fb --- /dev/null +++ b/prefix.py @@ -0,0 +1,15 @@ +class PrefixMiddleware(object): + + def __init__(self, app, prefix=''): + self.app = app + self.prefix = prefix + + def __call__(self, environ, start_response): + + if environ['PATH_INFO'].startswith(self.prefix): + environ['PATH_INFO'] = environ['PATH_INFO'][len(self.prefix):] + environ['SCRIPT_NAME'] = self.prefix + return self.app(environ, start_response) + else: + start_response('404', [('Content-Type', 'text/plain')]) + return ["This url does not belong to the app.".encode()] diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..67d740c --- /dev/null +++ b/static/style.css @@ -0,0 +1,30 @@ +html, +body { + font-family: sans-serif; + color: tomato; + background-color: #111; +} + +pre { + font-family: sans-serif; + line-height: 1.4; + max-width: 60ch; + white-space: pre-wrap; +} + +.work { + border: 1px solid currentColor; + display: inline-block; + width: auto; + padding: 0 16px; +} + +main { + display: flex; + align-items: flex-start; + gap: 16px; +} + +main > * { + flex: 1 0 60ch; +} diff --git a/templates/bonfire.html b/templates/bonfire.html new file mode 100644 index 0000000..4bc8230 --- /dev/null +++ b/templates/bonfire.html @@ -0,0 +1,29 @@ + + + + + + + Flat Bonfire Framework + + + +

Documentation Bonfire

+ +
+ {% for key, entry in content.items() %} + +
+

{{ key }}

+ + {% for section, text in entry.items()%} +
+

{{ section }}

+
{{ text}}
+
+ {% endfor %} +
+ {% endfor %} +
+ +