Initial doc update with new settings

This commit is contained in:
Florian Bruhin 2017-07-01 22:58:50 +02:00
parent 94ac2ca56c
commit 25ab3b30c2
6 changed files with 2157 additions and 2206 deletions

View File

@ -281,7 +281,7 @@ Syntax: +:edit-url [*--bg*] [*--tab*] [*--window*] ['url']+
Navigate to a url formed in an external editor. Navigate to a url formed in an external editor.
The editor which should be launched can be configured via the `general -> editor` config option. The editor which should be launched can be configured via the `editor.command` config option.
==== positional arguments ==== positional arguments
* +'url'+: URL to edit; defaults to the current page url. * +'url'+: URL to edit; defaults to the current page url.
@ -338,7 +338,7 @@ Show help about a command or setting.
* +'topic'+: The topic to show help for. * +'topic'+: The topic to show help for.
- :__command__ for commands. - :__command__ for commands.
- __option.foo.bar__ for settings. - __section__.__option__ for settings.
==== optional arguments ==== optional arguments
@ -408,7 +408,7 @@ Start hinting.
* +*-m*+, +*--mode*+: The hinting mode to use. * +*-m*+, +*--mode*+: The hinting mode to use.
- `number`: Use numeric hints. - `number`: Use numeric hints.
- `letter`: Use the chars in the hints.chars settings. - `letter`: Use the chars in the hints.chars setting.
- `word`: Use hint words based on the html elements and the - `word`: Use hint words based on the html elements and the
extra words. extra words.
@ -545,7 +545,7 @@ For `increment` and `decrement`, the number to change the URL by. For `up`, the
[[open]] [[open]]
=== open === open
Syntax: +:open [*--implicit*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*] Syntax: +:open [*--related*] [*--bg*] [*--tab*] [*--window*] [*--secure*] [*--private*]
['url']+ ['url']+
Open a URL in the current/[count]th tab. Open a URL in the current/[count]th tab.
@ -556,7 +556,7 @@ If the URL contains newlines, each line gets opened in its own tab.
* +'url'+: The URL to open. * +'url'+: The URL to open.
==== optional arguments ==== optional arguments
* +*-i*+, +*--implicit*+: If opening a new tab, treat the tab as implicit (like clicking on a link). * +*-r*+, +*--related*+: If opening a new tab, position the tab as related to the current one (like clicking on a link).
* +*-b*+, +*--bg*+: Open in a new background tab. * +*-b*+, +*--bg*+: Open in a new background tab.
* +*-t*+, +*--tab*+: Open in a new tab. * +*-t*+, +*--tab*+: Open in a new tab.
@ -632,8 +632,17 @@ Save the current page as a quickmark.
[[quit]] [[quit]]
=== quit === quit
Syntax: +:quit [*--save*] ['session']+
Quit qutebrowser. Quit qutebrowser.
==== positional arguments
* +'session'+: The name of the session to save.
==== optional arguments
* +*-s*+, +*--save*+: When given, save the open windows even if auto_save.session is turned off.
[[record-macro]] [[record-macro]]
=== record-macro === record-macro
Syntax: +:record-macro ['register']+ Syntax: +:record-macro ['register']+
@ -752,7 +761,7 @@ Syntax: +:session-save [*--current*] [*--quiet*] [*--force*] [*--only-active-win
Save a session. Save a session.
==== positional arguments ==== positional arguments
* +'name'+: The name of the session. If not given, the session configured in general -> session-default-name is saved. * +'name'+: The name of the session. If not given, the session configured in session_default_name is saved.
==== optional arguments ==== optional arguments
@ -764,19 +773,18 @@ Save a session.
[[set]] [[set]]
=== set === set
Syntax: +:set [*--temp*] [*--print*] ['section'] ['option'] ['values' ['values' ...]]+ Syntax: +:set [*--temp*] [*--print*] ['option'] ['values' ['values' ...]]+
Set an option. Set an option.
If the option name ends with '?', the value of the option is shown instead. If the option name ends with '!' and it is a boolean value, toggle it. If the option name ends with '?', the value of the option is shown instead. If the option name ends with '!' and it is a boolean value, toggle it.
==== positional arguments ==== positional arguments
* +'section'+: The section where the option is in.
* +'option'+: The name of the option. * +'option'+: The name of the option.
* +'values'+: The value to set, or the values to cycle through. * +'values'+: The value to set, or the values to cycle through.
==== optional arguments ==== optional arguments
* +*-t*+, +*--temp*+: Set value temporarily. * +*-t*+, +*--temp*+: Set value temporarily until qutebrowser is closed.
* +*-p*+, +*--print*+: Print the value after setting. * +*-p*+, +*--print*+: Print the value after setting.
[[set-cmd-text]] [[set-cmd-text]]
@ -843,7 +851,7 @@ Close the current/[count]th tab.
==== optional arguments ==== optional arguments
* +*-p*+, +*--prev*+: Force selecting the tab before the current tab. * +*-p*+, +*--prev*+: Force selecting the tab before the current tab.
* +*-n*+, +*--next*+: Force selecting the tab after the current tab. * +*-n*+, +*--next*+: Force selecting the tab after the current tab.
* +*-o*+, +*--opposite*+: Force selecting the tab in the opposite direction of what's configured in 'tabs->select-on-remove'. * +*-o*+, +*--opposite*+: Force selecting the tab in the opposite direction of what's configured in 'tabs.select_on_remove'.
* +*-f*+, +*--force*+: Avoid confirmation for pinned tabs. * +*-f*+, +*--force*+: Avoid confirmation for pinned tabs.
@ -911,7 +919,7 @@ Close all tabs except for the current one.
=== tab-pin === tab-pin
Pin/Unpin the current/[count]th tab. Pin/Unpin the current/[count]th tab.
Pinning a tab shrinks it to tabs->pinned-width size. Attempting to close a pinned tab will cause a confirmation, unless --force is passed. Pinning a tab shrinks it to `tabs.width.pinned` size. Attempting to close a pinned tab will cause a confirmation, unless --force is passed.
==== count ==== count
The tab index to pin or unpin The tab index to pin or unpin
@ -931,8 +939,7 @@ Unbind a keychain.
==== positional arguments ==== positional arguments
* +'key'+: The keychain or special key (inside <...>) to unbind. * +'key'+: The keychain or special key (inside <...>) to unbind.
* +'mode'+: A comma-separated list of modes to unbind the key in (default: `normal`). * +'mode'+: A mode to unbind the key in (default: `normal`).
[[undo]] [[undo]]
=== undo === undo
@ -1043,6 +1050,7 @@ How many steps to zoom out.
|<<move-to-start-of-line,move-to-start-of-line>>|Move the cursor or selection to the start of the line. |<<move-to-start-of-line,move-to-start-of-line>>|Move the cursor or selection to the start of the line.
|<<move-to-start-of-next-block,move-to-start-of-next-block>>|Move the cursor or selection to the start of next block. |<<move-to-start-of-next-block,move-to-start-of-next-block>>|Move the cursor or selection to the start of next block.
|<<move-to-start-of-prev-block,move-to-start-of-prev-block>>|Move the cursor or selection to the start of previous block. |<<move-to-start-of-prev-block,move-to-start-of-prev-block>>|Move the cursor or selection to the start of previous block.
|<<nop,nop>>|Do nothing.
|<<open-editor,open-editor>>|Open an external editor with the currently selected form field. |<<open-editor,open-editor>>|Open an external editor with the currently selected form field.
|<<prompt-accept,prompt-accept>>|Accept the current prompt. |<<prompt-accept,prompt-accept>>|Accept the current prompt.
|<<prompt-item-focus,prompt-item-focus>>|Shift the focus of the prompt file completion menu to another item. |<<prompt-item-focus,prompt-item-focus>>|Shift the focus of the prompt file completion menu to another item.
@ -1290,11 +1298,15 @@ Move the cursor or selection to the start of previous block.
==== count ==== count
How many blocks to move. How many blocks to move.
[[nop]]
=== nop
Do nothing.
[[open-editor]] [[open-editor]]
=== open-editor === open-editor
Open an external editor with the currently selected form field. Open an external editor with the currently selected form field.
The editor which should be launched can be configured via the `general -> editor` config option. The editor which should be launched can be configured via the `editor.command` config option.
[[prompt-accept]] [[prompt-accept]]
=== prompt-accept === prompt-accept

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ show it.
*-V*, *--version*:: *-V*, *--version*::
Show version and quit. Show version and quit.
*-s* 'SECTION' 'OPTION' 'VALUE', *--set* 'SECTION' 'OPTION' 'VALUE':: *-s* 'OPTION' 'VALUE', *--set* 'OPTION' 'VALUE'::
Set a temporary setting for this session. Set a temporary setting for this session.
*-r* 'SESSION', *--restore* 'SESSION':: *-r* 'SESSION', *--restore* 'SESSION'::

View File

@ -79,7 +79,8 @@ MONOSPACE = (' xos4 Terminus, Terminus, Monospace, '
Option = collections.namedtuple('Option', ['name', 'typ', 'default', Option = collections.namedtuple('Option', ['name', 'typ', 'default',
'backends', 'description']) 'backends', 'conditional_backends',
'description'])
def _raise_invalid_node(name, what, node): def _raise_invalid_node(name, what, node):
@ -183,15 +184,20 @@ def _parse_yaml_backends(name, node):
QtWebKit: true QtWebKit: true
QtWebEngine: Qt 5.9 QtWebEngine: Qt 5.9
-> setting available based on the given conditionals. -> setting available based on the given conditionals.
Return:
A list of backends, and a boolean whether the list is conditional based
on the Qt version.
""" """
if node is None: if node is None:
return [usertypes.Backend.QtWebKit, usertypes.Backend.QtWebEngine] return ([usertypes.Backend.QtWebKit, usertypes.Backend.QtWebEngine],
False)
elif node == 'QtWebKit': elif node == 'QtWebKit':
return [usertypes.Backend.QtWebKit] return ([usertypes.Backend.QtWebKit], False)
elif node == 'QtWebEngine': elif node == 'QtWebEngine':
return [usertypes.Backend.QtWebEngine] return ([usertypes.Backend.QtWebEngine], False)
elif isinstance(node, dict): elif isinstance(node, dict):
return _parse_yaml_backends_dict(name, node) return (_parse_yaml_backends_dict(name, node), True)
_raise_invalid_node(name, 'backends', node) _raise_invalid_node(name, 'backends', node)
@ -214,11 +220,15 @@ def _read_yaml(yaml_data):
raise ValueError("Invalid keys {} for {}".format( raise ValueError("Invalid keys {} for {}".format(
option.keys(), name)) option.keys(), name))
backends, conditional_backends = _parse_yaml_backends(
name, option.get('backend', None))
parsed[name] = Option( parsed[name] = Option(
name=name, name=name,
typ=_parse_yaml_type(name, option['type']), typ=_parse_yaml_type(name, option['type']),
default=option['default'], default=option['default'],
backends=_parse_yaml_backends(name, option.get('backend', None)), backends=backends,
conditional_backends=conditional_backends,
description=option['desc']) description=option['desc'])
# Make sure no key shadows another. # Make sure no key shadows another.

View File

@ -392,8 +392,10 @@ content.netrc_file:
type: type:
name: File name: File
none_ok: true none_ok: true
desc: Set location of a netrc-file for HTTP authentication. If unset, ~/.netrc desc: >-
is used. Location of a netrc-file for HTTP authentication.
If unset, `~/.netrc` is used.
content.notifications: content.notifications:
default: ask default: ask
@ -640,8 +642,11 @@ downloads.location.directory:
type: type:
name: Directory name: Directory
none_ok: true none_ok: true
desc: The directory to save downloads to. If unset, a sensible os-specific desc: >-
default is used. Will expand environment variables. The directory to save downloads to.
If unset, a sensible os-specific default is used.
Will expand environment variables.
downloads.location.prompt: downloads.location.prompt:
default: true default: true

View File

@ -144,19 +144,14 @@ def _get_command_quickref(cmds):
def _get_setting_quickref(): def _get_setting_quickref():
"""Generate the settings quick reference.""" """Generate the settings quick reference."""
out = [] out = []
for sectname, sect in configdata.DATA.items(): out.append('')
if not getattr(sect, 'descriptions'): out.append('[options="header",width="75%",cols="25%,75%"]')
continue out.append('|==============')
out.append("") out.append('|Setting|Description')
out.append(".Quick reference for section ``{}''".format(sectname)) for opt in sorted(configdata.DATA.values()):
out.append('[options="header",width="75%",cols="25%,75%"]') desc = opt.description.splitlines()[0]
out.append('|==============') out.append('|<<{},{}>>|{}'.format(opt.name, opt.name, desc))
out.append('|Setting|Description') out.append('|==============')
for optname, _option in sect.items():
desc = sect.descriptions[optname].splitlines()[0]
out.append('|<<{}-{},{}>>|{}'.format(
sectname, optname, optname, desc))
out.append('|==============')
return '\n'.join(out) return '\n'.join(out)
@ -326,8 +321,6 @@ def generate_commands(filename):
hidden_cmds = [] hidden_cmds = []
debug_cmds = [] debug_cmds = []
for name, cmd in cmdutils.cmd_dict.items(): for name, cmd in cmdutils.cmd_dict.items():
if name in cmdutils.aliases:
continue
if cmd.deprecated: if cmd.deprecated:
continue continue
if cmd.hide: if cmd.hide:
@ -363,63 +356,59 @@ def generate_commands(filename):
f.write(_get_command_doc(name, cmd)) f.write(_get_command_doc(name, cmd))
def _generate_setting_section(f, sectname, sect): def _generate_setting_option(f, opt):
"""Generate documentation for a single section.""" """Generate documentation for a single section."""
version_dependent_options = [('network', 'proxy'),
('general', 'print-element-backgrounds')] f.write("\n")
for optname, option in sect.items(): f.write('[[{}]]'.format(opt.name) + "\n")
f.write("== {}".format(opt.name) + "\n")
f.write(opt.description + "\n")
f.write("\n")
valid_values = opt.typ.get_valid_values()
if valid_values is not None:
f.write("Valid values:\n")
f.write("\n") f.write("\n")
f.write('[[{}-{}]]'.format(sectname, optname) + "\n") for val in valid_values:
f.write("=== {}".format(optname) + "\n") try:
f.write(sect.descriptions[optname] + "\n") desc = valid_values.descriptions[val]
f.write(" * +{}+: {}".format(val, desc) + "\n")
except KeyError:
f.write(" * +{}+".format(val) + "\n")
f.write("\n") f.write("\n")
valid_values = option.typ.get_valid_values() if opt.name == 'bindings.default':
if valid_values is not None: # FIXME:conf
f.write("Valid values:\n") pass
f.write("\n") elif opt.default:
for val in valid_values: f.write("Default: +pass:[{}]+\n".format(html.escape(
try: opt.typ.to_str(opt.default))))
desc = valid_values.descriptions[val] else:
f.write(" * +{}+: {}".format(val, desc) + "\n") f.write("Default: empty\n")
except KeyError:
f.write(" * +{}+".format(val) + "\n")
f.write("\n")
if option.default(): all_backends = [usertypes.Backend.QtWebKit, usertypes.Backend.QtWebEngine]
f.write("Default: +pass:[{}]+\n".format(html.escape( if opt.backends == all_backends or opt.conditional_backends:
option.default()))) pass
else: elif opt.backends == [usertypes.Backend.QtWebKit]:
f.write("Default: empty\n") f.write("\nThis setting is only available with the QtWebKit "
"backend.\n")
if (option.backends is None or elif opt.backends == [usertypes.Backend.QtWebEngine]:
(sectname, optname) in version_dependent_options): f.write("\nThis setting is only available with the QtWebEngine "
pass "backend.\n")
elif option.backends == [usertypes.Backend.QtWebKit]: else:
f.write("\nThis setting is only available with the QtWebKit " raise ValueError("Invalid value {!r} for opt.backends"
"backend.\n") .format(opt.backends))
elif option.backends == [usertypes.Backend.QtWebEngine]:
f.write("\nThis setting is only available with the QtWebEngine "
"backend.\n")
else:
raise ValueError("Invalid value {!r} for option.backends".format(
option.backends))
def generate_settings(filename): def generate_settings(filename):
"""Generate the complete settings section.""" """Generate the complete settings section."""
configdata.init()
with _open_file(filename) as f: with _open_file(filename) as f:
f.write(FILE_HEADER) f.write(FILE_HEADER)
f.write("= Settings\n") f.write("= Settings\n")
f.write(_get_setting_quickref() + "\n") f.write(_get_setting_quickref() + "\n")
for sectname, sect in configdata.DATA.items(): for opt in sorted(configdata.DATA.values()):
f.write("\n") _generate_setting_option(f, opt)
f.write("== {}".format(sectname) + "\n")
f.write(configdata.SECTION_DESC[sectname] + "\n")
if not getattr(sect, 'descriptions'):
pass
else:
_generate_setting_section(f, sectname, sect)
def _get_authors(): def _get_authors():