Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions tei_current_assignments_table.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1999/xhtml"
exclude-result-prefixes="#all"
version="3.0">

<!--
Input, primary: Either none (using, e.g., -it: switch to Saxon) or
any well-formed XML file will do, input is ignored.
Input, secondary: Reads in the content of the file provided by the
$input paramater, which should be the output of
the teiutils/bin/tei_current_assignments.py cmd.
Output: Same information as a sortable XHTML 5 table.

Written 2025-09-01 by Syd Bauman.

Copyright 2025 Syd Bauman; few rights reserved. Available under whatever
open source license Nick Cole uses for his teiutils.
-->

<xsl:output method="xhtml" html-version="5" expand-text="yes" indent="yes"/>
<xsl:param name="input" as="xs:string" select="'./tei_current_assignments.out'"/>

<xsl:template name="xsl:initial-template" match="/">
<xsl:variable name="lines" select="unparsed-text-lines( $input )" as="xs:string+"/>
<html xml:lang="en" lang="en">
<xsl:call-template name="head"/>
<body>
<xsl:call-template name="pre-table"/>
<table border="1" class="sortable">
<xsl:call-template name="table_header"/>
<tbody xsl:expand-text="yes">
<xsl:for-each select="$lines[ contains( .,'=') ]">
<xsl:call-template name="table_row">
<xsl:with-param name="line" select="."/>
</xsl:call-template>
</xsl:for-each>
</tbody>
</table>
</body>
</html>
</xsl:template>

<xsl:template name="head">
<head>
<title>tix</title>
<meta name="generated-by" content="{tokenize( static-base-uri(),'/')[last()]}"/>
<meta name="generation-timestamp" content="{current-dateTime()}"/>
<script type="application/javascript" src="http://www.wwp.neu.edu/utils/bin/javascript/sorttable.js"/>
<style type="text/css">
body { margin: 3em 3em 3em 6em; }
thead { background-color: #E7EAED; }
thead > th > td { padding: 0.5ex; text-align: center; }
tbody > tr > td.usr { padding: 0.5ex; text-align: left; }
tbody > tr > td.tei { padding: 0.5ex; text-align: center; font-family: monospace; }
tbody > tr > td.sty { padding: 0.5ex; text-align: center; font-family: monospace; }
tbody > tr > td.tot { padding: 0.5ex; text-align: center; font-family: monospace; }
</style>
</head>
</xsl:template>

<xsl:template name="pre-table">
<h1>TEI Ticket Triage Table</h1>
<p xsl:expand-text="yes">This table is drawn from the data in {$input}, which
itself was (or at least, should have been) generated by the `tei_current_assignments.py`
program by Nick Cole. It collects the number of <q>tickets</q> from the TEI and Stylesheets
repos, as per the GitHub API. Thus only <q>issues</q> and <q>pull requests</q> that are
<strong>assigned</strong> to a particular user are counted. Requests for review, comments,
commits, etc. are not counted, nor is any activity in any repo other than TEI and
Stylesheets.</p>
<p>Click on a column heading to sort by that column.</p>
</xsl:template>

<xsl:template name="table_header">
<thead>
<tr>
<th>GitHub<br/>username</th>
<th>TEI<br/>tickets</th>
<th>Stylesheets<br/>tickets</th>
<th>total<br/>tickets</th>
</tr>
</thead>
</xsl:template>

<xsl:template name="table_row">
<xsl:param name="line"/>
<xsl:variable name="tokens" as="xs:string+" select="tokenize($line)"/>
<xsl:variable name="username" select="$tokens[1]" as="xs:string"/>
<xsl:variable name="total" select="format-integer( $tokens[3] cast as xs:integer,'00')" as="xs:string"/>
<xsl:variable name="tei" as="xs:string">
<xsl:choose>
<xsl:when test="matches( $line, '\(tei - [0-9]+')">
<xsl:sequence select="replace( $line,'.*\(tei - ([0-9]+).*','$1') => xs:integer() => format-integer('00')"/>
</xsl:when>
<xsl:otherwise>00</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="stylesheets" as="xs:string">
<xsl:choose>
<xsl:when test="matches( $line, 'Stylesheets - [0-9]+')">
<xsl:sequence select="replace( $line,'.*Stylesheets - ([0-9]+).*','$1') => xs:integer() => format-integer('00')"/>
</xsl:when>
<xsl:otherwise>00</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<tr xsl:expand-text="yes">
<td class="usr">{$username}</td>
<td class="tei">{$tei}</td>
<td class="sty">{$stylesheets}</td>
<td class="tot">{$total}</td>
</tr>
</xsl:template>

</xsl:stylesheet>