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

PLAT-9652: tmpl: fix link tag usage in see tags #1

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

Daniel-Knights
Copy link
Contributor

@Daniel-Knights Daniel-Knights commented Oct 17, 2024

When using an @link tag inside an @see tag, if the link path is in the format module:<path>, the template doesn't parse it correctly, so it ends up like this:

Screenshot 2024-10-22 at 17 32 41

The problem is the full text is being passed to linkto instead of just the path. It slips through all the conditional checks and reaches the end return statement, which tries to convert it to a short name using getShortName, but this ends up splitting it by the colon after module and returning the popped result.

This PR checks if the @see text includes @link and uses the full link text directly instead of passing it to linkto.

Testing this change locally will require updating the template package code in your core repo's node_modules, and adding an @see tag somewhere as described above. For example, in base/browser.js:

/**
 * Whether the current browser is on a mobile device or not
 * @see {@link module:base/browser}
 * @type {boolean}
 */
export const isTouchDevice =
    touchParam && ['false', 'true'].includes(touchParam)
        ? touchParam == 'true'
        : mobile || !!navigator.maxTouchPoints; //The maxTouchPoints test covers Edge browsers on windows tablets

This becomes important in enh/PLAT-9652_fix_api_docs_links where I've added @see tags with @link, and updated jsdoc-plugin-typescript to include this change: openlayers/jsdoc-plugin-typescript#66.

@Daniel-Knights Daniel-Knights marked this pull request as ready for review October 22, 2024 16:42
Copy link
Contributor

@mstrong98 mstrong98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Daniel-Knights Well done!

@mstrong98 mstrong98 merged commit 3715012 into main Oct 22, 2024
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