Skip to content

Commit ab08ebe

Browse files
committed
Closer to textfsm101
1 parent 9b2cfa8 commit ab08ebe

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

flask_app.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import yaml
2-
from flask import Flask, render_template, request, Response, url_for, jsonify
2+
from flask import Flask, render_template, request, jsonify
33
from ttp import ttp
44

55
app = Flask(__name__, static_url_path="/static")
6-
config = {"name": "TTP", "data": "RAW", "rendered": "JSON"}
76
app.json.sort_keys = False
87
app.config.update(
98
TITLE="TTP",
109
SUBTITLE="Playground for TTP templates",
1110
GITHUB="https://github.com/infrastructureAsCode-ch/ttp101/",
12-
11+
data_textarea="RAW",
12+
template_textarea="TTP",
13+
rendered_textarea="JSON",
1314
)
1415

1516
@app.route("/")
1617
def index():
17-
return render_template("index.html", **config)
18+
return render_template("index.html")
1819

1920

2021
@app.route("/examples")

templates/form.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<div class="container-fluid">
22
<form id="templateForm" method="POST" action="rend">
3+
34
<div class="row">
45
<div class="col-lg-4">
56
<div class="form-group">
6-
<label for="textData">Data <small>{{data}}</small></label>
7+
<label for="textData">Data <small>{{config.data_textarea}}</small></label>
78
<textarea class="form-control show-spaces" id="textData" name="data" rows="20"></textarea>
89
</div>
910
</div>
1011
<div class="col-lg-4">
1112
<div class="form-group">
12-
<label for="textTemplate">Template <small>{{name}}</small></label>
13+
<label for="textTemplate">Template <small>{{config.template_textarea}}</small></label>
1314
<textarea class="form-control show-spaces" id="textTemplate" name="template"
1415
rows="20"></textarea>
1516
</div>
1617
</div>
1718
<div class="col-lg-4">
1819
<div class="form-group">
19-
<label for="textRendered" disabled>Rendered <small>{{rendered}}</small></label>
20+
<label for="textRendered" disabled>Rendered <small>{{config.rendered_textarea}}</small></label>
2021
<textarea class="form-control show-spaces" id="textRendered" rows="20" disabled></textarea>
2122
</div>
2223
</div>

0 commit comments

Comments
 (0)