diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 27774b8cf..9d906a009 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1 +1 @@ -See https://sw.kovidgoyal.net/kitty/changelog.html +See https://sw.kovidgoyal.net/kitty/changelog/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a9041720..e006514ff 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,9 +10,9 @@ config to reproduce the issue with). ### Contributing code -Install [the dependencies](https://sw.kovidgoyal.net/kitty/build.html#dependencies) +Install [the dependencies](https://sw.kovidgoyal.net/kitty/build/#dependencies) using your favorite package manager. Build and run kitty [from -source](https://sw.kovidgoyal.net/kitty/build.html#install-and-run-from-source). +source](https://sw.kovidgoyal.net/kitty/build/#install-and-run-from-source). Make a fork, submit your Pull Request. If it's a large/controversial change, open an issue beforehand to discuss it, so that you don't waste your time making a pull diff --git a/INSTALL.md b/INSTALL.md index 55745884c..9d5e12de6 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,3 +1,3 @@ -To build from source: +To build from source: -Pre-built binaries: +Pre-built binaries: diff --git a/README.asciidoc b/README.asciidoc index ff2fceab7..ea5a65c1b 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -4,7 +4,7 @@ See https://sw.kovidgoyal.net/kitty/[the kitty website]. image:https://github.com/kovidgoyal/kitty/workflows/CI/badge.svg["Build status", link="https://github.com/kovidgoyal/kitty/actions?query=workflow%3ACI"] -https://sw.kovidgoyal.net/kitty/faq.html[Frequently Asked Questions] +https://sw.kovidgoyal.net/kitty/faq/[Frequently Asked Questions] To ask other questions about kitty usage, use either the https://github.com/kovidgoyal/kitty/discussions/[discussions on GitHub] or the https://www.reddit.com/r/KittyTerminal[Reddit community] diff --git a/docs/conf.py b/docs/conf.py index 0009a61d3..d9fad3831 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -29,7 +29,7 @@ sys.path.insert(0, kitty_src) from kitty.conf.types import Definition # noqa -from kitty.constants import str_version # noqa +from kitty.constants import str_version, website_url # noqa # config {{{ # -- Project information ----------------------------------------------------- @@ -65,7 +65,7 @@ ] # URL for OpenGraph tags -ogp_site_url = 'https://sw.kovidgoyal.net/kitty/' +ogp_site_url = website_url() # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/kittens/diff/README.asciidoc b/kittens/diff/README.asciidoc index e7d4cab3c..e9a73c7d5 100644 --- a/kittens/diff/README.asciidoc +++ b/kittens/diff/README.asciidoc @@ -1 +1 @@ -See https://sw.kovidgoyal.net/kitty/kittens/diff.html +See https://sw.kovidgoyal.net/kitty/kittens/diff/ diff --git a/kittens/hints/main.py b/kittens/hints/main.py index 10ec3d947..74d9272d3 100644 --- a/kittens/hints/main.py +++ b/kittens/hints/main.py @@ -16,6 +16,7 @@ from kitty.cli import parse_args from kitty.cli_stub import HintsCLIOptions +from kitty.constants import website_url from kitty.fast_data_types import set_clipboard_string from kitty.key_encoding import KeyEvent from kitty.typing import BossType, KittyCommonOpts @@ -640,7 +641,7 @@ def run(args: HintsCLIOptions, text: str, extra_cli_args: Sequence[str] = ()) -> --customize-processing Name of a python file in the kitty config directory which will be imported to provide custom implementations for pattern finding and performing actions -on selected matches. See https://sw.kovidgoyal.net/kitty/kittens/hints.html +on selected matches. See {hints_url} for details. You can also specify absolute paths to load the script from elsewhere. @@ -649,7 +650,8 @@ def run(args: HintsCLIOptions, text: str, extra_cli_args: Sequence[str] = ()) -> the type of text being hinted. '''.format( default_regex=DEFAULT_REGEX, - line='{{line}}', path='{{path}}' + line='{{line}}', path='{{path}}', + hints_url=website_url('kittens/hints'), ).format help_text = 'Select text from the screen using the keyboard. Defaults to searching for URLs.' usage = '' diff --git a/kitty/boss.py b/kitty/boss.py index 26237eaa8..a1aa3bbad 100755 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -24,7 +24,7 @@ from .config import common_opts_as_dict, prepare_config_file_for_editing from .constants import ( appname, config_dir, is_macos, is_wayland, kitty_exe, - supports_primary_selection + supports_primary_selection, website_url ) from .fast_data_types import ( CLOSE_BEING_CONFIRMED, IMPERATIVE_CLOSE_REQUESTED, NO_CLOSE_REQUESTED, @@ -1141,7 +1141,7 @@ def done2(target_window_id: int, self: Boss) -> None: self._run_kitten('ask', [ '--name=create-marker', '--message', - _('Create marker, for example:\ntext 1 ERROR\nSee https://sw.kovidgoyal.net/kitty/marks.html\n') + _('Create marker, for example:\ntext 1 ERROR\nSee {}\n').format(website_url('marks')) ], custom_callback=done, action_on_removal=done2) diff --git a/kitty/cli.py b/kitty/cli.py index 3bfeda8e2..fba2f1955 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -12,7 +12,7 @@ from .cli_stub import CLIOptions from .conf.utils import resolve_config -from .constants import appname, defconf, is_macos, str_version +from .constants import appname, defconf, is_macos, str_version, website_url from .options.types import Options as KittyOpts from .typing import BadLineType, TypedDict @@ -146,7 +146,7 @@ def file(x: str) -> str: @role def doc(x: str) -> str: - return f'https://sw.kovidgoyal.net/kitty/{x}/' + return website_url(x) OptionSpecSeq = List[Union[str, OptionDict]] @@ -293,7 +293,8 @@ def get_defaults_from_seq(seq: OptionSpecSeq) -> Dict[str, Any]: to run inside :italic:`{appname}` as normal arguments following the :italic:`options`. For example: {appname} sh -c "echo hello, world. Press ENTER to quit; read" -For comprehensive documentation for kitty, please see: https://sw.kovidgoyal.net/kitty/''').format(appname=appname) +For comprehensive documentation for kitty, please see: {url}''').format( + appname=appname, url=website_url()) class PrintHelpForSeq: diff --git a/kitty/conf/types.py b/kitty/conf/types.py index 23d749812..482e84aa6 100644 --- a/kitty/conf/types.py +++ b/kitty/conf/types.py @@ -12,6 +12,7 @@ ) import kitty.conf.utils as generic_parsers +from kitty.constants import website_url if typing.TYPE_CHECKING: Only = typing.Literal['macos', 'linux', ''] @@ -41,15 +42,15 @@ def expand(m: Match) -> str: def remove_markup(text: str) -> str: - base = 'https://sw.kovidgoyal.net/kitty' + ref_map = { + 'layouts': f'{website_url("overview")}#layouts', + 'sessions': f'{website_url("overview")}#layouts', + 'functional': f'{website_url("keyboard-protocol")}#functional-key-definitions', + } def sub(m: Match) -> str: if m.group(1) == 'ref': - return { - 'layouts': f'{base}/overview/#layouts', - 'sessions': f'{base}/overview/#sessions', - 'functional': f'{base}/keyboard-protocol/#functional-key-definitions', - }[m.group(2)] + return ref_map[m.group(2)] return str(m.group(2)) return re.sub(r':([a-zA-Z0-9]+):`(.+?)`', sub, text, flags=re.DOTALL) diff --git a/kitty/constants.py b/kitty/constants.py index 3e5f70c35..3156bcbc9 100644 --- a/kitty/constants.py +++ b/kitty/constants.py @@ -186,3 +186,11 @@ def read_kitty_resource(name: str) -> bytes: except ImportError: from importlib_resources import read_binary # type: ignore return read_binary('kitty', name) + + +def website_url(doc_name: str = '') -> str: + if doc_name: + doc_name = doc_name.rstrip('/') + if doc_name: + doc_name += '/' + return f'https://sw.kovidgoyal.net/kitty/{doc_name}' diff --git a/kitty/rc/create_marker.py b/kitty/rc/create_marker.py index f9c90b50f..41ba80ecd 100644 --- a/kitty/rc/create_marker.py +++ b/kitty/rc/create_marker.py @@ -4,6 +4,7 @@ from typing import TYPE_CHECKING, Optional +from kitty.constants import website_url from kitty.options.utils import parse_marker_spec from .base import ( @@ -26,8 +27,8 @@ class CreateMarker(RemoteCommand): short_desc = 'Create a marker that highlights specified text' desc = ( 'Create a marker which can highlight text in the specified window. For example: ' - 'create_marker text 1 ERROR. For full details see: https://sw.kovidgoyal.net/kitty/marks.html' - ) + 'create_marker text 1 ERROR. For full details see: {}' + ).format(website_url('marks')) options_spec = MATCH_WINDOW_OPTION + '''\n --self type=bool-set diff --git a/kitty/update_check.py b/kitty/update_check.py index 689bb8fcc..ba2e62e5f 100644 --- a/kitty/update_check.py +++ b/kitty/update_check.py @@ -10,13 +10,13 @@ from urllib.request import urlopen from .config import atomic_save -from .constants import Version, cache_dir, kitty_exe, version +from .constants import Version, cache_dir, kitty_exe, version, website_url from .fast_data_types import add_timer, get_boss, monitor_pid from .notify import notify from .utils import log_error, open_url -CHANGELOG_URL = 'https://sw.kovidgoyal.net/kitty/changelog.html' -RELEASED_VERSION_URL = 'https://sw.kovidgoyal.net/kitty/current-version.txt' +CHANGELOG_URL = website_url('changelog') +RELEASED_VERSION_URL = website_url() + 'current-version.txt' CHECK_INTERVAL = 24 * 60 * 60. @@ -104,8 +104,8 @@ def process_current_release(raw: str) -> None: def run_worker() -> None: - import time import random + import time time.sleep(random.randint(1000, 4000) / 1000) with suppress(BrokenPipeError): # happens if parent process is killed before us print(get_released_version()) diff --git a/publish.py b/publish.py index 136e77e65..da8c5018e 100755 --- a/publish.py +++ b/publish.py @@ -328,7 +328,7 @@ def create_release(self, releases: Iterable[Dict[str, str]]) -> Dict[str, Any]: 'target_commitish': 'master', 'name': 'version %s' % self.version, 'body': f'Release version {self.version}.' - ' For changelog, see https://sw.kovidgoyal.net/kitty/changelog.html' + ' For changelog, see https://sw.kovidgoyal.net/kitty/changelog/' ' GPG key used for signing tarballs is: https://calibre-ebook.com/signatures/kovid.gpg', 'draft': False, 'prerelease': False