olena: olena-2.0-553-g3105f43 demo/xml2doc/main.cc: Add --template-path option.

--- 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 90de65c..6f048f1 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -14,6 +14,10 @@ 2013-04-18 Guillaume Lazzara <z@lrde.epita.fr> + * demo/xml2doc/main.cc: Add --template-path option. + +2013-04-18 Guillaume Lazzara <z@lrde.epita.fr> + * src/primitive/extract/lines_pattern.cc: Fix description. 2013-02-27 Anthony Seure <anthony.seure@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
participants (1)
-
Guillaume Lazzara