/usr/lib/cmake/paraview/generate_proxydocumentation.cmake is in paraview-dev 4.0.1-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | # This file is used by generate_htmls_from_xmls function in ParaViewMacros.cmake
# to split a file consisting of multiple htmls into multiple files.
cmake_minimum_required(VERSION 2.8)
# INPUT VARIABLES:
# xmlpatterns :- xmlpatterns executable.
# xml_to_xml_xsl :- xsl file to convert SM xml to internal xml Model.
# xml_to_html_xsl :- xsl file to conevrt the internal xml to html.
# xml_to_wiki_xsl :- xsl file to conevrt the internal xml to wiki.
# input_xmls :- + separated list of SM xml files
# input_gui_xmls :- + separated list of GUI xml files used to generate the
# CatergoryIndex.html
# output_dir :- Directory where all HTMLs are written out.
# output_file :- File written out on successful completion.
# This file is also used to save intermediate results.
if (NOT EXISTS "${xmlpatterns}")
message(FATAL_ERROR "No xmlpatterns executable was defined!!!")
endif()
# input_xmls is a pseudo-list. Convert it to a real CMake list.
string(REPLACE "+" ";" input_xmls "${input_xmls}")
string(REPLACE "+" ";" input_gui_xmls "${input_gui_xmls}")
set (xslt_xml)
# Generate intermediate xml using the input_xmls and XSL file.
# It also processes GUI xmls to add catergory-index sections.
foreach(xml ${input_xmls} ${input_gui_xmls})
get_filename_component(xml_name_we ${xml} NAME_WE)
get_filename_component(xml_name ${xml} NAME)
set (temp)
# process each XML using the XSL to generate the html.
execute_process(
# create directory first. This is not needed, but if no output htmls are
# generated because of missing proxy definitions, the the build may die with
# an error due to missing directory.
COMMAND ${CMAKE_COMMAND} -E make_directory "${output_dir}"
# do the XSL translations.
COMMAND "${xmlpatterns}" "${xml_to_xml_xsl}" "${xml}"
OUTPUT_VARIABLE temp
)
# combine results.
set (xslt_xml "${xslt_xml}\n${temp}")
endforeach()
# write the combined XML out in a single file.
set (xslt_xml "<xml>\n${xslt_xml}\n</xml>")
file (WRITE "${output_file}" "${xslt_xml}")
# process the temporary.xml using the second XSL to generate a combined html
# file.
set (multiple_htmls)
execute_process(
COMMAND "${xmlpatterns}"
"${xml_to_html_xsl}"
"${output_file}"
OUTPUT_VARIABLE multiple_htmls
)
# if the contents of input_file contains ';', then CMake gets confused.
# So replace all semicolons with a placeholder.
string(REPLACE ";" "\\semicolon" multiple_htmls "${multiple_htmls}")
# Convert the single string into a list split at </html> markers.
string(REPLACE "</html>" "</html>;" multiple_htmls_as_list "${multiple_htmls}")
# Generate output HTML for each <html>..</html> chunk in the input.
foreach (single_html ${multiple_htmls_as_list})
string(REGEX MATCH "<meta name=\"filename\" contents=\"([a-zA-Z0-9._-]+)\"" tmp "${single_html}")
set (filename ${CMAKE_MATCH_1})
if (filename)
# process formatting strings.
string (REPLACE "\\semicolon" ";" single_html "${single_html}")
string (REGEX REPLACE "\\\\bold{([^}]+)}" "<b>\\1</b>" single_html "${single_html}")
string (REGEX REPLACE "\\\\emph{([^}]+)}" "<i>\\1</i>" single_html "${single_html}")
file (WRITE "${output_dir}/${filename}" "${single_html}")
endif()
endforeach()
# ----------- WIKI -----------
# process the temporary.xml using the thrird XSL to generate a wiki content
set(wiki_sections sources filters writers)
foreach(wiki_section ${wiki_sections})
message("Processing wiki ${wiki_section}")
set(GROUP ${wiki_section})
set(QUERY "not(contains(lower-case($proxy_name),'reader'))")
set(tmp_wiki_xsl ${CMAKE_CURRENT_BINARY_DIR}/${wiki_section}_xml_to_wiki.xsl)
set(wiki_file ${output_dir}/${wiki_section}.wiki)
CONFIGURE_FILE(
${xml_to_wiki_xsl}
${tmp_wiki_xsl}
@ONLY IMMEDIATE)
execute_process(
COMMAND "${xmlpatterns}"
"${tmp_wiki_xsl}"
"${output_file}"
OUTPUT_VARIABLE wiki_content)
string (REGEX REPLACE " +" " " wiki_content "${wiki_content}")
string (REGEX REPLACE "\n " "\n" wiki_content "${wiki_content}")
file (WRITE "${wiki_file}" "${wiki_content}")
endforeach()
# Handle readers...
message("Processing wiki readers")
set(GROUP sources)
set(QUERY "contains(lower-case($proxy_name),'reader')")
set(tmp_wiki_xsl ${CMAKE_CURRENT_BINARY_DIR}/readers_xml_to_wiki.xsl)
set(wiki_file ${output_dir}/readers.wiki)
CONFIGURE_FILE(
${xml_to_wiki_xsl}
${tmp_wiki_xsl}
@ONLY IMMEDIATE)
execute_process(
COMMAND "${xmlpatterns}"
"${tmp_wiki_xsl}"
"${output_file}"
OUTPUT_VARIABLE wiki_content)
string (REGEX REPLACE " +" " " wiki_content "${wiki_content}")
string (REGEX REPLACE "\n " "\n" wiki_content "${wiki_content}")
file (WRITE "${wiki_file}" "${wiki_content}")
|