[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Subscript with parenthesis
From: |
Ihor Radchenko |
Subject: |
Re: Subscript with parenthesis |
Date: |
Fri, 22 Sep 2023 09:14:12 +0000 |
"Tom Alexander" <tom@fizz.buzz> writes:
> Some additional things I'm noticing:
>
> - when using parenthesis, :use-brackets-p is nil, so they're not equivalent
> to curly braces.
`org-element-subscript-parser' uses `org-match-substring-regexp', which
indeed allows foo_(...). This is not documented in org-syntax.org and in
the manual (12.3 Subscripts and Superscripts).
> - it does not support objects inside the parenthesis, just plain text, which
> again means they're not equivalent to braces.
Not true. I tried
b^(*asd*) and bold inside superscript does get parsed.
> - it, however, seems to require that the parenthesis are balanced because
> this test document does NOT contain a subscript:
> ```
> foo_(b(ar)
> ```
> which is closer to the curly braces requirement since that seems to be the
> only part of the subscript/superscript documentation that mentions needing
> balance.
Yup - the regexp used is the same with what we do for curly braces:
(defconst org-match-substring-regexp
(concat
"\\(\\S-\\)\\([_^]\\)\\("
"\\(?:" (org-create-multibrace-regexp "{" "}" org-match-sexp-depth) "\\)"
"\\|"
"\\(?:" (org-create-multibrace-regexp "(" ")" org-match-sexp-depth) "\\)"
"\\|"
"\\(?:\\*\\|[+-]?[[:alnum:].,\\]*[[:alnum:]]\\)\\)")
"The regular expression matching a sub- or superscript.")
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>