The make-doc-pro Document Formatter

    Author      : Robert M. Münch
    Date        : 03-December-2001
    Version     : 1.0.1
    Corrections : robert.muench@robertmuench.de

Contents

1. Introduction
2. Objective
3. Input Files
4. Formatting
4.1 Primary Rule
4.2 Language Support
4.3 Title Line
4.4 Boilerplate
4.5 Table of Contents
4.6 Section Headings
4.7 Code Examples
4.8 Bullet Points
4.9 Numbered Points
4.10 Inline Formatting
4.11 Definitions
4.12 Indented Sections
4.13 Note Boxes
4.14 Tables
4.15 Images
4.16 Layouts
4.17 Comments
4.18 Include Files
4.19 Alternate Output Files
4.20 Stand-alone URL Links
4.21 End of Text
5. Full Example
6. New Features
6.1 Relaxed Formatting
6.2 Font Settings
7. Credits

It's possible to have COLOURED text.

rebol

test a bold line

1. Introduction

The work of make-doc-pro is based on the work of Carl Sassenrath from Rebol Technologies. I have improved the original make-doc. This documentation is based on the origianl make-doc documentation and was extended to include the new make-doc-pro features.

Please read
  1. Not all parts of the document have been reworked to include make-doc-pro documentation yet.
[ back to top ]

2. Objective

make-doc-pro was created to provide a portable, easy-to-edit format for all kind of documents. The program was designed to convert a simple text formatted file into HTML or other document formats (such as PDF or REBOL/View). The beauty of the format is that the text documents are quick to write and are very readable.

You can also use this program to create the first version of an HTML file and then resume your editing in an HTML editor (although out of the dozen HTML editors I have tried, I have not found one that is as productive as the make-doc-pro approach to writing documents quickly.)

[ back to top ]

3. Input Files

The input file is an ordinary text file. Indented lines can be done with tabs or spaces. Doing layout within the text file isn't transformed to HTML layout, instead make-doc-pro uses a concept like TeX. There you don't have a WYSIWYG approach, you write the layout into the document. Keep this always in mind.

The text file is specified to make-doc-pro in one of two ways:

  1. If you run the make-doc-pro program a file request will prompt you for the filename of the text file.
  2. Or, you can specify the text file as an argument to the make-doc-pro program.

This second approach allows you to embed a REBOL script within your text document that automatically calls make-doc-pro if the text file is evaluated. This is handy if your text editor supports an "evaluate script" shortcut key. With the press of a single key, you can view your formatted output. To prevent the REBOL header from being formatted, use the ### as described below.

[ back to top ]

4. Formatting

A very simple text format is used. It is trivial to create and easy to edit.

4.1 Primary Rule

The main rule that you will need to follow is to separate all paragraphs with a newline. Write a single paragraph without pressing your RETURN key as one long line of text. Most text editors have a feature to word-wrap a text so that you can still see the paragraph style. Further some of the editors show you line-numbers. You can see that the text for one line-number might span several lines on your display.

You can use blank lines to to seperate paragraphs too. But please note that seperating normal text lines which should form a paragraph through newlines will issue a seperate paragraph each time.

For example:

    This is paragraph one.
    This is paragraph two.

If you fail to do this, your paragraphs will be merged together. You don't have to seperate special formating tags, as make-doc-pro can handle them without an extra blank line. This feature was added to make-doc-pro because beginners or people not used to work with such a markup style often forget to use blank lines.

4.2 Language Support

I added support for different languages to make-doc-pro. At the moment only the specifier for the contents and copyright section can be customized. By default make-doc-pro uses the english language option.

Language support isn't hardcoded into make-doc-pro instead you specifie a filename, which is than loaded and processed. From this point on the new definitions are used. So a good place to use this option is after the title/author block and before the TOC tag. In this case the TOC will have the correct description.

To specify an other language use the following code:

    =language DE

This will read the file DE.r and execute the definitions inside. Here you see a sample content of such a file:

    contents: "Inhalt"

    copyright: [

"Documentenformatierer Copyright Robert M. Münch. All Rights Reserved."
"Formatiert mit Make-Doc-Pro Version:" system/script/header/version " am " now/date " um " now/time

]

4.3 Title Line

The first line in the text file Will be considered as a title line. This text will be used for the document title as well as the HTML title tag. For example, this document started with line:

    The make-doc-pro Document Formatter

4.4 Boilerplate

If you follow the title line with a blank line then a few indented lines, the will be used as your boilerplate. Note that this is not currently a special style, it uses the indented code format.

This document has the boilerplate:

    Author      : Robert M. Münch
    Date        : 04-August-2001
    Version     : 0.9.5
    Corrections : robert.muench@robertmuench.de

4.5 Table of Contents

The table of contents (TOC) is automatically generated by the different section headings. It contains links to each section. No other effort is required. The TOC will indent and number the different sections and subsections. The level of indention is the same as later in the document text.

The TOC isn't included into your document by default. If you want to include a TOC use the following code where you want the TOC to appear. The TOC is only generated for the contents follwing the tag:

    =toc

4.6 Section Headings

make-doc-pro supports four different sorts of headings. These headings are indented to give the document a structure. This structure is shown in the TOC too.

4.6.1 Major Sections Headings

Major section headings are created with a line that begins with that is followed by the text of the heading. Here is an example:

    ===This is a Section

4.6.2 Subsection Headings

Minor section headings are created with a line that begins with --- and is followed by the text of the heading. Here is an example:

    ---This is a Subsection

A simple memory method for remembering that is for sections and --- is for subsections is to note that has more to it than ---. There are two more subsection headings you can use. The first is +++ and the second one is ... followed by the text of the heading. The subsections use different text sizes and indention levels to indicate the level of the heading.

Here is a summuray of the available heading styles:

===

Major Section heading

---

Subsection

+++

Subsubsection

...

Subsubsubsection

4.7 Code Examples

To create a code example, all you have to do is indent the text. Code examples are printed in a fixed-space bold font. For example:

    foreach line paragraph [
        print [
            length? line
            mold line
        ]
    ]

Notice that the example maintains its proper indentation. In REBOL indentation defaults to 4 spaces.

4.8 Bullet Points

A handy way of creating a simple list of bullet points is done by beginning paragraphs with a * character. Remember to keep the text flush left, otherwise it will become a code example. The example:

    *This is the first of a few bullet points.

    *This is a second bullet point.

    *This is another bullet point. It contains a lot more
    text, so it will show how bullets are wrapped on in
    the output.

will produce:

4.8.1 Bullet Points Level

make-doc-pro supports three different levels of bullet points. To use them just use several bullet characters. Here is an example:

    *First level
    **Second level
    ***Third level
    **Second level
    ***Third level

Will procude:

4.9 Numbered Points

Similar to bullet points, you can create numbered points. Start each numbered line with a # that is followed by the text of the line.

For example:

    #This is the first numbered line.

    #This is the second numbered line.

    #This is another bullet point. It contains a lot more
    text, so it will show how lines are wrapped on in
    the output.

produces:

  1. This is the first numbered line.
  2. This is the second numbered line.
  3. This is another bullet point. It contains a lot more text, so it will show how lines are wrapped on in the output.

4.10 Inline Formatting

You can change text decoration inline. You can use bold text, italic text or underline text. The formatting is quite easy for this:

    bold
    italic
    underline

The word you are going to decorate must have spaces in front of and after the inline decoration character:

    This is an underlined source text.

4.11 Definitions

A list of word definitions is created with a leading : for the word, followed by a - for the definition. The word of the definition can contain - characters too as long as there are no spaces. make-doc-pro recognizes the definition from the place starting after a "-" sequence is found.

For example, the definitions:

    :word - This is the first definition.

    :example-with- - This is the second definition.

    :next word - This is the second word. Note that it can
    include more than one word.

would appear as:

word

This is the first definition.

example-with-

This is the second definition.

next word

This is the second word. Note that it can include more than one word.

4.12 Indented Sections

To increase indention level of a section of text, you will need to use a \in and a /in to indicate decreasing the indention level. This means you can use several \in and /in for indention controling. Indetion level is increased/decreased by 1cm a time.

For example:

    \in

    This is a section of text.  I can contain most
    of the other special formats. For example, here
    are a few bullet points:

    *bullet 1

    *bullet 2

    /in

produces:

This is a section of indented text. It can contain most of the other special formats. For example, here are a few bullet points:

4.13 Note Boxes

Special notes can be shown in a callout box. A note begins with \note and ends with /note. The \note line can be followed by a box heading that will be shown at the top of the box.

The example:

    \note Example Note Box

    This is a special note. It can contain most
    of the other special formats. For example, here
    are a few numbered points:

    #number one

    #number two

    /note

produces:

Example Note Box

This is a special note. It can contain most of the other special formats. For example, here are a few numbered points:

  1. number one
  2. number two

4.14 Tables

make-doc-pro adds support for tables. It's only a basic thing yet but more to come. You create tables like this:

    \table
    cell1 | cell2 ||
    cell1 | cell2
    /table

produces:

header1 header2
cell1 cell2

table with headers.

    \table header
    header1 |  header2 ||
    cell1 | cell2
    /table

produces:

header1 header2
cell1 cell2

4.15 Images

Images are placed in a document with the image tag.

The line:

    =image center ms-word.gif

Would include the image, with the filename ms-word.gif from the same directory as the sourcetext file, centered in the document:

To left justify the image:

    =image left ms-word.gif

You can use right and float as well.

    =image right ms-word.gif

    =image float ms-word.gif

This is a text with an embedded image to include text styling graphics.

4.16 Layouts

VID layouts can be automatically generated as images. The images will be stored in a graphics folder in the local directory.

To create a layout, follow an example with a view command. The command does not need to immediately follow the example. It will always print the last example that appeared. This gives you space to explain the results before showing them.

Here is an example layout:

    backdrop %nyc.jpg 40.40.150
    banner "Example Layout"
    text bold "Just an example...."
    button "Ok"

This will normally appear as:

 make-doc-pro

But, it can also be shown left justified as:

 left make-doc-pro
Note:

In order to see the above examples, you must build a local copy of make-doc-pro.html. To do so, just run make-doc-pro and select makedocpro.txt from the file requestor.

The first is done with a:

    =view

The second is done with a:

    =view left

A graphics dir will be created within the working dir, containing the *.png generated file. It can be given a base file name with a line like:

    =view example

All other view commands that follow will use the same base name. If no base name is given, the word "image" will be used.

4.17 Comments

Comments begin with a semicolon (;) and continue through the end of the paragraph. It is OK to have whitespaces between the semicolon and the first character of the text.

Here is an example comment:

    ;This is a comment. It continues until
    a blank line is encountered. It is handy
    for commenting out paragraphs.

4.18 Include Files

While processing a file you can insert the contents of another file with the include command. For example:

    =include preface.txt

would include the file preface.txt.

The inserted file can use all of the same commands and body text as accepted by make-doc-pro. Any number of include commands can be used, and included files can also contain include commands.

Include files should be placed into the same directory as the sourcetext file.

4.19 Alternate Output Files

A single input file can create multiple output files. The new output file is specified with the file command. For example:

    =file directory.html

would cause all text and commands that follow it to be stored in the directory.html file. When using several output files, the TOC is kept in sync. This makes it possible to klick in the TOC and branch to an other file.

More than one file command can be used. For example:

    =file first.html

This is the text of the first file

    =file second.html

This is the text of the second file.

    =file third.html

This is the text of the third file.

4.20 Stand-alone URL Links

Simple types of URL links can be created with the url command. This command provides a file or site reference, followed by the hyperlink text. For example, to provide a relative link:

    =url work.html Where we work

To provide an absolute link:

    =url http://www.rebol.com The Main REBOL Site

This will appear as follows

The Main REBOL Site.

You can also provide email links with:

    =url mailto:robert.muench@robertmuench.de Send me an email.

Send me an email.

Sometimes it's necessary to use URL with spaces, especially if you want to link to a file on a intranet server. Than use the following form:

    =url "//mycomputer/mydirectory with spaces/myfile.txt" URL with spaces

URL with spaces

4.21 End of Text

If you follow your text with ### it will be used to mark the end of text formatting. This is handy if you want to include some comments or notes to yourself at the end of the file, but you don't want them formatted into the document.

For example:

    ###

would end text formatting.

You can also embed a REBOL script to automatically format your text (as described above). To do so, follow the ### with a REBOL header. Here is an example:

    ###
    [REBOL [] do/args %make-doc-pro.r %make-doc-pro.txt]

The ### marks the end of the formatting so the script portion will not be shown. The brackets around the script allow you to follow the line with notes or comments that are not evaluated. The brackets are not required.

[ back to top ]

5. Full Example

For a complete example of a make-doc-pro document, view the makedocpro.txt file that was used to create this document.

[ back to top ]

6. New Features

6.1 Relaxed Formatting

Normally, when the input file begins with a text line it is used as a title line. A table of contents is generated, each section and subsection is numbered, and sections are divided with horizontal bars.

However, if the first content line is a section or subsection header, then the above frills are disabled. The document will not include a table of contents, there will be no numbering of sections, and no horizontal divider bars will be inserted.

6.2 Font Settings

The fonts command has been added to allow you to specicfy font characteristics. The fonts command will accept a file name or a block. When a file name is specified, the corresponding file is must contain a block of font preferences. For example, to use a file called doc-fonts.r, you would include the line:

    =fonts doc-fonts.r

and the doc-fonts.r file could include these definitions:

    title: 
    h1: 
    h2: 
    h3: 
    h4: 
    h5: 
    normal: 
    toc: normal
    list: normal
    define: normal
    url: normal

All of these definitions are optional. When a font setting is not specified, the font setting will remain unchanged.

The font definition is an evaluated REBOL block and can include any valid REBOL expression. For example the NORMAL font style shown above is used multiple times once it has been defined.

Currently, only an HTML font tag specifications are accepted; however, future versions of make-doc-pro may allow a more generic description of fonts for PDF and other output formats.

The fonts command also allows you to specify inline font changes when followed by a block:

    =fonts [normal: ]

This would set normal text to a font size of 1.

Font Names

Please be aware that some fonts names are not universally supported on all browser platforms. When machine specific fonts are used, please provide a more universal alternate font as shown in the examples above.

[ back to top ]

7. Credits

I would like to thank some people that helped me to make make-doc-pro what it is:

[ back to top ]

Document formatter copyright Robert M. Münch. All Rights Reserved.
XHTML 1.0 Transitional formatted with Make-Doc-Pro Version:1.0.8 on 16-Jun-2005 at 15:11:50