emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: <c.buhtz@posteo.jp>
To: emacs-orgmode@gnu.org
Subject: Re: Inline markup: How does org identify nested code/verbatim?
Date: Sun, 29 Jan 2023 18:20:03 +0000	[thread overview]
Message-ID: <4P4fjw6Xy3z9rxN@submission02.posteo.de> (raw)
In-Reply-To: <4P4fNv4F48z6tmQ@submission01.posteo.de>

Please let me add the nested-regex-approach. I wouldn't call this a
solution but just an approach. No one understand that regex it is
nearly unmaintainable.

I hope for a more elegant solution.

This matches if we have code in verbatim
^|[ .,;:\-?!({\"']=.*?(?:^|[ .,;:\-?!({\"']~.*?~[.,;:\-?!)}\"']|$).*?=[ .,;:\-?!)}\"']|$

This matches if we have verbatim in code
(?:^|[ .,;:\-?!({\"']~.*?(?:^|[ .,;:\-?!({\"']=.*?=[.,;:\-?!)}\"']|$).*?~[ .,;:\-?!)}\"']|$)

If one of this matching I now which one of my "usual" regex pattern using catching groups to extract the content I should use first.

Just for testing (maybe on regex101.com) here is the text I used.

This =is ~code~ in verbatim= text.
This =is usual verbatim= text.

This ~is =verbatim= in code~ text.
This ~is usual code~ text.


  reply	other threads:[~2023-01-29 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-29 18:05 Inline markup: How does org identify nested code/verbatim? c.buhtz
2023-01-29 18:20 ` c.buhtz [this message]
2023-01-30  2:29   ` Max Nikulin
2023-01-30 14:56 ` Ihor Radchenko
2023-01-30 23:36   ` Tom Gillespie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4P4fjw6Xy3z9rxN@submission02.posteo.de \
    --to=c.buhtz@posteo.jp \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).