From daf81f5fcd4dbc8428b3160cafd755afc533b8c7 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 21 Oct 2015 07:31:47 +0200 Subject: [PATCH] www: Working website generation. --- README.asciidoc | 2 ++ scripts/asciidoc2html.py | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 58e9ae385..673d57271 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -6,6 +6,7 @@ qutebrowser =========== +// QUTE_WEB_HIDE image:icons/qutebrowser-64x64.png[qutebrowser logo] *A keyboard-driven, vim-like browser based on PyQt5 and QtWebKit.* image:https://img.shields.io/pypi/l/qutebrowser.svg?style=flat["license badge",link="https://github.com/The-Compiler/qutebrowser/blob/master/COPYING"] @@ -14,6 +15,7 @@ image:https://img.shields.io/github/issues/The-Compiler/qutebrowser.svg?style=fl image:https://requires.io/github/The-Compiler/qutebrowser/requirements.svg?branch=master["requirements badge",link="https://requires.io/github/The-Compiler/qutebrowser/requirements/?branch=master"] image:https://travis-ci.org/The-Compiler/qutebrowser.svg?branch=master["Build Status", link="https://travis-ci.org/The-Compiler/qutebrowser"] image:https://ci.appveyor.com/api/projects/status/9gmnuip6i1oq7046?svg=true["AppVeyor build status", link="https://ci.appveyor.com/project/The-Compiler/qutebrowser"] +// QUTE_WEB_HIDE_END qutebrowser is a keyboard-focused browser with a minimal GUI. It's based on Python, PyQt5 and QtWebKit and free software, licensed under the GPL. diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index fc1df3faf..b442d46b5 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -20,6 +20,7 @@ """Generate the html documentation based on the asciidoc files.""" +import re import os import os.path import sys @@ -111,13 +112,32 @@ class AsciiDoc: with open(modified_src, 'a', encoding='utf-8') as outfp: with open(src, 'r', encoding='utf-8') as infp: - outfp.write(infp.read()) + outfp.write('\n') + hidden = False + for line in infp: + if line.strip() == '// QUTE_WEB_HIDE': + assert not hidden + hidden = True + elif line.strip() == '// QUTE_WEB_HIDE_END': + assert hidden + hidden = False + + # Let's see if this looks good everywhere... + if re.match(r'^=+$', line): + line = line.replace('=', '-') + elif re.match(r'^= .+', line): + line = '==' + line[1:] + + if not hidden: + outfp.write(line) self.call(modified_src, dst, '--theme=qute') for path in ['icons', 'doc/img']: shutil.copytree(path, os.path.join(outdir, path)) + os.symlink('README.html', os.path.join(outdir, 'index.html')) + def _get_asciidoc_cmd(self): """Try to find out what commandline to use to invoke asciidoc.""" if self._args.asciidoc is not None: