Skip to content

Commit 510392c

Browse files
blowekamphjmjohnson
authored andcommitted
ENH: remove rendering datetime with Doxygen into HTML footer
The date and time are not set by javascript when the document is loaded. This removes nightly modification of all the HTML files, and enable traditional static HTML cache to work, and enable the generated HTML to be committed to git regularly without nightly modification.
1 parent a3a87b7 commit 510392c

5 files changed

Lines changed: 37 additions & 1 deletion

File tree

Documentation/Doxygen/DoxygenFooter.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
</small>
2222
</div>
2323
<address class="footer"><small>
24-
$generatedby &#160;<a href="http://www.doxygen.org/index.html">
24+
Generated on <span id="datetime">unknown</span> for $projectname by &#160;
25+
<a href="http://www.doxygen.org/index.html">
2526
<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>
2627
</a> $doxygenversion
2728
</small></address>

Documentation/Doxygen/DoxygenHeader.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
$treeview
1515
$search
1616
$mathjax
17+
<script type="text/javascript" src="$relpath^build_text.js"></script>
1718
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
1819
$extrastylesheet
1920
</head>

Utilities/Doxygen/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ if (ITK_BUILD_DOCUMENTATION)
140140
file(COPY workbox-cli-config.js serviceWorker.js.in
141141
DESTINATION ${ITK_BINARY_DIR}/Utilities/Doxygen/)
142142

143+
execute_process(COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_LIST_DIR}/datetime.py"
144+
RESULT_VARIABLE CMD_RESULT
145+
OUTPUT_VARIABLE _DATETIME)
146+
147+
if (CMD_RESULT)
148+
message(FATAL_ERROR "Datetime failed!")
149+
endif()
150+
151+
configure_file(${CMAKE_CURRENT_LIST_DIR}/build_text.js.in
152+
"${ITK_BINARY_DIR}/Utilities/Doxygen//html/build_text.js")
143153

144154
find_package( LATEX )
145155

Utilities/Doxygen/build_text.js.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$(function(){
2+
document.getElementById("datetime").textContent = "@_DATETIME@"
3+
});

Utilities/Doxygen/datetime.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright NumFOCUS
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0.txt
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
# Writes the date and time in RFC 2822 format to stdout
18+
19+
import time
20+
import sys
21+
sys.stdout.write(time.strftime('%a, %d %b %Y %H:%M:%S +0000', time.gmtime()))

0 commit comments

Comments
 (0)