Skip to content

Commit

Permalink
[thrift] Loudly say "V1" on generated Thrift documentation
Browse files Browse the repository at this point in the history
Also, remove the fake empty "wrapper" module from index.html
  • Loading branch information
abesto authored and adriancole committed Jan 31, 2018
1 parent 5e13d21 commit 92886d3
Show file tree
Hide file tree
Showing 9 changed files with 521 additions and 66 deletions.
15 changes: 0 additions & 15 deletions generate_docs_from_thrift.sh

This file was deleted.

44 changes: 44 additions & 0 deletions generate_thrift_v1_docs/generate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash

set -euo pipefail
set -x

# Where's Waldo?
me="$(readlink -f ${BASH_SOURCE[0]})"
[ $? -gt 0 ] && me="${BASH_SOURCE[0]}"
mydir="$(cd "$(dirname "$me")" && pwd -P)"
rootdir="$(cd $(dirname "$mydir") && pwd -P)"
target_root="${rootdir}/public"
target_dir="${target_root}/thrift/v1"

# Prepare clean output space
rm -rfv "$target_dir"
mkdir -p "$target_dir"

# Prepare clean workspace
cd "$(mktemp -d)"
git clone https://github.com/openzipkin/zipkin-api.git
cd zipkin-api/thrift

# Generate HTML docs with Thrift
rm -fv wrapper.thrift
for source in *.thrift; do
echo "include \"$source\"" >> wrapper.thrift
done
thrift -r --gen html -I . -out "$target_dir" wrapper.thrift

# Turn Thrift-output index.html into valid XML
# HTML Tidy exists with 1 on warnings, and we _will_ have warnings
set +e
tidy -indent -asxml -output "$target_dir/index.tidy.html" "$target_dir/index.html"
tidy_status=$?
[ $tidy_status -gt 1 ] && exit $tidy_status
set -e

# Apply some transforms to the generated HTML
java -jar /usr/share/java/Saxon-HE.jar \
-s:"$target_dir/index.tidy.html" \
-xsl:"$mydir/transform.xslt" \
-o:"$target_dir/index.baked.html"
mv -v "$target_dir/index.baked.html" "$target_dir/index.html"
rm -v "$target_dir/index.tidy.html"
23 changes: 23 additions & 0 deletions generate_thrift_v1_docs/transform.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<xsl:stylesheet version="3.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
<xsl:output method="xhtml" encoding="UTF-8" indent="yes"/>

<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<!-- Set title -->
<xsl:template match="/html/head/title">
<title>Zipkin V1 Thrift models</title>
</xsl:template>
<xsl:template match="//h1">
<h1>Zipkin V1 Thrift models</h1>
</xsl:template>

<!-- Remove the fake "wrapper" module from the output -->
<xsl:template match="//tr[td[text()='wrapper']]"/>
</xsl:stylesheet>
51 changes: 0 additions & 51 deletions public/thrift/index.html

This file was deleted.

129 changes: 129 additions & 0 deletions public/thrift/v1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<meta name="generator" content="HTML Tidy for HTML5 for Linux version 5.2.0" />

<link href="style.css" rel="stylesheet" type="text/css" />

<title xmlns="">Zipkin V1 Thrift models</title>

</head>

<body>

<div class="container-fluid">

<h1 xmlns="">Zipkin V1 Thrift models</h1>

<table class="table-bordered table-striped table-condensed">

<thead>

<tr>

<th>Module</th>

<th>Services</th>

<th>Data types</th>

<th>Constants</th>

</tr>

</thead>


<tr>

<td>zipkinCore</td>

<td></td>

<td>
<a href="zipkinCore.html#Struct_Annotation">Annotation</a><br />
<a href="zipkinCore.html#Enum_AnnotationType">AnnotationType</a><br />

<a href="zipkinCore.html#Struct_BinaryAnnotation">BinaryAnnotation</a><br />

<a href="zipkinCore.html#Struct_Endpoint">Endpoint</a><br />
<a href="zipkinCore.html#Struct_Span">Span</a><br />

</td>

<td><code><a href="zipkinCore.html#Const_CLIENT_ADDR">CLIENT_ADDR</a></code><br />

<code><a href="zipkinCore.html#Const_CLIENT_RECV">CLIENT_RECV</a></code><br />

<code><a href="zipkinCore.html#Const_CLIENT_RECV_FRAGMENT">CLIENT_RECV_FRAGMENT</a></code><br />

<code><a href="zipkinCore.html#Const_CLIENT_SEND">CLIENT_SEND</a></code><br />

<code><a href="zipkinCore.html#Const_CLIENT_SEND_FRAGMENT">CLIENT_SEND_FRAGMENT</a></code><br />

<code><a href="zipkinCore.html#Const_ERROR">ERROR</a></code><br />
<code><a href="zipkinCore.html#Const_HTTP_HOST">HTTP_HOST</a></code><br />

<code><a href="zipkinCore.html#Const_HTTP_METHOD">HTTP_METHOD</a></code><br />

<code><a href="zipkinCore.html#Const_HTTP_PATH">HTTP_PATH</a></code><br />

<code><a href="zipkinCore.html#Const_HTTP_REQUEST_SIZE">HTTP_REQUEST_SIZE</a></code><br />

<code><a href="zipkinCore.html#Const_HTTP_RESPONSE_SIZE">HTTP_RESPONSE_SIZE</a></code><br />

<code><a href="zipkinCore.html#Const_HTTP_STATUS_CODE">HTTP_STATUS_CODE</a></code><br />

<code><a href="zipkinCore.html#Const_HTTP_URL">HTTP_URL</a></code><br />
<code><a href="zipkinCore.html#Const_LOCAL_COMPONENT">LOCAL_COMPONENT</a></code><br />

<code><a href="zipkinCore.html#Const_MESSAGE_ADDR">MESSAGE_ADDR</a></code><br />

<code><a href="zipkinCore.html#Const_MESSAGE_RECV">MESSAGE_RECV</a></code><br />

<code><a href="zipkinCore.html#Const_MESSAGE_SEND">MESSAGE_SEND</a></code><br />

<code><a href="zipkinCore.html#Const_SERVER_ADDR">SERVER_ADDR</a></code><br />

<code><a href="zipkinCore.html#Const_SERVER_RECV">SERVER_RECV</a></code><br />

<code><a href="zipkinCore.html#Const_SERVER_RECV_FRAGMENT">SERVER_RECV_FRAGMENT</a></code><br />

<code><a href="zipkinCore.html#Const_SERVER_SEND">SERVER_SEND</a></code><br />

<code><a href="zipkinCore.html#Const_SERVER_SEND_FRAGMENT">SERVER_SEND_FRAGMENT</a></code><br />

<code><a href="zipkinCore.html#Const_WIRE_RECV">WIRE_RECV</a></code><br />

<code><a href="zipkinCore.html#Const_WIRE_SEND">WIRE_SEND</a></code><br />

</td>

</tr>

<tr>

<td>zipkinDependencies</td>

<td></td>

<td>
<a href="zipkinDependencies.html#Struct_Dependencies">Dependencies</a><br />

<a href="zipkinDependencies.html#Struct_DependencyLink">DependencyLink</a><br />

</td>

<td></td>

</tr>

</table>

</div>

</body>

</html>
File renamed without changes.
File renamed without changes.

0 comments on commit 92886d3

Please sign in to comment.