master
km0 2 years ago
parent 19199dffa9
commit 79ec9f6316

@ -6,7 +6,22 @@ sorry i will write the readme later teh school is closing
A small writing machine to experiment the list format. It's again web-to-print, it's again flask, it's again markdown, it's again it's again it's again. I'm 30% sorry. A small writing machine to experiment the list format. It's again web-to-print, it's again flask, it's again markdown, it's again it's again it's again. I'm 30% sorry.
## How to use ## Add your list
Add a new file in the `txt` folder! The format is Markdown, so use the `.md` format.
For example:
```markdown
- Bread
- Milk
- ![A pic of eggs](img/eggs.jpg)
- Leek
```
Your list will appear in the homepage, using the filename as title.
## How to develop
- Clone the repo - Clone the repo
- Create a virtual environment - Create a virtual environment
@ -18,4 +33,4 @@ A small writing machine to experiment the list format. It's again web-to-print,
- Run the script - Run the script
- `python main.py` - `python main.py`
It will open a browser window that renders the list from the `list.md` file. You can write there. Put your images in the `img` folder. It will open a browser window that renders the files from the `txt` folder. You can put a new list in that directory. Put your images in the `img` folder.

@ -45,7 +45,7 @@ def list(slug):
with open(f'txt/{slug}.md',"r") as f: with open(f'txt/{slug}.md',"r") as f:
text = f.read() text = f.read()
list = markdown(text) list = markdown(text)
return render_template('list.html', list = list) return render_template('list.html', slug=slug, list = list)
@app.route('/img/<file>') @app.route('/img/<file>')
def send_img(file): def send_img(file):

@ -84,3 +84,12 @@ code {
color: currentColor; color: currentColor;
text-transform: capitalize; text-transform: capitalize;
} }
.git {
position: absolute;
color: currentColor;
font-size: 1rem;
background-color: white;
top: 1rem;
right: 1rem;
}

@ -5,13 +5,16 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}" /> <link rel="stylesheet" href="{{url_for('static', filename='style.css')}}" />
<title>list list</title> <title>wlist</title>
</head> </head>
<body> <body>
<h1>List of lists</h1> <h1>List of lists</h1>
<a class="git" href="https://git.xpub.nl/kamo/writing-list">git</a>
<ul class="home-list"> <ul class="home-list">
{% for list in listos %} {% for list in listos %}
<li><a href="{{url_for('list', slug=list)}}">{{list}}</a></li> <li>
<a href="{{url_for('list', slug=list)}}" target="__blank">{{list}}</a>
</li>
{% endfor %} {% endfor %}
</ul> </ul>
</body> </body>

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The list</title> <title>{{slug}}</title>
<link rel="stylesheet" href="{{url_for('static', filename='style.css')}}" /> <link rel="stylesheet" href="{{url_for('static', filename='style.css')}}" />
</head> </head>
<body> <body>

Loading…
Cancel
Save