not using CamelCase for a frame in index
Real world example: my toplevel module is called WebAssembly, the htmls generated have proper names in CamelCase, but the index.html contains reference:
<frame name="main" src="Webassembly.html" />
To reproduce: grab WebAssembly, run mix docs and see docs/index.html.
Note it is possible you don't see the problem in browsers on your Macs because HFS is still by default case-insensitive (but case-presenving) wrt to file names. I found this out only when started to browse docs on Linux.
Ex_doc 0.5.1 & 0.5.2
Interesting. From where the index.html reference is coming from?
Don't know if I understand this question :)
I didn't do anything special to provide content in index.html. It got autogenerated together will all other docs.
What I did consciously was to fill moduledocs and function docs inside modules :)
It was a rhetorical question about ex_doc. Why just that reference is wrong? :)
Ahh :]
I spent a few minutes looking at this. The root cause is that the app name in the mix.exs file is :webassembly, rather than :web_assembly. Since no --main argument is passed to ex_doc, it derives the main doc module from this name (in lib/mix/tasks/docs.ex). When camel-cased it doesn't match the file name of the module WebAssembly.
The reason the other links work correctly is that they are built after the WebAssembly module is parsed, so the get the correct capitalization.
Not sure how to fix, you can pass any string or atom as the main page (like :readme or :overview). Perhaps we could check the file exists, but it would be more challenging to correct if the file doesn't exist.
Good analysis!
I didn't know about --main. Now I'd rather go with mix docs --main WebAssembly - it works! - than changing the app name in all apps that depend on it. Thx!
Great analysis, @jwarwick.
The issue is subtle, but I'm not sure I see a bug here. If your app name does not adhere to the convention that is used for generating module names, you can specify the :main option in mix.exs. By the way, the same convention is used in mix new, so you had to manually edit your module or app name after generating a project. Perhaps this could be documented somewhere.
Yup @alco that's right, I've had no idea that --app foo_bar would generate camelized FooBar, so did it by hand.
But!
For a careful reader such case is actually shown in examples - when you run mix help new
I think what could be documented is that you can set docs: [main: ...] in the project definition - btw excuse my ignorance, does it work for any mix task or just doc task is constructed this way that it grabs stuff from project def?
@herenowcoder The escript.build task looks up options under escript: ..., it also uses project-level options like :app. ExDoc does the same, in principle.
Haha, this actually is documented already :)
" The following options should be put under the :docs key in your project's
main configuration."
Another day full of learning Elixir ;) thx to all!