Repository navigation
Doxygen/znai integration #35
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
Merged
Merged
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
3ce272d
Add basic doxygen support
godexsoft be8bc7c
Add znai doc for test
godexsoft f3775f2
More WIP Znai stuff
godexsoft a9cafc6
Fix formatting
godexsoft 22cf39f
Fix formatting in docs :D
godexsoft 7cedc9c
Add cmake target to export Znai docs
godexsoft 87247ad
Add workflow to generate and upload docs to gh-pages
godexsoft d71e9b4
Remove token forwarding
godexsoft e2ec3ec
Few small adjustments
godexsoft 80fe3ae
Try to checkout with submodules
godexsoft 01e3ecb
Fix missing target
godexsoft e4e1f10
Fix doxygen path
godexsoft d271b58
Fix path to doxygen issue and cleanup
godexsoft 201207c
Add a few more drafted docs
godexsoft c634da1
Add dockerfile for ci image
godexsoft 9c2598e
Try gh-pages deploy workflow
godexsoft 58683de
Add permissions to workflow
godexsoft 6c02116
Add workflow_call back
godexsoft 5c426e7
Correct path to znai doc
godexsoft a76a7cc
Back to doc root
godexsoft 39258d9
Remove docs from build, use as separate workflow only
godexsoft e49561f
Merge branch 'main' into feature/doxygen
godexsoft 7ce7294
WIP
godexsoft 070e23b
merge branch 'main' into feature/doxygen
godexsoft 6fc0979
Merge branch 'main' into feature/doxygen
godexsoft 1ca1286
Deploy znai doc to root
godexsoft 78624ff
Use new ci image with znai 1.68
godexsoft 8524792
Merge branch 'main' into feature/doxygen
godexsoft 2b84e91
Switch to znai 1.69
godexsoft 0c91694
Merge branch 'main' into feature/doxygen
godexsoft 190d943
Small fixes after merging main
godexsoft 71d2676
Add a few more files and an error to discuss
godexsoft c976495
Use latest znai and add placeholder doxy comments
godexsoft 355491f
Use snippets from actual code
godexsoft e51eb02
Use lookup-paths file
godexsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| name: docs | ||
| on: | ||
| push: | ||
| branches: [main, feature/doxygen] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| generate_docs: | ||
| name: Generate and upload docs | ||
| runs-on: ubuntu-20.04 | ||
| container: | ||
| image: godexsoft/functional-ci:0.0.4 | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| submodules: 'true' | ||
|
|
||
| - name: Export docs | ||
| continue-on-error: false | ||
| shell: bash | ||
| id: run_cmake | ||
| run: | | ||
| mkdir .build | ||
| cd .build | ||
| cmake -DDOCS=True .. | ||
| cmake --build . --target export_docs | ||
|
|
||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v4 | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: ./.build/docs | ||
| name: docs-develop | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
| with: | ||
| artifact_name: docs-develop | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| FROM fedora:39 | ||
|
|
||
| WORKDIR /root | ||
|
|
||
| RUN dnf -y update ;\ | ||
| dnf -y install redhat-lsb python3.11 gcc libstdc++-static ccache \ | ||
| vim wget sudo curl git grep sed gdb zsh cmake doxygen ninja-build \ | ||
| unzip java-latest-openjdk clang git-clang-format clang-tools-extra llvm ;\ | ||
| dnf -y clean all | ||
|
|
||
| # Fail build if unexpected gcc version | ||
| RUN gcc --version | grep -E "^gcc \(GCC\) 13" | ||
|
|
||
| RUN wget https://repo.maven.apache.org/maven2/org/testingisdocumenting/znai/znai-dist/1.70/znai-dist-1.70-znai.zip ;\ | ||
| unzip znai-dist-1.70-znai.zip -d znai_tmp; mv znai_tmp/dist /opt/znai ;\ | ||
| rm -rf znai-dist-1.70-znai.zip znai_tmp | ||
| ENV PATH=/opt/znai:${PATH} | ||
|
|
||
| ENV CC=/usr/bin/gcc | ||
| ENV CXX=/usr/bin/g++ | ||
| ENV CMAKE_GENERATOR='Ninja' | ||
| ENV CMAKE_C_COMPILER=${CC} | ||
| ENV CMAKE_CXX_COMPILER=${CXX} |
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| find_package(Doxygen REQUIRED) | ||
|
godexsoft marked this conversation as resolved.
Resolved
|
||
| find_package(Znai REQUIRED) | ||
|
|
||
| set(DOXYGEN_GENERATE_HTML NO) | ||
| set(DOXYGEN_GENERATE_XML YES) | ||
|
|
||
| macro(znai_export_docs TARGET SOURCE_DIR DEPLOY_DIR) | ||
| add_custom_target(${TARGET} | ||
| COMMAND ${Znai} --source ${SOURCE_DIR} --deploy ${DEPLOY_DIR} --doc-id '""' --lookup-paths ${CMAKE_BINARY_DIR} | ||
| COMMENT "Exporting documentation to ${DEPLOY_DIR}" | ||
| ) | ||
| endmacro() | ||
|
|
||
| doxygen_add_docs( | ||
| docs | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/include | ||
| COMMENT "Generate documentation" | ||
| ) | ||
|
|
||
| znai_export_docs( | ||
| export_docs | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/docs | ||
| ${CMAKE_BINARY_DIR}/docs | ||
| COMMENT "Export final documentation" | ||
| ) | ||
|
|
||
| add_dependencies(export_docs docs) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| find_program (Znai NAMES znai) | ||
| if(Znai_FOUND) | ||
| message(STATUS "Znai found at ${Znai}") | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| title: fn::choice | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/choice.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::choice | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| TODO | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| title: fn::and_then | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/and_then.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::and_then_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::and_then_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. | ||
|
|
||
| --- | ||
|
|
||
| ## Examples {style: "api"} | ||
|
|
||
| :include-template: templates/snippet.md { | ||
| path: "examples/simple.cpp", | ||
| surroundedBy: ["// example-choice-parse", "// example-choice-checks"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| --- | ||
| title: Choice monad | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/choice.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::choice | ||
|
|
||
| ## choice_for {style: "api"} | ||
| Used to generate `fn::choice` correctly. Sorts and deduplicates types under the hood. | ||
|
|
||
| Some text explaining this section... | ||
|
|
||
| :include-doxygen-member: fn::choice_for { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| ## choice {style: "api"} | ||
| Some text explaining this section... | ||
|
|
||
| :include-doxygen-member: fn::choice { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| ## value {style: "api"} | ||
| Some text explaining this section... | ||
|
|
||
| :include-doxygen-member: fn::choice< Ts... >::value { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| title: fn::transform | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/transform.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::transform_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::transform_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "indexPath": "xml/index.xml" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| title: fn::and_then | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/and_then.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::and_then_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::and_then_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. | ||
|
|
||
| --- | ||
|
|
||
| ## Examples {style: "api"} | ||
|
|
||
| :include-template: templates/snippet.md { | ||
| path: "examples/simple.cpp", | ||
| surroundedBy: ["// example-error-struct", "// example-expected-and_then-value"], | ||
| desc: "The resulting value is `13` because `ex` does not contain an `Error` and therefore `and_then` is called." | ||
| } | ||
|
|
||
| :include-template: templates/snippet.md { | ||
| path: "examples/simple.cpp", | ||
| surroundedBy: ["// example-error-struct", "// example-expected-and_then-error"], | ||
| desc: "The result is an `Error` because `ex` already contained an `Error` and therefore `and_then` is not called." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| title: fn::fail | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/fail.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::fail_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::fail_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| --- | ||
| title: fn::filter | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/filter.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::filter_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::filter_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. | ||
|
|
||
| --- | ||
|
|
||
| ## Examples {style: "api"} | ||
|
|
||
| :include-template: templates/snippet.md { | ||
| path: "examples/simple.cpp", | ||
| surroundedBy: ["// example-error-struct", "// example-expected-filter-value"], | ||
| desc: "The resulting value is `42` because the filter predicate returns `true` for `42` as it is not less than `42`." | ||
| } | ||
|
|
||
| :include-template: templates/snippet.md { | ||
| path: "examples/simple.cpp", | ||
| surroundedBy: ["// example-error-struct", "// example-expected-filter-error"], | ||
| desc: "The error is set to `Less than 42` because the predicate returns `false` for `12` since it's less than `42`." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| title: fn::inspect | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/inspect.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::inspect_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::inspect_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| title: fn::inspect_error | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/inspect_error.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::inspect_error_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::inspect_error_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| title: fn::or_else | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/or_else.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::or_else_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::or_else_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| title: fn::recover | ||
| --- | ||
|
|
||
| ##### Defined in {style: "api", badge: "#include <functional/recover.hpp>"} | ||
|
|
||
| --- | ||
|
|
||
| :include-doxygen-doc: fn::recover_t | ||
|
|
||
| --- | ||
|
|
||
| ## Call signatures {style: "api"} | ||
| :include-doxygen-member: fn::recover_t::operator() { signatureOnly: false, includeAllMatches: true } | ||
|
|
||
| --- | ||
|
|
||
| ## Return value {style: "api"} | ||
| A monadic type of the same kind. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MykolaGolubyev I have added the deploy step here, it's uploading correctly to gh-pages but there is a catch, we specify
functionalas the doc-id when exporting the docs and so they end up inbuild/docs/functional. Once i upload with gh-pages, you can see the result on https://libfn.org/functionalThis is almost good but i'd like the
functionaldocs 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right. One way to "improve" it a bit is to use
docsasdocId(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
docsthen you can imagine havingblogor 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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestions. Trying now.
) for doc-id, then i getMissing argument for option: doc-id-doc-idautomatically sets the doc-id tono-id-specifiedwhich also is not root/) yields an exception: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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the
docsandblogidea - 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testingisdocumenting/znai#1188
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not appear to work. It creates the
no-id-specifiedfolder on export then.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix was released as 1.69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have switched to the new version and it seems to do the right thing now 👍 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MykolaGolubyev latest docs are deployed to libfn.org but we are yet to actually write the contents