Add programming language support.#207
Conversation
|
Why does the language need to be in the URL? |
|
Because there might be functions in both JS and PHP with the same name ( for example: These are different functions that would have documentation as to their usage specifically for that language ( The JS Both functions would require their own page as they're different functions. So they need different URLs to account for that. |
Of course they need different pages, but you wouldn't need to change the existing ones. Just put the language in the new ones. |
Yes, adding the programming language to the URL is not needed for existing PHP docs, but I think doing so makes sense architecturally...as long as the 301 redirects are handled at the sever config level. |
|
In a long-term view I also believe it's preferable. PHP may be the defacto default when it comes to WordPress development right now. But I don't think that will remain the case. In the future the unprefixed functions being PHP is not going to be as obvious to newcomers as it is now. |
For the parent trac issue please see: https://meta.trac.wordpress.org/ticket/3063.
In order to add the Gutenberg JSDoc into the code reference we'd want to be able to differentiate between JS and PHP functions, classes etc.
I've written a simple JSDoc template at https://github.com/herregroen/jsdoc-parser that converts JSDoc into a JSON format compatible with this plugin's import.
But importing that could potentially lead to conflicts as PHP and JS functions/classes might have the same names. This PR expands the structure of the plugin to support multiple programming languages. For now it's just a simple direct approach that needs further testing but I wanted to share it as soon as possible in order to gather input.
I've chosen to explicitly add
phpas well which means that all existing posts would have their name changed as well. Which means migrating would be a concern.