Skip to content

Commit

Permalink
fix hyperlinks and add checker
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Mar 21, 2024
1 parent 25f7905 commit 739d2ff
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 126 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
with:
# Upload entire repository
path: 'docs/_build/dirhtml'

- name: Check links
run: |
make linkcheck
pages:
runs-on: ubuntu-latest
Expand Down
5 changes: 5 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
("py:class", "menuinst._schema.ConstrainedStrValue"),
]

linkcheck_anchors_ignore = (
r"^L[0-9]+$",
r"^L[0-9]+-L[0-9]+$",
)

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

Expand Down
93 changes: 2 additions & 91 deletions docs/source/defining-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,57 +100,7 @@ Note that setting `CFBundleTypeRole` will make the wrapper blip in the dock when
opened. If you don't want that, do not set it.
:::

A multi-platform example:

```json
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://schemas.conda.io/menuinst-1.schema.json",
"menu_name": "File type handler example",
"menu_items": [
{
"name": "My CSV Reader",
"activate": true,
"command": ["{{ PREFIX }}/bin/open_menuinst_files.py"],
"icon": "{{ MENU_DIR }}/open_menuinst_files.{{ ICON_EXT }}",
"platforms": {
"linux": {
"command": ["{{ PREFIX }}/bin/open_menuinst_files.py", "%f"],
"MimeType": ["application/x-menuinst"],
"glob_patterns": {
"application/x-menuinst": ["*.menuinst"]
}
},
"osx": {
"CFBundleDocumentTypes": [
{
"CFBundleTypeName": "org.conda.menuinst.opener",
"CFBundleTypeRole": "Viewer",
"LSItemContentTypes": ["org.conda.menuinst.main-file-uti"],
"LSHandlerRank": "Default"
}
],
"UTExportedTypeDeclarations": [
{
"UTTypeConformsTo": ["public.data", "public.content"],
"UTTypeIdentifier": "org.conda.menuinst.main-file-uti",
"UTTypeTagSpecification": [
{
"public.filename-extension": ["menuinst"]
}
]
}
]
},
"windows": {
"command": ["{{ SCRIPTS_DIR }}/open_menuinst_files.py", "%1"],
"file_extensions": [".csv"]
}
}
}
]
}
```
A multi-platform example can be found at [`tests/data/jsons/file_types.json`](https://github.com/conda/menuinst/blob/main/tests/data/jsons/file_types.json).

### URL protocols

Expand All @@ -165,46 +115,7 @@ shortcut.
- On macOS, use `CFBundleURLTypes`. Requires no placeholders. See
{ref}`relevant note in File Types <macos-event-handler>`.

```json
{
"$schema": "https://json-schema.org/draft-07/schema",
"$id": "https://schemas.conda.io/menuinst-1.schema.json",
"menu_name": "Protocol handler example",
"menu_items": [
{
"name": "My custom menuinst:// handler",
"activate": true,
"command": ["{{ PREFIX }}/bin/my_protocol_handler.py"],
"icon": "{{ MENU_DIR }}/my_protocol_handler.{{ ICON_EXT }}",
"platforms": {
"linux": {
"command": ["{{ PREFIX }}/bin/my_protocol_handler.py", "%u"],
"MimeType": ["x-scheme-handler/menuinst"]
},
"osx": {
"command": [
"{{ PREFIX }}/bin/my_protocol_handler.py",
"--listen",
"4444"
],
"CFBundleURLTypes": [
{
"CFBundleURLIconFile": "{{ MENU_DIR }}/my_protocol_handler",
"CFBundleURLName": "my-protocol-handler.menuinst.does-not-work-yet",
"CFBundleURLSchemes": ["menuinst"]
}
],
"event_handler": "for i in 1 2 3 4 5; do echo \"$*\" | nc localhost 4444 && break || sleep 1; done"
},
"windows": {
"command": ["{{ SCRIPTS_DIR }}/my_protocol_handler.py", "%1"],
"url_protocols": ["menuinst"]
}
}
}
]
}
```
A multi-platform example can be found at [`tests/data/jsons/url_protocols.json`](https://github.com/conda/menuinst/blob/main/tests/data/jsons/url_protocols.json).

## Notes on Windows shortcuts

Expand Down
55 changes: 22 additions & 33 deletions menuinst/_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,26 @@ class Windows(BasePlatformSpecific):
particular application. If your shortcut produces duplicated icons, you need to define this
field. If not set, it will default to ``Menuinst.<name>``.
See `AppUserModelID docs <aumi-docs>`__ for more information on the required string format.
.. aumi-docs: https://learn.microsoft.com/en-us/windows/win32/shell/appids#how-to-form-an-application-defined-appusermodelid
See `AppUserModelID docs
<https://learn.microsoft.com/en-us/windows/win32/shell/appids#how-to-form-an-application-defined-appusermodelid>`__
for more information on the required string format.
"""


class Linux(BasePlatformSpecific):
"""
Linux-specific instructions.
Check the `Desktop entry specification <desktop-entry-spec>`__ for more details.
.. desktop-entry-spec: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys
Check the `Desktop entry specification
<https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys>`__
for more details.
"""

Categories: Optional[Union[List[str], constr(regex=r"^.+;$")]] = None
"""
Categories in which the entry should be shown in a menu.
"See 'Registered categories' in the `Menu Spec <menu-spec>`__.
.. menu-spec: http://www.freedesktop.org/Standards/menu-spec
"See 'Registered categories' in the `Menu Spec
<http://www.freedesktop.org/Standards/menu-spec>`__.
"""
DBusActivatable: Optional[bool] = None
"A boolean value specifying if D-Bus activation is supported for this application."
Expand All @@ -119,9 +118,8 @@ class Linux(BasePlatformSpecific):
"Disable shortcut, signaling a missing resource."
Implements: Optional[Union[List[str], constr(regex=r"^.+;$")]] = None
"""
List of supported interfaces. See 'Interfaces' in `Desktop Entry Spec <desktop-entry-spec>`__.
.. desktop-entry-spec: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#interfaces
List of supported interfaces. See 'Interfaces' in `Desktop Entry Spec
<https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#interfaces>`__.
"""
Keywords: Optional[Union[List[str], constr(regex=r"^.+;$")]] = None
"Additional terms to describe this shortcut to aid in searching."
Expand Down Expand Up @@ -153,15 +151,13 @@ class Linux(BasePlatformSpecific):
"Hint that the app prefers to be run on a more powerful discrete GPU if available."
StartupNotify: Optional[bool] = None
"""
Advanced. See `Startup Notification spec <startup-notification-spec>`__.
.. startup-notification-spec: _https://www.freedesktop.org/wiki/Specifications/startup-notification-spec/
Advanced. See `Startup Notification spec
<https://www.freedesktop.org/wiki/Specifications/startup-notification-spec/>`__.
"""
StartupWMClass: Optional[str] = None
"""
Advanced. See `Startup Notification spec <startup-notification-spec>`__.
.. startup-notification-spec: _https://www.freedesktop.org/wiki/Specifications/startup-notification-spec/
Advanced. See `Startup Notification spec
<https://www.freedesktop.org/wiki/Specifications/startup-notification-spec/>`__.
"""
TryExec: Optional[str] = None
"""
Expand All @@ -180,13 +176,9 @@ class MacOS(BasePlatformSpecific):
"""
Mac-specific instructions. Check these URLs for more info:
- ``CF*`` keys: see `Core Foundation Keys <cf-keys>`_
- ``LS*`` keys: see `Launch Services Keys <ls-keys>`_
- ``entitlements``: see `entitlements docs <entitlements-docs>`_
.. _cf-keys: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
.. _ls-keys: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html
.. _entitlements-docs: https://developer.apple.com/documentation/bundleresources/entitlements.
- ``CF*`` keys: see `Core Foundation Keys <https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html>`__
- ``LS*`` keys: see `Launch Services Keys <https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html>`__
- ``entitlements``: see `Entitlements documentation <https://developer.apple.com/documentation/bundleresources/entitlements>`__
"""

class CFBundleURLTypesModel(BaseModel):
Expand All @@ -211,15 +203,13 @@ class CFBundleDocumentTypesModel(BaseModel):
LSItemContentTypes: List[str] = ...
"""
List of UTI strings defining a supported file type; e.g. for
PNG files, use 'public.png'. See `UTI Reference <uti-reference>`_
PNG files, use 'public.png'. See `UTI Reference
<https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html>`__
for more info about the system-defined UTIs. Custom UTIs can be
defined via 'UTExportedTypeDeclarations'. UTIs defined by other
apps (not the system) need to be imported via 'UTImportedTypeDeclarations'.
See `Fun with UTIs <fun-with-utis>`_ for more info.
.. _uti-reference: https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html
.. _fun-with-utis: https://www.cocoanetics.com/2012/09/fun-with-uti/
See `Fun with UTIs <https://www.cocoanetics.com/2012/09/fun-with-uti/>`__ for more info.
"""
LSHandlerRank: Literal["Owner", "Default", "Alternate"] = ...
"""
Expand Down Expand Up @@ -302,9 +292,8 @@ class UTTypeDeclarationModel(BaseModel):
entitlements: Optional[List[constr(regex=r"[a-z0-9\.\-]+")]] = None
"""
List of permissions to request for the launched application.
See `the entitlements docs <entitlements>`__ for a full list of possible values.
.. entitlements: https://developer.apple.com/documentation/bundleresources/entitlements
See `the entitlements docs <https://developer.apple.com/documentation/bundleresources/entitlements>`__
for a full list of possible values.
"""
link_in_bundle: Optional[
Dict[constr(min_length=1), constr(regex=r"^(?!\/)(?!\.\./).*")]
Expand Down
4 changes: 2 additions & 2 deletions menuinst/data/menuinst.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"definitions": {
"Linux": {
"title": "Linux",
"description": "Linux-specific instructions.\n\nCheck the `Desktop entry specification <desktop-entry-spec>`__ for more details.\n\n.. desktop-entry-spec: https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys",
"description": "Linux-specific instructions.\n\nCheck the `Desktop entry specification\n<https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys>`__\nfor more details.",
"type": "object",
"properties": {
"name": {
Expand Down Expand Up @@ -354,7 +354,7 @@
},
"MacOS": {
"title": "MacOS",
"description": "Mac-specific instructions. Check these URLs for more info:\n\n- ``CF*`` keys: see `Core Foundation Keys <cf-keys>`_\n- ``LS*`` keys: see `Launch Services Keys <ls-keys>`_\n- ``entitlements``: see `entitlements docs <entitlements-docs>`_\n\n.. _cf-keys: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html\n.. _ls-keys: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html\n.. _entitlements-docs: https://developer.apple.com/documentation/bundleresources/entitlements.",
"description": "Mac-specific instructions. Check these URLs for more info:\n\n- ``CF*`` keys: see `Core Foundation Keys <https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html>`__\n- ``LS*`` keys: see `Launch Services Keys <https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html>`__\n- ``entitlements``: see `Entitlements documentation <https://developer.apple.com/documentation/bundleresources/entitlements>`__",
"type": "object",
"properties": {
"name": {
Expand Down

0 comments on commit 739d2ff

Please sign in to comment.