~ubuntu-branches/ubuntu/saucy/muse-el/saucy

« back to all changes in this revision

Viewing changes to examples/QuickStart.muse

  • Committer: Bazaar Package Importer
  • Author(s): Michael W. Olson (GNU address)
  • Date: 2006-01-12 22:22:01 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060112222201-t3meg2ziyaafhubk
Tags: 3.02.6-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#author John Wiegley
 
2
#title The Emacs Muse
 
3
 
 
4
Emacs Muse is an authoring and publishing environment for Emacs.  It
 
5
simplifies the process of writings documents and publishing them to
 
6
various output formats.
 
7
 
 
8
Muse consists of two main parts: an enhanced text-mode for authoring
 
9
documents and navigating within Muse projects, and a set of publishing
 
10
styles for generating different kinds of output.
 
11
 
 
12
* About this document
 
13
 
 
14
This document provides an example of Muse markup and also functions as
 
15
a quickstart for Muse.
 
16
 
 
17
To see what it looks like when published, type =make examples=.  You
 
18
will then get an Info document, an HTML document, and a PDF document
 
19
(provided you have an implementation of LaTeX installed with the
 
20
necessary fonts).
 
21
 
 
22
<contents>
 
23
 
 
24
* Getting Started
 
25
 
 
26
To use Muse, add the directory containing its files to your
 
27
=load-path= variable, in your =.emacs= file.  Then, load in the
 
28
authoring mode, and the styles you wish to publish to.  For example:
 
29
 
 
30
<example>
 
31
(add-to-list 'load-path "<path to Muse>")
 
32
 
 
33
(require 'muse-mode)     ; load authoring mode
 
34
 
 
35
(require 'muse-html)     ; load publishing styles I use
 
36
(require 'muse-latex)
 
37
(require 'muse-texinfo)
 
38
(require 'muse-docbook)
 
39
</example>
 
40
 
 
41
Once loaded, the command =M-x muse-publish-this-file= will publish an
 
42
input document to any available style.  If you enable =muse-mode=
 
43
within a buffer, by typing =M-x muse-mode=, this command will be bound
 
44
to =C-c C-t=.
 
45
 
 
46
* Creating a Muse project
 
47
 
 
48
Often you will want to publish all the files within a directory to a
 
49
particular set of output styles automatically.  To support, Muse
 
50
allows for the creations of "projects".  Here is a sample project, to
 
51
be defined in your =.emacs= file:
 
52
 
 
53
<example>
 
54
(require 'muse-project)
 
55
 
 
56
(setq muse-project-alist
 
57
      '(("website"                      ; my various writings
 
58
         ("~/Pages" :default "index")
 
59
         (:base "html" :path "~/public_html")
 
60
         (:base "pdf" :path "~/public_html/pdf"))))
 
61
</example>
 
62
 
 
63
The above defines a project named "website", whose files are located
 
64
in the directory =~/Pages=.  The default page to visit is =index=.
 
65
When this project is published, each page will be output as HTML to
 
66
the directory =~/public_html=, and as PDF to the directory
 
67
=~/public_html/pdf=.  Within any project page, you may create a link
 
68
to other pages using the syntax =[[pagename]]=.
 
69
 
 
70
* Markup rules
 
71
 
 
72
A Muse document uses special, contextual markup rules to determine how
 
73
to format the output result.  For example, if a paragraph is indented,
 
74
Muse assumes it should be quoted.
 
75
 
 
76
There are not too many markup rules, and all of them strive to be as
 
77
simple as possible so that you can focus on document creation, rather
 
78
than formatting.
 
79
 
 
80
** Paragraphs
 
81
 
 
82
Separate paragraphs in Muse must be separate by a blank line.
 
83
 
 
84
For example, the input text used for this section is:
 
85
 
 
86
<example>
 
87
Separate paragraphs in Muse must be separate by a blank line.
 
88
 
 
89
For example, the input text used for this section is:
 
90
</example>
 
91
 
 
92
** Centered paragraphs and quotations
 
93
 
 
94
A line that begins with six or more columns of whitespace (either tabs
 
95
or spaces) indicates a centered paragraph.
 
96
 
 
97
<comment>
 
98
                           This is centered
 
99
</comment>
 
100
 
 
101
  But if a line begins with whitespace, though less than six columns,
 
102
  it indicates a quoted paragraph.
 
103
 
 
104
** Headings
 
105
 
 
106
A heading becomes a chapter or section in printed output -- depending
 
107
on the style.  To indicate a heading, start a new paragraph with one
 
108
to three asterices, followed by a space and the heading title.  Then
 
109
begin another paragraph to enter the text for that section.
 
110
 
 
111
<example>
 
112
* First level
 
113
 
 
114
** Second level
 
115
 
 
116
*** Third level
 
117
</example>
 
118
 
 
119
** Horizontal rules
 
120
 
 
121
Four or more dashes indicate a horizontal rule.  Be sure to put blank
 
122
lines around it, or it will be considered part of the proceeding or
 
123
following paragraph!
 
124
 
 
125
----
 
126
 
 
127
The separator above was produced by typing:
 
128
 
 
129
<example>
 
130
----
 
131
</example>
 
132
 
 
133
** Emphasizing text
 
134
 
 
135
To emphasize text, surround it with certain specially recognized
 
136
characters:
 
137
 
 
138
<example>
 
139
*emphasis*
 
140
**strong emphasis**
 
141
***very strong emphasis***
 
142
_underlined_
 
143
=verbatim and monospace=
 
144
</example>
 
145
 
 
146
The above list renders as:
 
147
 
 
148
<verse>
 
149
*emphasis*
 
150
**strong emphasis**
 
151
***very strong emphasis***
 
152
_underlined_
 
153
=verbatim and monospace=
 
154
</verse>
 
155
 
 
156
** Adding footnotes
 
157
 
 
158
A footnote reference is simply a number in square
 
159
brackets<verbatim>[1]</verbatim>.[1] To define the footnote, place
 
160
this definition at the bottom of your file.  =footnote-mode= can be
 
161
used to greatly facilitate the creation of these kinds of footnotes.
 
162
 
 
163
<example>
 
164
 Footnotes:
 
165
 [1]  Footnotes are defined by the same number in brackets
 
166
      occurring at the beginning of a line.  Use footnote-mode's
 
167
      C-c ! a command, to very easily insert footnotes while
 
168
      typing.  Use C-x C-x to return to the point of insertion.
 
169
</example>
 
170
 
 
171
** Verse
 
172
 
 
173
Poetry requires that whitespace be preserved, but without resorting to
 
174
monospace.  To indicate this, use the following markup, reminiscent of
 
175
e-mail quotations:
 
176
 
 
177
<example>
 
178
> A line of Emacs verse;
 
179
>   forgive its being so terse.
 
180
</example>
 
181
 
 
182
The above is rendered as:
 
183
 
 
184
> A line of Emacs verse;
 
185
>   forgive its being so terse.
 
186
 
 
187
You can also use the =<literal><verse></literal>= tag, if you prefer:
 
188
 
 
189
<example>
 
190
<verse>
 
191
A line of Emacs verse;
 
192
  forgive its being so terse.
 
193
</verse>
 
194
</example>
 
195
 
 
196
** Literal paragraphs
 
197
 
 
198
The =<literal><example></literal>= tag is used for examples, where
 
199
whitespace should be preserved, the text rendered in monospace, and
 
200
any characters special to the output style escaped.
 
201
 
 
202
There is also the =<literal><literal></literal>= tag, which causes a
 
203
marked block to be entirely left alone.  This can be used for
 
204
inserting a hand-coded HTML blocks into HTML output, for example.
 
205
 
 
206
** Lists
 
207
 
 
208
Lists are given using special characters at the beginning of a line.
 
209
Whitespace must occur before bullets or numbered items, to distinguish
 
210
from the possibility of those characters occurring in a real sentence.
 
211
 
 
212
The supported kinds of lists are:
 
213
 
 
214
<example>
 
215
  - bullet item one
 
216
  - bullet item two
 
217
 
 
218
  1. Enumerated item one
 
219
  2. Enumerated item two
 
220
 
 
221
Term1 :: A definition one
 
222
 
 
223
Term2 :: A definition two
 
224
</example>
 
225
 
 
226
These are rendered as a bullet list:
 
227
 
 
228
  - bullet item one
 
229
  - bullet item two
 
230
 
 
231
An enumerated list:
 
232
 
 
233
  1. Enum item one
 
234
  2. Enum item two
 
235
 
 
236
And a definition list:
 
237
 
 
238
Term1 ::
 
239
  This is a first definition
 
240
  And it has two lines;
 
241
  no, make that three.
 
242
 
 
243
Term2 ::
 
244
  This is a second definition
 
245
 
 
246
** Tables
 
247
 
 
248
Only very simple tables are supported.  The syntax is:
 
249
 
 
250
<example>
 
251
  Double bars  || Separate header fields
 
252
 
 
253
  Single bars   | Separate body fields
 
254
  Here are more | body fields
 
255
 
 
256
  Triple bars ||| Separate footer fields
 
257
</example>
 
258
 
 
259
The above is rendered as:
 
260
 
 
261
Double bars  || Separate header fields
 
262
 
 
263
Single bars   | Separate body fields
 
264
Here are more | body fields
 
265
 
 
266
Triple bars ||| Separate footer fields
 
267
 
 
268
<comment>
 
269
Double bars  || Separate header fields
 
270
 
 
271
Single bars   | Separate body fields
 
272
Here are more | body fields
 
273
 
 
274
Triple bars ||| Separate footer fields
 
275
</comment>
 
276
 
 
277
** Anchors and tagged links
 
278
 
 
279
#example If you begin a line with "#anchor" -- where "anchor" can be
 
280
any word that doesn't contain whitespace -- it defines an anchor at
 
281
that point into the document.  This point can be referenced using
 
282
"page#anchor" as the target in a Muse link (see below).
 
283
 
 
284
Click [[#example][here]] to go back to the previous paragraph.
 
285
 
 
286
** URLs and E-mail addresses
 
287
 
 
288
A URL or e-mail address encountered in the input text is published as
 
289
a hyperlink if the output style supports it.  If it is an image URL,
 
290
it will be inlined if possible.  For example, the latest Muse source
 
291
can be downloaded at
 
292
http://www.newartisans.com/johnw/Emacs/muse.tar.gz and mail may be
 
293
sent to johnw@gnu.org
 
294
 
 
295
** Links
 
296
 
 
297
A hyperlink can reference a URL, or another page within a Muse
 
298
project.  In addition, descriptive text can be specified, which should
 
299
be displayed rather than the link text in output styles that supports
 
300
link descriptions.  The syntax is:
 
301
 
 
302
<example>
 
303
[[link target][link description]]
 
304
[[link target without description]]
 
305
</example>
 
306
 
 
307
Thus, Muse can be downloaded [[http://download.gna.org/muse-el/][here]], or at
 
308
[[http://download.gna.org/muse-el/]].
 
309
 
 
310
** Embedded lisp
 
311
 
 
312
Arbitrary kinds of markup can be achieved using the
 
313
=<literal><lisp></literal>= tag, which is the only Muse tag supported
 
314
in a style's header and footer text.  With the
 
315
=<literal><lisp></literal>= tag, you may generated whatever output
 
316
text you wish.  The inserted output will get marked up, if the
 
317
=<literal><lisp></literal>= tag appears within the main text of the
 
318
document.
 
319
 
 
320
<example>
 
321
<lisp>(concat "This form gets " "inserted")</lisp>
 
322
</example>
 
323
 
 
324
The above renders as: <lisp>(concat "This form gets " "inserted")</lisp>.
 
325
 
 
326
* Publishing styles
 
327
 
 
328
One of the principle features of Muse is the ability to publish a
 
329
simple input text to a variety of different output styles.  Muse also
 
330
makes it easy to create new styles, or derive from an existing style.
 
331
 
 
332
** Deriving from an existing style
 
333
 
 
334
To create a new style from an existing one, use =muse-derive-style=:
 
335
 
 
336
<example>
 
337
(muse-derive-style DERIVED-NAME BASE-NAME STYLE-PARAMETERS)
 
338
</example>
 
339
 
 
340
The derived name is a string defining the new style, such as
 
341
"my-html".  The base name must identify an existing style, such as
 
342
"html" -- if you have loaded =muse-html=.  The style parameters are
 
343
the same as those used to create a style, except that they override
 
344
whatever definitions exist in the base style.  However, some
 
345
definitions only partially override.  Those which support partial
 
346
overriding are:
 
347
 
 
348
 - =:functions= -- If a markup function is not found in the derived
 
349
   style's function list, the base style's function list will be
 
350
   queried.
 
351
 
 
352
 - =:strings=
 
353
 
 
354
 - =:before=
 
355
 
 
356
 - =:before-end=
 
357
 
 
358
 - =:after=
 
359
 
 
360
** Overriding an existing style
 
361
 
 
362
Write me.
 
363
 
 
364
** Creating a new style
 
365
 
 
366
Write me.
 
367
 
 
368
Footnotes:
 
369
[1]  This is a footnote.