From 070d5ae300a319a8b11f86a2a0282c84331b0bc5 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 8 Sep 2014 12:18:54 +0200 Subject: [PATCH] Add more documentation. --- doc/{ => help}/commands.asciidoc | 2 +- doc/help/index.asciidoc | 50 ++++++++++++++++++++++++++++++++ doc/{ => help}/settings.asciidoc | 0 qutebrowser/browser/commands.py | 6 ++-- scripts/generate_doc.py | 24 ++++++++++----- 5 files changed, 71 insertions(+), 11 deletions(-) rename doc/{ => help}/commands.asciidoc (99%) create mode 100644 doc/help/index.asciidoc rename doc/{ => help}/settings.asciidoc (100%) diff --git a/doc/commands.asciidoc b/doc/help/commands.asciidoc similarity index 99% rename from doc/commands.asciidoc rename to doc/help/commands.asciidoc index b533690ff..7ef9178d5 100644 --- a/doc/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -74,7 +74,7 @@ Get the value from a section/option. [[help]] === help -Syntax: +:help 'topic'+ +Syntax: +:help ['topic']+ Show help about a command or setting. diff --git a/doc/help/index.asciidoc b/doc/help/index.asciidoc new file mode 100644 index 000000000..b81ea1d5e --- /dev/null +++ b/doc/help/index.asciidoc @@ -0,0 +1,50 @@ +qutebrowser help +================ + +Documentation +------------- + +The following help pages are currently available: + +* link:FAQ.html[Frequently asked questions] +* link:commands.html[Documentation of commands] +* link:settings.html[Documentation of settings] + +Getting help +------------ + +You can get help in the IRC channel +irc://irc.freenode.org/#qutebrowser[`#qutebrowser`] on +http://freenode.net/[Freenode] +(https://webchat.freenode.net/?channels=#qutebrowser[webchat]), or by writing a +message to the +https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[mailinglist] at +mailto:qutebrowser@lists.qutebrowser.org[]. + +Bugs +---- + +If you found a bug or have a feature request, you can report it in several +ways: + +* Use the built-in `:report` command or the automatic crash dialog. +* Open an issue in the Github issue tracker. +* Write a mail to the +https://lists.schokokeks.org/mailman/listinfo.cgi/qutebrowser[mailinglist] at +mailto:qutebrowser@lists.qutebrowser.org[]. + +License +------- + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . diff --git a/doc/settings.asciidoc b/doc/help/settings.asciidoc similarity index 100% rename from doc/settings.asciidoc rename to doc/help/settings.asciidoc diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 8bac8f0b0..2ee04a72c 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -669,7 +669,7 @@ class CommandDispatcher: @cmdutils.register(instance='mainwindow.tabs.cmd', name='help', completion=[usertypes.Completion.helptopic]) - def show_help(self, topic): + def show_help(self, topic=None): r"""Show help about a command or setting. Args: @@ -678,7 +678,9 @@ class CommandDispatcher: - :__command__ for commands. - __section__\->__option__ for settings. """ - if topic.startswith(':'): + if topic is None: + path = 'index.html' + elif topic.startswith(':'): command = topic[1:] if command not in cmdutils.cmd_dict: raise cmdexc.CommandError("Invalid command {}!".format( diff --git a/scripts/generate_doc.py b/scripts/generate_doc.py index c6935ccc9..0a104b303 100755 --- a/scripts/generate_doc.py +++ b/scripts/generate_doc.py @@ -22,6 +22,7 @@ import os import sys +import glob import html import shutil import os.path @@ -416,15 +417,22 @@ def main(): print("{}Generating asciidoc files...{}".format( col.Fore.CYAN, col.Fore.RESET)) regenerate_manpage('doc/qutebrowser.1.asciidoc') - generate_settings('doc/settings.asciidoc') - generate_commands('doc/commands.asciidoc') + generate_settings('doc/help/settings.asciidoc') + generate_commands('doc/help/commands.asciidoc') regenerate_authors('README.asciidoc') - asciidoc_files = [('doc/qutebrowser.1.asciidoc', None), - ('doc/settings.asciidoc', - 'qutebrowser/html/doc/settings.html'), - ('doc/commands.asciidoc', - 'qutebrowser/html/doc/commands.html'), - ('README.asciidoc', None)] + asciidoc_files = [ + ('doc/qutebrowser.1.asciidoc', None), + ('README.asciidoc', None), + ('doc/FAQ.asciidoc', 'qutebrowser/html/doc/FAQ.html'), + ] + try: + os.mkdir('qutebrowser/html/doc') + except FileExistsError: + pass + for src in glob.glob('doc/help/*.asciidoc'): + name, _ext = os.path.splitext(os.path.basename(src)) + dst = 'qutebrowser/html/doc/{}.html'.format(name) + asciidoc_files.append((src, dst)) for src, dst in asciidoc_files: call_asciidoc(src, dst)