Skip to content

Conversation

@fordhurley
Copy link
Contributor

@fordhurley fordhurley commented Sep 1, 2018

Fixes #14819

This was noted in #14750 (comment).

The problem was that the [path] for the docs changed to support localization, but the source code didn't. For example, /docs/#api/objects/Mesh became /docs/#api/en/objects/Mesh.

The doc links follow the pattern:

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

where [path] is, for our example, en/objects/Mesh.

I introduced a new variable, [nonLocalizedPath], and changed the links to:

[link:https://github.com/mrdoob/three.js/blob/master/src/[nonLocalizedPath].js src/[nonLocalizedPath].js]

Not an elegant solution, but it gets the job done. Extremely open to other approaches.

@fordhurley
Copy link
Contributor Author

A more elegant solution might be to completely DRY the links in the docs by defining the whole link as a variable, e.g. [linkToSource].

@mrdoob
Copy link
Owner

mrdoob commented Sep 4, 2018

I think [path] is only used for these links.

Instead of modifying all the files, I think you should be able just remove the /en part in this line:

https://github.com/mrdoob/three.js/blob/dev/docs/page.js#L56

text = text.replace( /\[path\]/gi, path.substr( 3 ) );

@fordhurley
Copy link
Contributor Author

Ok, great! I was afraid there would be a reason to keep the full [path] around, but this is dramatically simpler. I just opened a new PR with that solution: #14846

@fordhurley fordhurley closed this Sep 4, 2018
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