old-www/HOWTO/Linuxdoc-Reference-3.html

171 lines
6.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
<TITLE>Linuxdoc Reference: A minimalistic document</TITLE>
<LINK HREF="Linuxdoc-Reference-4.html" REL=next>
<LINK HREF="Linuxdoc-Reference-2.html" REL=previous>
<LINK HREF="Linuxdoc-Reference.html#toc3" REL=contents>
</HEAD>
<BODY>
<A HREF="Linuxdoc-Reference-4.html">Next</A>
<A HREF="Linuxdoc-Reference-2.html">Previous</A>
<A HREF="Linuxdoc-Reference.html#toc3">Contents</A>
<HR>
<H2><A NAME="crash"></A> <A NAME="s3">3. A minimalistic document</A></H2>
<P>In this section you'll find what you'll need for a minimalistic linuxdoc
dtd conform document.
It's intended to give a first touch.
Skip this section, if you already now the principles.
<P>
<H2><A NAME="ss3.1">3.1 Step By Step</A>
</H2>
<P>The steps you have to do to create a nice linuxdoc document and map it to
the form you need are:
<P>
<UL>
<LI>Take a plain text editor of your choice.</LI>
<LI>Create a file and name it (or later save it as) e.g. <CODE>start.sgml</CODE>.</LI>
<LI>Type the document</LI>
<LI>Save the file and close your editor.</LI>
<LI>Run the checker by typing <CODE>sgmlcheck&nbsp;start.sgml</CODE>.</LI>
<LI>If you get errors reported, reopen your document in your editor again
and try to correct it
<BLOCKQUOTE>The error messages of <CODE>sgmlcheck</CODE>
will give you a hint about the type of error and also line and column where
it occurred.</BLOCKQUOTE>
.
Run the checker again until no more errors occur.</LI>
<LI>Now you have to decide what's your document for.
<!--
mapping
-->
Take the apropriate parser mapper combination and translate
your document.
To find the mappers available in the SGML-Tools see table
<A HREF="#tmapper">SGML-Tools mappers for sgml documents</A>.
<CENTER><TABLE BORDER><TR><TD>
<BR>
type</TD><TD>to produce</TD></TR><TR><TD>
</TD></TR><TR><TD>
<CODE>sgml2html start.sgml</CODE></TD><TD>Hypertext markup language for web browsers</TD></TR><TR><TD>
<CODE>sgml2lyx start.sgml</CODE></TD><TD>Lyx or KLyx wysiwym textformat</TD></TR><TR><TD>
<CODE>sgml2info start.sgml</CODE></TD><TD>Info page for UN*X info</TD></TR><TR><TD>
<CODE>sgml2latex start.sgml</CODE></TD><TD>DVI output</TD></TR><TR><TD>
<CODE>sgml2latex --output=tex start.sgml</CODE></TD><TD>pure tex output</TD></TR><TR><TD>
<CODE>sgml2latex --output=ps start.sgml</CODE></TD><TD>postscript output</TD></TR><TR><TD>
<CODE>sgml2rtf start.sgml</CODE></TD><TD>rich text format</TD></TR><TR><TD>
<CODE>sgml2txt start.sgml</CODE></TD><TD>pure text</TD></TR><TR><TD>
<CAPTION>SGML-Tools mappers for sgml documents
<A NAME="tmapper"></A> </CAPTION>
</TD></TR></TABLE></CENTER>
</LI>
</UL>
<P>
<P>
<H2><A NAME="ss3.2">3.2 A Startup Document</A>
</H2>
<P>We start with a simple document (the numbers and colon in the beginning
of the line are for explanation, don't type it!):
<P>
<!--
example!startup document
-->
<HR>
<PRE>
1: &lt;!doctype linuxdoc system>
2: &lt;notes>
3: &lt;title>A Small Linuxdoc Example&lt;/title>
4: &lt;p>Hello &lt;em>world&lt;/em>.&lt;/p>
5: &lt;p>&lt;bf>Here&lt;/bf> we are.&lt;/p>
6: &lt;/notes>
</PRE>
<HR>
<P>Now we take a look at the single lines:
<OL>
<LI>A linuxdoc document has to start, like all SGML conform documents,
with the <EM>preamble</EM>.
If you like you can take it as a piece of necessary magic, or you can
try to find more information about SGML.
The preamble is indicating to the SGML-parser, which dtd
(document type definition) it should use for checking the syntax of the
document.
</LI>
<LI>Open the <EM>document class</EM>:
You have to decide, wich type of document you want to write.
See section
<A HREF="Linuxdoc-Reference-4.html#linuxdoc">Document Classes</A> for detailed
description about that <EM>document classes</EM>.
The necessary header information, wich is depending on the
<EM>document class</EM> is also explained there.
In our case we place a <CODE>&lt;notes&gt;</CODE> tag forming a note, wich is
indicating a simple unstructured document.
</LI>
<LI>Even if optional it's a good idea to give a <EM>title</EM> to the document.
That's done with the <CODE>&lt;title&gt;</CODE> tag.
</LI>
<LI>A paragraph marked by the <CODE>&lt;p&gt;</CODE> tag, containing the word <CODE>world</CODE>
wich is <EM>inline</EM> <EM>emphasize</EM>d by the <CODE>&lt;em&gt;</CODE> tag.
</LI>
<LI>Another completely tagged paragraph, with another word <EM>inline</EM>
<EM>boldface</EM>d by the <CODE>&lt;bf&gt;</CODE> tag.
</LI>
<LI>Here we close the open <EM>document class</EM> tag.</LI>
</OL>
<P>The same example may be written a little bit shorter, by leaving out tags
which are placed automatically by the parser, and by using shortened tags:
<P>
<!--
example!startup document short
-->
<HR>
<PRE>
1: &lt;!doctype linuxdoc system>
2: &lt;notes>
3: &lt;title>A Small Linuxdoc Example
4: &lt;p>Hello &lt;em/world/.
5:
6: &lt;bf/Here/ we are.
7: &lt;/notes>
</PRE>
<HR>
<P>
<P>Now we look at the single lines again:
<OL>
<LI>The <EM>preambel</EM>.
</LI>
<LI>The document class (also unchanged).
</LI>
<LI>The <EM>title</EM>. It's not closed, because the <CODE>p</CODE> tag in the next line is
implicitely closing it.
</LI>
<LI>The paragraph is implicitly closing the <EM>title</EM>. The <EM>emphasize</EM> tag is
noted in short form. The short notation you can use only if your tagged text
doesn't contain a litteral <CODE>/</CODE>. The <EM>paragraph</EM> is not explicitly
closed in this line.
</LI>
<LI>The empty line here is the reason, why you don't need to close the previous
<EM>paragraph</EM> and don't need to open the next one.
A empty line is interpreted as a end of the current paragraph and the
start of a new one.
</LI>
<LI>Another paragraph (not opened directly), with another short <EM>inline</EM> tag.
</LI>
<LI>Closing the open <EM>document class</EM> tag, wich is implicitly also
closing the still open paragraph.</LI>
</OL>
<P>Maybe now it's a little bit more clear, who you have to work with tags.
<P>
<P>
<HR>
<A HREF="Linuxdoc-Reference-4.html">Next</A>
<A HREF="Linuxdoc-Reference-2.html">Previous</A>
<A HREF="Linuxdoc-Reference.html#toc3">Contents</A>
</BODY>
</HTML>