mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-16 07:47:22 +01:00
doc: Add a system to share ldoc content across multiple files
This avoid copy-pasting
This commit is contained in:
parent
30eafb1132
commit
a51d6d3abd
2 changed files with 21 additions and 0 deletions
|
@ -297,6 +297,9 @@ set(AWESOME_THEMES_PATH ${AWESOME_DATA_PATH}/themes)
|
||||||
|
|
||||||
|
|
||||||
if(GENERATE_DOC)
|
if(GENERATE_DOC)
|
||||||
|
# Load the common documentation
|
||||||
|
include(docs/load_ldoc.cmake)
|
||||||
|
|
||||||
# Generate some images and examples
|
# Generate some images and examples
|
||||||
include(docs/generate_examples.cmake)
|
include(docs/generate_examples.cmake)
|
||||||
|
|
||||||
|
|
18
docs/load_ldoc.cmake
Normal file
18
docs/load_ldoc.cmake
Normal file
|
@ -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()
|
Loading…
Reference in a new issue