emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Tom Gillespie <tgbugs@gmail.com>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: Tim Cross <theophilusx@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: [Syntax discussion] Should we treat src blocks without LANG as paragraphs? (was: [BUG] ox-html does not export captions of source blocks without language)
Date: Fri, 16 Dec 2022 21:17:33 -0800	[thread overview]
Message-ID: <CA+G3_PMwiLb-tX_w5je+pp9YX95muC3WOzeDo24iqhfTLoxvHA@mail.gmail.com> (raw)
In-Reply-To: <878rj8u2na.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 1963 bytes --]

Hi Ihor,
   Chiming in here with a slight variant on what
others have said. Best!
Tom

I don't think this should be handled at the syntactic
layer at all. The empty string block language should
be syntactically valid with any special behavior
needed being handled later.

Linters could treat it as a warning/error though,
but the parsing is made significantly easier if
the empty string is present allowing the grammar
to be fully closed and regular.

Thus, I don't think we need to make this a syntactic
error or pun a src block without a lang to another type.

I think we can add an implementation for when the
block language is the empty string. This keeps
the grammar regular by removing a special case.

I assume that internally the empty string block lang
would mostly call the example block codepaths,
except that it should probably issue a warning or fail
if someone tries to org-src-edit the block so that we
can alert them that they are missing the lang.

Treating src blocks missing a lang as paragraphs is
incorrect because according to the syntax spec they
are syntactically still blocks (greater or lesser depending
on your inclinations).

I think the general principle we want to follow here is
that a block (or any entity in general) should not lose
its type because some part of its syntax is malformed
(I have made similar arguments about property drawers).

That is, if something starts with #+begin_NAME stuff
and there is a corresponding #+end_NAME, then it
is a block.

The choice of how a src block without a lang should
behave is a bit more complex as there are multiple
consumers of src blocks that make different assumptions.

As mentioned above. I think that if a block is missing the lang
we could think of it instead as the null language. If we have the
:var language because someone has other contents on the line
they have a well formed src block, but will get a different error
because there is currently no known language ":var".

[-- Attachment #2: Type: text/html, Size: 2576 bytes --]

  reply	other threads:[~2022-12-17  5:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 21:40 [BUG] ox-html does not export captions of source blocks without language Johan Bolmsjö
2022-12-14 21:51 ` Kaushal Modi
2022-12-14 22:05   ` Johan Bolmsjö
2022-12-15  9:31 ` [Syntax discussion] Should we treat src blocks without LANG as paragraphs? (was: [BUG] ox-html does not export captions of source blocks without language) Ihor Radchenko
2022-12-15 10:32   ` Kaushal Modi
2022-12-15 11:32   ` Max Nikulin
2022-12-15 14:29     ` Tim Cross
2022-12-15 15:07       ` Ihor Radchenko
2022-12-17  5:17         ` Tom Gillespie [this message]
2022-12-18  1:33           ` Tim Cross
2022-12-17 14:47         ` [Syntax discussion] Should we treat src blocks without LANG as paragraphs? Max Nikulin
2022-12-18 13:35           ` [BUG] org-latex-src-block-backend is directly used as variable instead of querying export option (was: [Syntax discussion] Should we treat src blocks without LANG as paragraphs?) Ihor Radchenko
2022-12-18 13:40             ` Timothy
2022-12-21 12:14               ` Ihor Radchenko
2022-12-27 14:18           ` [FR] Present list of errors in separate buffer when running org-export, similar to what org-lint does " Ihor Radchenko
2022-12-27 18:39             ` Tim Cross
2022-12-17  9:56     ` [Syntax discussion] Should we treat src blocks without LANG as paragraphs? (was: [BUG] ox-html does not export captions of source blocks without language) Ihor Radchenko
2022-12-15 13:32   ` Timothy
2022-12-27 14:08 ` [BUG] ox-html does not export captions of source blocks without language Ihor Radchenko
2023-01-16 10:09   ` Ihor Radchenko
2023-01-16 10:31     ` [ANN] orgtbl-fit tbanelwebmin
2023-01-24 19:55       ` Ihor Radchenko
2023-01-25 15:02         ` tbanelwebmin
2023-01-26 10:35           ` Ihor Radchenko
2023-01-26 19:13             ` tbanelwebmin
2023-02-20 10:50               ` Ihor Radchenko
2023-03-01 11:48                 ` tbanelwebmin
2023-03-03 15:13                   ` Ihor Radchenko
2023-03-05 18:46                     ` tbanelwebmin
2023-01-23 13:32     ` [BUG] ox-html does not export captions of source blocks without language Ihor Radchenko
  -- strict thread matches above, loose matches on Subject: below --
2022-12-16  6:15 [Syntax discussion] Should we treat src blocks without LANG as paragraphs? (was: [BUG] ox-html does not export captions of source blocks without language) Pedro Andres Aranda Gutierrez

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=CA+G3_PMwiLb-tX_w5je+pp9YX95muC3WOzeDo24iqhfTLoxvHA@mail.gmail.com \
    --to=tgbugs@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \
    --cc=yantar92@posteo.net \
    /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).