Skip to content

Commit

Permalink
HPCC-293990 Add ECL colour support to online docs
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Jul 19, 2023
1 parent a2b1a5a commit 87f7bfc
Show file tree
Hide file tree
Showing 8 changed files with 1,219 additions and 3 deletions.
8 changes: 6 additions & 2 deletions cmake_modules/docMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ MACRO(DOCBOOK_TO_HTML _xsl_file _xml_file _out_dir _html_target _css_path _zip_t
endif()
get_filename_component(css_file_name ${_css_path} NAME)

set(_portaljs_path "${HPCC_SOURCE_DIR}/build/docs/portal-js/dist/index.js")
get_filename_component(portaljs_file_name ${_portaljs_path} NAME)

STRING(REGEX REPLACE "(.+)/([^/]+)$" "\\1" _out_dir1 "${_out_dir}")
STRING(REGEX REPLACE ".+/([^/]+)$" "\\1" _out_dir2 "${_out_dir}")

Expand All @@ -119,12 +122,13 @@ MACRO(DOCBOOK_TO_HTML _xsl_file _xml_file _out_dir _html_target _css_path _zip_t
ADD_CUSTOM_COMMAND(
COMMAND mkdir -p ${_out_dir}
COMMAND cp ${_css_path} ${_out_dir}/
OUTPUT ${_out_dir}/${css_file_name}
COMMAND cp ${_portaljs_path} ${_out_dir}/
OUTPUT ${_out_dir}/${css_file_name} ${_out_dir}/${portaljs_file_name}
)
ADD_CUSTOM_TARGET(${_html_target}
COMMAND ${XSLTPROC_EXECUTABLE} --nonet --xinclude --stringparam html.stylesheet ${css_file_name} --stringparam generate.toc "book toc" --param chapter.autolabel 0 ${_xsl_file} ${_xml_file}
WORKING_DIRECTORY ${_out_dir}
DEPENDS docbook-expand ${_out_dir}/${css_file_name} ${HELP_DEPENDENCIES}
DEPENDS portal-js docbook-expand ${_out_dir}/${css_file_name} ${HELP_DEPENDENCIES}
#SOURCES ${_xsl_file}
)
SET(HELP_DEPENDENCIES)
Expand Down
7 changes: 7 additions & 0 deletions docs/BuildTools/PortalGen.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,11 @@
<BR/>
</xsl:template>

<!-- Colourize ECL Code -->
<xsl:template name="user.head.content">
</xsl:template>
<xsl:template name="user.footer.content">
<script src="index.js" />
</xsl:template>

</xsl:stylesheet>
1 change: 1 addition & 0 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ endif()


# Required directories to add.
add_subdirectory(portal-js)
add_subdirectory(common)
add_subdirectory(BuildTools)
add_subdirectory(resources)
Expand Down
2 changes: 1 addition & 1 deletion docs/EN_US/ECLProgrammersGuide/PRG_Mods/CodeSign.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
Server machine, so if you want to use your own service definitions, they
can be signed using a key that has been installed in this way:</para>

<para><programlisting>gpg --output &lt;signed-ecl&gt; --default-key &lt;key-id&gt; --clearsign &lt;ecl-file-to-sign&gt;</programlisting></para>
<para><programlisting lang="bash">gpg --output &lt;signed-ecl&gt; --default-key &lt;key-id&gt; --clearsign &lt;ecl-file-to-sign&gt;</programlisting></para>

<para>Using this method, a trusted person can sign code to indicate that
it is acceptable for untrusted people to use, without allowing the
Expand Down
82 changes: 82 additions & 0 deletions docs/portal-js/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
project ( portal-js )

file(REMOVE_RECURSE
${CMAKE_CURRENT_BINARY_DIR}/src
)

file(COPY
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json
${CMAKE_CURRENT_SOURCE_DIR}/package.json
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

set ( SRCS
${CMAKE_CURRENT_BINARY_DIR}/src/index.ts
${CMAKE_CURRENT_SOURCE_DIR}/package-lock.json
${CMAKE_CURRENT_SOURCE_DIR}/package.json
)

if ( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
set ( PORTALJS_BUILD "build-dev" )
else ()
set ( PORTALJS_BUILD "build" )
endif ()

set (NPM_ERROR "")
if (WIN32)
execute_process(COMMAND cmd /c "npm --version" OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _NPM_VERSION_RESULT)
else ()
execute_process(COMMAND npm --version OUTPUT_VARIABLE _VERSION RESULT_VARIABLE _NPM_VERSION_RESULT)
endif ()
if (NOT _NPM_VERSION_RESULT)
string (REPLACE "v" "" NPM_VERSION_STRING "${_VERSION}")
string (REPLACE "." ";" _VERSION_LIST "${NPM_VERSION_STRING}")
list (GET _VERSION_LIST 0 NPM_VERSION_MAJOR)
if (NPM_VERSION_MAJOR LESS 6)
set (NPM_ERROR "NPM version ${NPM_VERSION_MAJOR} is too old (expected >= 6), please install NodeJS as per https://github.com/hpcc-systems/HPCC-Platform/wiki/Building-HPCC#prerequisites" )
endif ()
else ()
set (NPM_ERROR "Unable to locate node/npm, please install NodeJS as per https://github.com/hpcc-systems/HPCC-Platform/wiki/Building-HPCC#prerequisites" )
endif ()

if ( NOT "${NPM_ERROR}" STREQUAL "")
message ( FATAL_ERROR "${NPM_ERROR}" )
endif ()

add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/no.file
COMMAND npm run --silent clean
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

add_custom_target( portaljs_clean
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/no.file
)

add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/node_modules/.package-lock.json
COMMAND npm ci
# --silent
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/package-lock.json
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

add_custom_target( portaljs_fetchdeps
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/node_modules/.package-lock.json
)

add_custom_command (
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/dist/index.js
COMMAND npm run --silent ${PORTALJS_BUILD}
DEPENDS ${SRCS}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/node_modules/.package-lock.json
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

add_custom_target ( portal-js ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dist/index.js
)

add_dependencies ( portal-js portaljs_fetchdeps )

# install ( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/build/." DESTINATION componentfiles/files COMPONENT Runtime USE_SOURCE_PERMISSIONS )
Loading

0 comments on commit 87f7bfc

Please sign in to comment.