diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c08ba18..23c2655 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,7 +24,7 @@ jobs: - name: build book run: | cd guide - mdbook build + cmake -P build.cmake || exit 1 ls book - name: setup pages uses: actions/configure-pages@v4 diff --git a/.github/workflows/guide.yml b/.github/workflows/guide.yml index b527594..0400187 100644 --- a/.github/workflows/guide.yml +++ b/.github/workflows/guide.yml @@ -19,5 +19,5 @@ jobs: - name: build run: | cd guide - mdbook build || exit 1 + cmake -P build.cmake || exit 1 ls book diff --git a/guide/book.toml b/guide/book.toml index 87209f2..db0956a 100644 --- a/guide/book.toml +++ b/guide/book.toml @@ -1,6 +1,10 @@ [book] -authors = ["Karn Kaul"] +authors = ["Karnage"] language = "en" -multilingual = false src = "src" title = "Learn Vulkan" + +[output.html] +theme = "theme" +additional-js = ["theme/lang_toggle.js"] +additional-css = ["theme/lang_toggle.css"] diff --git a/guide/build.cmake b/guide/build.cmake new file mode 100644 index 0000000..a5e61a8 --- /dev/null +++ b/guide/build.cmake @@ -0,0 +1,27 @@ +# Build the target languages +function(BuildBook LANGUAGE SOURCE_DIR TARGET_DIR) + set(LANGUAGE "${LANGUAGE}") + + if(NOT EXISTS "${SOURCE_DIR}/src/SUMMARY.md") + message(WARNING "Skipping '${LANGUAGE}' – SUMMARY.md not found at ${SOURCE_DIR}") + return() + endif() + + if(NOT EXISTS "${SOURCE_DIR}/book.toml") + message(WARNING "Skipping '${LANGUAGE}' – book.toml not found at ${SOURCE_DIR}") + return() + endif() + + message(STATUS "Building book for language: ${LANGUAGE}") + execute_process( + COMMAND mdbook build -d ${TARGET_DIR} + WORKING_DIRECTORY ${SOURCE_DIR} + COMMAND_ERROR_IS_FATAL ANY + ) +endfunction() + +# Copy the theme folder +file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/theme" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/translations") + +BuildBook("en" "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/book") +BuildBook("ko-KR" "${CMAKE_CURRENT_SOURCE_DIR}/translations/ko-KR" "${CMAKE_CURRENT_SOURCE_DIR}/book/ko-KR") diff --git a/guide/theme/index.hbs b/guide/theme/index.hbs new file mode 100644 index 0000000..afc3145 --- /dev/null +++ b/guide/theme/index.hbs @@ -0,0 +1,332 @@ + + +
+ + +