From d4a964ecb4d9cbd2fb2c642cdbfa7c8c47710c6f Mon Sep 17 00:00:00 2001 From: str4d Date: Wed, 25 Nov 2015 01:45:01 +0000 Subject: [PATCH] Only read spec headers when rendering index --- i2p2www/spec/views.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/i2p2www/spec/views.py b/i2p2www/spec/views.py index 2f99ab19..ca49a684 100644 --- a/i2p2www/spec/views.py +++ b/i2p2www/spec/views.py @@ -31,10 +31,14 @@ def spec_index(): for f in os.listdir(SPEC_DIR): if f.endswith('.rst'): path = safe_join(SPEC_DIR, f) - # read file + # read file header + header = '' with codecs.open(path, encoding='utf-8') as fd: - content = fd.read() - parts = publish_parts(source=content, source_path=SPEC_DIR, writer_name="html") + for line in fd: + header += line + if not line.strip(): + break + parts = publish_parts(source=header, source_path=SPEC_DIR, writer_name="html") meta = get_metadata_from_meta(parts['meta']) spec = {