Merge branch 'docs' of https://github.com/blueyed/kitty
This commit is contained in:
commit
9a365b0968
17
docs/conf.py
17
docs/conf.py
@ -500,35 +500,30 @@ def write_conf_docs(app, all_kitten_names):
|
|||||||
sc_role.warn_dangling = True
|
sc_role.warn_dangling = True
|
||||||
sc_role.process_link = process_shortcut_link
|
sc_role.process_link = process_shortcut_link
|
||||||
|
|
||||||
def generate(all_options, name='kitty'):
|
def generate_default_config(all_options, name):
|
||||||
from kitty.conf.definition import as_conf_file
|
from kitty.conf.definition import as_conf_file
|
||||||
from textwrap import indent
|
|
||||||
with open(f'generated/conf-{name}.rst', 'w', encoding='utf-8') as f:
|
with open(f'generated/conf-{name}.rst', 'w', encoding='utf-8') as f:
|
||||||
print('.. highlight:: conf\n', file=f)
|
print('.. highlight:: conf\n', file=f)
|
||||||
f.write(render_conf(name, all_options.values()))
|
f.write(render_conf(name, all_options.values()))
|
||||||
|
|
||||||
with open(f'generated/conf-{name}-literal.rst', 'w', encoding='utf-8') as f:
|
conf_name = re.sub(r'^kitten-', '', name) + '.conf'
|
||||||
print('.. code-block:: conf\n', file=f)
|
with open(f'generated/conf/{conf_name}', 'w', encoding='utf-8') as f:
|
||||||
text = '\n'.join(as_conf_file(all_options.values()))
|
text = '\n'.join(as_conf_file(all_options.values()))
|
||||||
text = indent(text, ' ', lambda l: True)
|
|
||||||
print(text, file=f)
|
print(text, file=f)
|
||||||
|
|
||||||
from kitty.config_data import all_options
|
from kitty.config_data import all_options
|
||||||
generate(all_options)
|
generate_default_config(all_options, 'kitty')
|
||||||
|
|
||||||
from kittens.runner import get_kitten_conf_docs
|
from kittens.runner import get_kitten_conf_docs
|
||||||
for kitten in all_kitten_names:
|
for kitten in all_kitten_names:
|
||||||
all_options = get_kitten_conf_docs(kitten)
|
all_options = get_kitten_conf_docs(kitten)
|
||||||
if all_options:
|
if all_options:
|
||||||
generate(all_options, f'kitten-{kitten}')
|
generate_default_config(all_options, f'kitten-{kitten}')
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
def setup(app):
|
def setup(app):
|
||||||
try:
|
os.makedirs('generated/conf', exist_ok=True)
|
||||||
os.mkdir('generated')
|
|
||||||
except FileExistsError:
|
|
||||||
pass
|
|
||||||
from kittens.runner import all_kitten_names
|
from kittens.runner import all_kitten_names
|
||||||
all_kitten_names = all_kitten_names()
|
all_kitten_names = all_kitten_names()
|
||||||
write_cli_docs(all_kitten_names)
|
write_cli_docs(all_kitten_names)
|
||||||
|
|||||||
@ -35,6 +35,7 @@ expanded, so :code:`${USER}.conf` becomes :file:`name.conf` if
|
|||||||
Sample kitty.conf
|
Sample kitty.conf
|
||||||
^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
Below is a sample :file:`kitty.conf` with all default settings.
|
Below is a sample :download:`kitty.conf </generated/conf/kitty.conf>` with all default settings.
|
||||||
|
|
||||||
.. include:: /generated/conf-kitty-literal.rst
|
.. literalinclude:: /generated/conf/kitty.conf
|
||||||
|
:language: conf
|
||||||
|
|||||||
@ -152,6 +152,7 @@ Command Line Interface
|
|||||||
Sample diff.conf
|
Sample diff.conf
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Below is a sample :file:`diff.conf` with all default settings.
|
Below is a sample :download:`diff.conf </generated/conf/diff.conf>` with all default settings.
|
||||||
|
|
||||||
.. include:: /generated/conf-kitten-diff-literal.rst
|
.. literalinclude:: /generated/conf/diff.conf
|
||||||
|
:language: conf
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user