<!-- =====================================================================  -->
<!-- This file is an AbiWord document.                                      -->
<!-- AbiWord is a free, Open Source word processor.                         -->
<!-- You may obtain more information about AbiWord at www.abisource.com     -->
<!-- You should not edit this file by hand.                                 -->
<!-- =====================================================================  -->

<!--         Build_ID          = freebird-jeff -->
<!--         Build_Options     = JavaScript:Off Debug:On -->
<!--         Build_Target      = Linux_2.0.33_i386_DBG -->
<!--         Build_CompileTime = 20:01:27 -->
<!--         Build_CompileDate = Mar  9 1999 -->

<awml>
<section>
<p><c PROPS="font-size:18pt; font-weight:bold">It is my intention to keep this document in sync with the current state of the code.  Thus, this document does not yet describe the full feature set planned for version 1.0.  This document is current with version 0.5.0 of the code.</c></p>
<p></p>
<p><c PROPS="font-family:courier; font-size:11pt">$Id: AbiWord_DocumentFormat.abw,v 1.14 1999/03/10 06:39:05 jeff Exp $</c></p>
<p></p>
<p PROPS="text-align:center"><c PROPS="font-size:24pt; font-weight:bold">AbiWord Document Format</c></p>
<p PROPS="text-align:center"><c PROPS="font-size:10pt">Version 1.0</c></p>
<p PROPS="text-align:center"><c PROPS="font-size:11pt">Copyright (C) 1999 AbiSource, Inc., All Rights Reserved.</c></p>
<p PROPS="text-align:center"><c PROPS="font-style:italic">Jeff Hostetler</c></p>
<p PROPS="text-align:center"><c PROPS="font-family:courier">jeff@abisource.com</c></p>
<p PROPS="text-align:center">AbiSource, Inc.</p>
<p PROPS="text-align:center"><c PROPS="font-family:courier">$Date: 1999/03/10 06:39:05 $</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-weight:bold">1. Introduction</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">This document describes the AbiWord file format used to represent AbiWord native documents. This document describes file format version 1.0.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">AbiWord uses XML[1] to represent a document. This does not imply that AbiWord is an XML editor; but rather, AbiWord is a Word Processor that just happens to use XML as a convenient syntax for representing documents. AbiWord contains a very strict and unforgiving import; it requires well-formed XML in strict adherence to the AbiWord DTD[2]. Our primary goal is to support documents written by AbiWord rather than hand written XML.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">AbiWord also uses some of the syntax and conventions from CSS2[3] to represent certain concepts, such as character formatting. CSS2 was designed as a style mechanism for WWW documents and not as a style mechanism for page-oriented documents. We used CSS2 as a guideline, taking parts that were of use and inventing our own mechanism as necessary.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-weight:bold">2. Document Structure</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The AbiWord file format is an 7bit-clean ASCII XML file. Non-US-ASCII characters are represented using standard XML numeric entities (e.g., "<c PROPS="font-family:Courier New">&amp;#xff;</c><c PROPS="font-family:Times New Roman">"</c> or "<c PROPS="font-family:Courier New">&amp;#xffff;</c><c PROPS="font-family:Times New Roman">").</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman">The following illustrates the basic form of an AbiWord file:</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:12pt">	&lt;awml&gt;<br/>		&lt;section&gt;<br/>			&lt;p PROPS="text-align:center"&gt;Hello World.&lt;/p&gt;<br/>			&lt;p&gt;This is a test paragraph.&lt;/p&gt;<br/>			&lt;p&gt;This word is<br/>				&lt;c PROPS="font-weight:bold"&gt;bold&lt;/c&gt;.&lt;/p&gt;<br/>		&lt;/section&gt;<br/>		&lt;section PROPS="column-gap:0.25in; columns:2"&gt;<br/>			&lt;p&gt;This section has two columns.&lt;/p&gt;<br/>		&lt;/section&gt;<br/>		&lt;data&gt;<br/>			&lt;d name="foo"&gt;<br/>				XXXXXXXXXX...<br/>			&lt;/d&gt;<br/>		&lt;/data&gt;<br/>	&lt;/awml&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-weight:normal">2.1.  </c><c PROPS="font-family:Courier New; font-style:normal; font-weight:normal">&lt;AWML&gt;...&lt;/AWML&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-style:normal; font-weight:normal">The entire content of the document is contained within this pair of tags. Within these tags are a series of sections and an optional data block.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-style:normal; font-weight:normal">2.2.  &lt;SECTION&gt;...</c><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">&lt;/SECTION&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt; font-style:normal; font-weight:normal">These tags delimit a section. A section is a portion of a document that has some common characteristic, such as its column layout. A section does not necessarily correspond to anything in the actual content, such as a chapter.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt; font-style:normal; font-weight:normal">The following are section-level properties and may appear in the value of the PROPS attribute of the &lt;section&gt; tag:</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	columns: </c><c PROPS="font-family:Courier New; font-size:14pt; font-style:italic; font-weight:normal">integer-number-of-columns</c><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal"> ;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	column-gap: </c><c PROPS="font-family:Courier New; font-size:14pt; font-style:italic; font-weight:normal">dimensioned-distance</c><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal"> ;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	section-space-after: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	page-margin-top: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	page-margin-left: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	page-margin-right: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-style:normal; font-weight:normal">	page-margin-bottom: ...;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt; font-weight:normal">2.2.1.  &lt;P&gt;...&lt;/P&gt; </c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt; font-style:normal">These tags represent a block (or paragraph). All document text must be within a block. Blocks may not be nested (at the current time). All paragraph formatting options appear as attributes of the this tag. All document content must appear within a block.  A section must contain at least one paragraph.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The following are block-level properties and may appear in the value of the PROPS attribute:</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt">	text-align: </c><c PROPS="font-family:Courier New; font-size:14pt; font-weight:bold">left</c><c PROPS="font-family:Courier New; font-size:14pt"> | center | right | justify ;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt">	text-decoration: </c><c PROPS="font-family:Courier New; font-size:14pt; font-weight:bold">none</c><c PROPS="font-family:Courier New; font-size:14pt"> | underline line-through;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt">	line-height: </c><c PROPS="font-family:Courier New; font-size:14pt; font-style:italic">dimensioned-distance</c><c PROPS="font-family:Courier New; font-size:14pt">;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	orphans: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	widows: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	keep-together: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	keep-with-next: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	margin-top: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	margin-left: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	margin-right: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	margin-bottom: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	text-indent: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	tabstops: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	default-tab-interval: ...;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.2.2.  &lt;C&gt;...&lt;/C&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt; font-style:normal">These tags delimit an in-line span format. These tags are used to apply a span-level format change within a block. For example, making a word italic within a paragraph.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt; font-style:normal">Spans may be nested, but this should be thought of as a convenience for document translators; AbiWord will flatten these during import and will write them out flattened on export.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt; font-style:normal">A set of start and end C tags delimit a span of document text. These are only necessary to change a style from the settings inherited from the block. Text need not be enclosed in C tags.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman; font-size:14pt">The following are span-level properties and may appear in the value of the PROPS attribute:</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New; font-size:14pt">	color: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	font-family: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	font-style: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	font-variant: ...; </c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	font-weight: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	font-stretch: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	font-size: ...;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.2.3.  &lt;I/&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">This tag defines an in-line image reference.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The &lt;I&gt; tag has the following attributes:</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	dataid=</c><c PROPS="font-family:Courier New; font-style:italic">data-item-name</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The dataid is a reference to a named Data Item in the Data section of the file.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The &lt;I&gt; tag has the following properties that may appear in the value of the PROPS attribute:</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	width: ...;</c></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	height: ...;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.2.4.  &lt;BR/&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman">This tag defines a forced line-break.  This tag has no attributes or properties.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.2.5.  &lt;CBR/&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman">This tag defines a forced column-break.  This tag has no attributes or properties.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.2.6.  &lt;PBR/&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman">This tag defines a forced page-break.  This tag has no attributes or properties.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.2.7.  &lt;F/&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman">This tag defines an in-line computed field reference.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Times New Roman">TODO define the set of attributes and properties for &lt;F/&gt;.</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Nimbus Mono">2.3.  &lt;DATA&gt;...&lt;/DATA&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">These tags delimit a series of one or more data items.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">2.3.1.  &lt;D&gt;...&lt;/D&gt;</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">These tags define a Data Item -- an opaque blob of Base64-Encoded data.  Encoded content may be broken up on multiple lines as in MIME.  For images, these are Base64-encoded PNG objects.  Other types of objects may be defined in the future.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The &lt;D&gt; tag has the following attributes:</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-family:Courier New">	name=</c><c PROPS="font-family:Courier New; font-style:italic">unique-data-item-name</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The name attribute provides a target for the DATAID attribute of the &lt;I&gt; and other tags.</p>
<p PROPS="text-align:left"> </p>
<p PROPS="text-align:left"><c PROPS="font-weight:bold">3.  Example Document</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">The source for this document can be used as an example to study from. Additionally, the source tree contains numerous simple example documents (in <c PROPS="font-family:courier">abi/docs</c><c PROPS="font-family:times"> and </c><c PROPS="font-family:courier">abi/src/wp/samples</c>). The XML source for these documents can be viewed with any text editor.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-weight:bold">4.  References</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">[1] XML</p>
<p PROPS="text-align:left">[2] AbiWord DTD</p>
<p PROPS="text-align:left">[3] CSS2</p>
<p PROPS="text-align:left">[4] The AbiWord source. (See <c PROPS="font-family:courier; font-weight:normal">http://www.abisource.com/lxr/</c> for a fully cross-referenced view of the AbiWord source code.)</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left"><c PROPS="font-weight:bold">5.  TODO</c></p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">[]	Discuss white-space handling within content and around tags.</p>
<p PROPS="text-align:left"></p>
<p PROPS="text-align:left">[]	Discuss mapping of CR, LF, VT, HT, FF into various tags and vice versa.</p>
<p PROPS="text-align:left"></p>
</section>
</awml>
