summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>1999-02-07 13:02:03 +0000
committerSimon Tatham <anakin@pobox.com>1999-02-07 13:02:03 +0000
commit959dba8dc71bd6b5e2c7f59eec0fcb20f0d71d8d (patch)
tree9f849955d7a127157d569cd7f6e6d191ff4d7d66
parente224954f9ab0e3e8f309ce0e3f368db535ad0cf9 (diff)
downloadhalibut-959dba8dc71bd6b5e2c7f59eec0fcb20f0d71d8d.zip
halibut-959dba8dc71bd6b5e2c7f59eec0fcb20f0d71d8d.tar.gz
halibut-959dba8dc71bd6b5e2c7f59eec0fcb20f0d71d8d.tar.bz2
halibut-959dba8dc71bd6b5e2c7f59eec0fcb20f0d71d8d.tar.xz
Test input file, and Jed highlighting/wrapping mode
[originally from svn r25]
-rw-r--r--inputs/test.but85
-rw-r--r--misc/buttress.sl69
2 files changed, 154 insertions, 0 deletions
diff --git a/inputs/test.but b/inputs/test.but
new file mode 100644
index 0000000..f605fe6
--- /dev/null
+++ b/inputs/test.but
@@ -0,0 +1,85 @@
+\title Buttress: A Test Document
+
+\preamble This manual is a small joke effort, designed to use every
+feature that Buttress's input format supports.
+
+\copyright Copyright 1999 Simon Tatham. All rights reserved.
+
+\C{chap} First chapter title
+
+This is a paragraph of text. It
+has line breaks in between words, multiple
+ spaces (ignored), and \e{emphasised text} as well as \c{code
+fragments}.
+
+\cw{This} is weak code. And \k{sect} contains some other stuff.
+\K{head} does too.
+
+\S{sect} First section title
+
+Here's a code paragraph:
+
+\c No leading spaces
+\c One leading space
+\c Blank line follows this one.
+\c
+\c
+\c
+\c
+\c Blank line precedes this one.
+\c Two leading spaces
+\c We can use \ { and } with impunity here.
+
+This is a list:
+
+\b Ooh.
+
+\b Aah.
+
+\b Eek.
+
+This is a numbered list:
+
+\n Ooh.
+
+\n{keyword} Aah.
+
+\n Eek. `Aah' is point \k{keyword}.
+
+Oh, while I'm here: some special characters. The \\, \{ and \}
+characters, to be precise. And their code equivalents, \c{\\},
+\c{\{}, \c{\}}.
+
+\H{head} First subheading
+
+So here's a subsection. Just incidentally, `this' is in quotes.
+Those quotes had better work in all formats.
+
+We'll try for some Unicode here: \i{Schr\u00F6{oe}dinger}.
+
+An index tag containing non-alternatived Unicode: \i{\u00BFChe?}
+
+An invisible index tag: \I{she seems to have an invisible tag}yeah.
+
+\A{app} Needless appendix
+
+Here's an \i{appendix}, for no terribly good reason at all. See
+\k{book}.
+
+\U{bib} Bibliography
+
+\B{book} Some text describing a book.
+
+\B{nocite} Some text describing a book. This text should appear in
+the document even though there is no \cw{\\k} citing it.
+
+\nocite{nocite}
+
+\B{uncited} If this text appears, there's an actual error.
+
+\# This is a comment.
+
+\# Now for the index section.
+
+\IM{she seems to have an invisible tag}{appendix} Invisible tags
+and/or appendices
diff --git a/misc/buttress.sl b/misc/buttress.sl
new file mode 100644
index 0000000..68f08af
--- /dev/null
+++ b/misc/buttress.sl
@@ -0,0 +1,69 @@
+% The functions here are common to both TeX and LaTeX modes.
+
+$1 = "Buttress";
+create_syntax_table ($1);
+
+define_syntax ("\#", "", '%', $1); % Comment Syntax
+define_syntax ('\\', '\\', $1); % Quote character
+define_syntax ("{", "}", '(', $1); % are all these needed?
+define_syntax ("a-zA-Z0-9", 'w', $1);
+set_syntax_flags ($1, 8);
+
+#ifdef HAS_DFA_SYNTAX
+%enable_highlight_cache ("buttress.dfa", $1);
+define_highlight_rule ("\\\\#.*$", "comment", $1);
+define_highlight_rule ("^\\\\c([ \t].*)?$", "string", $1);
+define_highlight_rule ("\\\\[\\\\{}]", "keyword0", $1);
+define_highlight_rule ("\\\\[A-Za-tv-z][A-Za-z]*", "keyword0", $1);
+define_highlight_rule ("\\\\u[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9]",
+ "keyword0", $1);
+define_highlight_rule ("\\\\u[A-Fa-f0-9]?[A-Fa-f0-9]?[A-Fa-f0-9]?[A-Fa-f0-9]",
+ "keyword1", $1);
+define_highlight_rule ("[{}]", "delimiter", $1);
+define_highlight_rule (".", "normal", $1);
+build_highlight_table ($1);
+#endif
+
+% This hook identifies lines containing TeX comments as paragraph separator
+define buttress_is_comment() {
+ bol ();
+ while (ffind ("\\\\#")) go_right (3);
+ ffind ("\\#"); % return value on stack
+}
+
+variable Buttress_Ignore_Comment = 0; % if true, line containing a comment
+ % does not delimit a paragraph
+
+define buttress_paragraph_separator() {
+ bol();
+ skip_white();
+ if (eolp())
+ return 1;
+ if (looking_at("\\c ") or looking_at("\\c\t") or
+ looking_at("\\c\n"))
+ return 1;
+ return not (Buttress_Ignore_Comment) and buttress_is_comment();
+}
+
+define buttress_wrap_hook() {
+ variable yep;
+ push_spot ();
+ yep = up_1 () and buttress_is_comment ();
+ pop_spot ();
+ if (yep) {
+ push_spot ();
+ bol_skip_white ();
+ insert ("\\# ");
+ pop_spot ();
+ }
+}
+
+define buttress_mode() {
+ variable mode = "Buttress";
+ % use_keymap (mode);
+ set_mode (mode, 0x1 | 0x20);
+ set_buffer_hook ("par_sep", "buttress_paragraph_separator");
+ set_buffer_hook ("wrap_hook", "buttress_wrap_hook");
+ use_syntax_table (mode);
+ runhooks ("buttress_mode_hook");
+}