Rename .html files to .jinja2.

Add <title> to main page.
Small style tweaks.
This commit is contained in:
Sage Vaillancourt 2022-09-22 16:11:26 -04:00
parent a032d0577f
commit 17ab611e9c
5 changed files with 11 additions and 10 deletions

View File

@ -2,6 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>UnderCover</title>
<link rel="stylesheet" type="text/css" href=" <link rel="stylesheet" type="text/css" href="
{{ url_for('static', filename='styles_min.css') }}"> {{ url_for('static', filename='styles_min.css') }}">
<meta name="viewport" content="user-scalable=no;width=device-width"> <meta name="viewport" content="user-scalable=no;width=device-width">
@ -28,7 +29,7 @@
<h1><span class="logo left">Under</span><span class="logo right">Cover</span></h1> <h1><span class="logo left">Under</span><span class="logo right">Cover</span></h1>
<a> <a>
<h2>The secret cover letter generator</h2> <h2>The secret cover letter generator</h2>
{% from "_formhelpers.html" import render_field %} {% from "_formhelpers.jinja2" import render_field %}
<form method=post> <form method=post>
<dl> <dl>
{{ render_field(form.username) }} {{ render_field(form.username) }}
@ -54,7 +55,7 @@
{% endif %} {% endif %}
<input class=submit type=submit value="Generate PDF" <input class=submit type=submit value="Generate PDF"
{% if errors %} {% if errors %}
onclick="var e = document.getElementById('errors'); e.parentNode.removeChild(e);" onclick="const e = document.getElementById('errors'); e.parentNode.removeChild(e);"
{% endif %} {% endif %}
> >
</form> </form>

View File

@ -25,7 +25,7 @@ base_tex_text = open(proj_dir + "/writing_templates/base.tex", "r").read()
@dataclass @dataclass
class CLData(): class CLData:
username: str username: str
company: str company: str
jobandpronoun: str jobandpronoun: str
@ -55,7 +55,7 @@ class CLData():
f.write(base_tex_text) f.write(base_tex_text)
f.close() f.close()
output_arg="-jobname=outputs/" + unique_id + " " + unique_file output_arg = "-jobname=outputs/" + unique_id + " " + unique_file
com = "pdflatex -halt-on-error " + output_arg com = "pdflatex -halt-on-error " + output_arg
build_text = "[" + get_datetime() + "] Building for " + unique_id + " " build_text = "[" + get_datetime() + "] Building for " + unique_id + " "
result = subprocess.run( result = subprocess.run(
@ -94,7 +94,7 @@ class CLData():
errors = list(map(str.strip, result.stdout.split("\n"))) errors = list(map(str.strip, result.stdout.split("\n")))
del errors[:13] del errors[:13]
del errors[-2:] del errors[-2:]
return (None, errors) return None, errors
def cleanup(unique): def cleanup(unique):

4
start
View File

@ -2,14 +2,14 @@
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then if ! test -f "$SCRIPT_DIR/.undercover_init_successful"; then
if ! $SCRIPT_DIR/init; then if ! "$SCRIPT_DIR/init"; then
exit 1 exit 1
fi fi
fi fi
if ! pip3 -V | grep "$SCRIPT_DIR/.venv"; then if ! pip3 -V | grep "$SCRIPT_DIR/.venv"; then
echo "Entering virtual environment..." echo "Entering virtual environment..."
source $SCRIPT_DIR/.venv/bin/activate source "$SCRIPT_DIR/.venv/bin/activate"
fi fi
if [[ "$1" == "prod" ]]; then if [[ "$1" == "prod" ]]; then

View File

@ -66,7 +66,7 @@ class CLForm(Form):
def index_get(): def index_get():
if flaskr.INDEX is None: if flaskr.INDEX is None:
flaskr.INDEX = render_template( flaskr.INDEX = render_template(
'writing.html', 'writing.jinja2',
form=CLForm() form=CLForm()
) )
return flaskr.INDEX return flaskr.INDEX
@ -115,7 +115,7 @@ def index_post():
(resp, errors) = data.generate_pdf() (resp, errors) = data.generate_pdf()
if errors: if errors:
resp = make_response(render_template( resp = make_response(render_template(
'writing.html', 'writing.jinja2',
form=form, form=form,
errors=errors, errors=errors,
)) ))
@ -125,6 +125,6 @@ def index_post():
return resp return resp
return render_template( return render_template(
'writing.html', 'writing.jinja2',
form=form, form=form,
) )