ol
test a bold line
===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.
\note Please read
#Not all parts of the document have been reworked to include make-doc-pro documentation yet.
/note
===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.)
===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:
#If you run the make-doc-pro program a file request will prompt you for the filename of the text file.
#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.
===Formatting
A very simple text format is used. It is trivial to create and easy to edit.
---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.
---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
]
---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
---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
---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
---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.
+++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
+++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
---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.
---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:
*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.
+++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:
*First level
**Second level
***Third level
**Second level
***Third level
---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:
#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.
---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.
---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.
---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:
\in
This is a section of indented text. It can contain most of the other special formats. For example, here are a few bullet points:
*bullet 1
*bullet 2
/in
---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:
\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
---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:
\table
header1 | header2 ||
cell1 | cell2
/table
table with headers.
\table header
header1 | header2 ||
cell1 | cell2
/table
produces:
\table header
header1 | header2 ||
cell1 | cell2
/table
---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:
=image center ms-word.gif
To left justify the image:
=image left ms-word.gif
=image left ms-word.gif
You can use right and float as well.
=image right ms-word.gif
=image right ms-word.gif
=image float ms-word.gif
=image ms-word.gif
This is a text with an embedded image =image float ms-word.gif to include text styling graphics.
---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:
=view make-doc-pro
But, it can also be shown left justified as:
=view left make-doc-pro
\note 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.
/note
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.
---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.
---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.
---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.
---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
=url http://www.rebol.com The Main REBOL Site.
You can also provide email links with:
=url mailto:robert.muench@robertmuench.de Send me an email.
=url mailto:robert.muench@robertmuench.de 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 "//mycomputer/mydirectory with spaces/myfile.txt" URL with spaces
---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.
===Full Example
For a complete example of a make-doc-pro document, view the makedocpro.txt file that was used to create this document.
===New Features
---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.
--- 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.
\note 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.
/note
===Credits
I would like to thank some people that helped me to make make-doc-pro what it is:
*Carl Sassenrath for creating Rebol and the initial idea I took and extended to make-doc-pro.
*Christophe Coussement for doing the ~dummy documentation test~ and reporting feedback to me.
*All the people who have created the polymorphic if (pic) that I use in make-doc-pro. It's really a nice function.
*The creator of the vword function I use in one place, which makes some checks very easy.
###
Note: To format this text, just evaluate it in the same directory as make-doc-pro.r.