From a51d6d3abd1b5c21f7bda005c001d1e4fa01cb92 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Sun, 8 May 2016 23:45:42 -0400 Subject: [PATCH] doc: Add a system to share ldoc content across multiple files This avoid copy-pasting --- awesomeConfig.cmake | 3 +++ docs/load_ldoc.cmake | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 docs/load_ldoc.cmake diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index 09fe93db6..83f0f5bf6 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -297,6 +297,9 @@ set(AWESOME_THEMES_PATH ${AWESOME_DATA_PATH}/themes) if(GENERATE_DOC) + # Load the common documentation + include(docs/load_ldoc.cmake) + # Generate some images and examples include(docs/generate_examples.cmake) diff --git a/docs/load_ldoc.cmake b/docs/load_ldoc.cmake new file mode 100644 index 000000000..3123f082f --- /dev/null +++ b/docs/load_ldoc.cmake @@ -0,0 +1,18 @@ +# To avoid copy pasting, some documentation is stored in reusable files +set(SHAPE_FILE "${SOURCE_DIR}/docs/common/${SHAPE_NAME}.lua") + +set(path "${SOURCE_DIR}/docs/common/") + +# Get the documentation file list +file(GLOB doc_files RELATIVE "${path}" "${path}/*.ldoc") + +foreach(doc_file_name ${doc_files}) + # Read the file + file(READ "${path}/${doc_file_name}" doc_file_content) + + # Remove the file extension + string(REGEX REPLACE "\\.ldoc" "" DOC_FILE_NAME ${doc_file_name}) + + # Create a new variable usable from lua files + set(DOC_${DOC_FILE_NAME}_COMMON "Imported documentation\n\n${doc_file_content}") +endforeach()