Updated cow to return 1 on error (still needs work).
Updated Makefile to check for error from cow. Fixed bug in events.xsl that prevents events from displaying on main page. Moved mirror_* variables into cscweb.xsl. Added news about mirror.cs.
This commit is contained in:
parent
dc0cc52db0
commit
7cf3cd7f5b
20
cow/main.c
20
cow/main.c
|
@ -1,4 +1,5 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
|
@ -17,10 +18,13 @@ extern int xmlLoadExtDtdDefaultValue;
|
|||
|
||||
void init_extensions();
|
||||
|
||||
/* TODO: check for parse errors */
|
||||
static int error = 0;
|
||||
|
||||
/* output usage message. progname is the name of the executable. */
|
||||
static void usage(const char* progname)
|
||||
{
|
||||
printf("Usage: %s [options] stylesheet input\n", progname);
|
||||
printf("Usage: %s [options] stylesheet input output\n", progname);
|
||||
printf(" --param name value : pass a parameter to the stylesheet\n");
|
||||
}
|
||||
|
||||
|
@ -32,6 +36,7 @@ int main(int argc, char** argv)
|
|||
int nbparams = 0;
|
||||
xsltStylesheetPtr cur = NULL;
|
||||
xmlDocPtr doc, res;
|
||||
FILE *out;
|
||||
|
||||
maxparams = 16;
|
||||
params = (const char**)malloc(sizeof(char*) * maxparams * 2);
|
||||
|
@ -59,7 +64,7 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
if (argNum == argc) {
|
||||
if ((argc - argNum) != 3) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
@ -73,9 +78,18 @@ int main(int argc, char** argv)
|
|||
cur = xsltParseStylesheetFile((const xmlChar *)argv[argNum]);
|
||||
argNum++;
|
||||
doc = xmlParseFile(argv[argNum]);
|
||||
argNum++;
|
||||
if(!doc)
|
||||
return 1;
|
||||
res = xsltApplyStylesheet(cur, doc, params);
|
||||
xsltSaveResultToFile(stdout, res, cur);
|
||||
if(!res || error)
|
||||
return 1;
|
||||
out = fopen(argv[argNum], "w");
|
||||
if(!out)
|
||||
return 1;
|
||||
xsltSaveResultToFile(out, res, cur);
|
||||
|
||||
fclose(out);
|
||||
xsltFreeStylesheet(cur);
|
||||
xmlFreeDoc(res);
|
||||
xmlFreeDoc(doc);
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- mirror variables -->
|
||||
<xsl:variable name="mirror_csc">http://csclub.uwaterloo.ca/files/</xsl:variable>
|
||||
<xsl:variable name="mirror_cs">http://mirror.cs.uwaterloo.ca/csclub/</xsl:variable>
|
||||
|
||||
<xsl:output method="xml" encoding="ISO-8859-1" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" />
|
||||
|
||||
<!-- include additional style sheets -->
|
||||
|
|
|
@ -9,12 +9,12 @@ ifdef DEBUG
|
|||
endif
|
||||
|
||||
all: $(OUTPUTS)
|
||||
@for i in $(SUBDIRS) ; do (cd $$i && $(MAKE) && cd ..) ; done
|
||||
@for i in $(SUBDIRS) ; do (cd $$i && ($(MAKE) || exit 1) && cd ..) ; done
|
||||
|
||||
clean-recurse: clean
|
||||
@for i in $(SUBDIRS) ; do (cd $$i && $(MAKE) clean-recurse && cd ..) ; done
|
||||
@for i in $(SUBDIRS) ; do (cd $$i && ($(MAKE) clean-recurse || exit 1) && cd ..) ; done
|
||||
clean:
|
||||
rm -f *.html events.ics
|
||||
|
||||
%.html: %.xml $(ROOT)/csc.dtd $(ROOT)/cscweb.xsl $(ROOT)/xsl/*.xsl $(ROOT)/events.xml $(ROOT)/news.xml $(ROOT)/menu.xml $(ROOT)/default.mk directory.xml $(ROOT)/cow/cow
|
||||
$(ROOT)/cow/cow $(XSLTARGS) $(ROOT)/cscweb.xsl $< > $@
|
||||
$(ROOT)/cow/cow $(XSLTARGS) $(ROOT)/cscweb.xsl $< $@ || exit 1;
|
||||
|
|
3
news.xml
3
news.xml
|
@ -2,6 +2,9 @@
|
|||
|
||||
<!DOCTYPE newdefs SYSTEM "csc.dtd">
|
||||
<newsdefs>
|
||||
<newsitem author="dtbartle" date="2007-08-13">
|
||||
Our talks our now mirrored on mirror.cs for ResNet and on-campus users.
|
||||
</newsitem>
|
||||
<newsitem author="mspang" date="2007-05-11">
|
||||
The <a href="/about/exec.html">executive</a> has been elected for the Spring 2007 term.
|
||||
</newsitem>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<tr>
|
||||
<th colspan="2" class="news">Upcoming Events</th>
|
||||
</tr>
|
||||
<xsl:for-each select="document(concat($pwd, '/../events.xml'))/eventdefs/eventitem">
|
||||
<xsl:for-each select="document(concat($pwd, '/events.xml'))/eventdefs/eventitem">
|
||||
<xsl:sort select="translate(@date, '-', '')"
|
||||
order="ascending" data-type="number" />
|
||||
<xsl:if test="translate(@date, '-', '') >= translate($date, '-', '')">
|
||||
|
|
|
@ -4,9 +4,6 @@
|
|||
xmlns:csc="http://www.csclub.uwaterloo.ca/cow"
|
||||
extension-element-prefixes="csc">
|
||||
|
||||
<xsl:variable name="mirror_csc">http://csclub.uwaterloo.ca/files/</xsl:variable>
|
||||
<xsl:variable name="mirror_cs">http://mirror.cs.uwaterloo.ca/csc/</xsl:variable>
|
||||
|
||||
<xsl:template match="mediafile">
|
||||
<xsl:param name="ext" />
|
||||
<xsl:param name="mirror" />
|
||||
|
|
Loading…
Reference in New Issue