Skip to content

Commit b5f8c59

Browse files
bigbrettpadelsbach
authored andcommitted
updates to work with new wolfHSM doc structure (english only)
1 parent 97e334c commit b5f8c59

3 files changed

Lines changed: 70 additions & 24 deletions

File tree

wolfHSM/Doxyfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,12 @@ WARN_LOGFILE =
868868
INPUT = README.md \
869869
wolfhsm/wh_client.h \
870870
wolfhsm/wh_client_crypto.h \
871-
wolfhsm/wh_server.h
871+
wolfhsm/wh_client_she.h \
872+
wolfhsm/wh_server.h \
873+
wolfhsm/wh_server_keystore.h \
874+
wolfhsm/wh_server_img_mgr.h \
875+
wolfhsm/wh_server_cert.h \
876+
wolfhsm/wh_server_cert_cache.h
872877

873878
# This tag can be used to specify the character encoding of the source files
874879
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

wolfHSM/Makefile

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,33 @@ endif
1111
all: pdf html
1212

1313

14-
SOURCES = chapter01.md \
15-
chapter02.md \
16-
chapter03.md \
17-
chapter04.md \
18-
chapter05.md \
19-
chapter06.md \
20-
chapter07.md \
21-
chapter08.md
22-
APPENDIX= appendix01.md
14+
ifeq ($(DOC_LANG),JA)
15+
SOURCES = chapter01.md \
16+
chapter02.md \
17+
chapter03.md \
18+
chapter04.md \
19+
chapter05.md \
20+
chapter06.md \
21+
chapter07.md \
22+
chapter08.md
23+
APPENDIX = appendix01.md
24+
HOMEPAGE = chapter01.md
25+
LINK_STRIP = chapter[0-9][0-9].md|appendix[0-9][0-9].md
26+
else
27+
SOURCES = 1-Overview.md \
28+
2-FAQs.md \
29+
3-Quickstart.md \
30+
4-Architecture.md \
31+
5-Features.md \
32+
6-Utilities.md \
33+
7-Examples.md \
34+
8-Integration.md \
35+
9-Configuration.md
36+
APPENDIX = 10-API-docs-client.md \
37+
11-API-docs-server.md
38+
HOMEPAGE = 0-Index.md
39+
LINK_STRIP = [0-9]+-[A-Za-z0-9-]+\.md
40+
endif
2341

2442
ifeq ($(DOC_LANG),JA)
2543
DOXY = Doxyfile-ja
@@ -64,14 +82,14 @@ html-setup: wolfhsm-update
6482
$(Q)cp ../common/*.css build/html/
6583
$(Q)perl -i -pe 's/ ```/```/g' build/html/*.md
6684
$(Q)perl -i -pe "s/\#--/\#-/g" build/html/*.md
67-
$(Q)mv build/html/$(word 1,$(SOURCES)) build/html/index.md
85+
$(Q)mv build/html/$(HOMEPAGE) build/html/index.md
6886

6987
# Override pdf-setup to ensure wolfhsm repo is cloned first
7088
.PHONY: pdf-setup
7189
pdf-setup: wolfhsm-update builddir
7290
$(Q)cp -a $(SRC)/* build/pdf/
7391
$(Q)cp ../common/*.png build/pdf/
74-
$(Q)perl -i -pe "s/chapter[0-9][0-9].md|appendix[0-9][0-9].md//g" build/pdf/*.md
92+
$(Q)perl -i -pe "s/$(LINK_STRIP)//g" build/pdf/*.md
7593
$(Q)perl -i -pe "s/\#--/\#/g" build/pdf/*.md
7694

7795
# Need an index.md, so let's make it chapter01.
@@ -85,10 +103,16 @@ html-prep: api
85103

86104
$(Q)perl -i -pe "s/\/group_/group_/g" build/html/group* build/html/*8h*
87105
$(Q)perl -i -pe "s/dox_comments\/header_files\///" build/html/*8h*
106+
$(Q)perl -i -pe "s/\[([^\]]+)\]\(Classes\/[^)]+\.md\)/\1/g" build/html/*8h*
88107

89108
# Set input format to gfm to fix issues with converted API docs
90109
# Regexes:
91-
# 1. Indent all headings by one #
110+
# 1. Demote the auto-generated API h-file headings by one # (only wh__*_8h.md)
111+
# so they nest as subsections under their parent appendix chapter. Don't
112+
# demote chapter source files — pandoc -N needs their H1 → \section for
113+
# proper "1.", "2.", ... numbering (and "A.", "B.", ... after \appendix);
114+
# if everything is demoted to ##, every chapter renders as "0.N" and the
115+
# appendix as ".N".
92116
# 2. Fix broken anchors from Doxybook2
93117
# 3. Remove file references from links
94118
# 4. Three regexes to remove metadata which outputs in the PDF text
@@ -98,7 +122,7 @@ html-prep: api
98122
pdf-prep: api
99123
$(Q)cp -a api/md/*8h* build/pdf/
100124

101-
$(Q)perl -i -pe "s/# /## /g" build/pdf/*.md
125+
$(Q)perl -i -pe "s/# /## /g" build/pdf/wh__*_8h.md
102126
$(Q)perl -i -pe "s/(\/group_.*|Classes\/struct.*|\/.*8h)\.md//g" build/pdf/*.md
103127
$(Q)perl -i -pe "s/^-(-)+$$//" build/pdf/*.md
104128
$(Q)perl -i -pe "s/^title:.*//" build/pdf/*.md
@@ -111,4 +135,11 @@ pdf-prep: api
111135
$(Q)perl -i -pe "s/(?<=md\#function\-)(.*)(?=\))/\$$1=~s#-#_#gr/ge" build/pdf/*.md
112136
$(Q)perl -i -pe "s/(?<=md\#typedef\-)(.*)(?=\))/\$$1=~s#-#_#gr/ge" build/pdf/*.md
113137
$(Q)perl -i -pe "s/(?<=md\#enum\-)(.*)(?=\))/\$$1=~s#-#_#gr/ge" build/pdf/*.md
114-
$(Q)cat build/pdf/wh__client_8h.md build/pdf/wh__client__crypto_8h.md build/pdf/wh__server_8h.md >> build/pdf/appendix01.md
138+
$(Q)perl -i -pe "s/\[([^\]]+)\]\((?:\.\.\/)*wolfhsm\/wh_[a-z_]+\.h\)/\1/g" build/pdf/*.md
139+
$(Q)perl -i -pe "s/\[([^\]]+)\]\(wh__[a-z_0-9]+\.md\)/\1/g" build/pdf/*.md
140+
$(Q)if [ "$(DOC_LANG)" = "JA" ]; then \
141+
cat build/pdf/wh__client_8h.md build/pdf/wh__client__crypto_8h.md build/pdf/wh__client__she_8h.md build/pdf/wh__server_8h.md build/pdf/wh__server__keystore_8h.md build/pdf/wh__server__img__mgr_8h.md build/pdf/wh__server__cert_8h.md build/pdf/wh__server__cert__cache_8h.md >> build/pdf/appendix01.md; \
142+
else \
143+
cat build/pdf/wh__client_8h.md build/pdf/wh__client__crypto_8h.md build/pdf/wh__client__she_8h.md >> build/pdf/10-API-docs-client.md; \
144+
cat build/pdf/wh__server_8h.md build/pdf/wh__server__keystore_8h.md build/pdf/wh__server__img__mgr_8h.md build/pdf/wh__server__cert_8h.md build/pdf/wh__server__cert__cache_8h.md >> build/pdf/11-API-docs-server.md; \
145+
fi

wolfHSM/mkdocs.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,28 @@ docs_dir: build/html/
44
site_dir: html/
55
copyright: Copyright © 2024 wolfSSL Inc.
66
nav:
7-
- "1. Introduction": index.md
8-
- "2. Overview": chapter02.md
9-
- "3. Getting Started": chapter03.md
10-
- "4. Functional Components": chapter04.md
11-
- "5. Client Library": chapter05.md
12-
- "6. Server Library": chapter06.md
13-
- "7. Customizing wolfHSM": chapter07.md
14-
- "8. Porting wolfHSM": chapter08.md
15-
- "9. API Reference":
7+
- Home: index.md
8+
- "1. Overview": 1-Overview.md
9+
- "2. FAQs": 2-FAQs.md
10+
- "3. Quickstart": 3-Quickstart.md
11+
- "4. Architecture": 4-Architecture.md
12+
- "5. Features": 5-Features.md
13+
- "6. Utilities": 6-Utilities.md
14+
- "7. Examples": 7-Examples.md
15+
- "8. Integration": 8-Integration.md
16+
- "9. Configuration": 9-Configuration.md
17+
- "10. Client API Reference":
18+
- Overview: 10-API-docs-client.md
1619
- Client API: wh__client_8h.md
1720
- Client Crypto API: wh__client__crypto_8h.md
21+
- Client SHE API: wh__client__she_8h.md
22+
- "11. Server API Reference":
23+
- Overview: 11-API-docs-server.md
1824
- Server API: wh__server_8h.md
25+
- Server Keystore API: wh__server__keystore_8h.md
26+
- Server Image Manager API: wh__server__img__mgr_8h.md
27+
- Server Cert API: wh__server__cert_8h.md
28+
- Server Cert Cache API: wh__server__cert__cache_8h.md
1929
theme:
2030
name: null
2131
custom_dir: ../mkdocs-material/material

0 commit comments

Comments
 (0)