Repository navigation
Doxygen/znai integration - #35
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #35 +/- ##
=======================================
Coverage 100.0% 100.0%
=======================================
Files 20 20
Lines 857 859 +2
Branches 121 121
=======================================
+ Hits 857 859 +2
|
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: ./.build/docs |
There was a problem hiding this comment.
@MykolaGolubyev I have added the deploy step here, it's uploading correctly to gh-pages but there is a catch, we specify functional as the doc-id when exporting the docs and so they end up in build/docs/functional. Once i upload with gh-pages, you can see the result on https://libfn.org/functional
This is almost good but i'd like the functional docs to be at the root of libfn.org. Is that something we can do with Znai today? The problem is that znai generates all the internal links/paths as /functional/... so i can't simply put the exported pages to the root of libfn.org.
I could not find any options on Znai that would allow me to easily fix it. Please let me know if there are any 🙇♂️
There was a problem hiding this comment.
Ah right. One way to "improve" it a bit is to use docs as docId (e.g. https://liftwizard.io/docs/configuration/json5-configuration)
But also wonder (haven't tried) if you pass an empty string or maybe forward slash as docId.
The reason for docId internal requirement is so urls can be treated the same way /docs/my-page and /docs/my-page/ (extra slash). Otherwise relative linking (..) would be messed up.
If you go with docs then you can imagine having blog or something like that. Not ideal trade off I understand.
Let me know if empty docId doesn't work and I will check the code to make it work.
There was a problem hiding this comment.
Thanks for the suggestions. Trying now.
- If i specify empty ('') or a space (
) for doc-id, then i getMissing argument for option: doc-id - Completely removing
-doc-idautomatically sets the doc-id tono-id-specifiedwhich also is not root - Specifying a forward slash (
/) yields an exception:generating the rest of HTML pages deploying index.md to /index.html Exception in thread "main" java.lang.RuntimeException: error during rendering of index: java.nio.file.AccessDeniedException: /index.html
Looks like this use-case is just not supported atm.
Perhaps it will be easy to fix. I like the forward slash idea. I feel like it's almost working except for the permissions 🤞
There was a problem hiding this comment.
As for the docs and blog idea - that's not too bad if we ever have a blog.
But for now, I'd like Znai to have the ability to generate straight for the root path. I think this is likely going to be a common use case.. I fear it's only time before other users come with the same question to you ![]()
There was a problem hiding this comment.
Could you please try to remove doc-id parameter altogether?
This does not appear to work. It creates the no-id-specified folder on export then.
Feel free to provide more feedback so I can pack them all together for the next release
Sorry, did not find the time to write more documentation yet. So i don't really have feedback outside of what we covered before in the discussion on this pr. 🙇
There was a problem hiding this comment.
I have switched to the new version and it seems to do the right thing now 👍 🙇
There was a problem hiding this comment.
Let me know if you have docs deployed somewhere - I could take a look and maybe suggest a thing or two if you want.
If you have some energy left, could you please post something here - testingisdocumenting/znai#824
There was a problem hiding this comment.
@MykolaGolubyev latest docs are deployed to libfn.org but we are yet to actually write the contents ![]()
|
|
||
| --- | ||
|
|
||
| <!-- |
There was a problem hiding this comment.
@MykolaGolubyev 👋
I tried to add some more stubs today and ran into this error.
Not sure what's going on here. Hope you can shed some light on this.
FWIW i can see fn::pack in the generated doxygen XML. Any pointers are welcome 🙇
There was a problem hiding this comment.
The only difference i can see in terms of doxygen XML is that fn::pack got multiple members that have the same name. Maybe some issue with that?
332 │ <compound refid="structfn_1_1pack" kind="struct"><name>fn::pack</name>
333 │ <member refid="structfn_1_1pack_1a1cd01f467210d1d7c92970b2ac9710e6" kind="typedef"><name>_impl</name></member>
334 │ <member refid="structfn_1_1pack_1a6b53a6941902d275f05b8f8c5958a413" kind="typedef"><name>append_type</name></member>
335 │ <member refid="structfn_1_1pack_1a5220de4d35d50f54338debe93b10b849" kind="function"><name>append</name></member>
336 │ <member refid="structfn_1_1pack_1a53d43b92cdf165cb2d8067b0c629058f" kind="function"><name>append</name></member>
337 │ <member refid="structfn_1_1pack_1a6d0c972a2291e4847df68664b2c26550" kind="function"><name>append</name></member>
338 │ <member refid="structfn_1_1pack_1ab91b4d2c1b74c153c82986fd87395908" kind="function"><name>append</name></member>
339 │ <member refid="structfn_1_1pack_1a9e45953a7b8f6963ba6d0441c4c92098" kind="function"><name>append</name></member>
340 │ <member refid="structfn_1_1pack_1a9e613c892d2c3f5fb01716b5ec6cad46" kind="function"><name>append</name></member>
341 │ <member refid="structfn_1_1pack_1a76399fca98d2deadfe412506e672b550" kind="function"><name>append</name></member>
342 │ <member refid="structfn_1_1pack_1a54b1422d57f8881d34f9dd0dc34b2a06" kind="function"><name>append</name></member>
343 │ <member refid="structfn_1_1pack_1a71cecf0ac11f392300b0e1f429fc4ff4" kind="function"><name>invoke</name></member>
344 │ <member refid="structfn_1_1pack_1a1c02cb92af7c4b414e386139a3ed16b2" kind="function"><name>invoke</name></member>
345 │ <member refid="structfn_1_1pack_1ae8ea2c2693c675bfafda5c93f38b0c9b" kind="function"><name>invoke</name></member>
346 │ <member refid="structfn_1_1pack_1a944f830f292b349d5576f64247becfa7" kind="function"><name>invoke</name></member>
347 │ <member refid="structfn_1_1pack_1a86f6e65efd32c44fb4f6658b67023e90" kind="function"><name>invoke_r</name></member>
348 │ <member refid="structfn_1_1pack_1a0e70b046265c82ff71799a363700c5df" kind="function"><name>invoke_r</name></member>
349 │ <member refid="structfn_1_1pack_1aa1416546a44ade53d09e240c7d9f3f1c" kind="function"><name>invoke_r</name></member>
350 │ <member refid="structfn_1_1pack_1a845b8cb7987cc4bc407082ba74a4537a" kind="function"><name>invoke_r</name></member>
351 │ </compound>
352 │ <compound refid="structfn_1_1detail_1_1pack__impl" kind="struct"><name>fn::detail::pack_impl</name>
353 │ </compound>
The error from znai is in the source file where this comment is pointing.
There was a problem hiding this comment.
Copying the error out for visibility:
Exception in thread "main" java.lang.RuntimeException:
markup parsing error:
TOC item: reference-manual/pack
full path: /Users/godexsoft/Development/functional/docs/reference-manual/pack.md
error handling include plugin <doxygen-doc>
free param: fn::pack
opts: {}
expected to find element <declname>
at org.testingisdocumenting.znai.website.WebSite.throwParsingErrorMessage(WebSite.java:570)
at org.testingisdocumenting.znai.website.WebSite.parseMarkupAndUpdateTocItemAndSearch(WebSite.java:562)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1117)
at org.testingisdocumenting.znai.website.WebSite.parseMarkups(WebSite.java:501)
at org.testingisdocumenting.znai.website.WebSite.parse(WebSite.java:193)
at org.testingisdocumenting.znai.website.WebSite.parseAndDeploy(WebSite.java:179)
at org.testingisdocumenting.znai.website.WebSite$Configuration.deployTo(WebSite.java:1034)
at org.testingisdocumenting.znai.cli.ZnaiCliApp.generateDocs(ZnaiCliApp.java:197)
at org.testingisdocumenting.znai.cli.ZnaiCliApp.start(ZnaiCliApp.java:99)
at org.testingisdocumenting.znai.cli.ZnaiCliApp.start(ZnaiCliApp.java:70)
at org.testingisdocumenting.znai.cli.ZnaiCliApp.main(ZnaiCliApp.java:75)
Caused by: java.lang.RuntimeException: error handling include plugin <doxygen-doc>
free param: fn::pack
opts: {}
expected to find element <declname>
at org.testingisdocumenting.znai.parser.commonmark.MarkdownVisitor.handleIncludePlugin(MarkdownVisitor.java:232)
at org.testingisdocumenting.znai.parser.commonmark.MarkdownVisitor.visit(MarkdownVisitor.java:155)
at znaishaded.org.commonmark.node.CustomBlock.accept(CustomBlock.java:7)
at znaishaded.org.commonmark.node.AbstractVisitor.visitChildren(AbstractVisitor.java:137)
at znaishaded.org.commonmark.node.AbstractVisitor.visit(AbstractVisitor.java:28)
at znaishaded.org.commonmark.node.Document.accept(Document.java:7)
at org.testingisdocumenting.znai.parser.commonmark.MarkdownParser.parsePartial(MarkdownParser.java:98)
at org.testingisdocumenting.znai.parser.commonmark.MarkdownParser.parse(MarkdownParser.java:66)
at org.testingisdocumenting.znai.website.WebSite.parseMarkupAndUpdateTocItemAndSearch(WebSite.java:549)
... 10 more
Caused by: java.lang.IllegalArgumentException: expected to find element <declname>
at org.testingisdocumenting.znai.utils.XmlUtils.lambda$nextLevelNodeByName$1(XmlUtils.java:87)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at org.testingisdocumenting.znai.utils.XmlUtils.nextLevelNodeByName(XmlUtils.java:87)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenMemberParser.lambda$parseMember$0(DoxygenMemberParser.java:63)
at java.base/java.util.stream.SpinedBuffer$1Splitr.forEachRemaining(SpinedBuffer.java:364)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:782)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenMemberParser.parseMember(DoxygenMemberParser.java:62)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenMemberParser.parseXml(DoxygenMemberParser.java:44)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenMemberParser.parse(DoxygenMemberParser.java:38)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenCompoundParser.parseMember(DoxygenCompoundParser.java:66)
at java.base/java.util.stream.SpinedBuffer$1Splitr.forEachRemaining(SpinedBuffer.java:356)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:782)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenCompoundParser.parseXml(DoxygenCompoundParser.java:62)
at org.testingisdocumenting.znai.doxygen.parser.DoxygenCompoundParser.parse(DoxygenCompoundParser.java:39)
at org.testingisdocumenting.znai.doxygen.Doxygen.findAndParseCompound(Doxygen.java:136)
at org.testingisdocumenting.znai.doxygen.Doxygen.getCachedOrFindAndParseCompound(Doxygen.java:101)
at org.testingisdocumenting.znai.doxygen.plugin.DoxygenDocIncludePlugin.process(DoxygenDocIncludePlugin.java:58)
at org.testingisdocumenting.znai.extensions.TrackingIncludePlugin.process(TrackingIncludePlugin.java:65)
at org.testingisdocumenting.znai.parser.commonmark.MarkdownVisitor.handleIncludePlugin(MarkdownVisitor.java:228)
... 18 more
There was a problem hiding this comment.
I was able to reproduce and believe the problem is that znai expects declname for every argument:
<param>
<type>std::in_place_type_t< T ></type>
</param>
<param>
<type>auto &&...</type>
<declname>args</declname>
</param>
As a temporary workaround (if possible) a to change signature so that Doxygen generates declname.
Longer term, do you have a preference what to use as a default?
There was a problem hiding this comment.
Any progress with this issue @MykolaGolubyev ?
The tmp workaround of course works but i don't think anyone would want to sacrifice code for docs so better support for unnamed arguments is very much desired! 🙇♂️
There was a problem hiding this comment.
Thanks for reminding. Will allocate some time this week.
There was a problem hiding this comment.
Thanks for letting me know 🙇 Will try as soon as i can.
| { | ||
| "title": "Functional", | ||
| "type": "Library", | ||
| "support": { |
There was a problem hiding this comment.
@MykolaGolubyev originally i had viewOn here and i'd keep it if there is a way to disable it on some pages. For example, i don't want this link on the landing index.md page but i'd like to have it for all the files inside of reference-manual. Is there a way to do this? I could not find it. Thanks
There was a problem hiding this comment.
just in case - viewOn should point to original md file that is the source for the page.
What makes you want to hide it for some pages?
There was a problem hiding this comment.
It generates urls automatically.. for the index.md it generates url//index. instead of url/index.md. If all urls would be correct, maybe i'd keep viewOn as is
There was a problem hiding this comment.
this looks like a bug! could you please submit another issue?
There was a problem hiding this comment.
@MykolaGolubyev all ready for you: testingisdocumenting/znai#1210
Bronek
left a comment
There was a problem hiding this comment.
Looking good, just please avoid copying code into documentation.
| CHECK(parse("2e9") == fn::choice(2e9)); | ||
| CHECK(parse("5e9") == fn::choice(5e9)); | ||
| CHECK(parse("foo").has_value(std::in_place_type<std::nullopt_t>)); | ||
|
|
There was a problem hiding this comment.
Please do not copy code excerpts like this into documentation; they can easily become obsolete. Instead do try to refer to existing code in unit tests - tests/examples is made for this. Ideally if Znai supported some form of code referral syntax, so you just put some kind of a comment inside e.g. tests/examples/simple.cpp. It's fine (a good practice even) to add more files to tests/examples specifically for this purpose.
There was a problem hiding this comment.
Sure, Znai definitely got some support for it. I will try and use it 👍
| index | ||
| sum | ||
| index | ||
|
No newline at end of file |
There was a problem hiding this comment.
I like this structure (might not like it later in the life of the project, but today it's great)
There was a problem hiding this comment.
Cool, you can always adjust it later (or i will on your request).
Ok, so this is heavily WIP stuff of course.
To try this you will need a few things:
DOCSoption in cmake (-DDOCS=ONor through VSCode CMake Cache editor UI)docstargetbrew install testingisdocumenting/brew/znaion mac. If you are on Linux - bad luck, you are on your ownThe above steps should generate
build/xmldoxygen output.You can now try znai like so
znai --preview --port 3333from thedocsfolder. 3333 can be replaced with your favourite port number. You can then navigate to127.0.0.1:3333to see the generated website. You can tweak things insidedocsfolder and znai will reload automatically.