Browse Source

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.
pull/15/head
jean-pierre charras 6 years ago
parent
commit
49dbc37277
  1. 1
      CMakeLists.txt
  2. 10
      CMakeModules/Html2C.cmake
  3. 16
      CMakeModules/markdown2C.cmake
  4. 1
      common/CMakeLists.txt
  5. 7
      markdown2html/CMakeLists.txt
  6. 1
      pcb_calculator/CMakeLists.txt
  7. 14
      pcb_calculator/attenuators/attenuator_classes.cpp

1
CMakeLists.txt

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

10
CMakeModules/Html2C.cmake

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

16
CMakeModules/markdown2C.cmake

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

1
common/CMakeLists.txt

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

7
markdown2html/CMakeLists.txt

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

1
pcb_calculator/CMakeLists.txt

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

14
pcb_calculator/attenuators/attenuator_classes.cpp

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

Loading…
Cancel
Save