Skip to content
Permalink
Browse files
Change expression help from free form html files to structured json
A new script then parses these json help files into the html help
contents, in a standardised manner. Previously, the function help
was a bunch of different formats and structures.

Now, a custom stylesheet can be applied (and later tweaked!) to
format these help. Eg, this commit colors variables and function
names in the syntax section for greater readability.
  • Loading branch information
nyalldawson committed Sep 2, 2015
1 parent 524716f commit 709c14391b1d5e40ff944f4834facd19bd111cad
Show file tree
Hide file tree
Showing 277 changed files with 1,087 additions and 1,860 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,6 +1,5 @@
FILE(GLOB HELP_FILES *)

LIST(REMOVE_ITEM HELP_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt)
FILE(GLOB HELP_FILES text/*)
FILE(GLOB JSON_HELP_FILES json/*)

SET(HELP_OUTPUT "${CMAKE_SOURCE_DIR}/src/core/qgsexpression_texts.cpp")

@@ -10,12 +9,24 @@ LIST(SORT HELP_FILES)

FOREACH(HELP_FILE ${HELP_FILES})
STRING(REGEX REPLACE "^.*/([^/]+)$" "\\1" FN ${HELP_FILE})

FILE(READ ${HELP_FILE} HELP)
STRING(REPLACE "\\" "\" HELP "${HELP}")
STRING(REPLACE "\"" "\\\"" HELP "${HELP}")
STRING(REPLACE "\n" "\\n\"\n\"" HELP "${HELP}")
FILE(APPEND ${HELP_OUTPUT} "\n gFunctionHelpTexts.insert( \"${FN}\", QCoreApplication::translate( \"function_help\", \"${HELP}\") );")
ENDFOREACH(HELP_FILE ${HELP_FILES})

FOREACH(HELP_FILE ${JSON_HELP_FILES})
STRING(REGEX REPLACE "^.*/([^/]+)$" "\\1" FN ${HELP_FILE})
STRING(REPLACE "\$" "\\$" HELP_FILE "${HELP_FILE}")
EXEC_PROGRAM(${PYTHON_EXECUTABLE} ARGS "${CMAKE_CURRENT_SOURCE_DIR}/../process_function_template.py" "${HELP_FILE}" OUTPUT_VARIABLE HELP RETURN_VALUE RET )
IF(NOT "${RET}" STREQUAL "0")
MESSAGE(FATAL_ERROR "parsing function help ${HELP_FILE} failed: ${HELP}")
ENDIF()
STRING(REPLACE "\\" "\" HELP "${HELP}")
STRING(REPLACE "\"" "\\\"" HELP "${HELP}")
STRING(REPLACE "\n" "\\n\"\n\"" HELP "${HELP}")
FILE(APPEND ${HELP_OUTPUT} "\n gFunctionHelpTexts.insert( \"${FN}\", QCoreApplication::translate( \"function_help\", \"${HELP}\") );")
ENDFOREACH(HELP_FILE ${HELP_FILES})

FILE(APPEND ${HELP_OUTPUT} "\n}\n")

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 709c143

Please sign in to comment.