Qse: Quikscript Editor

Expand a File

Qse allows the file in the window (and other files) to be expanded, that is, have internal instructions acted upon to

Text inserted by invoking a macro or including a file is itself checked for expansion keywords.

Include a file

Another file is included into the current file with the instruction
%include newname%

A file­name is interpreted relative to the file from which it was called, and simple names are interpreted as being in the same directory. Names beginning with '..' are interpreted as being in a higher level directory.

Date

A string
%DATE%
within a file will be replaced by the current local date.

Defining and invoking a macro

Macros can be defined using the form
%DM,name:string:%
and such strings will not be copied to the output. These set up text substitutions that will apply to the remainder of the document.

Such macros can be invoked with

%M,name%
so that this text will be replaced by the string in the definition. Invocation is recursive, by which I mean that the replacement text is not simply copied directly to standard output, but instead is processed as the input stream. Within this replacement text may be other macro invocations (%M,othername%), new macro definitions, or %include.. directives. (A macro cannot be redefined within its own body; our simple syntax will not allow colons to appear in the 'string' part of a definition).

Example of Macro usage

A situation where macros might be useful is if we wanted to use two paragraph styles within the one document. Paragraphs have four attributes: the body alignment, the first line indentation, the inter­paragraph gap, and the minimum distance from the bottom of the page for the start of a new paragraph. If we needed to use the style of paragraph with indented first line for most of the document, but in some areas to switch to a hanging first line style for numbered points, we could define two macros for each style:
%DM,Num:%P,15,-10,-.5%:%
%DM,Par:%P,0,5,0%:%
   
Then to commence a normal paragraph, we would use %M,Par%, and commence a numbered paragraph, %M,Num%. The parameters of the two styles would be defined once, and we could switch between the two styles as needed without needing to remember to reset the parameters of the original style at the end of a section.

Similar styles can be set up for section titles, where a little extra space before the title, a change in font size and paragraph style, and the use of bold will be used systematically for all headings throughout the document.

%DM,Head:%L%%SZ,16%%PH,0,0,0%%BD%:%
%DM,Body:%SZ,11%%P,0,0,0%%LT%:%
   

A file is provided with Quikscript (macros.qs) which contains a set of macro definitions that are useful for structured documents, with lists possibly containing sub­lists. In this way, a layout style can be established in the one place, so that measurements of offsets or indentations do not need to be actually used within the document.