blob: 42f5f5ceedb3b880cf205163a57556d03fa4b0f7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>likha-pdf</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kj-sh604/noir.css@latest/out/noir.min.css" />
<script src="https://unpkg.com/htmx.org@1.9.12"></script>
<style>
.htmx-indicator {
display: none;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
display: inline;
}
</style>
</head>
<body>
<main>
<h1>likha-pdf</h1>
<p>simple markdown export with pandoc + lualatex.</p>
<section>
<h3>image upload</h3>
<form
id="upload-form"
hx-post="/upload-image"
hx-target="#upload-result"
hx-swap="innerHTML"
hx-encoding="multipart/form-data"
hx-indicator="#uploading"
>
<label for="image">image file</label>
<input id="image" name="image" type="file" accept="image/*" required />
<button id="upload-button" type="submit">upload image</button>
<small id="uploading" class="htmx-indicator">uploading…</small>
</form>
<div id="upload-result" aria-live="polite"></div>
</section>
<form
id="convert-form"
hx-post="/convert"
hx-target="#result"
hx-swap="innerHTML"
hx-indicator="#loading"
>
<label for="markdown"><strong>textarea</strong></label>
<textarea
id="markdown"
name="markdown"
rows="16"
placeholder="markdown goes here..."
required
></textarea>
<section>
<h3>pdf options</h3>
<label for="paper_size">Paper size</label>
<select id="paper_size" name="paper_size">
{% for key, label in paper_sizes.items() %}
<option value="{{ key }}">{{ label }}</option>
{% endfor %}
</select>
<label for="margin">Margins</label>
<select id="margin" name="margin">
{% for key, label in margins.items() %}
<option value="{{ key }}" {% if key == "1in" %}selected{% endif %}>{{ label }}</option>
{% endfor %}
</select>
<fieldset>
<legend>main font</legend>
<label>
<input type="radio" name="main_font" value="serif" checked /> serif
</label>
<label>
<input type="radio" name="main_font" value="sans" /> sans-serif
</label>
</fieldset>
</section>
<button id="convert-button" type="submit">generate pdf</button>
<small id="loading" class="htmx-indicator">converting…</small>
</form>
<section id="result" aria-live="polite"></section>
</main>
<script src="{{ url_for('static', filename='main.js') }}"></script>
</body>
</html>
|