[yelp-tools] [tools/yelp-cache.in] Adding yelp-cache to generate Mallard cache files
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-tools] [tools/yelp-cache.in] Adding yelp-cache to generate Mallard cache files
- Date: Thu, 8 Jul 2010 13:22:39 +0000 (UTC)
commit 392694e333d52909c75ec519c73103e59d935e33
Author: Shaun McCance <shaunm gnome org>
Date: Thu Jul 8 09:22:11 2010 -0400
[tools/yelp-cache.in] Adding yelp-cache to generate Mallard cache files
configure.ac | 7 +++++++
tools/Makefile.am | 2 ++
tools/yelp-cache.in | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ad65f65..ac36961 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,11 +22,18 @@ PKG_CHECK_MODULES(GNOME_DOC_UTILS,
[
libxml-2.0 >= 2.6.12
libxslt >= 1.1.8
+ yelp-xsl
])
+XSL_PATH="`$PKG_CONFIG --variable=xsltdir yelp-xsl`"
+
+XSL_MAL_CACHE="$XSL_PATH""/mallard/cache/mal-cache.xsl"
+AC_SUBST(XSL_MAL_CACHE)
+
AC_CONFIG_FILES([
Makefile
tools/Makefile
+tools/yelp-cache
xml2po/Makefile
xml2po/xml2po.pc
xml2po/xml2po/Makefile
diff --git a/tools/Makefile.am b/tools/Makefile.am
index f21b3a2..d0928e5 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,4 +1,6 @@
aclocaldir = $(datadir)/aclocal
aclocal_DATA = yelp.m4
+bin_SCRIPTS = yelp-cache
+
EXTRA_DIST = $(aclocal_DATA)
diff --git a/tools/yelp-cache.in b/tools/yelp-cache.in
new file mode 100755
index 0000000..58f95d3
--- /dev/null
+++ b/tools/yelp-cache.in
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+
+import optparse
+import os
+import os.path
+import subprocess
+import urllib
+
+xsl_mal_cache='@XSL_MAL_CACHE@'
+
+parser = optparse.OptionParser()
+parser.add_option ('-o', '--output', dest='output', default='index.cache',
+ help='write cache to FILE', metavar='FILE')
+(options, args) = parser.parse_args()
+
+if len(args) == 0:
+ args = [os.getcwd()]
+
+pages = []
+for arg in args:
+ if os.path.isdir(arg):
+ for f in os.listdir(arg):
+ if f.endswith('.page'):
+ pages.append(os.path.join(arg, f))
+ else:
+ pages.append(arg)
+
+pages = ['file://' + urllib.pathname2url(os.path.join(os.getcwd(), page)) for page in pages]
+cache = '<cache:cache xmlns:cache="http://projectmallard.org/cache/1.0/" xmlns="http://projectmallard.org/1.0/">\n'
+for page in pages:
+ cache += '<page cache:href="%s"/>\n' % page
+cache += '</cache:cache>'
+
+outfile = open(options.output, 'w')
+
+subprocess.Popen(['xsltproc', xsl_mal_cache, '-'], stdin=subprocess.PIPE, stdout=outfile).communicate(input=cache)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]