Commit 7984a4c9 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Added support to generate indexes for the proxy documentation.

Also respects the GUI xmls.
parent 8dc9dfc6
......@@ -227,39 +227,42 @@ ENDFUNCTION (protobuf_generate)
# xmls: IN : full pathnames to xml files.
# output_dir : IN : full path to output directory where to generate the htmls.
#------------------------------------------------------------------------------
function (generate_htmls_from_xmls output_files xmlpatterns xmls output_dir )
set (dependencies)
foreach(xml ${xmls})
get_filename_component(xml_name_we ${xml} NAME_WE)
get_filename_component(xml_name ${xml} NAME)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${xml_name_we}.final"
function (generate_htmls_from_xmls output_files xmlpatterns xmls gui_xmls output_dir)
# create a string from the xmls list to pass
set (xmls_string)
foreach (xml ${xmls})
set (xmls_string "${xmls_string}${xml}+")
endforeach()
set (gui_xmls_string)
foreach (gui_xml ${gui_xmls})
set (gui_xmls_string "${gui_xmls_string}${gui_xml}+")
endforeach()
# process each XML using the XSL to generate the html.
COMMAND "${xmlpatterns}"
"${ParaView_CMAKE_DIR}/smdocumentation_generator.xsl"
"${xml}"
-output
"${CMAKE_CURRENT_BINARY_DIR}/${xml_name_we}.inter"
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/temporary.xml"
# process each html file to sperate it out into files for each proxy.
COMMAND "${CMAKE_COMMAND}"
-Dinput_file="${CMAKE_CURRENT_BINARY_DIR}/${xml_name_we}.inter"
-Doutput_dir="${output_dir}"
-Doutput_file="${CMAKE_CURRENT_BINARY_DIR}/${xml_name_we}.final"
-P "${ParaView_CMAKE_DIR}/split_htmls.cmake"
# process each html file to sperate it out into files for each proxy.
COMMAND "${CMAKE_COMMAND}"
-Dxmlpatterns="${xmlpatterns}"
-Dxml_to_xml_xsl="${ParaView_CMAKE_DIR}/smdocumentation_generator.xsl"
-Dxml_to_html_xsl="${ParaView_CMAKE_DIR}/xml_to_html.xsl"
-Dinput_xmls:STRING="${xmls_string}"
-Dinput_gui_xmls:STRING="${gui_xmls_string}"
-Doutput_dir="${output_dir}"
-Dtemporary_dir="${CMAKE_CURRENT_BINARY_DIR}"
-P "${ParaView_CMAKE_DIR}/split_htmls.cmake"
DEPENDS "${xml}"
"${ParaView_CMAKE_DIR}/smdocumentation_generator.xsl"
"${ParaView_CMAKE_DIR}/split_htmls.cmake"
DEPENDS ${xmls}
"${ParaView_CMAKE_DIR}/smdocumentation_generator.xsl"
"${ParaView_CMAKE_DIR}/xml_to_html.xsl"
"${ParaView_CMAKE_DIR}/split_htmls.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMENT "Generating Documentation HTMLS for \"${xml_name}\"")
COMMENT "Generating Documentation HTMLs from xmls")
set (dependencies ${dependencies}
"${CMAKE_CURRENT_BINARY_DIR}/${xml_name_we}.final")
endforeach()
set (dependencies ${dependencies}
"${CMAKE_CURRENT_BINARY_DIR}/temporary.xml")
set (${output_files} ${dependencies} PARENT_SCOPE)
endfunction()
This diff is collapsed.
......@@ -2,7 +2,49 @@
# to split a file consisting of multiple htmls into multiple files.
cmake_minimum_required(VERSION 2.8)
file(READ "${input_file}" multiple_htmls)
# 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(
COMMAND "${xmlpatterns}" "${xml_to_xml_xsl}" "${xml}"
WORKING_DIRECTORY "${temporary_dir}"
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 "${temporary_dir}/temporary.xml" "${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}"
"${temporary_dir}/temporary.xml"
WORKING_DIRECTORY "${temporary_dir}"
OUTPUT_VARIABLE multiple_htmls
)
# if the contents of input_file contains ';', then CMake gets confused.
# So replace all semicolons with a placeholder.
......@@ -13,26 +55,13 @@ 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})
set (proxy_name)
set (group_name)
string(REGEX MATCH "<meta[^>]*name=\"proxy_name\".*>([a-zA-Z0-9_-]+):([a-zA-Z0-9_-]+)</meta>"
tmp "${single_html}")
if (CMAKE_MATCH_2)
set(proxy_name ${CMAKE_MATCH_2})
endif()
if (CMAKE_MATCH_1)
set(group_name ${CMAKE_MATCH_1})
endif()
if (group_name)
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}/${group_name}.${proxy_name}.html" "${single_html}")
file (WRITE "${output_dir}/${filename}" "${single_html}")
endif()
endforeach()
# write the output file
file(WRITE "${output_file}" "done")
<?xml version="1.0" encoding="utf8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/xml">
<html>
<head>
<title>Catergory Index</title>
<meta name="filename" contents="CategoryIndex.html" />
</head>
<body>
<xsl:for-each select="categoryindex">
<h2><xsl:value-of select="label" /></h2>
<hr />
<table class="index_table">
<tr><th>Name</th><th>Description</th></tr>
<xsl:for-each select="item">
<tr>
<td>
<xsl:element name="a">
<xsl:attribute name="href"><xsl:value-of select="group" />.<xsl:value-of select="name"/>.html</xsl:attribute>
<xsl:variable name="group_name"><xsl:value-of select="group"/></xsl:variable>
<xsl:variable name="proxy_name"><xsl:value-of select="name"/></xsl:variable>
<xsl:value-of select="/xml/proxy[group=$group_name and name=$proxy_name]/label" />
<span />
</xsl:element>
</td>
<td>
<xsl:variable name="group_name"><xsl:value-of select="group"/></xsl:variable>
<xsl:variable name="proxy_name"><xsl:value-of select="name"/></xsl:variable>
<xsl:value-of select="/xml/proxy[group=$group_name and name=$proxy_name]/documentation/brief" />
</td>
</tr>
</xsl:for-each>
</table>
</xsl:for-each>
</body>
</html>
<xsl:apply-templates select="proxy"/>
</xsl:template>
<xsl:template match="/xml/proxy">
<html>
<head>
<title><xsl:value-of select="label" /></title>
<xsl:element name="meta">
<xsl:attribute name="name">proxy_name</xsl:attribute>
<xsl:attribute name="contents"><xsl:value-of select="group"/>.<xsl:value-of select="name" /></xsl:attribute>
</xsl:element>
<xsl:element name="meta">
<xsl:attribute name="name">filename</xsl:attribute>
<xsl:attribute name="contents"><xsl:value-of select="group"/>.<xsl:value-of select="name" />.html</xsl:attribute></xsl:element>
</head>
<body>
<h2><xsl:value-of select="label"/> (<xsl:value-of select="name"/>)</h2>
<i><p><xsl:value-of select="documentation/brief" /></p></i>
<div class="description"><xsl:value-of select="documentation/long" /></div>
<table width="97%" border="2px">
<tr bgcolor="#9acd32">
<th>Property</th>
<th width="60%">Description</th>
<th width="5%">Default(s)</th>
<th width="20%">Restrictions</th>
</tr>
<xsl:for-each select="property">
<tr>
<th><xsl:value-of select="label" /></th>
<td><xsl:value-of select="documentation/long" /></td>
<td><xsl:value-of select="defaults" /><span/></td>
<td>
<xsl:for-each select="domains/domain">
<p>
<xsl:value-of select="text"/>
<xsl:for-each select="list" >
<ul>
<xsl:for-each select="item">
<li><xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
</xsl:for-each>
</p>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
......@@ -26,19 +26,30 @@ FIND_PROGRAM(QT_XMLPATTERNS_EXECUTABLE
MARK_AS_ADVANCED(QT_HELP_GENERATOR QT_XMLPATTERNS_EXECUTABLE)
set (gui_xmls
${ParaView_SOURCE_DIR}/Applications/ParaView/ParaViewSources.xml
${ParaView_SOURCE_DIR}/Applications/ParaView/ParaViewFilters.xml
${ParaView_SOURCE_DIR}/Applications/ParaView/ParaViewReaders.xml
${ParaView_SOURCE_DIR}/Applications/ParaView/ParaViewWriters.xml)
# generate htmls from the server manager xmls.
generate_htmls_from_xmls(proxy_html_outputs
"${QT_XMLPATTERNS_EXECUTABLE}"
"${PARAVIEW_SERVERMANAGER_XMLS}"
"${gui_xmls}"
"${CMAKE_CURRENT_BINARY_DIR}")
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/paraview.qch
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/paraview.qhp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/paraview.qhp
${proxy_html_outputs}
COMMAND ${CMAKE_COMMAND}
-E copy_if_different
"${CMAKE_CURRENT_SOURCE_DIR}/paraview.qhp"
"${CMAKE_CURRENT_BINARY_DIR}/paraview.qhp"
COMMAND ${QT_HELP_GENERATOR}
ARGS ${CMAKE_CURRENT_BINARY_DIR}/paraview.qhp
-o ${CMAKE_CURRENT_BINARY_DIR}/paraview.qch
${CMAKE_CURRENT_BINARY_DIR}/paraview.qhp
-o ${CMAKE_CURRENT_BINARY_DIR}/paraview.qch
COMMENT "Compiling Qt help project paraview.qhp"
)
......
......@@ -8,10 +8,10 @@
<section title="Introduction" ref="Book/Book_Chapter1.html"/>
<section title="Plugins" ref="Book/Book_Chapter16.html"/>
<section title="Appendices" ref="Book/Book_Chapter17.html"/>
<section title="Sources" ref="ParaViewSources.html"/>
<section title="Filters" ref="ParaViewFilters.html"/>
<section title="Readers" ref="ParaViewReaders.html"/>
<section title="Writers" ref="ParaViewWriters.html"/>
<section title="Sources" ref="CategoryIndex.html"/>
<section title="Filters" ref="CategoryIndex.html"/>
<section title="Readers" ref="CategoryIndex.html"/>
<section title="Writers" ref="CategoryIndex.html"/>
</section>
</toc>
<keywords>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment