sub/superscript character has to follow a non-blank character

* lisp/org.el (org-match-substring-regexp,
  org-match-substring-with-braces-regexp): Update regexp.
  A sub/superscript cannot start anymore at the beginning of the line
  or after a space.
This commit is contained in:
Nicolas Goaziou 2013-02-25 21:30:16 +01:00
parent e024beaa7e
commit 11033a97dc
2 changed files with 2 additions and 14 deletions

View File

@ -5413,7 +5413,7 @@ stacked delimiters is N. Escaping delimiters is not possible."
(defvar org-match-substring-regexp
(concat
"\\([^\\]\\|^\\)\\([_^]\\)\\("
"\\(\\S-\\)\\([_^]\\)\\("
"\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
"\\|"
"\\(" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
@ -5423,7 +5423,7 @@ stacked delimiters is N. Escaping delimiters is not possible."
(defvar org-match-substring-with-braces-regexp
(concat
"\\([^\\]\\|^\\)\\([_^]\\)\\("
"\\(\\S-\\)\\([_^]\\)\\("
"\\(" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
"\\)")
"The regular expression matching a sub- or superscript, forcing braces.")

View File

@ -1684,12 +1684,6 @@ Outside list"
(should
(org-test-with-temp-text "a_{b}"
(org-element-map (org-element-parse-buffer) 'subscript 'identity)))
;; At the beginning of an item.
(should
(eq 'subscript
(org-test-with-temp-text "- _b"
(progn (search-forward "_")
(org-element-type (org-element-context))))))
;; Multiple subscripts in a paragraph.
(should
(= 2
@ -1710,12 +1704,6 @@ Outside list"
(should
(org-test-with-temp-text "a^{b}"
(org-element-map (org-element-parse-buffer) 'superscript 'identity)))
;; At the beginning of an item.
(should
(eq 'superscript
(org-test-with-temp-text "- ^b"
(progn (search-forward "^")
(org-element-type (org-element-context))))))
;; Multiple superscript in a paragraph.
(should
(= 2