-
Couldn't load subscription status.
- Fork 352
Get rid of the 'extra-' prefix #462
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
Conversation
|
About this statement from @wsmoak:
We can take some precautions about this possible issue, for example, if the filesystem is case-sensitive a collision is unlikely because all the module pages begin with uppercase and the additional documentation file names are down-cased. But this scenario is not always the case. So, we can raise an exception, something like this: if File.regular? output do
raise ArgumentError, "the file #{output} already exists"
else
File.write! output, html
end |
|
@milmazz I think if there is a collision, not files at all should be generated, so we should check before writing anything, if a collition exists, and raise if that happens. |
|
I will stop being stubborn, so 👍 from me. It would be nice to warn when there is a conflict but it is worth having in mind that we often override the previously generated docs when generating the new ones. So I am not sure if we actually should warn or raise... maybe we should just keep things exactly as in this PR. |
|
Actually, here is another idea. In the
Would this be preferable to removing prefixes altogether? |
|
@josevalim Please correct me if I'm wrong. I understood you to say that we can cover the following scenarios:
Did I understand you correctly? I think that your idea is clever, can clutter a little bit the |
|
I think no prefix is preferable as the default. If there is a conflict I think it's likely going to be someone doing it on purpose to try to override the generated content (which does not currently seem to be possible) and either raising or warning is fine... they'll wander over here and ask. So let someone add the prefix if they need it, or just learn how it works and rename their file to avoid the issue. Is this how the "Extras Map" proposal would work? original: new: Works for me! :) Reminder that there is more discussion in https://groups.google.com/forum/#!topic/elixir-lang-core/UzhyIhvQsC8 |
|
My concern about removing "-extra" is that it is a backwards incompatible change and there are some projects already relying on it. I really like the indication it is some extra content and not part of the generated docs. :( It seems we need to do two things to give the flexibility you need:
This seems to be enough, so I think we can close this PR. Thanks everyone for the discussion! PS: @wsmoak, if you are porting Phoenix guides, I think you will eventually need to add extra assets to the docs. Like images and so on. That should be fun to support too. :) |
|
@wsmoak I think a collision may happen unintentionally. somebody having a module named "Authors" and a file called "AUTHORS.md" for example |
@josevalim Is this is your main concern I think we should consider the following options:
Regardless of the options mentioned before, I think that the best way is to allow the developer to rename the files via |
|
I agree @milmazz -- ExDoc is pre-1.0 and this is the time to put it through its paces and figure out what works best. I'd really like to see the configuration called "pages" rather than "extras". As I mentioned on the mailing list, from my perspective this is not something 'extra' or incidental to the project, it is "The Documentation". And I found it confusing to see Pages in the generated HTML and then have to figure out that it came from configuration called "extras". Maybe "extras" could be deprecated and continue to work as-is for a time, and "pages" will have the new behavior? |
That's because the "Pages" bit was supposed to be customizable but we never got to it. For example, Phoenix may want to call it "Guides". :) |
|
@josevalim @wsmoak I think with the commit 0038081 we can cover all the scenarios:
|
|
@milmazz if we are going to remove the prefix, there is no need to create a page that redirects. As you said, we are before 1.0, so let's just get rid of it. :D |
|
I tried this out (using the correct branch this time) and I can override the filenames, but it does make for a lot of repetition in the config. If the "extras-" prefix is going away entirely (yay!) then I'll wait... Thanks @milmazz -- I wasn't expecting someone to do the work for me. :) Let me know if I can help. |
@josevalim Done!
@wsmoak The current proposal does not create redirects anymore. Please tell me what do you think and how we can improve your experience? Also, please remember that you can open new issues :)
I'm glad to help. |
|
It looks like after I merged #467 into |
This PR removes the
extra-prefix from the additional documentation (specified with the optionextras), this was suggested by @wsmoak, you can see more details about the discussion here@josevalim If you can, please let me know what do you think or if I need to fix something else.
As a side note, I also worked in another solution, moving all the additional documentation into the subdirectory
extras, but, I like more this way.