Added a new make target that generates .txt files from Markdown release notes.
This commit is contained in:
parent
5b634dab77
commit
92999a3174
@ -283,6 +283,14 @@ add_custom_target(generate_pdf
|
||||
-P generate-pdf.cmake
|
||||
COMMENT "Generating PDF files" VERBATIM)
|
||||
|
||||
add_custom_target(generate_txt_release
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Documentation ${CMAKE_BINARY_DIR}/Documentation
|
||||
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/Documentation ${CMAKE_COMMAND}
|
||||
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
||||
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
|
||||
-P generate-txt-release.cmake
|
||||
COMMENT "Generating TXT release notes" VERBATIM)
|
||||
|
||||
|
||||
add_custom_target(generate_html
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Documentation ${CMAKE_BINARY_DIR}/Documentation
|
||||
|
29
Documentation/format.pl
Normal file
29
Documentation/format.pl
Normal file
@ -0,0 +1,29 @@
|
||||
open(my $in,"<",@ARGV[0]);
|
||||
open(my $out,">",@ARGV[1]);
|
||||
my $tbl = 0;
|
||||
while(<$in>){
|
||||
if(/<table>/)
|
||||
{
|
||||
$tbl = 1;
|
||||
}
|
||||
elsif(/<\/table>/)
|
||||
{
|
||||
$tbl = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($tbl == 1)
|
||||
{
|
||||
s/\n//;
|
||||
s/<\/tr>/\n/;
|
||||
s/<td>//;
|
||||
s/<tr>//;
|
||||
s/<\/td>/\t/;
|
||||
s/^ +//;
|
||||
s/ +$//;
|
||||
}
|
||||
s/[*]/\t/;
|
||||
print $out "$_";
|
||||
}
|
||||
}
|
||||
|
12
Documentation/generate-txt-release.cmake
Normal file
12
Documentation/generate-txt-release.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
# The BUILD_DIR variable is set at runtime
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
file(MAKE_DIRECTORY ${BUILD_DIR}/txt)
|
||||
file(GLOB_RECURSE MARKDOWN Release-Notes/*.md)
|
||||
foreach(VAR ${MARKDOWN})
|
||||
get_filename_component(NEWNAME ${VAR} NAME)
|
||||
execute_process(COMMAND perl ${CMAKE_CURRENT_BINARY_DIR}/format.pl ${VAR} ${BUILD_DIR}/txt/${NEWNAME}.txt)
|
||||
endforeach()
|
Loading…
x
Reference in New Issue
Block a user