From 933b463e56750e46ad2a0a657aee204d4ef1b10d Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Tue, 27 Dec 2005 18:51:18 +0000 Subject: [PATCH] Pave the way for nested lists by adding markup strings. * examples/muse.rnc: muse.element.format is no longer a block, and may not contain muse.element.p. * lisp/muse-latex.el (muse-latex-markup-strings): Add markup strings for '(begin|end)-(quote|uli|oli|dl)-item. Add '(begin|end)-(dl|ddt|dde) markup strings. This will allow for more flexibility in constructing all sorts of lists, especially definition lists. Rename 'start-dde to 'begin-dde for consistency. * lisp/muse-texinfo.el (muse-latex-markup-strings): Ditto. (muse-texinfo-markup-regexps): Remove list concatenation regexp. * lisp/muse-docbook.el (muse-docbook-markup-strings) (muse-docbook-markup-regexps): Ditto, but simplify paragraph regexp. * lisp/muse-xml.el (muse-xml-markup-regexps, muse-xml-markup-strings): Ditto. * lisp/muse-html.el (muse-html-markup-regexps, muse-html-markup-strings): Ditto. Include

in center markup. (muse-html-markup-paragraph): Remove special treatment of blockquote and center. * lisp/muse-groff.el (muse-groff-markup-strings): Rename 'begin-dde to 'start-dde. * lisp/muse-publish.el (muse-publish-markup-regexps): Begin implementing nested list preliminaries. This is currently broken, probably. * lisp/muse-regexps.el (muse-list-item-regexp): New regexp that matches the beginning of a list item. git-archimport-id: mwolson@gnu.org--2005/muse--main--1.0--patch-325 --- ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ examples/muse.rnc | 3 --- lisp/muse-docbook.el | 41 +++++++++++++++++++++-------------------- lisp/muse-groff.el | 4 +--- lisp/muse-html.el | 44 +++++++++++++++++++++----------------------- lisp/muse-latex.el | 13 ++++++++----- lisp/muse-publish.el | 18 ++++++++---------- lisp/muse-regexps.el | 9 +++++++++ lisp/muse-texinfo.el | 20 +++++++++----------- lisp/muse-xml.el | 45 +++++++++++++++++++++++---------------------- 10 files changed, 146 insertions(+), 97 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15a7807..799fdc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,52 @@ # arch-tag: automatic-ChangeLog--mwolson@gnu.org--2005/muse--main--1.0 # +2005-12-27 18:51:18 GMT Michael Olson patch-325 + + Summary: + Pave the way for nested lists by adding markup strings. + Revision: + muse--main--1.0--patch-325 + + * examples/muse.rnc: muse.element.format is no longer a block, and may + not contain muse.element.p. + + * lisp/muse-latex.el (muse-latex-markup-strings): Add markup strings for + '(begin|end)-(quote|uli|oli|dl)-item. Add '(begin|end)-(dl|ddt|dde) + markup strings. This will allow for more flexibility in constructing + all sorts of lists, especially definition lists. Rename 'start-dde to + 'begin-dde for consistency. + + * lisp/muse-texinfo.el (muse-latex-markup-strings): Ditto. + (muse-texinfo-markup-regexps): Remove list concatenation regexp. + + * lisp/muse-docbook.el (muse-docbook-markup-strings) + (muse-docbook-markup-regexps): Ditto, but simplify paragraph regexp. + + * lisp/muse-xml.el (muse-xml-markup-regexps, muse-xml-markup-strings): + Ditto. + + * lisp/muse-html.el (muse-html-markup-regexps, muse-html-markup-strings): + Ditto. Include

in center markup. + (muse-html-markup-paragraph): Remove special treatment of blockquote + and center. + + * lisp/muse-groff.el (muse-groff-markup-strings): Rename 'begin-dde to + 'start-dde. + + * lisp/muse-publish.el (muse-publish-markup-regexps): Begin implementing + nested list preliminaries. This is currently broken, probably. + + * lisp/muse-regexps.el (muse-list-item-regexp): New regexp that matches + the beginning of a list item. + + modified files: + ChangeLog examples/muse.rnc lisp/muse-docbook.el + lisp/muse-groff.el lisp/muse-html.el lisp/muse-latex.el + lisp/muse-publish.el lisp/muse-regexps.el lisp/muse-texinfo.el + lisp/muse-xml.el + + 2005-12-27 03:20:11 GMT Michael Olson patch-324 Summary: diff --git a/examples/muse.rnc b/examples/muse.rnc index c650ac0..5c904d6 100644 --- a/examples/muse.rnc +++ b/examples/muse.rnc @@ -49,7 +49,6 @@ MUSE = & muse.element.hr* & muse.element.image* & muse.element.example* - & muse.element.format* # for centering paragraphs & muse.element.verse* } @@ -92,7 +91,6 @@ muse.element.section = element section { & muse.element.hr* & muse.element.image* & muse.element.example* - & muse.element.format* # for centering paragraphs & muse.element.verse* & text }? @@ -178,7 +176,6 @@ muse.element.definition = element definition { muse.element.format = element format { muse.attribute.type? & muse.attribute.level? - & muse.element.p? & text }? ## code element diff --git a/lisp/muse-docbook.el b/lisp/muse-docbook.el index 8d51337..eddbb77 100644 --- a/lisp/muse-docbook.el +++ b/lisp/muse-docbook.el @@ -75,19 +75,9 @@ This may be text or a filename." :group 'muse-docbook) (defcustom muse-docbook-markup-regexps - `(;; Join together the parts of a list - (10000 ,(concat "" - "\\([" muse-regexp-blank "]*\n\\)\\{0,2\\}" - "[" muse-regexp-blank "]*" - "<\\1list" "[^>]*>\\s-*") - 0 "") - - ;; Beginning of doc, end of doc, or plain paragraph separator - (10100 ,(concat "\\(\n\\)?" - "\\(\\(\n\\([" - muse-regexp-blank - "]*\n\\)+\\)\\|\\`\\s-*\\|\\s-*\\'\\)" - "\\(<\\(blockquote\\|center\\)>\n\\)?") + `(;; Beginning of doc, end of doc, or plain paragraph separator + (10000 ,(concat "\\(\\(\n\\([" muse-regexp-blank "]*\n\\)+\\)" + "\\|\\`\\s-*\\|\\s-*\\'\\)") 0 muse-docbook-markup-paragraph)) "List of markup rules for publishing a Muse page to DocBook XML. For more on the structure of this list, see `muse-publish-markup-regexps'." @@ -153,13 +143,24 @@ For more on the structure of this list, see (end-center . "\n") (begin-quote . "
\n") (end-quote . "\n
") - (begin-uli . "\n") - (end-uli . "\n") - (begin-oli . "\n") - (end-oli . "\n") - (begin-ddt . "\n\n") - (start-dde . "\n") - (end-ddt . "\n\n") + (begin-quote-item . "") + (end-quote-item . "") + (begin-uli . "\n") + (end-uli . "\n") + (begin-uli-item . "") + (end-uli-item . "") + (begin-oli . "\n") + (end-oli . "\n") + (begin-oli-item . "") + (end-oli-item . "") + (begin-dl . "\n") + (end-dl . "\n") + (begin-dl-item . "\n") + (end-dl-item . "\n") + (begin-ddt . "") + (end-ddt . "\n") + (begin-dde . "") + (end-dde . "") (begin-table . "\n") (end-table . "\n") (begin-table-group . " \n") diff --git a/lisp/muse-groff.el b/lisp/muse-groff.el index 4c2124a..9435c0d 100644 --- a/lisp/muse-groff.el +++ b/lisp/muse-groff.el @@ -113,8 +113,6 @@ For more on the structure of this list, see (begin-most-emph . "\\f(BI") (end-most-emph . "\\fP") (begin-verse . ".QUOTE") - (end-verse-line . "") - (last-stanza-end . "") (end-verse . ".QUOTE OFF") (begin-center . "\n.CENTER\n") (end-center . "\n.QUAD L\n") @@ -129,7 +127,7 @@ For more on the structure of this list, see (begin-oli . ".list DIGIT\n.SHIFT_LIST 2m\n.ITEM\n") (end-oli . "\n.LIST OFF") (begin-ddt . "\\fB") - (start-dde . "\\fP\n.IR 4P\n") + (begin-dde . "\\fP\n.IR 4P\n") (end-ddt . ".IRX CLEAR")) "Strings used for marking up text. These cover the most basic kinds of markup, the handling of which diff --git a/lisp/muse-html.el b/lisp/muse-html.el index b747568..ac9f22d 100644 --- a/lisp/muse-html.el +++ b/lisp/muse-html.el @@ -208,18 +208,9 @@ as you wrap the region in ." :group 'muse-html) (defcustom muse-html-markup-regexps - `(;; Join together the parts of a list - (10000 ,(concat "" - "\\([" muse-regexp-blank "]*\n\\)\\{0,2\\}" - "[" muse-regexp-blank "]*" - "<\\1>\\s-*") - 0 "") - - ;; Beginning of doc, end of doc, or plain paragraph separator - (10100 ,(concat "\\(\n\\)?" - "\\(\\(\n\\([" muse-regexp-blank - "]*\n\\)+\\)\\|\\`\\s-*\\|\\s-*\\'\\)" - "\\(<\\(blockquote\\|center\\)>\n\\)?") + `(;; Beginning of doc, end of doc, or plain paragraph separator + (10000 ,(concat "\\(\\(\n\\([" muse-regexp-blank "]*\n\\)+\\)" + "\\|\\`\\s-*\\|\\s-*\\'\\)") 0 muse-html-markup-paragraph)) "List of markup rules for publishing a Muse page to HTML. For more on the structure of this list, see `muse-publish-markup-regexps'." @@ -285,17 +276,26 @@ For more on the structure of this list, see (end-verse . "

") (begin-example . "
")
     (end-example     . "
") - (begin-center . "
\n") - (end-center . "\n
") + (begin-center . "
\n

") + (end-center . "

\n
") (begin-quote . "
\n") (end-quote . "\n
") - (begin-uli . "
    \n
  • ") - (end-uli . "
  • \n
") - (begin-oli . "
    \n
  1. ") - (end-oli . "
  2. \n
") - (begin-ddt . "
\n
") - (start-dde . "
\n
") - (end-ddt . "
\n
") + (begin-quote-item . "

") + (end-quote-item . "

") + (begin-uli . "
    \n") + (end-uli . "\n
") + (begin-uli-item . "
  • ") + (end-uli-item . "
  • ") + (begin-oli . "
      \n") + (end-oli . "\n
    ") + (begin-oli-item . "
  • ") + (end-oli-item . "
  • ") + (begin-dl . "
    \n") + (end-dl . "\n
    ") + (begin-ddt . "
    ") + (end-ddt . "
    \n") + (begin-dde . "
    ") + (end-dde . "
    ") (begin-table . "\n") (end-table . "\n") (begin-table-row . " \n") @@ -422,8 +422,6 @@ This will be used if no special characters are found." (muse-insert-markup "

    ")))) ((muse-looking-back "\\(\\|


    \\)\n\n") (muse-insert-markup "

    ")) - ((muse-looking-back "<\\(blockquote\\|center\\)>\n") - (muse-insert-markup "

    ")) (t (muse-insert-markup "

    ")))) diff --git a/lisp/muse-latex.el b/lisp/muse-latex.el index b7f0e9b..068bc04 100644 --- a/lisp/muse-latex.el +++ b/lisp/muse-latex.el @@ -191,13 +191,16 @@ For more on the structure of this list, see (end-center . "\n\\end{center}") (begin-quote . "\\begin{quote}\n") (end-quote . "\n\\end{quote}") - (begin-uli . "\\begin{itemize}\n\\item ") + (begin-uli . "\\begin{itemize}\n") (end-uli . "\n\\end{itemize}") - (begin-oli . "\\begin{enumerate}\n\\item ") + (begin-uli-item . "\\item ") + (begin-oli . "\\begin{enumerate}\n") (end-oli . "\n\\end{enumerate}") - (begin-ddt . "\\begin{description}\n\\item[") - (start-dde . "] ") - (end-ddt . "\\end{description}")) + (begin-oli-item . "\\item ") + (begin-dl . "\\begin{description}\n") + (end-dl . "\n\\end{description}") + (begin-ddt . "\\item[") + (end-ddt . "] ")) "Strings used for marking up text. These cover the most basic kinds of markup, the handling of which differs little between the various styles." diff --git a/lisp/muse-publish.el b/lisp/muse-publish.el index 7f762ba..e4ca500 100644 --- a/lisp/muse-publish.el +++ b/lisp/muse-publish.el @@ -28,6 +28,9 @@ ;; ;; Peter K. Lee (saint AT corenova DOT com) provided the ;; `muse-style-elements-list' function. +;; +;; Jim Ottaway (j DOT ottaway AT lse DOT ac DOT uk) provided an +;; implementation for nested lists. ;;; Code: @@ -136,16 +139,11 @@ If non-nil, publish comments using the markup of the current style." ;; reason all of these rules are handled here, is so that ;; blockquote detection doesn't interfere with indented list ;; members. - (2200 ,(concat "^[" - muse-regexp-blank - "]+\\(-[" - muse-regexp-blank - "]*\\|[0-9]+\\.[" - muse-regexp-blank - "]*\\|\\(?:.+?\\)[" - muse-regexp-blank - "]+::\n?\\)") - 1 list) + (2150 ,(concat "^\\(\\(?:[^" muse-regexp-blank "\n]+\\)[" + muse-regexp-blank "]+::\n?\\)") + 0 " \\&") + + (2200 muse-list-item-regexp 1 list) (2300 ,(concat "^\\(\\(?:.+?\\)[" muse-regexp-blank "]+::\n?\\)") 0 list) diff --git a/lisp/muse-regexps.el b/lisp/muse-regexps.el index 87f3aa2..2c8e47d 100644 --- a/lisp/muse-regexps.el +++ b/lisp/muse-regexps.el @@ -137,6 +137,15 @@ the time." :options '("[:upper:]" "A-Z") :group 'muse-regexp) +(defcustom muse-list-item-regexp + (concat "^[" muse-regexp-blank "]+\\(-[" + muse-regexp-blank "]*\\|[0-9]+\\.[" + muse-regexp-blank "]*\\|\\(?:.+?\\)[" + muse-regexp-blank "]+::\n?\\)") + "Regexp used to match the beginning of list items when publishing." + :type 'regexp + :group 'muse-regexp) + (defcustom muse-table-field-regexp (concat "[" muse-regexp-blank "]+\\(|+\\)[" muse-regexp-blank "]+") "Regexp used to match table separators when publishing." diff --git a/lisp/muse-texinfo.el b/lisp/muse-texinfo.el index f9da834..786ebb4 100644 --- a/lisp/muse-texinfo.el +++ b/lisp/muse-texinfo.el @@ -97,12 +97,7 @@ It may contain markup tags." :type 'string :group 'muse-texinfo) -(defcustom muse-texinfo-markup-regexps - `(;; join together the parts of a list or table - (10000 ,(concat "@end \\(\\(multi\\)?table\\|itemize\\|enumerate\\)" - "\n\\{1,2\\}" - "@\\1.*\n+") - 0 "")) +(defcustom muse-texinfo-markup-regexps nil "List of markup rules for publishing a Muse page to Texinfo. For more on the structure of this list, see `muse-publish-markup-regexps'." :type '(repeat (choice @@ -165,13 +160,16 @@ For more on the structure of this list, see (end-center . "\n@end quotation") (begin-quote . "@quotation\n") (end-quote . "\n@end quotation") - (begin-uli . "@itemize @bullet\n@item\n") + (begin-uli . "@itemize @bullet\n") (end-uli . "\n@end itemize") - (begin-oli . "@enumerate\n@item\n") + (begin-uli-item . "@item\n") + (begin-oli . "@enumerate\n") (end-oli . "\n@end enumerate") - (begin-ddt . "@table @strong\n@item ") - (start-dde . "\n") - (end-ddt . "\n@end table")) + (begin-oli-item . "@item\n") + (begin-dl . "@table @strong\n") + (end-dl . "\n@end table") + (begin-ddt . "@item ") + (end-ddt . "\n")) "Strings used for marking up text. These cover the most basic kinds of markup, the handling of which differs little between the various styles." diff --git a/lisp/muse-xml.el b/lisp/muse-xml.el index 99a51c6..5103f5e 100644 --- a/lisp/muse-xml.el +++ b/lisp/muse-xml.el @@ -85,19 +85,9 @@ This may be text or a filename." :group 'muse-xml) (defcustom muse-xml-markup-regexps - `(;; Join together the parts of a list - (10000 ,(concat "" - "\\([" muse-regexp-blank "]*\n\\)\\{0,2\\}" - "[" muse-regexp-blank "]*" - "]*>\\s-*") - 0 "") - - ;; Beginning of doc, end of doc, or plain paragraph separator - (10100 ,(concat "\\(\n\\)?" - "\\(\\(\n\\([" - muse-regexp-blank - "]*\n\\)+\\)\\|\\`\\s-*\\|\\s-*\\'\\)" - "\\(<\\(blockquote\\|format type=\"center\"\\)>\n\\)?") + `(;; Beginning of doc, end of doc, or plain paragraph separator + (10000 ,(concat "\\(\\(\n\\([" muse-regexp-blank "]*\n\\)+\\)" + "\\|\\`\\s-*\\|\\s-*\\'\\)") 0 muse-xml-markup-paragraph)) "List of markup rules for publishing a Muse page to XML. For more on the structure of this list, see `muse-publish-markup-regexps'." @@ -167,17 +157,28 @@ For more on the structure of this list, see (end-verse . "") (begin-example . "") (end-example . "") - (begin-center . "\n") - (end-center . "\n") + (begin-center . "

    \n") + (end-center . "\n

    ") (begin-quote . "
    \n") (end-quote . "\n
    ") - (begin-uli . "\n") - (end-uli . "\n") - (begin-oli . "\n") - (end-oli . "\n") - (begin-ddt . "\n") - (start-dde . "\n") - (end-ddt . "\n\n") + (begin-quote-item . "

    ") + (end-quote-item . "

    ") + (begin-uli . "\n") + (end-uli . "\n") + (begin-uli-item . "") + (end-uli-item . "") + (begin-oli . "\n") + (end-oli . "\n") + (begin-oli-item . "") + (end-oli-item . "") + (begin-dl . "\n") + (end-dl . "\n") + (begin-dl-item . "\n") + (end-dl-item . "\n") + (begin-ddt . "") + (end-ddt . "\n") + (begin-dde . "") + (end-ddt . "") (begin-table . "\n") (end-table . "\n") (begin-table-row . " \n") -- 2.11.4.GIT