Use new URL scheme and define the kitty website centrally as much as possible

This commit is contained in:
Kovid Goyal 2021-07-27 09:03:11 +05:30
parent 17f3d2d581
commit 1bd39ff935
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
14 changed files with 42 additions and 29 deletions

View File

@ -1 +1 @@
See https://sw.kovidgoyal.net/kitty/changelog.html
See https://sw.kovidgoyal.net/kitty/changelog/

View File

@ -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

View File

@ -1,3 +1,3 @@
To build from source: <https://sw.kovidgoyal.net/kitty/build.html>
To build from source: <https://sw.kovidgoyal.net/kitty/build/>
Pre-built binaries: <https://sw.kovidgoyal.net/kitty/binary.html>
Pre-built binaries: <https://sw.kovidgoyal.net/kitty/binary/>

View File

@ -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]

View File

@ -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']

View File

@ -1 +1 @@
See https://sw.kovidgoyal.net/kitty/kittens/diff.html
See https://sw.kovidgoyal.net/kitty/kittens/diff/

View File

@ -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 = ''

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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}'

View File

@ -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

View File

@ -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())

View File

@ -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