Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Add linkToDocs.php helper script #188

Merged
merged 7 commits into from
Oct 2, 2024

Conversation

garvinhicking
Copy link
Contributor

@garvinhicking garvinhicking commented Sep 24, 2024

Allows to call an "API endpoint" on docs.typo3.org which can redirect to a common intersphinx identifier (like "t3coreapi:caching").

Version dependencies can also be specified.

This is possible by looking up a objects.inv.json file inside the resolved directory of the docs.typo3.org server, parse it, search for the index and then forward to the target URI.

We do not need an aggregator to merge all possible JSON files into one, because we only need to lookup the specific intersphinx repository destination.

Composer dependency 't3docs/typo3-version-handling' is utilized to provide the needed lookup maps between "intersphinx identifier" and actual rendering directory.

Example calls:

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3renderguides:available-default-inventories

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3coreapi:caching@12.4

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3coreapi:caching@11.5

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3coreapi:caching@main

https://intercept.ddev.site/services/linkToDocs.php?shortcode=typo3-cms-seo:introduction@main

Allows to call an "API endpoint" on docs.typo3.org
which can redirect to a common intersphinx identifier
(like "t3coreapi:caching").

Version dependencies can also be specified.

This is possible by looking up a objects.inv.json
file inside the resolved directory of the
docs.typo3.org server, parse it, search for the
index and then forward to the target URI.

We do not need an aggregator to merge all possible
JSON files into one, because we only need to lookup
the specific intersphinx repository destination.

Composer dependency 't3docs/typo3-version-handling'
is utilized to provide the needed lookup maps
between "intersphinx identifier" and actual
rendering directory.

Example calls:

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3renderguides:available-default-inventories

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3coreapi:caching@12.4

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3coreapi:caching@11.5

https://intercept.ddev.site/services/linkToDocs.php?shortcode=t3coreapi:caching@main

https://intercept.ddev.site/services/linkToDocs.php?shortcode=typo3-cms-seo:introduction@main
Copy link

private-packagist bot commented Sep 24, 2024

legacy_hook/composer.lock

Package changes

Package Operation From To About
psr/cache add - 2.0.0 view code - License: MIT License
psr/container add - 2.0.2 view code - License: MIT License
psr/log add - 3.0.2 view code - License: MIT License
symfony/cache add - v5.4.44 view code - License: MIT License
symfony/cache-contracts add - v2.5.3 view code - License: MIT License
symfony/polyfill-php73 add - v1.31.0 view code - License: MIT License
symfony/service-contracts add - v3.5.0 view code - License: MIT License
symfony/var-exporter add - v6.4.9 view code - License: MIT License
t3docs/typo3-version-handling add - 0.14.0 view code - License: MIT License
guzzlehttp/guzzle upgrade 7.8.1 7.9.2 diff
guzzlehttp/promises upgrade 2.0.2 2.0.3 diff
guzzlehttp/psr7 upgrade 2.6.2 2.7.0 diff
psr/http-factory upgrade 1.0.2 1.1.0 diff
symfony/deprecation-contracts upgrade v3.4.0 v3.5.0 diff
symfony/finder upgrade v5.4.35 v5.4.43 diff
symfony/polyfill-php80 upgrade v1.29.0 v1.31.0 diff

Dev Package changes

Package Operation From To About
mikey179/vfsstream upgrade v1.6.11 v1.6.12 diff
myclabs/deep-copy upgrade 1.11.1 1.12.0 diff
nikic/php-parser upgrade v5.0.1 v5.2.0 diff
phpunit/php-code-coverage upgrade 10.1.12 10.1.16 diff
phpunit/phpunit upgrade 10.5.11 10.5.35 diff
roave/security-advisories upgrade dev-latest da77e3d dev-latest 4d2e39c diff
sebastian/comparator upgrade 5.0.1 5.0.2 diff
sebastian/environment upgrade 6.0.1 6.1.0 diff

Settings · Docs · Powered by Private Packagist

@garvinhicking
Copy link
Contributor Author

c/o @NeoBlack - as discussed

legacy_hook/src/DocumentationLinker.php Outdated Show resolved Hide resolved
legacy_hook/src/DocumentationLinker.php Outdated Show resolved Hide resolved
legacy_hook/src/DocumentationLinker.php Outdated Show resolved Hide resolved
legacy_hook/src/DocumentationLinker.php Outdated Show resolved Hide resolved
Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

Copy link

The composer.lock diff comment has been updated to reflect new changes in this PR.

@andreaskienast andreaskienast merged commit 6abfc73 into TYPO3GmbH:develop Oct 2, 2024
2 of 3 checks passed
garvinhicking added a commit to TYPO3-Documentation/render-guides that referenced this pull request Oct 10, 2024
With TYPO3GmbH/site-intercept#188 we
introduced the possibility on docs.typo3.org to forward
to interlink shortcodes to the appropriate targets.

This server-side script is able to go through all
`objects.inv.json` files hosted on the server to parse
the proper targets, and then do a HTTP forward to
the actual documentation files.

This patch implements a new entry block "Shortlink"
(because "permalink" is the actual link to the site,
and still has value to be displayed as a primary
entry) in the popup modal when clicking on a header
reference.

NOTE: This should be regarded as an "experimental"
feature. There may be situations in which the
resolution of permalink targets with confvals and
filenames and others may not work properly yet. We
will need to catch these issues and address
them with follow-up patches to either this
repository or the site-intercept repository
using specific examples.
garvinhicking added a commit to garvinhicking/site-intercept that referenced this pull request Oct 11, 2024
andreaskienast added a commit that referenced this pull request Oct 11, 2024
)

* [TASK] Allow linkToDocs to fallback to 'main' for unknown versions

Follow-up of #188

* [BUGFIX] linkToDocs drive-by fix of wrong URL hash replacement

* [TASK] Declare `MAIN_IDENTIFIER` private

---------

Co-authored-by: Andreas Kienast <andreas.kienast@typo3.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants