Implement description lists.

These are implemented as part of plain lists, so a leading
"-" or "+" is still needed.  Maybe this is not the most pretty
implementation, but it works without rewriting the quite
complex list formatting code.  So all the list formatting
continues to work just fine.  The description tag
is highlighted in bold, so still easy to spot.

The HTML exporter does export these already, the LaTeX
exporter still needs to be adapted.
This commit is contained in:
Carsten Dominik 2008-05-05 09:13:25 +02:00
parent 97eef5ed07
commit e6b87d40b3
5 changed files with 117 additions and 53 deletions

View File

@ -1,3 +1,11 @@
2008-05-04 Carsten Dominik <dominik@science.uva.nl>
* lisp/org.el (org-set-font-lock-defaults): Make the description
tag bold.
* lisp/org-exp.el (org-export-as-html, org-close-li): Implement
description lists.
2008-05-02 Carsten Dominik <dominik@science.uva.nl> 2008-05-02 Carsten Dominik <dominik@science.uva.nl>
* lisp/org.el (org-read-date-analyze): "." as an alias for "+0" in * lisp/org.el (org-read-date-analyze): "." as an alias for "+0" in

View File

@ -12,6 +12,30 @@
** Details ** Details
*** Description lists are now supported natively
A plain list will be exported as a description list if the
first item in the list has a /term/ and the /description/,
separated by " :: ". For example
: Free software by Carsten Dominik
: - RefTeX :: Support for LaTeX Labels, References, Citations
: - CDLaTeX :: more LaTeX functionality for Emacs
: - TeXmathp :: checking LaTeX buffers for Math mode.
: - ORG :: An Emacs mode for notes and projet planning.
: - CONSTANTS :: An Emacs package for inserting the definition of
: natural constants and units into a buffer.
: - IDLWAVE :: The Emacs modes for editing and
: running IDL and WAVE CL files.
: - CHAIN :: A tool for running a code with
: different sets of parameters
: - MPP :: A preprocessor tool for creating MPEG
: and other movie streams
: - Dirabbrev :: Using abbreviations for directories
: in the shell
: - PSFIXBB :: fixing the BoundingBox in postscript files
: - TFMT :: A table formatting tool
*** Blockquotes for export *** Blockquotes for export
For quoting an entire paragraph as a citation, use For quoting an entire paragraph as a citation, use

View File

@ -1128,24 +1128,34 @@ additional structure. They also provide a way to create lists of
checkboxes (@pxref{Checkboxes}). Org supports editing such lists, checkboxes (@pxref{Checkboxes}). Org supports editing such lists,
and the HTML exporter (@pxref{Exporting}) parses and formats them. and the HTML exporter (@pxref{Exporting}) parses and formats them.
Org knows ordered and unordered lists. Unordered list items start Org knows ordered lists, unordered lists, and description lists.
with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a @itemize @bullet
bullet, lines must be indented or they will be seen as top-level @item
headlines. Also, when you are hiding leading stars to get a clean @emph{Unordered} list items start with @samp{-}, @samp{+}, or
outline view, plain list items starting with a star are visually @samp{*}@footnote{When using @samp{*} as a bullet, lines must be indented or
indistinguishable from true headlines. In short: even though @samp{*} they will be seen as top-level headlines. Also, when you are hiding leading
is supported, it may be better to not use it for plain list items.} as stars to get a clean outline view, plain list items starting with a star are
bullets. Ordered list items start with a numeral followed by either a visually indistinguishable from true headlines. In short: even though
period or a right parenthesis, such as @samp{1.} or @samp{1)}. Items @samp{*} is supported, it may be better to not use it for plain list items.}
belonging to the same list must have the same indentation on the first as bullets.
line. In particular, if an ordered list reaches number @samp{10.}, then @item
the 2--digit numbers must be written left-aligned with the other numbers @emph{Ordered} list items start with a numeral followed by either a period or
in the list. Indentation also determines the end of a list item. It a right parenthesis, such as @samp{1.} or @samp{1)}.
ends before the next line that is indented like the bullet/number, or @item
less. Empty lines are part of the previous item, so you can have @emph{Description} list items are like unordered list items, but contain the
several paragraphs in one item. If you would like an empty line to separator @samp{ :: } to separate the description @emph{term} from the
terminate all currently open plain lists, configure the variable desciption.
@code{org-empty-line-terminates-plain-lists}. Here is an example: @end itemize
Items belonging to the same list must have the same indentation on the first
line. In particular, if an ordered list reaches number @samp{10.}, then the
2--digit numbers must be written left-aligned with the other numbers in the
list. Indentation also determines the end of a list item. It ends before
the next line that is indented like the bullet/number, or less. Empty lines
are part of the previous item, so you can have several paragraphs in one
item. If you would like an empty line to terminate all currently open plain
lists, configure the variable @code{org-empty-line-terminates-plain-lists}.
Here is an example:
@example @example
@group @group
@ -1159,6 +1169,10 @@ terminate all currently open plain lists, configure the variable
- on DVD only - on DVD only
He makes a really funny face when it happens. He makes a really funny face when it happens.
But in the end, not individual scenes matter but the film as a whole. But in the end, not individual scenes matter but the film as a whole.
Important actors in this film are:
- @b{Elijah Wood} :: He plays the Frodo
- @b{Sean Austin} :: He plays the Sam, Frodos friend. I still remember
him very well from his role as Mikey Walsh a in the Goonies.
@end group @end group
@end example @end example
@ -1166,7 +1180,8 @@ Org supports these lists by tuning filling and wrapping commands to
deal with them correctly@footnote{Org only changes the filling deal with them correctly@footnote{Org only changes the filling
settings for Emacs. For XEmacs, you should use Kyle E. Jones' settings for Emacs. For XEmacs, you should use Kyle E. Jones'
@file{filladapt.el}. To turn this on, put into @file{.emacs}: @file{filladapt.el}. To turn this on, put into @file{.emacs}:
@code{(require 'filladapt)}}. @code{(require 'filladapt)}}, and by exporting them properly
(@pxref{Exporting}).
The following commands act on items when the cursor is in the first line The following commands act on items when the cursor is in the first line
of an item (the line with the bullet or number). of an item (the line with the bullet or number).
@ -1260,7 +1275,8 @@ Visibility cycling (@pxref{Visibility cycling}) on the headline will
hide and show the entry, but keep the drawer collapsed to a single line. hide and show the entry, but keep the drawer collapsed to a single line.
In order to look inside the drawer, you need to move the cursor to the In order to look inside the drawer, you need to move the cursor to the
drawer line and press @key{TAB} there. Org mode uses a drawer for drawer line and press @key{TAB} there. Org mode uses a drawer for
storing properties (@pxref{Properties and Columns}). storing properties (@pxref{Properties and Columns}), and another one for
storing clock times (@pxref{Clocking work time}).
@node Orgstruct mode, , Drawers, Document Structure @node Orgstruct mode, , Drawers, Document Structure
@section The Orgstruct minor mode @section The Orgstruct minor mode
@ -9042,15 +9058,17 @@ single key navigation.
@i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a
conflict with @file{allout.el}. conflict with @file{allout.el}.
@item @item
@i{Jason Riedy} sent a patch to fix a bug with export of TODO keywords. @i{Jason Riedy} generalized the send-receive mechanism for orgtbl tables with
extensive patches.
@item @item
@i{Philip Rooke} created the Org reference card and provided lots @i{Philip Rooke} created the Org reference card, provided lots
of feedback. of feedback, developed and applied standards to the Org documentation and
wrote the manual for the contributed packages.
@item @item
@i{Christian Schlauer} proposed angular brackets around links, among @i{Christian Schlauer} proposed angular brackets around links, among
other things. other things.
@item @item
Linking to VM/BBDB/Gnus was inspired by @i{Tom Shannon}'s Linking to VM/BBDB/Gnus was first inspired by @i{Tom Shannon}'s
@file{organizer-mode.el}. @file{organizer-mode.el}.
@item @item
@i{Ilya Shlyakhter} proposed the Archive Sibling. @i{Ilya Shlyakhter} proposed the Archive Sibling.
@ -9075,14 +9093,12 @@ keyword.
@i{David Wainberg} suggested archiving, and improvements to the linking @i{David Wainberg} suggested archiving, and improvements to the linking
system. system.
@item @item
@i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The @i{John Wiegley} wrote @file{emacs-wiki.el}, @file{planner.el}, and
development of Org was fully independent, and both systems are really @file{muse.el}, which have similar goals as Org. Initially the development
different beasts in their basic ideas and implementation details. I later of Org was fully independent because I was not aware of the existence of
looked at John's code, however, and learned from his implementation of (i) these packages. But with time I have accasionally looked at John's code and
links where the link itself is hidden and only a description is shown, and learned a lot from it. John has also contributed a number of great ideas and
(ii) popping up a calendar to select a date. John has also contributed a patches directly to Org, including the file @code{org-mac-message.el}'
number of great ideas and patches directly to Org, including the file
@code{org-mac-message.el}'
@item @item
@i{Carsten Wimmer} suggested some changes and helped fix a bug in @i{Carsten Wimmer} suggested some changes and helped fix a bug in
linking to Gnus. linking to Gnus.

View File

@ -468,6 +468,7 @@ Org-mode file."
vertical-align: top; vertical-align: top;
<!--border: 1pt solid #ADB9CC;--> <!--border: 1pt solid #ADB9CC;-->
} }
dt { font-weight: bold; }
</style>" </style>"
"The default style specification for exported HTML files. "The default style specification for exported HTML files.
Since there are different ways of setting style information, this variable Since there are different ways of setting style information, this variable
@ -2309,7 +2310,7 @@ PUB-DIR is set, use this as the publishing directory."
(inquote nil) (inquote nil)
(infixed nil) (infixed nil)
(in-local-list nil) (in-local-list nil)
(local-list-num nil) (local-list-type nil)
(local-list-indent nil) (local-list-indent nil)
(llt org-plain-list-ordered-item-terminator) (llt org-plain-list-ordered-item-terminator)
(email (plist-get opt-plist :email)) (email (plist-get opt-plist :email))
@ -2349,7 +2350,7 @@ PUB-DIR is set, use this as the publishing directory."
"[\r\n]")) "[\r\n]"))
table-open type table-open type
table-buffer table-orig-buffer table-buffer table-orig-buffer
ind start-is-num starter didclose ind item-type starter didclose
rpl path desc descp desc1 desc2 link rpl path desc descp desc1 desc2 link
snumber fnc snumber fnc
) )
@ -2716,10 +2717,10 @@ lang=\"%s\" xml:lang=\"%s\">
(setq head-count (+ head-count 1))) (setq head-count (+ head-count 1)))
(when in-local-list (when in-local-list
;; Close any local lists before inserting a new header line ;; Close any local lists before inserting a new header line
(while local-list-num (while local-list-type
(org-close-li) (org-close-li (car local-list-type))
(insert (if (car local-list-num) "</ol>\n" "</ul>")) (insert (format "</%sl>\n" (car local-list-type)))
(pop local-list-num)) (pop local-list-type))
(setq local-list-indent nil (setq local-list-indent nil
in-local-list nil)) in-local-list nil))
(setq first-heading-pos (or first-heading-pos (point))) (setq first-heading-pos (or first-heading-pos (point)))
@ -2757,10 +2758,15 @@ lang=\"%s\" xml:lang=\"%s\">
(t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))
line) line)
(setq ind (org-get-string-indentation line) (setq ind (org-get-string-indentation line)
start-is-num (match-beginning 4) item-type (if (match-beginning 4) "o" "u")
starter (if (match-beginning 2) starter (if (match-beginning 2)
(substring (match-string 2 line) 0 -1)) (substring (match-string 2 line) 0 -1))
line (substring line (match-beginning 5))) line (substring line (match-beginning 5))
item-tag)
(if (string-match "\\(.*?\\) ::[ \t]*" line)
(setq item-type "d"
item-tag (match-string 1 line)
line (substring line (match-end 0))))
(unless (string-match "[^ \t]" line) (unless (string-match "[^ \t]" line)
;; empty line. Pretend indentation is large. ;; empty line. Pretend indentation is large.
(setq ind (if org-empty-line-terminates-plain-lists (setq ind (if org-empty-line-terminates-plain-lists
@ -2772,9 +2778,9 @@ lang=\"%s\" xml:lang=\"%s\">
(not starter)) (not starter))
(< ind (car local-list-indent)))) (< ind (car local-list-indent))))
(setq didclose t) (setq didclose t)
(org-close-li) (org-close-li (car local-list-type))
(insert (if (car local-list-num) "</ol>\n" "</ul>")) (insert (format "</%sl>\n" (car local-list-type)))
(pop local-list-num) (pop local-list-indent) (pop local-list-type) (pop local-list-indent)
(setq in-local-list local-list-indent)) (setq in-local-list local-list-indent))
(cond (cond
((and starter ((and starter
@ -2782,14 +2788,21 @@ lang=\"%s\" xml:lang=\"%s\">
(> ind (car local-list-indent)))) (> ind (car local-list-indent))))
;; Start new (level of) list ;; Start new (level of) list
(org-close-par-maybe) (org-close-par-maybe)
(insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) (insert (cond
(push start-is-num local-list-num) ((equal item-type "u") "<ul>\n<li>\n")
((equal item-type "o") "<ol>\n<li>\n")
((equal item-type "d")
(format "<dl>\n<dt>%s</dt><dd>\n" item-tag))))
(push item-type local-list-type)
(push ind local-list-indent) (push ind local-list-indent)
(setq in-local-list t)) (setq in-local-list t))
(starter (starter
;; continue current list ;; continue current list
(org-close-li) (org-close-li (car local-list-type))
(insert "<li>\n")) (insert (cond
((equal (car local-list-type) "d")
(format "<dt>%s</dt><dd>\n" (or item-tag "???")))
(t "<li>\n"))))
(didclose (didclose
;; we did close a list, normal text follows: need <p> ;; we did close a list, normal text follows: need <p>
(org-open-par))) (org-open-par)))
@ -2827,10 +2840,10 @@ lang=\"%s\" xml:lang=\"%s\">
(when inquote (insert "</pre>\n")) (when inquote (insert "</pre>\n"))
(when in-local-list (when in-local-list
;; Close any local lists before inserting a new header line ;; Close any local lists before inserting a new header line
(while local-list-num (while local-list-type
(org-close-li) (org-close-li (car local-list-type))
(insert (if (car local-list-num) "</ol>\n" "</ul>\n")) (insert (format "</%sl>\n" (car local-list-type)))
(pop local-list-num)) (pop local-list-type))
(setq local-list-indent nil (setq local-list-indent nil
in-local-list nil)) in-local-list nil))
(org-html-level-start 1 nil umax (org-html-level-start 1 nil umax
@ -3376,10 +3389,10 @@ stacked delimiters is N. Escaping delimiters is not possible."
(when org-par-open (when org-par-open
(insert "</p>") (insert "</p>")
(setq org-par-open nil))) (setq org-par-open nil)))
(defun org-close-li () (defun org-close-li (&optional type)
"Close <li> if necessary." "Close <li> if necessary."
(org-close-par-maybe) (org-close-par-maybe)
(insert "</li>\n")) (insert (if (equal type "d") "</dd>\n" "</li>\n")))
(defvar body-only) ; dynamically scoped into this. (defvar body-only) ; dynamically scoped into this.
(defun org-html-level-start (level title umax with-toc head-count) (defun org-html-level-start (level title umax with-toc head-count)

View File

@ -3659,6 +3659,9 @@ between words."
(if org-provide-checkbox-statistics (if org-provide-checkbox-statistics
'("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" '("\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]"
(0 (org-get-checkbox-statistics-face) t))) (0 (org-get-checkbox-statistics-face) t)))
;; Description list items
'("^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(.*?\\) ::"
2 'bold prepend)
(list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)") (list (concat "^\\*+ \\(.*:" org-archive-tag ":.*\\)")
'(1 'org-archived prepend)) '(1 'org-archived prepend))
;; Specials ;; Specials