Skip to content

Commit c18be83

Browse files
committed
docs: nlohmann.json demo
1 parent cfa9eb7 commit c18be83

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,13 +690,20 @@ jobs:
690690
ref: master
691691
path: fmt
692692

693+
- name: Clone Nlohmann.Json
694+
uses: actions/checkout@v4
695+
with:
696+
repository: nlohmann/json
697+
ref: develop
698+
path: nlohmann-json
699+
693700
- name: Patch Demo Projects
694701
shell: bash
695702
run: |
696703
set -euo pipefail
697704
set -x
698705
699-
for project in beman-optional fmt; do
706+
for project in beman-optional fmt nlohmann-json; do
700707
src="./examples/third-party/$project"
701708
dst="./$project"
702709
@@ -728,6 +735,8 @@ jobs:
728735
echo "Number of files in demos/boost-url/$variant/$generator: $(find demos/boost-url/$variant/$generator -type f | wc -l)"
729736
# beman.optional demo
730737
mrdocs --config="$(pwd)/beman-optional/docs/mrdocs.yml" --output="$(pwd)/demos/beman-optional/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
738+
# nlohmann-json demo
739+
mrdocs --config="$(pwd)/nlohmann-json/docs/mrdocs.yml" --output="$(pwd)/demos/nlohmann-json/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
731740
# fmt demo
732741
mrdocs --config="$(pwd)/fmt/doc/mrdocs.yml" --output="$(pwd)/demos/fmt/$variant/$generator" --multipage=$multipage --generator="$generator" --log-level=debug
733742
# mrdocs documenting mrdocs demo
@@ -736,7 +745,7 @@ jobs:
736745
737746
# Render the asciidoc files to html using asciidoctor
738747
if [[ ${{ runner.os }} == 'Linux' ]]; then
739-
for project in boost-url beman-optional mrdocs fmt; do
748+
for project in boost-url beman-optional mrdocs fmt nlohmann-json; do
740749
root="$(pwd)/demos/$project/$variant"
741750
src="$root/adoc"
742751
dst="$root/adoc-asciidoc"

docs/extensions/mrdocs-demos.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,17 @@ function humanizeLibrary(library) {
130130
{
131131
return 'Beman.Optional';
132132
}
133+
if (library === 'nlohmann-json')
134+
{
135+
return 'Nlohmann.JSON';
136+
}
137+
if (library === 'boost-scope') {
138+
return 'Boost.Scope';
139+
}
140+
if (library === 'fmt') {
141+
return 'Fmt';
142+
}
143+
// Match boost-<library> and convert to Boost.<Library> (capitalized)
133144
const boostLibrary = library.match(/boost-([\w]+)/);
134145
if (boostLibrary) {
135146
const capitalized = boostLibrary[1].charAt(0).toUpperCase() + boostLibrary[1].slice(1);
@@ -143,6 +154,12 @@ function libraryLink(library) {
143154
return 'https://github.com/boostorg/url[Boost.URL,window=_blank]';
144155
} else if (library === 'boost-scope') {
145156
return 'https://github.com/boostorg/scope[Boost.Scope,window=_blank]';
157+
} else if (library === 'nlohmann-json') {
158+
return 'https://www.github.com/nlohmann/json[Nlohmann.JSON,window=_blank]';
159+
} else if (library === 'beman-optional') {
160+
return 'https://www.github.com/steve-downey/optional[Beman.Optional,window=_blank]';
161+
} else if (library === 'fmt') {
162+
return 'https://github.com/fmtlib/fmt[fmt,window=_blank]';
146163
}
147164
return humanizeLibrary(library);
148165
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
source-root: ..
2+
input:
3+
- ../include
4+
exclude:
5+
- ../include/nlohmann/detail
6+
- ../include/nlohmann/thirdparty
7+
includes:
8+
- ../include
9+
file-patterns:
10+
- '*.hpp'
11+
include-symbols:
12+
- 'nlohmann::**'
13+
implementation-defined:
14+
- 'nlohmann::detail'
15+
multipage: true
16+
generator: adoc

examples/third-party/projects.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020
"branch": "master",
2121
"config": "doc/mrdocs.yml"
2222
},
23+
{
24+
"name": "Nlohmann.Json",
25+
"id": "nlohmann-json",
26+
"repository": "https://www.github.com/nlohmann/json",
27+
"branch": "develop",
28+
"config": "docs/mrdocs.yml"
29+
},
2330
{
2431
"name": "Mr.Docs",
2532
"id": "mrdocs",

0 commit comments

Comments
 (0)