3 * Description: RFC and Internet Draft reformatter.
5 * Some RFCs and Internet Drafts are broken in such a way
6 * that there is no linefeed character separating the
7 * pages. These documents are really pain to print
8 * because you have to know the exact page height. The
9 * `rfc' highlighting state fixes these broken documents
10 * by removing all unnecessary blank lines from the page
11 * breaks and by separating the pages with a formfeed
12 * character. This style also highlights the MUST, MUST
13 * NOT, REQUIRED SHALL, SHALL NOT, SHOULD, SHOULD NOT,
14 * RECOMMENDED, MAY, and OPTIONAL keywords, described by
17 * Author: Markku Rossi <mtr@iki.fi>
20 state rfc_page_separator_garbage extends Highlight
23 /* Skip all whitespace lines. */
26 /* Print the correct separator line. */
27 language_print("\f\n");
33 state rfc extends HighlightEntry
35 /* Find the page separators and skip all whitespace lines after that. */
36 /\[[Pp]age[ \t]+[0-9]+[ \t]*\]\n/ {
38 call(rfc_page_separator_garbage);
40 /* Highlight the keywords, described by the RFC 2119.
41 (build-re '(MUST NOT REQUIRED SHALL SHOULD RECOMMENDED MAY OPTIONAL))
43 /\b(M(AY|UST)|NOT|OPTIONAL|RE(COMMENDED|QUIRED)|SH(ALL|OULD))\b/ {
46 highlight_face(false);