Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jul 2015 19:40:07 +0000 (UTC)
From:      Mark Felder <feld@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r391836 - in head/security/vuxml: . files
Message-ID:  <201507121940.t6CJe72Z087834@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: feld
Date: Sun Jul 12 19:40:07 2015
New Revision: 391836
URL: https://svnweb.freebsd.org/changeset/ports/391836

Log:
  Add ability to produce html files for vuxml entries
  
  This will allow committers to test complex vuxml entries before
  submission.
  
  A special thanks to hrs for responding to my plea for this feature
  
  Submitted by:	hrs

Added:
  head/security/vuxml/files/common.css   (contents, props changed)
  head/security/vuxml/files/html.xsl   (contents, props changed)
Modified:
  head/security/vuxml/Makefile

Modified: head/security/vuxml/Makefile
==============================================================================
--- head/security/vuxml/Makefile	Sun Jul 12 19:26:12 2015	(r391835)
+++ head/security/vuxml/Makefile	Sun Jul 12 19:40:07 2015	(r391836)
@@ -96,4 +96,16 @@ tidy: vuln.xml
 newentry:
 	@${SH} ${FILESDIR}/newentry.sh "${VUXML_FILE}"
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if defined(VID) && !empty(VID)
+html: work/${VID}.html
+work/${VID}.html: ${FILESDIR}/html.xsl ${FILESDIR}/common.css ${VUXML_FILE}
+	${MKDIR} work
+	xsltproc --stringparam vid "${VID}" \
+	    --output ${.TARGET} \
+	    ${FILESDIR}/html.xsl ${VUXML_FILE}
+	${INSTALL_DATA} ${FILESDIR}/common.css work
+.endif
+
+.include <bsd.port.post.mk>

Added: head/security/vuxml/files/common.css
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/vuxml/files/common.css	Sun Jul 12 19:40:07 2015	(r391836)
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2003-2009 Jacques Vidrine and contributors. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+body {
+  background: #ffffff;
+  font-family: verdana, "bitstream vera sans", arial, helvetica, sans-serif;
+}
+h1.title {
+  color: #208020;
+}
+h2.section {
+  color: #208020;
+}
+
+h1.title0 {
+  margin-bottom: 0em;
+  color: #208020;
+}
+p.subtitle {
+  margin-top: 0em;
+  color: #208020;
+  font-size: small;
+  font-style: italic;
+  font-weight: bold;
+}
+
+/* The blurb in the upper-right corner. */
+.blurb {
+  color: #40A040;
+  font-size: small;
+  font-style: italic;
+  border: thin solid #40A040;
+  text-align: center;
+  width: 9em;
+  float: right;
+  padding: 2px;
+}
+div.blurb A:link, div.blurb A:visited, div.blurb A:hover {
+  text-decoration: none;
+  color: #40A040;
+}
+
+/* The link from the package page to FreshPorts.org. */
+div.freshportslink {
+  color: #AD0040;
+  font-size: small;
+  font-style: italic;
+  text-align: left;
+  padding: 0px 2px 2px 2px;
+}
+div.freshportslink a:link, div.freshportslink a:visited,
+div.freshportslink a:hover {
+  border: thin solid #AD0040;
+  text-decoration: none;
+  color: #AD0040;
+  padding: 2px;
+}
+
+/* The link from the CVE page to cve.mitre.org. */
+div.cvelink {
+  color: #AD0040;
+  font-size: small;
+  font-style: italic;
+  text-align: left;
+  padding: 0px 2px 2px 2px;
+}
+div.cvelink a:link, div.cvelink a:visited, div.cvelink a:hover {
+  border: thin solid #AD0040;
+  text-decoration: none;
+  color: #AD0040;
+  padding: 2px;
+}
+
+/* Most links are black unless the mouse is over them. */
+A:link, A:visited {
+  text-decoration: none;
+  color: #000000;
+}
+A:hover {
+  text-decoration: underline;
+  color: #802020;
+}
+
+/* Some links should be more visible. */
+A:link.vis, A:visited.vis {
+  text-decoration: none;
+  color: #0000ef;
+}
+
+/* Links in the ``embedded'' HTML look a bit different. */
+div.embed A:link {
+  text-decoration: underline;
+  color: #6b69ff;
+}
+div.embed A:visited {
+  text-decoration: underline;
+  color: #840084;
+}
+div.embed A:hover {
+  text-decoration: underline;
+  color: #ff0000;
+}
+div.citation A:link {
+  text-decoration: none;
+  color: #6b69ff;
+}
+div.citation A:visited {
+  text-decoration: none;
+  color: #840084;
+}
+div.citation A:hover {
+  text-decoration: none;
+  color: #ff0000;
+}
+
+/* Simple list tables */
+table.list {
+  border: thin solid #000000;
+}
+table.list thead td {
+  text-align: center;
+  background: #000000;
+  color: #ffffff;
+}
+
+/* Label/content tables */
+td.label {
+  font-weight: bold;
+  padding-right: 0.75em;
+  padding-left: 0.75em;
+  background-color: #c6d3de;
+  white-space: nowrap;
+}
+td.content {
+  padding-right: 0.75em;
+  padding-left: 0.75em;
+  background: #e5ffe5;
+}
+
+/* The navigation bar */
+tbody.nav td {
+  border: thin solid black;
+  padding: 3pt;
+}
+
+/* Our common table style */
+table.common thead th {
+  padding-right: 0.75em;
+  padding-left: 0.75em;
+  background-color: #c6d3de;
+  white-space: nowrap;
+}
+table.common tbody td {
+  padding-right: 0.75em;
+  padding-left: 0.75em;
+  background: #e5ffe5;
+}
+table.common tbody td.group {
+  background: #c5ffc5;
+  white-space: nowrap;
+}
+
+/* Blockquotes */
+blockquote {
+  background: #F0F0F0;
+  border-left: #CCCCCC 0.5em solid;
+  border-right: #CCCCCC 1px dashed;
+  border-top: #CCCCCC 1px dashed;
+  border-bottom: #CCCCCC 1px dashed;
+}
+div.citation {
+  font-size: small;
+  font-style: italic;
+  text-align: right;
+}
+
+/* Various attributes */
+.package {
+  font-family: "monaco", "andale mono", "courier new", monospace;
+}
+.vid {
+  font-family: "monaco", "andale mono", "courier new", monospace;
+}
+.copyright {
+  font-size: small;
+  font-style: italic;
+}
+.email {
+  font-family: "monaco", "andale mono", "courier new", monospace;
+}
+.hide {
+  display: none;
+}
+.note {
+  font-size: small;
+  font-style: italic;
+  color: #801010;
+}
+.date, .cvename {
+  white-space: nowrap;
+}
+

Added: head/security/vuxml/files/html.xsl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/security/vuxml/files/html.xsl	Sun Jul 12 19:40:07 2015	(r391836)
@@ -0,0 +1,179 @@
+<?xml version="1.0"?>
+<!-- $FreeBSD$ -->
+<xsl:stylesheet
+  version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:vuxml="http://www.vuxml.org/apps/vuxml-1"
+  xmlns:xhtml="http://www.w3.org/1999/xhtml"
+  xmlns:exsl="http://exslt.org/common"
+  extension-element-prefixes="exsl"
+  exclude-result-prefixes="xhtml vuxml">
+
+  <xsl:output method="xml" encoding="utf-8" indent="yes"
+    doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+    doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
+
+  <xsl:param name="vid" select="'none'" />
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="vuxml:vuxml/vuxml:vuln[@vid = $vid]" />
+  </xsl:template>
+
+  <xsl:template name="range-spec">
+    <xsl:param name="gt" />
+    <xsl:param name="ge" />
+    <xsl:param name="lt" />
+    <xsl:param name="le" />
+    <xsl:param name="eq" />
+    <xsl:param name="name" />
+
+    <tr valign="top">
+      <td class="version">
+	<xsl:choose>
+	  <xsl:when test="$gt != ''"><xsl:value-of select="$gt" /></xsl:when>
+	  <xsl:when test="$ge != ''"><xsl:value-of select="$ge" /></xsl:when>
+	  <xsl:when test="$eq != ''"><xsl:value-of select="$eq" /></xsl:when>
+	</xsl:choose>
+      </td>
+      <td class="operator">
+	<xsl:choose>
+	  <xsl:when test="$gt != ''">&#60;</xsl:when>
+	  <xsl:when test="$ge != ''">&#60;&#61;</xsl:when>
+	  <xsl:when test="$eq != ''">&#61;</xsl:when>
+	</xsl:choose>
+      </td>
+      <td class="package"><xsl:element name="a">
+	  <xsl:attribute name="href">
+	    <xsl:value-of select="concat('pkg-', $name, '.html')" />
+	  </xsl:attribute>
+	  <xsl:value-of select="$name" /></xsl:element></td>
+      <td class="operator">
+	<xsl:choose>
+	  <xsl:when test="$lt != ''">&#60;</xsl:when>
+	  <xsl:when test="$le != ''">&#60;&#61;</xsl:when>
+	</xsl:choose>
+      </td>
+      <td class="version">
+	<xsl:choose>
+	  <xsl:when test="$lt != ''"><xsl:value-of select="$lt" /></xsl:when>
+	  <xsl:when test="$le != ''"><xsl:value-of select="$le" /></xsl:when>
+	</xsl:choose>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template name="vuln-range">
+    <xsl:param name="range" />
+    <xsl:param name="name" />
+
+    <xsl:for-each select="exsl:node-set($range)">
+      <xsl:call-template name="range-spec">
+	<xsl:with-param name="lt" select="vuxml:lt" />
+	<xsl:with-param name="le" select="vuxml:le" />
+	<xsl:with-param name="gt" select="vuxml:gt" />
+	<xsl:with-param name="ge" select="vuxml:ge" />
+	<xsl:with-param name="name" select="$name" />
+      </xsl:call-template>
+    </xsl:for-each>
+  </xsl:template>
+
+  <xsl:template name="stats" xmlns="http://www.w3.org/1999/xhtml">;
+    <xsl:param name="id" />
+    <xsl:param name="label" />
+    <xsl:param name="content" />
+
+    <tr valign="top">
+      <td class="label"><xsl:value-of select="$label" /></td>
+      <td class="content">
+	<xsl:element name="span">
+	  <xsl:attribute name="class"><xsl:value-of select="$id" /></xsl:attribute>
+	  <xsl:value-of select="$content" /></xsl:element>
+      </td>
+    </tr>
+  </xsl:template>
+
+  <xsl:template match="vuxml:vuln">
+    <html xmlns="http://www.w3.org/1999/xhtml">;
+      <head>
+	<title><xsl:value-of select="vuxml:topic" /></title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8;" />
+	<link rel="stylesheet" type="text/css" href="common.css" />
+      </head>
+
+      <body>
+	<h1 class="title"><xsl:value-of select="vuxml:topic" /></h1>
+
+	<table cellspacing="12">
+	  <tr valign="top">
+	    <td><table class="list">
+		<thead><tr><td colspan="5">Affected packages</td></tr></thead>
+		<tbody>
+		  <xsl:for-each select="vuxml:affects/vuxml:package">
+		    <xsl:for-each select="vuxml:name">
+		      <xsl:call-template name="vuln-range">
+			<xsl:with-param name="range" select="../vuxml:range" />
+			<xsl:with-param name="name" select="." />
+		      </xsl:call-template>
+		    </xsl:for-each>
+		  </xsl:for-each>
+		</tbody>
+	      </table></td></tr>
+	</table>
+
+	<h2 class="section">Details</h2>
+
+	<table class="stats">
+	  <xsl:call-template name="stats">
+	    <xsl:with-param name="id" select="'vid'" />
+	    <xsl:with-param name="label" select="'VuXML ID'" />
+	    <xsl:with-param name="content" select="$vid" />
+	  </xsl:call-template>
+
+	  <xsl:for-each select="
+	    vuxml:dates/vuxml:discovery	|
+	    vuxml:dates/vuxml:entry	|
+	    vuxml:dates/vuxml:modified">
+	    <xsl:call-template name="stats">
+	      <xsl:with-param name="id" select="name()" />
+	      <xsl:with-param name="label"
+		select="concat(translate(substring(name(), 1, 1),
+		    'abcdefghijllmnopqrstuvwxyz',
+		    'ABCDEFGHIJKLMNOPQRSTUVWXYZ'),
+		substring(name(), 2))" />
+	      <xsl:with-param name="content" select="." />
+	    </xsl:call-template>
+	  </xsl:for-each>
+	</table>
+
+	<div class="embed">
+	  <xsl:for-each select="vuxml:description/xhtml:body">
+	    <xsl:copy-of select="node()" />
+	  </xsl:for-each>
+	</div>
+
+	<h2 class="section">References</h2>
+	<table class="reftab">
+	  <xsl:for-each select="vuxml:references/vuxml:cvename">
+	    <tr valign="top">
+	      <td class="label">CVE Name</td>
+	      <td class="content"><xsl:element name="a">
+		  <xsl:attribute name="href"><xsl:value-of select="concat(., '.html')" /></xsl:attribute>
+		  <xsl:value-of select="." />
+		</xsl:element></td>
+	    </tr>
+	  </xsl:for-each>
+	  <xsl:for-each select="vuxml:references/vuxml:url">
+	    <tr valign="top">
+	      <td class="label">URL</td>
+	      <td class="content"><xsl:element name="a">
+		  <xsl:attribute name="href"><xsl:value-of select="." /></xsl:attribute>
+		  <xsl:value-of select="." />
+		</xsl:element>
+	      </td>
+	    </tr>
+	  </xsl:for-each>
+	</table>
+      </body>
+    </html>
+  </xsl:template>
+</xsl:stylesheet>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507121940.t6CJe72Z087834>