From 77f0128f8cb2ce1f1a2be8bae110eba3fcfea807 Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Fri, 9 Oct 2015 09:59:54 +0300 Subject: [PATCH] Fixed HTML links referring to Markdown files instead of the generated HTML files. --- Documentation/generate-html.cmake | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/generate-html.cmake b/Documentation/generate-html.cmake index 1e8b59ea1..802942218 100644 --- a/Documentation/generate-html.cmake +++ b/Documentation/generate-html.cmake @@ -2,17 +2,26 @@ cmake_minimum_required(VERSION 2.8.12) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/") +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") find_package(Pandoc) if(PANDOC_FOUND AND BUILD_DIR) + file(MAKE_DIRECTORY ${BUILD_DIR}/html) file(GLOB_RECURSE MARKDOWN *.md) + foreach(VAR ${MARKDOWN}) + # Set the output file type as html string(REPLACE ".md" ".html" OUTPUT ${VAR}) + + # Change the file paths to the destination directory get_filename_component(DIR ${VAR} DIRECTORY) string(REPLACE "${CMAKE_CURRENT_BINARY_DIR}" "${BUILD_DIR}/html" FILE ${OUTPUT}) + + # Format using Pandoc and copy to the destination directory execute_process(COMMAND ${CMAKE_COMMAND} -E chdir ${DIR} ${PANDOC_EXECUTABLE} ${VAR} -o ${OUTPUT}) + execute_process(COMMAND sed -i -e "s/.md/.html/g" ${OUTPUT}) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${OUTPUT} ${FILE}) endforeach() endif()