[NTLK] Also back: Paperback book packager site
Victor Rehorst
victor at chuma.org
Wed Oct 18 18:37:31 EDT 2017
On 18/10/17 02:43 PM, Grant Hutchinson wrote:
> This is fantastic, Victor.
>
> Ok, now for some questions ...
OK, now for some answers.
> 1) Can you explain how the book maker works?
> 2) Isn't the Paperback utility just a Mac OS or Windows application?
Sure. At a high level, it uses the DCL's ability to manipulate and
combine Newton frames, object, and other data into a valid Newton
package. At a lower level:
1) It loads a package template from a file in NSOF format into the DCL's
abstraction of a Newton Object in-memory. To paraphrase an email from
Paul back in 2004:
The template is just a Frame (f) where:
- f is a package frame
- f.appSymbol is modified by PBBookMaker to be the package symbol
- f.theForm is the Paperback reader app, without data
- f.theForm.book is modified by PBBookMaker to be the book structure
[in the template, it has the value nil]
2) It reads the input text for the book
3) (optionally) looks for patterns in the text to create a linked table
of contents
4) Wraps the book text, parameters, and table of contents data into
another Newton frame, and adds it to the in-memory Object (f.theForm.book)
5) Transforms said object to package format and writes it out.
The underlying command-line tool was announced by Paul on the list back
in 2004: https://marc.info/?l=newtontalk&m=108155067823711&w=2
> 3) How are you able to convert text files into Newton packages using Escale?
Escale, being based on the DCL, uses the same code classes.
> 4) Is the file format documented somewhere?
>
> The reason I'm asking is that this seems like it might be an easy way to create a Newton-compatible version of the Newton Glossary from my plain text source files.
There isn't really a file format per say... it's a Newton package. The
input is plain text. The only special thing about it is the table of
contents detection. If you prefix all of the lines you want in the
table of contents with a particular string, and specify it in the form,
then you get links to those sections (with the detected prefix
removed). If you could write something for Kirby or whatever that would
spit out the glossary into a single text file, with these special lines,
then bam-o! For example, with a text file kind of like this:
----~~~~----
Newton Glossary
Version x.y.doesnotexist
@@TOC A definition
A definition is a phrase which describes the meaning of a word or
another phrase. Can you write a definition which is its own
definition? My head hurts now.
Source: anon.
@@TOC NSOF
Newton Streamed Object Format.
The data format used when sending arbitrary Newton objects over a
communications link, or as a stream of binary data written to an
arbitrary storage medium. I just wrote / cribbed this definition, I
know it isn't the one in the glossary, OK?
----~~~~----
You get the picture. Processing that with "@@TOC" as the
table-of-contents prefix, and the "remove table of contents lines" would
look something like this, with the table of contents open by tapping the
Overview button:
https://screenshots.firefox.com/dIEbQLpv1FRl8deZ/null
More information about the NewtonTalk
mailing list