pretext-cli build -x missing option

11 views
Skip to first unread message

Jason Siefken

unread,
Nov 26, 2022, 10:47:43 PM11/26/22
to prete...@googlegroups.com
I've been out of the loop for a while, but it appears the pretext CLI no longer has the `build -x ...` option to execute custom XSL. Has this option been renamed?

Oscar Levin

unread,
Nov 27, 2022, 11:05:14 AM11/27/22
to PreTeXt development
Yes, essentially all options for the build command have been moved to the project.ptx manifest.  See here:  Paragraph

Steven Clontz

unread,
Nov 28, 2022, 12:52:41 PM11/28/22
to PreTeXt development
I've since realized that this has caused a little bit of pain for me with a project that's invoking our CLI programmatically. I can't decide if the flaw is that we should expose more functionality via the CLI, or the fact that I really should make my own python script that creates a `Project` object manually and uses it programmatically.

Jason Siefken

unread,
Nov 28, 2022, 11:39:09 PM11/28/22
to prete...@googlegroups.com, Steven Clontz
I think the CLI should support setting everything through the commandline. Here's an idea:

If the project file contained
<a>
 <b>
  <c>Option X</c>
 </b>
</a>

then you could run

```
pretext --project-opt a.b.c "Option X"
```

and get the same result. Basically, you can create an "overlay" of any option in the project file via commandline arguments. If you process this after you parse the project file but before you validate, then you can use the same validation as well :-D. You could also have a nice message if you've overwritten an option in the project file that says something like, "Option a.b.c `XXX` has been overwritten via --project-opt to be `YYY`"

--
You received this message because you are subscribed to the Google Groups "PreTeXt development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-dev/dabd1866-7bb9-4a64-b505-06e0f1495c22n%40googlegroups.com.

Steven Clontz

unread,
Nov 28, 2022, 11:41:46 PM11/28/22
to Jason Siefken, prete...@googlegroups.com
In general this seems promising. Support for attributes would be necessary most likely.

Jason Siefken

unread,
Nov 28, 2022, 11:53:34 PM11/28/22
to Steven Clontz, prete...@googlegroups.com
I'm not thrilled with this idea, but if it works via current commandline processing libraries, it could be the least painful.

What about
<a>
 <b>
  <c foo="bar" baz="fizz">Option X</c>
 </b>
</a>


pretext --project-opt a.b.c="Option X" \
       
--project-opt a.b.c@foo=bar \
        --project-opt a.b.c@baz=fizz

Or you could go with an xpath-inspired syntax

pretext --project-opt /a/b/c[@foo=bar][@baz=fizz]="Option X"

Or if you wanted to be terrible to the users, you could go full xpath

pretext --project-opt /a/b/c[@foo=bar][@baz=fizz][text()="Option X"]


Reply all
Reply to author
Forward
0 new messages