Fix a few issues related to help files in html or markdown.

Fix *.cmake scripts that dropped the semicolon in strings during conversion.
Move markdown2html in a separate library.
This commit is contained in:
jean-pierre charras 2019-10-01 17:03:00 +02:00
parent d9336e9f97
commit 49dbc37277
7 changed files with 33 additions and 17 deletions

View File

@ -1007,6 +1007,7 @@ endif()
# Binaries ( CMake targets )
add_subdirectory( bitmaps_png )
add_subdirectory( libs )
add_subdirectory( markdown2html )
add_subdirectory( common )
add_subdirectory( 3d-viewer )
add_subdirectory( cvpcb )

View File

@ -5,9 +5,13 @@
set( lines "" )
file( STRINGS ${inputFile} lines )
#Remark: strings can contain semicolon. a semicolon is a separation in cmake.
#so, to avoid stripping semicolon in variables we have to quote them
file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from an HTML file\n" )
foreach( line ${lines} )
STRING(REGEX REPLACE "\"" "\\\\\"" linem ${line})
file( APPEND ${outputFile} "\"" ${linem} "\\n\"\n" )
endforeach( line ${lines} )
STRING(REGEX REPLACE "\"" "\\\\\"" linem "${line}" )
file( APPEND ${outputFile} "\"" "${linem}" "\\n\"\n" )
endforeach( line "${lines}" )

View File

@ -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" )

View File

@ -312,7 +312,6 @@ set( COMMON_SRCS
lib_tree_model.cpp
lib_tree_model_adapter.cpp
lockfile.cpp
../markdown2html/markdown2html.cpp
marker_base.cpp
md5_hash.cpp
msgpanel.cpp

View File

@ -0,0 +1,7 @@
project(markdown)
add_library ( markdown_lib STATIC
markdown2html.cpp
)
include_directories( BEFORE ${INC_BEFORE} ${INC_AFTER} )

View File

@ -89,6 +89,7 @@ set_target_properties( pcb_calculator_kiface PROPERTIES
)
target_link_libraries( pcb_calculator_kiface
common
markdown_lib
${wxWidgets_LIBRARIES}
)
set_source_files_properties( pcb_calculator.cpp PROPERTIES

View File

@ -18,21 +18,21 @@
// Html texts showing the formulas
wxString pi_formula(
wxString pi_formula =
#include <pi_formula.h>
);
wxString tee_formula(
wxString tee_formula =
#include <tee_formula.h>
);
wxString bridget_tee_formula =
#include <bridget_tee_formula.h>
;
wxString splitter_formula(
wxString splitter_formula =
#include <splitter_formula.h>
);
#ifndef NULL