diff --git a/ORGWEBPAGE/Changes.org b/ORGWEBPAGE/Changes.org index d45e74771..2b3a50303 100644 --- a/ORGWEBPAGE/Changes.org +++ b/ORGWEBPAGE/Changes.org @@ -15,6 +15,17 @@ :VISIBILITY: content :END: + +** Incompatible changes + +*** Short examples must have a space after the colon + + Short literal examples can be created by preceeding lines + with a colon. Such lines must now have a space after the + colon. I believe this is already general practice, but now + it must be like this. The only exception are lines what are + empty except for the colon. + ** Details *** The relative timer can be paused diff --git a/doc/ChangeLog b/doc/ChangeLog index ad39eca04..8ce137a5c 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2009-01-09 Carsten Dominik + + * org.texi (Literal examples): Document that a space must follow + the colon in short examples. + 2009-01-08 Carsten Dominik * org.texi (Relative timer): Document `org-timer-stop'. diff --git a/doc/org.texi b/doc/org.texi index 6422db9fe..762fd3b82 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -7376,10 +7376,12 @@ Some example from a text file. @end example For simplicity when using small examples, you can also start the example -lines with a colon: +lines with a colon followed by a space. There may also be additional +whitespace before the colon: @example -: Some example from a text file. +Here is an example + : Some example from a text file. @end example @cindex formatting source code, markup rules diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f1a599dcb..1a9e6a15c 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2009-01-09 Carsten Dominik + + * org-export-latex.el (org-export-latex-fixed-width): Enforce the + space after the colon in short examples. + + * org-exp.el (org-export-protect-colon-examples): Rewritten, to + enforce a space after the colon. However, we also allow lines + that are *only* a colon. + (org-export-as-html): Enforce the space after the colon in short + examples. + (org-export-preprocess-string): Do the colon example protection + earlier. + (org-export-remove-timestamps): Do not check for protection at the + end of the line. + 2009-01-08 Carsten Dominik * org.el (org-format-latex-options): Add new matcher for single diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 52379bb42..4008b9afd 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1527,6 +1527,9 @@ on this string to produce the exported version." ;; Handle source code snippets (org-export-replace-src-segments-and-examples backend) + ;; Protect short examples marked by a leading colon + (org-export-protect-colon-examples) + ;; Normalize footnotes (when (plist-get parameters :footnotes) (org-footnote-normalize nil t)) @@ -1552,19 +1555,12 @@ on this string to produce the exported version." ;; Remove todo-keywords before exporting, if the user has requested so (org-export-remove-headline-metadata parameters) - ;; Remove timestamps, if the user has requested so - (org-export-remove-clock-lines) - (unless (plist-get parameters :timestamps) - (org-export-remove-timestamps)) - ;; Find targets in comments and move them out of comments, ;; but mark them as targets that should be invisible (setq target-alist (org-export-handle-invisible-targets target-alist)) - ;; Protect short examples - (org-export-protect-colon-examples) - - ;; Protect backend specific stuff, throw away the others. + ;; Select and protect backend specific stuff, throw away stuff + ;; that is specific for other backends (org-export-select-backend-specific-text backend) ;; Protect quoted subtrees @@ -1576,6 +1572,11 @@ on this string to produce the exported version." ;; Blockquotes and verse (org-export-mark-blockquote-and-verse) + ;; Remove timestamps, if the user has requested so + (org-export-remove-clock-lines) + (unless (plist-get parameters :timestamps) + (org-export-remove-timestamps)) + ;; Attach captions to the correct object (setq target-alist (org-export-attach-captions-and-attributes backend target-alist)) @@ -1606,16 +1607,16 @@ on this string to produce the exported version." ;; Another hook (run-hooks 'org-export-preprocess-before-backend-specifics-hook) - ;; Specific LaTeX stuff + ;; LaTeX-specific preprocessing (when latexp (require 'org-export-latex nil) (org-export-latex-preprocess)) - ;; Specific ASCII stuff + ;; ASCII-specific preprocessing (when asciip (org-export-ascii-preprocess)) - ;; Specific HTML stuff + ;; HTML-specific preprocessing (when htmlp (org-export-html-preprocess parameters)) @@ -1887,9 +1888,15 @@ from the buffer." (defun org-export-protect-colon-examples () "Protect lines starting with a colon." (goto-char (point-min)) - (while (re-search-forward "^[ \t]*:.*\\(\n[ \t]*:.*\\)*" nil t) - (add-text-properties (match-beginning 0) (match-end 0) - '(org-protected t)))) + (let ((re "^[ \t]*:\\([ \t]\\|$\\)") beg end) + (while (re-search-forward re nil t) + (beginning-of-line 1) + (setq beg (point)) + (while (looking-at re) + (end-of-line 1) + (or (eobp) (forward-char 1))) + (add-text-properties beg (if (bolp) (1- (point)) (point)) + '(org-protected t))))) (defun org-export-select-backend-specific-text (backend) (let ((formatters @@ -3440,7 +3447,7 @@ lang=\"%s\" xml:lang=\"%s\"> ;; Fixed-width, verbatim lines (examples) (when (and org-export-with-fixed-width - (string-match "^[ \t]*:\\(.*\\)" line)) + (string-match "^[ \t]*:\\(\\([ \t]\\|$\\).*\\)" line)) (when (not infixed) (setq infixed t) (org-close-par-maybe) diff --git a/lisp/org-export-latex.el b/lisp/org-export-latex.el index b5265fc7f..addd0c754 100644 --- a/lisp/org-export-latex.el +++ b/lisp/org-export-latex.el @@ -1022,17 +1022,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (defun org-export-latex-fixed-width (opt) "When OPT is non-nil convert fixed-width sections to LaTeX." (goto-char (point-min)) - (while (re-search-forward "^[ \t]*:" nil t) + (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t) (if opt (progn (goto-char (match-beginning 0)) (insert "\\begin{verbatim}\n") - (while (looking-at "^\\([ \t]*\\):\\(.*\\)$") + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") (replace-match (concat (match-string 1) (match-string 2)) t t) (forward-line)) (insert "\\end{verbatim}\n\n")) (progn (goto-char (match-beginning 0)) - (while (looking-at "^\\([ \t]*\\):\\(.*\\)$") + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") (replace-match (concat "%" (match-string 1) (match-string 2)) t t) (forward-line))))))