From 187d979a6cfb606ffa22dce4f89c271871d47233 Mon Sep 17 00:00:00 2001 From: berteh Date: Tue, 4 Aug 2015 03:53:07 +0200 Subject: [PATCH] update doc for command-line --- README.md | 56 ++++++++++++++++++++++++++++++++++++++++++ ScribusGeneratorCLI.py | 20 ++++++++------- 2 files changed, 67 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ee1fd6f..3d9b0fd 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,62 @@ To change the properties of a sub-element (such as the text lines in a text fram [3]: https://docs.python.org/2/library/xml.etree.elementtree.html#supported-xpath-syntax "The reduced set of XPATH expressions valid in the 'parameter' field is defined in the ElementTree XPath support documentation." [4]: simply use the color name as defined in your Scribus file colours (``edit > Colours``). +Running Scribus Generator from the command line +--------- +It is possible to (partially) run Scribus Generator from the command line. Partially meaning: SLA generation works great, but no PDF generation for the moment. + +Find all needed information from script help: ``./ScribusGeneratorCLI.py --help`` + + positional arguments: + infiles SLA file(s) to use as template(s) for the generation, + wildcards are supported + + optional arguments: + -h, --help show this help message and exit + -c CSVFILE, --csvFile CSVFILE + CSV file containing the data to substitute in each + template during generation. Default is scribus source + file(s) name with "csv" extension instead of "sla". If + csv file is not found, generation from this particular + template is skipped. + -d CSVDELIMITER, --csvDelimiter CSVDELIMITER + CSV field delimiter character. Default is comma: "," + -f, --fast, --noPdf no PDF generation, scribus SLA only (much faster) + -n OUTNAME, --outName OUTNAME + name of the generated files, with no extension. + Default is a simple incremental index. + -o OUTDIR, --outDir OUTDIR + directory were generated files are stored. Default is + the directory of the scribus source file. outputDir + will be created if it does not exist. + -p, --pdfOnly, --noSla + discard Scribus SLA, generate PDF only. This option is + not used when --fast or --noPdf is used. + -v, --verbose print detailed progress information on the command + line. + + requirements + This program requires Scribus 1.4.+ (for PDF generation only) and Python 2.7+ + + examples: + + ScribusGeneratorCLI.py my-template.sla + generates Scribus and PDF files for each line of 'my-template.csv' + by subsituting the provides values into 'my-template.sla' to the + current directory. + + ScribusGeneratorCLI.py --verbose --fast --outDir "/home/user/tmp" example/Business_Card.sla + generates Scribus files for each line of example/Business_Card.csv + in the "/home/user/tmp" subdirectory. + + ScribusGeneratorCLI.py --verbose --fast --outName "card_%VAR_email%" */*.sla + generates Scribus files for each sla file in any subdirectory + that has a csv file with a similar name in the same directory. + Generated files will have a name constructed from the "email" field + data, and are stored in their respective sla file directory. + + + Issues ------- diff --git a/ScribusGeneratorCLI.py b/ScribusGeneratorCLI.py index 22825a3..d664402 100755 --- a/ScribusGeneratorCLI.py +++ b/ScribusGeneratorCLI.py @@ -35,20 +35,22 @@ examples: + %(prog)s my-template.sla + generates Scribus and PDF files for each line of 'my-template.csv' + by subsituting the provides values into 'my-template.sla' to the + current directory. + %(prog)s --verbose --fast --outDir "/home/user/tmp" example/Business_Card.sla generates Scribus files for each line of example/Business_Card.csv in the "/home/user/tmp" subdirectory. - %(prog)s --verbose --fast --outName "card_%VAR_email%" */*.sla - generates Scribus files for each sla file in any subdirectory - that has a csv file with a similar name in the same directory. - Generated files will have a name constructed from the "email" field - data, and are stored in their respective sla file directory. + %(prog)s --verbose --fast --outName "card_%%VAR_email%%" */*.sla + generates Scribus files for each sla file in any subdirectory + that has a csv file with a similar name in the same directory. + Generated files will have a name constructed from the "email" field + data, and are stored in their respective sla file directory. + - %(prog)s my-template.sla - generates Scribus and PDF files for each line of 'my-template.csv' - by subsituting the provides values into 'my-template.sla' to the - current directory. more information: https://github.com/berteh/ScribusGenerator/ ''')