---
scribo/ChangeLog | 4 ++++
scribo/demo/xml2doc/main.cc | 27 ++++++++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 1fe01ca..5705d60 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,9 @@
2013-04-18 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * demo/xml2doc/main.cc: Add --template-path option.
+
+2013-04-18 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* src/primitive/extract/lines_pattern.cc: Fix description.
2013-02-27 Anthony Seure <anthony.seure(a)lrde.epita.fr>
diff --git a/scribo/demo/xml2doc/main.cc b/scribo/demo/xml2doc/main.cc
index 5606d2d..dd49094 100644
--- a/scribo/demo/xml2doc/main.cc
+++ b/scribo/demo/xml2doc/main.cc
@@ -28,6 +28,8 @@
#include "datarootdir.hh"
+static QString template_path;
+
void check_xsltproc()
{
@@ -42,7 +44,11 @@ void check_xsltproc()
QString get_datarootdir(const QString& file)
{
- QFile f(SCRIBO_LOCAL_DATAROOTDIR "/templates/" + file);
+ QFile f(template_path + "/templates/" + file);
+ if (f.exists())
+ return template_path + "/templates/";
+
+ f.setFileName(SCRIBO_LOCAL_DATAROOTDIR "/templates/" + file);
if (f.exists())
return SCRIBO_LOCAL_DATAROOTDIR "/templates/";
@@ -90,7 +96,7 @@ int svg_base64(const QString& xml, const QString& svg)
int main(int argc, char **argv)
{
QString man = \
- "xml_transform\n"
+ "Usage: scribo-xml2doc [--template-path <dir>] [OPTIONS]\n"
"OPTIONS:\n\n"
"HTML output:\n"
@@ -138,8 +144,23 @@ int main(int argc, char **argv)
QString option(argv[1]);
- if (argc > 4)
+ if (argc == 5 || argc == 7)
{
+ if (argc == 7)
+ {
+ if ("--template-path" == option)
+ {
+ template_path = argv[2];
+ argv += 2;
+ option = QString(argv[1]);
+ }
+ else
+ {
+ qDebug() << man;
+ return 1;
+ }
+ }
+
if ("--html-full" == option)
{
check_xsltproc();
--
1.7.2.5