Skip to content

Commit 81ea305

Browse files
committed
(WIP) test for mdbook serve
1 parent d029604 commit 81ea305

File tree

8 files changed

+28
-34
lines changed

8 files changed

+28
-34
lines changed

guide/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
book
2-
build/*
3-
book.toml
2+
build/*

guide/book-template.config

Lines changed: 0 additions & 10 deletions
This file was deleted.

guide/build-books.cmake

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
# Function to configure the book file and add a custom target to build it.
2-
function(BuildBook LANGUAGE AUTHORS)
3-
# Set the variables for substitution.
4-
set(AUTHORS "${AUTHORS}")
1+
function(BuildBook LANGUAGE)
52
set(LANGUAGE "${LANGUAGE}")
63
set(ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
74
set(TARGET_DIR "${ROOT_DIR}/src/${LANGUAGE}")
85

9-
# Create a custom target that calls mdbook with the generated config.
10-
if(EXISTS "${TARGET_DIR}/SUMMARY.md")
11-
# Configure the template file with the substitutions.
12-
configure_file(
13-
${ROOT_DIR}/book-template.config
14-
${TARGET_DIR}/book.toml
15-
@ONLY
16-
)
17-
18-
message(STATUS "Building book for language: ${LANGUAGE}")
19-
execute_process(
20-
COMMAND mdbook build -d ${ROOT_DIR}/book/${LANGUAGE}
21-
WORKING_DIRECTORY ${TARGET_DIR}
22-
)
23-
else()
24-
message(WARNING "Skipping '${LANGUAGE}' – SUMMARY.md not found at ${SUMMARY_FILE}")
6+
if(NOT EXISTS "${TARGET_DIR}/SUMMARY.md")
7+
message(WARNING "Skipping '${LANGUAGE}' – SUMMARY.md not found at ${TARGET_DIR}")
8+
return()
9+
endif()
10+
11+
if(NOT EXISTS "${TARGET_DIR}/book.toml")
12+
message(WARNING "Skipping '${LANGUAGE}' – book.toml not found at ${TARGET_DIR}")
13+
return()
2514
endif()
15+
16+
message(STATUS "Building book for language: ${LANGUAGE}")
17+
execute_process(
18+
COMMAND mdbook build -d ${ROOT_DIR}/book/${LANGUAGE}
19+
WORKING_DIRECTORY ${TARGET_DIR}
20+
)
2621
endfunction()
2722

2823
# Create configurations for both languages.
29-
BuildBook("en" "Karn Kaul")
30-
BuildBook("zh-TW" "Mes")
24+
BuildBook("en")
25+
BuildBook("zh-TW")

guide/src/en/book.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[book]
2+
authors = ["Karn Kaul"]
3+
language = "en"
4+
src = "."
5+
title = "Learn Vulkan"
6+
7+
[output.html]
8+
theme = "../theme"
9+
additional-js = ["../theme/lang-toggle.js"]
10+
additional-css = ["../theme/lang-toggle.css"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)