Datafile questions

3 views
Skip to first unread message

Andrew Scholer

unread,
Sep 6, 2023, 6:01:28 PMSep 6
to pretext...@googlegroups.com
A few questions about datafiles:

1) Text datafiles with inline contents (instead of pulling from a source file) do not seem to get turned into generated datafiles. Is that by design?

2) It appears that the datafile generation step for text files get redered with native line endings, which is not desirable for something that will get rendered into a preformatted textbox. If you generate datafiles on a windows machine, the datafile looks like it is double-spaced when rendered in HTML due to CRLF's. Anyone have a suggestion on how to disable that behavior?

3) I see that runestone-activecode's can have a datafile attribute. But I can't figure out what it does. Can anyone point me to documentation?

Thank you!

Andrew Scholer (he/him/his)
Computer Science Instructor/Program Chair
Chemeketa Community College

Rob Beezer

unread,
Sep 6, 2023, 7:34:16 PMSep 6
to pretext...@googlegroups.com
On 9/6/23 15:00, Andrew Scholer wrote:
> A few questions about datafiles:
>
> 1) Text datafiles with inline contents (instead of pulling from a source file)
> do not seem to get turned into generated datafiles. Is that by design?

Just following Runestone's lead, iirc. Its what the Javascript can handle or
expect.

> 2) It appears that the datafile generation step for text files get redered with
> native line endings, which is not desirable for something that will get rendered
> into a preformatted textbox. If you generate datafiles on a windows machine, the
> datafile looks like it is double-spaced when rendered in HTML due to CRLF's.
> Anyone have a suggestion on how to disable that behavior?

Stop using Windows?

These are generated by Python, and I recall there being settings that influence
line endings (generally) so perhaps we can control this at that point in the
process.

> 3) I see that runestone-activecode's can have a datafile attribute. But I can't
> figure out what it does. Can anyone point me to documentation?

Find this example in the Runestone version of the sample book:

Paragraph
https://pretextbook.org/examples/sample-book/noparts/html/data-files.html#p-835


> Thank you!
>
> Andrew Scholer (he/him/his)
> Computer Science Instructor/Program Chair
> Chemeketa Community College
> 503.589.7649
> computerscience.chemeketa.edu/people/andrew-scholer/
> <http://computerscience.chemeketa.edu/people/andrew-scholer/>
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CACm44N_di%2BH7YcMFZtR7cq50By1Sh1%2B7Mcsmvw2zesUAcu4unA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CACm44N_di%2BH7YcMFZtR7cq50By1Sh1%2B7Mcsmvw2zesUAcu4unA%40mail.gmail.com?utm_medium=email&utm_source=footer>.

Andrew Scholer

unread,
Sep 7, 2023, 11:04:13 AMSep 7
to pretext...@googlegroups.com
Thanks Rob!

I was under the mistaken impression that the lack of a generated file was going to prevent it from getting into the Runestone DB. I can see now that the inline content is getting picked up as intended.

lol @ #2

Andrew Scholer (he/him/his)
Computer Science Instructor/Program Chair
Chemeketa Community College

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/MTAwMDAzMS5iZWV6ZXI.1694043253%40quikprotect.

Rob Beezer

unread,
Sep 7, 2023, 12:11:41 PMSep 7
to pretext...@googlegroups.com
> If you generate datafiles on a windows machine, the datafile looks like it is
double-spaced when rendered in HTML due to CRLF's.

I'd love to see this fixed, but I don't have a Windows machine to work on.
There's no end of stuff out there about Python, Windows, Linux, \n, \r\n, etc.
Open in binary mode, or use "io.open( ) with keyword argumant "newline", and so on.

Action begins in pretext/python.py at current line 724.

Is this confined to data from some external text file, or data authored inline
in source PreTeXt, or does it happen in both situations?

Rob

On 9/7/23 08:03, Andrew Scholer wrote:
> Thanks Rob!
>
> I was under the mistaken impression that the lack of a generated file was going
> to prevent it from getting into the Runestone DB. I can see now that the inline
> content is getting picked up as intended.
>
> lol @ #2
>
> Andrew Scholer (he/him/his)
> Computer Science Instructor/Program Chair
> Chemeketa Community College
> 503.589.7649
> computerscience.chemeketa.edu/people/andrew-scholer/
> <http://computerscience.chemeketa.edu/people/andrew-scholer/>
> https://pretextbook.org/examples/sample-book/noparts/html/data-files.html#p-835 <https://pretextbook.org/examples/sample-book/noparts/html/data-files.html#p-835>
>
>
> > Thank you!
> >
> > Andrew Scholer (he/him/his)
> > Computer Science Instructor/Program Chair
> > Chemeketa Community College
> > 503.589.7649
> > computerscience.chemeketa.edu/people/andrew-scholer/
> <http://computerscience.chemeketa.edu/people/andrew-scholer/>
> > <http://computerscience.chemeketa.edu/people/andrew-scholer/
> <http://computerscience.chemeketa.edu/people/andrew-scholer/>>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "PreTeXt support" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to pretext-suppo...@googlegroups.com
> <mailto:pretext-support%2Bunsu...@googlegroups.com>
> > <mailto:pretext-suppo...@googlegroups.com
> <mailto:pretext-support%2Bunsu...@googlegroups.com>>.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/pretext-support/CACm44N_di%2BH7YcMFZtR7cq50By1Sh1%2B7Mcsmvw2zesUAcu4unA%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CACm44N_di%2BH7YcMFZtR7cq50By1Sh1%2B7Mcsmvw2zesUAcu4unA%40mail.gmail.com> <https://groups.google.com/d/msgid/pretext-support/CACm44N_di%2BH7YcMFZtR7cq50By1Sh1%2B7Mcsmvw2zesUAcu4unA%40mail.gmail.com?utm_medium=email&utm_source=footer <https://groups.google.com/d/msgid/pretext-support/CACm44N_di%2BH7YcMFZtR7cq50By1Sh1%2B7Mcsmvw2zesUAcu4unA%40mail.gmail.com?utm_medium=email&utm_source=footer>>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pretext-suppo...@googlegroups.com
> <mailto:pretext-support%2Bunsu...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/MTAwMDAzMS5iZWV6ZXI.1694043253%40quikprotect <https://groups.google.com/d/msgid/pretext-support/MTAwMDAzMS5iZWV6ZXI.1694043253%40quikprotect>.
>
> --
> You received this message because you are subscribed to the Google Groups
> "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to pretext-suppo...@googlegroups.com
> <mailto:pretext-suppo...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pretext-support/CACm44N9F9RDXhJie3bn606oqL2XfRHoCkHc6ipuxhnuhNN45nw%40mail.gmail.com <https://groups.google.com/d/msgid/pretext-support/CACm44N9F9RDXhJie3bn606oqL2XfRHoCkHc6ipuxhnuhNN45nw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
Reply all
Reply to author
Forward
0 new messages