where is external-directory-source variable used?

25 views
Skip to first unread message

kcri...@gmail.com

unread,
Jul 19, 2024, 12:56:18 PM (5 days ago) Jul 19
to PreTeXt development
As far as I can tell, this variable is only used for ePub by the actual code.

$ grep external-directory-source xsl/*.xsl

xsl/pretext-epub.xsl:                    <xsl:value-of select="$external-directory-source"/>

xsl/publisher-variables.xsl:<xsl:variable name="external-directory-source">

xsl/publisher-variables.xsl:    <xsl:value-of select="$external-directory-source"/>


But it's clearly *intended* to be used for, well, everything.

<xsl:variable name="external-directory-source">
    <xsl:variable name="raw-input" select="$publication/source/directories/@external"/>

There is a default a hard-coding a little later in publisher-variables.xsl


which would be used directly by xsltproc, and is, as far as I can tell.

Nonetheless, apparently the pretext.py script (in get_managed_directories()) *separately* gets the correct values anyway, which is easy if you use the CLI.  But I can't find any documentation on how to do that without using the CLI.

Any help would be very appreciated, particularly in terms of the variable in question (not pretext.py); I'm working on #2159, and to do that incrementally I really need to avoid using the CLI (yet).  I would have used the PROSE Zoom but it seems it might have been canceled due to the workshop, is that correct?  Thanks!

kcri...@gmail.com

unread,
Jul 19, 2024, 1:51:39 PM (5 days ago) Jul 19
to PreTeXt development
<xsl:variable name="external-directory-source">
    <xsl:variable name="raw-input" select="$publication/source/directories/@external"/>

There is a default a hard-coding a little later in publisher-variables.xsl

For completeness, note the same thing is true of the generated directory source, which is hard-coded to "generated" there. 

Rob Beezer

unread,
Jul 20, 2024, 7:24:25 PM (3 days ago) Jul 20
to prete...@googlegroups.com
The versions of these two variables without the "-source" suffix are the ones in
use.

kcri...@gmail.com

unread,
Jul 22, 2024, 7:53:10 AM (2 days ago) Jul 22
to PreTeXt development

The versions of these two variables without the "-source" suffix are the ones in
use.

That's what I thought.  Unfortunately, it seems to show up in the slide conversion when using xsltproc directly.  (Sean, can you confirm this, or not?)   

Separate note: should these variables be removed completely?

Sean Fitzpatrick

unread,
Jul 22, 2024, 9:01:41 AM (2 days ago) Jul 22
to prete...@googlegroups.com
I haven't encountered those variables, but I also haven't looked closely at the XSL for slides.
If you mean that these are variables to be passed to xsltproc during build, I haven't used them.
--
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/4d807a67-ed8a-41f7-9383-fe25ff61ee26n%40googlegroups.com.

kcri...@gmail.com

unread,
Jul 22, 2024, 9:04:22 AM (2 days ago) Jul 22
to PreTeXt development

I haven't encountered those variables, but I also haven't looked closely at the XSL for slides.
If you mean that these are variables to be passed to xsltproc during build, I haven't used them.

What I meant was more along the lines of, "Have you ever had to use <directories external="external" ...> in your publication file?"  because of this?  That's the issue I ran into.

Sean Fitzpatrick

unread,
Jul 22, 2024, 10:56:25 AM (2 days ago) Jul 22
to prete...@googlegroups.com
Do you mean as opposed to using <directories external="assets"...>, or doing nothing at all?

I'm not sure xsltproc is copying the <directories> into the <img> tags in HTML, so where your images are might not match where the slides.html file thinks they are.

But this is another one of these places where it "just works" with the CLI, and I'm not sure why.
(This was not the case last Fall.)

It looks like the CLI is using the same pretext-revealjs.xsl that's in the pretext repo.

I have the pretext/pretext script working with slides, except that I'm not sure image files are being put in the right place. (Or perhaps it's more like, the image files are being put in the right place, but the XSL is not setting the right paths in the html file.)
--
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.

kcri...@gmail.com

unread,
Jul 22, 2024, 12:46:53 PM (2 days ago) Jul 22
to PreTeXt development

Do you mean as opposed to using <directories external="assets"...>, or doing nothing at all?

The former.  See also https://github.com/PreTeXtBook/pretext/issues/1970 where something similar happens, perhaps even for a related reason.
 
I'm not sure xsltproc is copying the <directories> into the <img> tags in HTML, so where your images are might not match where the slides.html file thinks they are.

Well, it does something in reveal-js, and I believe what it is doing is using the variable that is the topic of this thread (or, at least so I follow the code, and so it seems when I put random xsl:message lines into the code).  

Sean Fitzpatrick

unread,
Jul 22, 2024, 1:16:35 PM (2 days ago) Jul 22
to prete...@googlegroups.com

I will need to test to see if I can use something other than "external" and get the devscript to handle it correctly.


--
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.

Sean Fitzpatrick

unread,
Jul 22, 2024, 1:29:59 PM (2 days ago) Jul 22
to prete...@googlegroups.com

Ok, if I use the modified devscript, and a folder named "assets", with external="assets" in the directories element, the assets folder gets copied to a folder named external, which is what the HTML expects to find.

So I think this is ok.

Rob Beezer

unread,
Jul 22, 2024, 2:05:49 PM (2 days ago) Jul 22
to prete...@googlegroups.com
OK, I am not following much of this discussion. And it has been a huge
distraction. Reading carefully the comments and the code, such as the 14 lines
of comments preceding the definition of the variable in question, and the four
other similar definitions immediately following, might have answered the question.

> But it's clearly *intended* to be used for, well, everything.

No, not at all. Uninformed speculation is a big part of why this thread is such
a mess.

Four global variables: generated-directory and external-directory, -source
versions and not

"-source" versions: we need to interrogate files in the author's *source*, hence
the names. Example: the HTML Asymptote files that are generated. We need the
size of the window they display in. So these two variables tell us the path the
author has chosen as the names of these directories, as the literal versions
given within the "source" element of their publisher file. We provide this
flexibility as a convenience for those who may want alternate versions (B/W v.
color JPEG?).

not "-source" versions: these directories are managed, mostly copied into
temporary build directories from source. That involves a rename/standardization
to "generated" and "external". These appear frequently in output so that
various files/pieces are located correctly. These get used repeatedly while
forming output.

Rob

Sean Fitzpatrick

unread,
Jul 22, 2024, 7:52:04 PM (2 days ago) Jul 22
to prete...@googlegroups.com
Sorry, I am in semi-vacation mode and was using limited time to get the
PRs correct for the sample slideshow and the pretext/pretext support for
it. I have not had time to dig into the XSL so the best I could do is
report that everything was working the way I would expect it to.

kcri...@gmail.com

unread,
Jul 23, 2024, 10:02:27 AM (16 hours ago) Jul 23
to PreTeXt development
OK, I am not following much of this discussion. And it has been a huge
distraction. Reading carefully the comments and the code, such as the 14 lines
of comments preceding the definition of the variable in question, and the four
other similar definitions immediately following, might have answered the question. 
 
Unfortunately I had done this, understood (I think) the point of the comments, and yet something persisted in using the "wrong" variables for me with xsltproc (confirmed by changing the publisher file) in revealjs.  So I did my best to ask for help to unravel that mystery.

Sean did a great job confirming that there must have been something else going on with pretext/pretext differently than xsltproc.  Which was the original question I had, "But I can't find any documentation on how to do that [use the pretext script to get the slideshow to build] without using the CLI."

In the event, #2159 was apparently mostly handled by Sean anyway.
Reply all
Reply to author
Forward
0 new messages