|
In this chapter the syntax of a Scribe text is presented informally.
In particular, the Scribe syntax is compared to the HTML syntax. It is also
presented how Scribe source files can be processed.
In this section we show how to produce very simple electronic documents
with Scribe. Suppose that we want to produce the following Web document:
Hello World!
This is a very simple text. |
The HTML source file for such a page should look like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Hello world Example</TITLE>
</HEAD>
<BODY>
<H1>Hello World!</H1>
This is a very simple text.
</BODY>
</HTML> |
In Scribe, the very same document must be written:
(document :title [Hello World!] [
This is a very simple text.]) |
1.2 Adding colors and fonts
|
Let us suppose that we want now to colorize and change the face of some
words such as:
Hello World!
This is a very simple text. |
The HTML source file for such a document should look like:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Hello world Example</TITLE>
</HEAD>
<BODY>
<H1>Hello World!</H1>
This is a <B>very</B> <I>simple</I> <FONT color="red">text</FONT>.
</BODY>
</HTML> |
In Scribe, the very same document must be written:
(document :title [Hello World!] [
This is a ,(bold [very]) ,(it [simple]) ,(color :fg [red] [text]).]) |
As one may notice the Scribe version is much more compact than the HTML one.
For large documents there is an obvious need of structure. Scribe documents
may contain chapters, sections, subsections,
itemize, ... For instance, if we want to extend our previous
example to:
Hello World!
1. A first Section
This is a very simple text.
2. A second Section
That contains an itemize construction:
. first item
. second item
. third item |
The Scribe source for that text is:
(document :title [Hello World!] [
(section :title [A first Section] [
This is a ,(bold [very]) ,(it [simple]) ,(color :fg [red] [text]).])
(section :title [A second Section] [
That section contains an ,(bold itemize) construction:
,(itemize [first item]
[second item]
[third item])])]) |
A Scribe document may contain links to chapters, to sections, to other
Scribe documents or Web pages. The following Scribe source
code illustrates these various kinds of links:
(document :title [Various links] [
(section :title "A Section" [
The first link points to an external web page. Here we point to a
,(ref :url [http://slashdot.org/] [Slashdot])
web page. The second one points to the second
,(ref :section [A second Section] [Section])
of that document.])
(section :title [A second Section] [
The last links points to the first
,(ref :scribe [user.scr] :figure [A simple web page] [Figure])
of the Scribe User Manual.])]) |
1.5 Compiling Scribe documents
|
There are several ways to render a Scribe document. It can be statically
compiled by the scribe compiler to various formats such as HTML,
LaTeX, man and so on. It can be compiled on-demand by the mod_scribe
Apache Scribe module. In this
section we only present static compilation.
Let us suppose a Scribe text located in a file file.scr.
In order to compile to various formats one must type in:
$ scribe file.scr -o file.html # This produces an HTML file.
$ scribe file.scr -o file.tex # This produces a TeX file.
$ scribe file.scr -o file.man # This produces a man page.
$ scribe file.scr -o file.info # This produces an info page.
$ scribe file.scr -o file.mgp # This produces a MagicPoint document |
|