8.3. Writing HTML


Without doubt, the most commonly used markup language today is hypertext markup language (HTML), used for creating web pages. HTML consists of text with tags that define characteristics about the text. HTML is not hard to write, and you could use Emacs or any other editor to write the tags and the text. An HTML tag generally looks like this:

<tagname>text being tagged</tagname>

For your convenience, several modes are available for writing HTML in Emacs, including HTML mode, HTML helper mode, html menus, and a variety of SGML[1] tools including sgml mode and psgml mode. Of these tools, we've chosen to describe HTML mode, a variant of sgml mode, which is included in GNU Emacs, and HTML helper mode, which is a popular add-on. If you are writing XHTML, a stricter version of HTML that can be validated, you should consider XHTML mode, described briefly in this section, or psgml mode, covered later in the XML section of this chapter.

[1] SGML stands for standardized general markup language. Both XML and HTML are descendants of SGML.

Serious web developers may want to investigate some of the cutting edge development going on to make Emacs even more powerful. Check out HTMLModeDeluxe (http://www.emacswiki.org/cgi-bin/wiki/HtmlModeDeluxe) and the Emacs WebDev Environment by Darren Brierton (http://www.dzr-web.com/people/darren/projects/emacs-webdev). Both of these tools support mmm mode (where mmm stands for "multiple major modes"). Using this feature, the cursor changes major mode depending on the section of the page you are editing. When you edit a script, the mode changes automatically to support that type of authoring. Both are excellent tools for building complex web pages.

In the following sections, we are not going to teach you to write HTML. (For more information on writing HTML, see HTML and XHTML: The Definitive Guide by Chuck Musciano and Bill Kennedy, O'Reilly) Rather, we're going to teach you the rudiments of using HTML mode and HTML helper mode to help you create HTML documents.

8.3.1 Using HTML Mode

To start HTML mode, type M-x html-mode (or simply open an HTML file). Most authors use a standard template when they write HTML. You may already have one. If you don't, HTML mode is happy to supply one for you. Simply start by typing C-c C-t (for sgml-tag) or by selecting Insert Tag from the SGML menu. If you enter the <html> tag that signifies the start of an HTML document, Emacs inserts a basic template in your buffer.

Type: C-c C-t html Enter

Emacs prompts for a title.


Type: A Tale of Two Cities Enter

Emacs inserts an HTML template.


Note that Emacs automatically creates a first-level header that is equal to the title you entered. It also inserts a hyperlink so that readers can email you. Depending on your spam tolerance, you may want to delete that line. Also, Emacs is just guessing at your name and email address. You can set these explicitly by adding two lines to your .emacs file. Change Mr. Dickens' information to settings appropriate for you.

(setq user-mail-address "cdickens@great-beyond.com") (setq user-full-name "Charles Dickens")

You could approach HTML mode in a couple of ways. You could learn the key bindings for various tags, or you could simply use the sgml-tag command for everything. It depends how many bindings you want to learn. A mixed approach may be best, where you learn keystrokes for the most common tags and use sgml-tag for less common tags.

Key bindings are intuitive in HTML mode. Like most specialized editing modes, many functions are bound to C-c C-something. We've seen C-c C-t to insert a tag. You won't be too surprised to find that to move forward to the next tag you type C-c C-f and to move back to the previous tag you type C-c C-b. To insert an <href> tag, type C-c C-h. You see what we mean.

HTML mode is designed for writing HTML, not XHTML. XHTML is stricter, requiring all tags to have a closing tag. The common <p> tag is a salient example. HTML authors would never use the closing tag </p> that XHTML requires. HTML mode inserts a lone <p> tag even when given a command, such as sgml-tag, that normally inserts a tag pair. If you want to write XHTML, use XHTML mode instead. Emacs starts this mode itself if your file contains a reference to an XHTML document type definition. Other than completion of tags, XHTML mode is very similar to HTML mode described here.[2]

[2] At this writing, there is no way to enter XHTML mode explicitly. If your file looks like an XHTML file, Emacs puts you in that mode automatically.

Being able to hide the tags is a helpful feature. To hide HTML tags, type C-c Tab; use the same command to display the tags again. Let's say that we've inserted some of our dickens file into the dickens.html file we were just working with.

Initial state:

dickens.html with tags showing.


Type: C-c Tab

Emacs hides the tags.


You can keep typing text, concentrating on what you're writing rather than being distracted by the markup. Emacs protects you from deleting tags when you're writing by making hidden text read-only. If you move the cursor onto a hidden tag, Emacs displays it in the minibuffer.

Of course, the whole purpose of writing HTML is to display it in a web browser. Typing C-c C-v (for browse-url-of-buffer) opens the default web browser to view the web page you're writing.

If you'd like to look at the file in a web browser each time you save, you can turn on a function called html-autoview-mode, invoked by pressing C-c C-s. When you save the file, Emacs automatically opens it in the default browser.

8.3.1.1 Character encoding in HTML mode

What if you want to include special characters or characters from other character sets in your web page? The short answer is that you can enter a character's encoding explicitly. For example, to enter a capital U with an umlaut, you can type &#220;. Many characters can also be represented as named entities, which are certainly easier to remember than numbers. For example, the named entity for a capital U with an umlaut is &Uuml;.

But HTML mode does provide more support than this. We'll take the simplest case first. Let's say you can create a character with your keyboard; for a common case, take the ampersand, a character that must be encoded since it has a special meaning in HTML. Type C-c C-n & Enter. Emacs inserts the entity for an ampersand, &amp;. You can insert entities for a wide variety of keyboard characters this way.

But let's say that you are inserting characters that are not on your keyboard. For example, perhaps you are in the U.S. writing up a list of contributors from Europe and many of their names have accent marks. The ISO Latin-1 character set will handle this.

If you have a keyboard that already emits Latin-1 characters and Latin-1 is your default coding system for keyboard input, inserting such characters is relatively straightforward. Simply press C-c 8 to turn on a minor mode called SGML name entity mode. Emacs says sgml name entity mode is now on.[3] C-c 8 toggles this state. Type Latin-1 characters as you normally would and Emacs inserts the named entities associated with those characters.

[3] Pay no attention to the fact that this is called SGML versus HTML name entity mode. Since HTML mode is derived from SGML mode, many commands that work with HTML have sgml in their names. Also, note that the command is called sgml-name-8bit-mode, a clear discrepancy with the minibuffer message.

For those of us with other keyboard encodings, however, there's a bit more to do. To get bindings to insert entities into your HTML file, we discuss two options. The first is ISO accents mode. This mode provides support, as the name implies, for accented text. Whether you're typing umlauts, cedillas, circumflexes, acute, or grave marks, ISO accents mode is up to the task. The other option is to use the C-x 8 prefix to insert a wide range of entities, including currency signs, mathematical symbols, and copyright signs (as well as all the accented characters ISO accents mode supports).

8.3.1.1.1 Using ISO accents mode

To use ISO accents mode to insert entities in your file, type C-c 8 to turn on SGML name entity mode, then M-x iso-accents-mode Enter to turn on that mode. In ISO accents mode, certain characters (including /, ~, ', ", `, and ^) are interpreted as prefixes to create accented characters. SGML name entity mode captures these keystrokes and automatically inserts the appropriate HTML entity. For example, typing 'a produces the HTML entity for á, &aacute;. For specific key bindings, see Table 8-2.

8.3.1.1.2 Using the C-x 8 prefix

You can also insert a wide range of entities using C-x 8 after you do some setup.[4] First enter SGML name entity mode by typing C-c 8. Next specify Latin-1 as your character set by typing C-x Enter k latin-1 Enter. You can then enter a large number of entities by typing commands prefixed with C-x 8. For example, to insert the entity for a yen symbol, type C-x 8 Y. Watch the minibuffer. The literal character will appear in the minibuffer as the entity is inserted. Both ISO accents mode and the C-x 8 prefixes allow you to type a single undo command (C-_) to translate the entity back into the literal character.

[4] For some reason, perhaps the way SGML name entity mode is programmed, you can insert these entities only using key bindings. The mode fails to trap the equivalent commands and translate them into entities. For this reason, we focus on key bindings.

Table 8-2 provides a list of accented characters and the bindings that help insert them. Table 8-3 lists other named entities including punctuation marks and symbols.

Table 8-2. Bindings for inserting entities for accented characters[5]

C-x 8 prefix

keystrokes

ISO accents mode shortcut

Character entity

Character displayed in browser

C-x 8 "

"

&acute;

´

C-x 8 ' a

' a

&aacute;

á

C-x 8 'A

'A

&Aacute;

Á

C-x 8 ' e

' e

&eacute;

é

C-x 8 ' E

' E

&Eacute;

É

C-x 8 ' i

' i

&iacute;

í

C-x 8 ' I

' I

&Iacute;

Í

C-x 8 ' o

' o

&oacute;

ó

C-x 8 ' O

' O

&Oacute;

Ó

C-x 8 ' u

' u

&uacute;

ú

C-x 8 ' U

' U

&Uacute;

Ú

C-x 8 ' y

' y

&yacute;

C-x 8 ' Y

' Y

&Yacute;

C-x 8 ` a

` a

&agrave;

à

C-x 8 ` A

` A

&Agrave;

À

C-x 8 ` e

` e

&egrave;

è

C-x 8 ` E

` E

&Egrave;

È

C-x 8 ` i

` i

&igrave;

ì

C-x 8 ` I

` I

&Igrave;

Ì

C-x 8 ` o

` o

&ograve;

ò

C-x 8 ` O

` O

&Ograve;

Ò

C-x 8 ` u

` u

&ugrave;

ù

C-x 8 ` U

` U

&Ugrave;

C-x 8 ^ a

^ a

&acirc;

â

C-x 8 ^ A

^ A

&Acirc;

Â

C-x 8 ^ e

^ e

&ecirc;

ê

C-x 8 ^ E

^ E

&Ecirc;

Ê

C-x 8 ^ i

^ i

&icirc;

î

C-x 8 ^ I

^ I

&Icirc;

Î

C-x 8 ^ o

^ o

&ocirc;

ô

C-x 8 ^ O

^ O

&Ocirc;

Ô

C-x 8 ^ u

^ u

&ucirc;

û

C-x 8 ^ U

^ U

&Ucirc;

Û

C-x 8 " "

""

&uml;

¨

C-x 8 " a

" a

&auml;

ä

C-x 8 " A

" A

&Auml;

Ä

C-x 8 " e

" e

&euml;

ë

C-x 8 " E

" E

&Euml;

Ë

C-x 8 " i

" i

&iuml;

ï

C-x 8 " I

" I

&Iuml;

Ï

C-x 8 " o

" o

&ouml;

ö

C-x 8 " O

" O

&Ouml;

Ö

C-x 8 " u

" u

&uuml;

ü

C-x 8 " U

" U

&Uuml;

Ü

C-x 8 " s

" s

&szlig;

ß

C-x 8 " y

" y

&yuml;

ÿ

C-x 8 " Y

" Y

&Yuml;

C-x 8 ~ ~

 
&not;

¬

C-x 8 ~ a

~ a

&atilde;

ã

C-x 8 ~ A

~ A

&Atilde;

Ã

C-x 8 ~ d

~ d

&eth;

C-x 8 ~ D

~ D

&ETH;

C-x 8 ~ n

~ n

&ntilde;

ñ

C-x 8 ~ N

~ N

&Ntilde;

Ñ

C-x 8 ~ o

~ o

&otilde;

õ

C-x 8 ~ O

~ O

&Otilde;

Õ

C-x 8 ~ t

~ t

&thorn;

C-x 8 ~ T

~ T

&THORN;

C-x 8 / /

 
&divide;

÷

C-x 8 o

/ /

&ring;

°

C-x 8 / a

/ a

&aring;

å

C-x 8 / A

/ A

&Aring;

Å

C-x 8 / e

/ e

&aelig;

æ

C-x 8 / E

/ E

&AElig;

Æ

C-x 8 / o

/ o

&oslash;

ø

C-x 8 / O

/ O

&Oslash;

Ø

C-x 8 , ,

~~

&cedil;

¸

C-x 8 , c

~c

&ccedil;

ç

C-x 8 , C

~C

&Ccedil;

Ç


[5] For instructions on making these bindings work properly, read this section carefully.

Table 8-3. Bindings for inserting entities for punctuation and symbols

C-x 8 prefix keystrokes

Character entity

Character displayed in browser

C-x 8 1 / 2

&frac12;

1/2

C-x 8 1 / 4

&frac14;

1/4

C-x 8 3 / 4

&frac34;

3/4

C-x 8 SPC

&nbsp;

nonbreaking space

C-x 8 !

&iexcl;

¡

C-x 8 $

&curren;

¤

C-x 8 +

&plusmn;

±

C-x 8 -

&shy;

soft hyphen

C-x 8 .

&middot;

·

C-x 8 <

&laquo;

«

C-x 8 =

&macr;

¯

C-x 8 >

&raquo;

»

C-x 8 ?

&iquest;

¿

C-x 8 |

&brvbar;

|

C-x 8 c

&cent;

¢

C-x 8 C

&copy;

©

C-x 8 L

&pound;

£

C-x 8 P

&para;

C-x 8 R

&reg;

®

C-x 8 S

&sect;

§

C-x 8 u

&micro;

µ

C-x 8 x

&#215;

x

C-x 8 Y

&yen;

¥

C-x 8 ^ 1

&sup1;

1

C-x 8 ^ 2

&sup2;

2

C-x 8 ^ 3

&sup3;

3

C-x 8 _ a

&ordf;

a

C-x 8 _ o

&ordm;

o


Table 8-4 lists HTML mode commands.

Table 8-4. HTML mode commands

Keystrokes

Command name

Action

(none)

html-mode

Enter HTML mode.

C-c C-tSGML

sgml-tag

Inserts a tag, prompting for attributes. If you enter html as the tag name, inserts a template html file.

C-c TabSGML

sgml-tags-invisible

Hides or shows the tags in the file.

C-c C-vSGML

browse-url-of-buffer

Display buffer in default browser.

C-c C-s

html-autoview- mode

If this mode is on (this command toggles it), display file in browser each time it is saved in Emacs.

C-c 8

sgml-name-8bit-mode

If turned on, certain keystrokes for inserting Latin-1 characters are captured and replaced with the appropriate entities. See "Character encoding in HTML mode" for details.

C-c C-fSGML

sgml-skip-tag-forward

Move forward to the next tag of the same level.

C-c C-bSGML

sgml-skip-tag-backward

Move backward to previous tag of the same level.

C-c Del or C-c C-dSGML

sgml-delete-tag

With cursor on or before a tag, deletes tag or tag pair.

C-c 1

html-headline-1

Insert an <h1>.

C-c 2

html-headline-2

Insert an <h2>.

C-c 3

html-headline-3

Insert an <h3>.

C-c 4

html-headline-4

Insert an <h4>.

C-c 5

html-headline-5

Insert an <h5>.

C-c 6

html-headline-6

Insert an <h6> (useful for footnote text) .

C-c Enter

html-paragraph

Insert <p> tag.

C-c C-c hHTML

html-href-anchor

Insert a hyperlink.

C-c C-c nHTML

html-name-anchor

Insert an anchor so that a link can be created to the anchored part of the page.

C-c C-c u HTML

html-unordered-list

Create a bulleted list.

C-c C-c o HTML

html-ordered-list

Create a numbered list.

C-c C-c lHTML

html-list-item

Add an item to a list.

C-c C-c iHTML

html-image

Insert <img src="/books/2/27/1/html/2/"> and position cursor for you to enter filename of image.

C-c C-jHTML

html-line

Insert a line break (<br>).

C-c C-c - HTML

html-horizontal-rule

Insert a horizontal rule (<hr>).

C-c C-c r

html-radio-buttons

Insert a group of radio buttons. Emacs prompts for a name for the group, then repeatedly for value, whether it should be checked, and associated text. Press C-g to complete the group.

C-c C-c c HTML

html-checkboxes

Insert a group of checkboxes. Emacs prompts for a name for the group, then repeatedly for value, whether it should be checked, and associated text. Press C-g to complete the group.

C-c ?SGML

sgml-tag-help

Provide brief verbal description of tag at cursor position.


8.3.2 Using HTML Helper Mode

HTML helper mode, written by Nelson Minar and now maintained by Gian Uberto Lauri, offers great flexibility in writing HTML. You can enable various hand-holding features depending on your level of expertise and preferences.

Why would you choose HTML helper mode over Emacs's own HTML mode? Although HTML mode makes it easy to write basic HTML, it provides little support for programmatic, interactive web pages. HTML helper mode supports ASP, JSP (and JDE, the Java Development Environment, discussed in Chapter 9), and PHP, to name a few more advanced features. If you're writing HTML in Emacs, you're likely to be a developer of such pages rather than a more text-oriented author. For this reason, HTML helper mode continues to be popular among Emacs users.

Html helper mode is not part of Emacs by default. You can download it from its homepage at http://www.nongnu.org/baol-hth. Download the file into a directory such as ~/elisp, move to that directory, and then type:

% tar xvzf html-helper-mode.tar.gz

The system unpacks the tar file for you. (Of course, if you are installing on Windows, you can simply use WinZip to decompress and unpack the file.) The tar file contains several components, including:

  • html-helper-mode.el the Lisp file for HTML helper mode

  • hhm-changelog changes that have been made

  • hhm-config.el a Lisp file that allows Emacs customization to work[6]

    [6] The version we downloaded in August 2004 marked this file as alpha code, so don't be surprised if you find bugs. Visit the file to see if its status has changed.

8.3.2.1 Starting HTML helper mode

Before you can start HTML helper mode, you have to load it into Emacs. (For a complete discussion of this topic, see "Building Your Own Lisp Library" in Chapter 11; we describe it briefly here.) Begin by typing M-x load-file Enter. Emacs asks which file to load and you enter ~/elisp/html-helper-mode.el and press Enter, adjusting the path to reflect the location where you installed html-helper-mode.el. You enter the mode by typing M-x html-helper-mode Enter. HTML helper appears on the mode line.

Making HTML helper mode part of your startup is easier. Put the following lines in your .emacs file:

(setq load-path (cons "~/elisp " load-path)) (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)

In the first line, insert the complete path for the directory in which html-helper-mode.el is located in quotation marks, replacing ~/elisp to the correct value for your system. The second line tells Emacs to load HTML helper mode automatically when you start Emacs.

If you want to use HTML helper mode for editing HTML files by default, add this line to .emacs as well:

 (setq auto-mode-alist (cons '("\\.html?$" . html-helper-mode)  auto-mode-alist))

If you edit other types of files with HTML helper mode, you may want to add lines to include all the types of files you edit. Adding more lines is the easiest way. For example, to make HTML helper mode the default for PHP files, add this line to .emacs:

 (setq auto-mode-alist (cons '("\\.php$" . html-helper-mode)  auto-mode-alist))

8.3.2.2 A brief tour of HTML helper mode

The main reason people like HTML helper mode is that it provides easy menu access to a wide variety of options. Realizing that having a crowded menu with many submenus could overwhelm new users, the authors created an option called Turn on Novice Menu. Selecting this option from the HTML menu provides a barebones menu, as shown in Figure 8-1. Novice HTML writers can use these options to create a basic HTML document without worrying about what forms, JSPs, PHP, and the like mean.

Figure 8-1. HTML helper mode's Novice menu (Mac OS X)


Selecting Turn on Expert Menu from the HTML menu returns the larger menu with its numerous submenus, as shown in Figure 8-2.

Figure 8-2. HTML helper mode's Expert menu (Mac OS X)


8.3.2.3 Inserting an HTML template

HTML helper mode inserts a template for you every time you create a new HTML file.

Type: C-x C-f new.html

HTML helper mode inserts a template with all the basic elements needed for a valid HTML document (Windows).


The template contains all the basic HTML elements. The entire document is surrounded by <html></html> tags. Then the head and the body are separated. Following an <hr> tag that tells the browser to insert a horizontal line, called a horizontal rule, the <address> tag leaves a place for the author to put in his or her email address. In these days of spam, it's unlikely you'll want to do that. (You can leave the <address> tag blank or delete it.)

If you do want to include an email address, enter a line like this in your .emacs file (substituting your own email address, of course):

 (setq html-helper-address-string    "<a href=\"mailto:cdickens@great-beyond.com "\>Charles Dickens</a>")

Type: C-x C-f newfile.html

Emacs inserts the HTML template, including the address.


Normally you begin filling out the template by entering title and a level-one header (these are often the same). You can then begin writing paragraphs of text. Before you start typing, press M-Enter. Emacs inserts <p></p> and positions the cursor between them. You can see from the ending paragraph tag that HTML helper mode is working toward XHTML compliance.

Type: M-Enter

Emacs positions the cursor between <p> and </p> so you can start insert text.


8.3.2.4 Putting tags around a region

When editing HTML files, you often spend a lot of time marking up existing text. If you preface any of the tag commands with C-u, Emacs inserts the tags around a region rather than putting them at the cursor position.[7] To demonstrate, we'll start a new HTML file and insert text from our dickens file.

[7] For this to work, you must invoke the command through the keyboard, either using its key binding or its command name. Using a menu option doesn't work.

Type: C-x C-f ataleoftwocities.html

Emacs inserts the HTML template.


Move the cursor past the <h1> pair and type C-x C-i dickens.

Emacs inserts the dickens text file, to which we can add HTML tags.


If you were really doing this properly, you'd type something like "A Tale of Two Cities, Chapter 1 as the title and the first-level header. But for now, you just want to see how to mark up a region of existing text. Begin by marking the Dickens paragraph as a region and type C-u M-Enter.

Type: M-h C-u M-Enter.

Emacs inserts opening and closing paragraph tags.


8.3.2.5 Using completion

HTML helper mode supports completion. You type the beginning of a tag and press M-Tab (for tempo-complete-tag).[8] If there's more than one possibility, a window of possible completions appears. Let's say you are working on a bulleted list.

[8] If M-Tab is trapped by the operating system to switch between applications (it is on Red Hat Linux), type Esc Tab instead.

Type: <olM-Tab

Emacs inserts the tags to begin and end the list and the tag for one list item.


Note, however, that completion is sometimes case-sensitive. For example, typing <s M-Tab shows the following completions:

<select                                        <span class= <span style =                                        <strike> <strong>                                        <samp>

Notice that the <script> tag is missing. But if you try typing <S M-Tab, the script tag and its attributes are inserted, as in:

<SCRIPT TYPE="text/javascript"> </SCRIPT>

The distinction between upper- and lowercase shows that HTML helper mode is moving toward XHTML compliance, but hasn't quite arrived. XHTML requires that all tags be lowercase. On the positive side, note that the attribute is in quotation marks, another XHTML requirement.

8.3.2.6 Turning on prompting

Some HTML tags require you to input certain attributes. For example, when you enter a hyperlink, you have to specify the URL of the link and the text that the user will select. If you type C-c C-a l (the lowercase letter "L") to enter a link, HTML helper mode inserts:

<a href=""></a>

with the cursor on the second quotation mark so you can type in the URL. HTML helper mode offers additional help if you turn on prompting. Add this line to your .emacs file:

(setq tempo-interactive t)

Note that HTML helper mode prompts only for required attributes; if you want to input optional attributes, you have to add them by hand.

Whether you consider prompting useful or intrusive is a matter of personal taste. If you are a beginning HTML author, prompting may help you remember to enter all the necessary information for each tag. If you find you don't like it, simply delete the line you added to the .emacs file.

8.3.2.7 Character encoding in HTML helper mode

HTML helper mode supports entry of only the most common character entities. However, it does make it easy to insert these entities. Simply type C-c before the character in question. For example, type C-c < to enter the escape code for a less-than sign (&lt;).

Character entities are also available by selecting HTML Insert Character Entities.

Table 8-5 lists bindings for inserting character entities in HTML helper mode.

Table 8-5. Inserting character entities in HTML helper mode

Keystrokes

Command name

Character entity

Character rendered on web page

C-c >

tempo-template-html-greater-than

&gt;

>

C-c <

tempo-template-html-less-than

&lt;

<

C-c &

tempo-template-html-ampersand

&amp;

&

C-c u

tempo-template-html-u`-(&&ugrave;)

&ugrave;

ù

C-c i

tempo-template-html-i`-(&&igrave;)

&igrave;

ì

C-c o

tempo-template-html-o`-(&&ograve;)

&ograve;

ò

C-c E

tempo-template-html-e'-(&&eacute;)

&eacute;

é

C-c e

tempo-template-html-e`-(&&egrave;)

&egrave;

è

C-c a

tempo-template-html-a`-(&&agrave;)

&agrave;

à

C-c SPC

tempo-template-html-nonbreaking-space

&nbsp;

nonbreaking space

C-c -

tempo-template-html-soft-hyphen

&shy;

soft hyphen

C-c @

tempo-template-html-copyright

&copy;

©

C-c $

tempo-template-html-registered

&reg;

®

C-c "

tempo-template-html-quotation-mark

&quot;

"

C-c #

tempo-template-html-ascii-code

Enter the 3-digit code for the desired character

specified character


Table 8-6 lists the key bindings for HTML helper mode. There are key bindings for advanced HTML features such as forms as well as for some of the HTML 3.0 features. Some tags would normally appear on different lines (for example, in the case of a list); in this table, they are shown on one line.

Table 8-6. HTML helper mode commands

Keystrokes

Command name

Action

C-u

universal-argument

When used before any other tag command, insert tags around a region.

M-Tab

tempo-complete-tag

Complete the current tag.

C-c C-z vHTML

browse-url-of-file

Display this file in the default browser.

C-c C-z uHTML

browse-url-default-browser

Load the URL at point in default browser.

C-c M-h 1 HTML Header 1

tempo-template-html-header-1

Insert <h1></h1>.

C-c M-h 2 HTML Header 2

tempo-template-html-header-2

Insert <h2></h2>.

C-c M-h 3 HTML Header 3

tempo-template-html-header-3

Insert <h3></h3>.

C-c M-h 4 HTML Header 4

tempo-template-html-header-4

Insert <h4></h4>.

C-c M-h 5 HTML Header 5

tempo-template-html-header-5

Insert <h5></h5>.

C-c M-h 6HTML Header 6

tempo-template-html-header-6

Insert <h6></h6>.

M-Enter HTML

tempo-template-html-paragraph

Insert <p></p>.

C-c C-a l HTML

tempo-template-html-hyperlink

Insert <a href=""></a>.

C-c C-a n HTML

tempo-template-html-link-target

Insert <a name=""></a>.

C-c Enter HTML

tempo-template-html-line-break

Insert a literal line break, <br>.

C-c = HTML

tempo-template-html-horizontal-line

Insert a horizontal rule, <hr>.

C-c C-z tHTML

html-helper-insert-timestamp-delimiter-at-point

Insert timestamp delimiters.

C-c C-h tHTML

tempo-template-html-title

Insert <title></title>.

C-c Tab aHTML

tempo-template-html-image

Insert <img src="/books/2/27/1/html/2/">.

C-c C-l u HTML

tempo-template-html-unordered-list

Insert <ul><li></li></ul>.

C-c C-l oHTML

tempo-template-html-ordered-list

Insert <ol><li></li></ol>.

C-c C-l t HTML

tempo-template-html-definition-item

Insert <dt><dd>.

C-c C-l l HTML

tempo-template-html-item

Insert <li></li>.

C-c C-l d HTML

tempo-template-html-definition-list

Insert <dl><dt><dd></dl>.

C-c C-l m HTML

tempo-template-html-menu-list

Insert <menu><li></li></menu>.

C-c C-l r HTML

tempo-template-html-directorylist

Insert <dir><li></li></dir>.

C-c C-l i HTML

html-helper-smart-insert-item

Insert <li></li>.

C-c C-f z HTML

tempo-template-html-reset-form

Insert <input type="RESET">.

C-c C-f b HTML

tempo-template-html-button

Insert <input type="BUTTON">.

C-c C-f m HTML

tempo-template-html- submit-form

Insert <input type="SUBMIT">.

C-c C-f s HTML

tempo-template-html-selections

Insert <select><option></select>.

C-c C-f o HTML

tempo-template-html-option

Insert <option>.

C-c C-f v HTML

tempo-template-html-option-with-value

Insert <option value="">.

C-c C-f iHTML

tempo-template-html-input-image-field

Insert <input type="IMAGE">.

C-c C-f r HTML

tempo-template-html-input-radiobutton

Insert <input type="RADIO">.

C-c C-f c HTML

tempo-template-html-checkbox

Insert <input type="CHECKBOX">.

C-c C-f pHTML

tempo-template-html-text-area

Insert <textarea></textarea>.

C-c C-f fHTML

tempo-template-html-form

Insert <form></form>.

C-c C-f t `HTML

tempo-template-html-text-field

Insert <input type="TEXT">.

C-c C-f hHTML

tempo-template-html-hidden-field

Insert <input type="HIDDEN">.

C-c M-l s HTML

tempo-template-html-strong

Insert <strong></strong>.

C-c M-l e HTML

tempo-template-html-emphasized

Insert <em></em>.

C-c M-l b HTML

tempo-template-html-blockquote

Insert <blockquote></blockquote>.

C-c M-l p HTML

tempo-template-html-preformatted

Insert <pre></pre>.

C-c C-p s HTML

tempo-template-html-strikethru

Insert <s></s>.

C-c C-p fHTML

tempo-template-html-fixed

Insert <tt></tt>.

C-c C-p u HTML

tempo-template-html-underline

Insert <u></u>.

C-c C-p i HTML

tempo-template-html-italic

Insert <i></i>.

C-c C-p b HTML

tempo-template-html-bold

Insert <b></b>.

C-c C-p c HTML

tempo-template-html-center

Insert <center></center>.

C-c C-p l HTML

tempo-template-html-spanning-class

Insert <span class=""></span>.

C-c C-p 5 HTML

tempo-template-html-spanning-style

Insert <span style=""></span>.

C-c C-s a HTML

tempo-template-html-address

Insert <address></address>.

C-c M-l d HTML

tempo-template-html-definition

Insert <dfn></dfn>.

C-c M-l v HTML

tempo-template-html-variable

Insert <var></var>.

C-c M-l k HTML

tempo-template-html-keyboard

Insert <kbd></kbd>.

C-c M-l r HTML

tempo-template-html-citation

Insert <cite></cite>.

C-c M-l x HTML

tempo-template-html-sample

Insert <samp></samp>.

C-c M-l c HTML

tempo-template-html-code

Insert <code></code>.

C-c C-h b HTML

tempo-template-html-base

Insert <base href="">.

C-c C-h l HTML

tempo-template-html-link

Insert <link href="">.

C-c C-h m HTML

tempo-template-html-meta-name

Insert <meta content="">.

C-c C-h n HTML

tempo-template-html-nextid

Insert <nextid>.

C-c C-h i HTML

tempo-template-html-isindex

Insert <isindex>.

C-c C-h B HTML

tempo-template-html-body

Insert <body></body>.

C-c C-h H HTML

tempo-template-html-head

Insert <head></head>.

C-c C-t t HTML Table

tempo-template-html-table

Insert <table></table>.

C-c C-t p HTML html table caption

tempo-template-html-html-table-caption

Insert <caption></caption>.

C-c C-t d HTML Table Data

tempo-template-html-table-data

Insert <TD></TD>.

C-c C-t hHTML Table Header

tempo-template-html-table-header

Insert <TH></TH>.

C-c C-t r

HTML

tempo-template-html-table-row

Insert <TR></TR>.




Learning GNU Emacs
Learning GNU Emacs, Third Edition
ISBN: 0596006489
EAN: 2147483647
Year: 2003
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net