From a8f73dd37167b793173edd719886b9a1ef302737 Mon Sep 17 00:00:00 2001 From: Karim Hamidou Date: Sat, 19 Mar 2016 08:54:46 -0700 Subject: [PATCH] add a route to list RFCs --- app.py | 10 +++--- static/css/skeleton.css | 2 +- templates/list.html | 76 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 templates/list.html diff --git a/app.py b/app.py index 944ad114..676ebb2d 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ import os +import glob from flask import Flask, render_template, request, redirect, url_for from src.render_rfc import render_html_rfc @@ -26,11 +27,10 @@ def render_text_rfc(rfc_number): rendered = render_html_rfc(filename) return render_template('rfc.html', **rendered) -@app.route('/.txt') -def send_text_file(file_name): - """Send your static text file.""" - file_dot_text = file_name + '.txt' - return app.send_static_file(file_dot_text) +@app.route('/list') +def list_rfc(): + rfcs = [rfc[5:].split('.txt')[0] + '.html' for rfc in glob.glob('text/rfc*.txt')] + return render_template('list.html', rfcs=rfcs) @app.after_request diff --git a/static/css/skeleton.css b/static/css/skeleton.css index f92c66a5..8ac864c8 100644 --- a/static/css/skeleton.css +++ b/static/css/skeleton.css @@ -189,7 +189,7 @@ code { margin: 0 .2rem; font-size: 90%; white-space: nowrap; - background: #F1F1F1; + background: #FFF; border: 1px solid #E1E1E1; border-radius: 4px; } pre > code { diff --git a/templates/list.html b/templates/list.html new file mode 100644 index 00000000..4722e356 --- /dev/null +++ b/templates/list.html @@ -0,0 +1,76 @@ + + + + + + + RFCSpot: RFCs for the rest of us. + + + + + + + + + + + + + + + +
+
+
+
+

List of available RFCs:

+ {% for column in rfcs | sort | slice(4) -%} +
+ {%- for rfc in column -%} +
RFC {{ rfc }}
+ {%- endfor -%} +
+ {%- endfor %} + +
+ + + {% for rfc in rfcs %} + + {% endfor %} + + +
+ +
+
+
+ + + + + -- 2.43.0