|
|
@ -7,18 +7,22 @@ file( READ ${inputFile} buffer ) |
|
|
|
|
|
|
|
file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from an .md file\n" ) |
|
|
|
|
|
|
|
#Remark: strings can contain semicolon. a semicolon is a separation in cmake. |
|
|
|
#so, to avoid stripping semicolon in variables we have to quote them |
|
|
|
|
|
|
|
# Replace each "\" char by "\\". the \ is found in .md files |
|
|
|
# to prepend some chars that usually control chars |
|
|
|
STRING( REGEX REPLACE "\\\\" "\\\\\\\\" linea ${buffer} ) |
|
|
|
# to prepend some chars that are usually control chars |
|
|
|
STRING( REPLACE "\\" "\\\\" linea "${buffer}" ) |
|
|
|
|
|
|
|
# Replace each " char by \" |
|
|
|
STRING( REPLACE "\"" "\\\"" linem "${linea}" ) |
|
|
|
|
|
|
|
# Replace each EOL char by "\n" + " + EOL |
|
|
|
STRING( REGEX REPLACE "\"" "\\\\\"" linem ${linea} ) |
|
|
|
STRING( REPLACE "\n" "\\n\"\n\"" buff_m "${linem}" ) |
|
|
|
|
|
|
|
# create the full string compatible "C": |
|
|
|
# _HKI( "<md string>"\n |
|
|
|
# to make it translatable. We use here the marker _HKI because |
|
|
|
# the translation will be explicitely called in Kicad code |
|
|
|
STRING( REGEX REPLACE "\n" "\\\\n\"\n\"" buff_m ${linem} ) |
|
|
|
|
|
|
|
# Write the buffer between quotes |
|
|
|
file( APPEND ${outputFile} "_HKI( \"" ${buff_m} "\" )\n" ) |
|
|
|
file( APPEND ${outputFile} "_HKI( \"" "${buff_m}" "\" );\n" ) |