emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Description list with " :: " in the tag.
@ 2023-09-08 17:25 Tom Alexander
  2023-09-09  3:15 ` Max Nikulin
  2023-09-09  9:06 ` Ihor Radchenko
  0 siblings, 2 replies; 10+ messages in thread
From: Tom Alexander @ 2023-09-08 17:25 UTC (permalink / raw)
  To: emacs-orgmode

Emacs version: 29.1
Org-mode version: 163bafb43dcc2bc94a2c7ccaa77d3d1dd488f1af

Found a conflict between the documentation and the parser behavior. The org-mode documentation[1] for description list items says that TAG '[...] does not contain the substring " :: "'

Using this sample document, I have created a plain list item with a tag that contains that substring by wrapping it in a verbatim block:
```
- =foo :: bar= :: baz
```

Which parses to:
```
(org-data
 (:standard-properties
  [1 1 1 23 23 0 nil org-data nil nil nil 3 23 nil #<buffer *scratch*> nil nil nil]
  :path nil :CATEGORY nil)
 (section
  (:standard-properties
   [1 1 1 23 23 0 nil first-section nil nil nil 1 23 nil #<buffer *scratch*> nil nil #0])
  (plain-list
   (:standard-properties
    [1 1 1 23 23 0 nil top-comment nil nil nil nil nil nil #<buffer *scratch*> nil
       ((1 0 "- " nil nil "=foo :: bar=" 23))
       #1]
    :type descriptive)
   (item
    (:standard-properties
     [1 1 19 23 23 0
        (:tag)
        item nil nil nil nil nil nil #<buffer *scratch*> nil
        ((1 0 "- " nil nil "=foo :: bar=" 23))
        #2]
     :bullet "- " :checkbox nil :counter nil :pre-blank 0 :tag
     ((verbatim
       (:standard-properties
        [3 nil nil nil 15 0 nil nil nil nil nil nil nil nil #<buffer *scratch*> nil nil #3]
        :value "foo :: bar"))))
    (paragraph
     (:standard-properties
      [19 19 19 23 23 0 nil nil nil nil nil nil nil nil #<buffer *scratch*> nil nil #3])
     #("baz\n" 0 4
       (:parent #4)))))))
```

It seems that "TAG-TEXT" is not just text but it can include objects and those objects can include the substring " :: ".

[1] https://orgmode.org/worg/org-syntax.html#Items

--
Tom Alexander



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Description list with " :: " in the tag.
  2023-09-08 17:25 Description list with " :: " in the tag Tom Alexander
@ 2023-09-09  3:15 ` Max Nikulin
  2023-09-09  9:06 ` Ihor Radchenko
  1 sibling, 0 replies; 10+ messages in thread
From: Max Nikulin @ 2023-09-09  3:15 UTC (permalink / raw)
  To: emacs-orgmode


On 09/09/2023 00:25, Tom Alexander wrote:
> Using this sample document, I have created a plain list item with a tag
> that contains that substring by wrapping it in a verbatim block:
> ```
> - =foo :: bar= :: baz
> ```

The following does not address your particular question, it is just a 
warning. Be careful with "::" since the following is recognized as a 
description list item.

- =foo :: bar=



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Description list with " :: " in the tag.
  2023-09-08 17:25 Description list with " :: " in the tag Tom Alexander
  2023-09-09  3:15 ` Max Nikulin
@ 2023-09-09  9:06 ` Ihor Radchenko
  2023-09-10  4:22   ` Max Nikulin
  2023-09-11 16:05   ` Tom Alexander
  1 sibling, 2 replies; 10+ messages in thread
From: Ihor Radchenko @ 2023-09-09  9:06 UTC (permalink / raw)
  To: Tom Alexander; +Cc: emacs-orgmode

"Tom Alexander" <tom@fizz.buzz> writes:

> Emacs version: 29.1
> Org-mode version: 163bafb43dcc2bc94a2c7ccaa77d3d1dd488f1af
>
> Found a conflict between the documentation and the parser behavior. The org-mode documentation[1] for description list items says that TAG '[...] does not contain the substring " :: "'
>
> Using this sample document, I have created a plain list item with a tag that contains that substring by wrapping it in a verbatim block:
> ```
> - =foo :: bar= :: baz
> ```
>    (item
> ...
>         ((1 0 "- " nil nil "=foo :: bar=" 23))
> ...
> It seems that "TAG-TEXT" is not just text but it can include objects and those objects can include the substring " :: ".

It is simpler.
Everything after the bullet and before the last " :: " is considered as
tag. Everything after the last " :: " is description.
Then, tag and description are parsed, allowing objects inside.

org-syntax document is inaccurate here - it says that the _first_ " :: "
is used as tag:description delimiter, not the _last_.

I do not see any benefit changing the current parser. So, we probably
need to update org-syntax document instead.

-- 
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>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Description list with " :: " in the tag.
  2023-09-09  9:06 ` Ihor Radchenko
@ 2023-09-10  4:22   ` Max Nikulin
  2023-09-11 16:05   ` Tom Alexander
  1 sibling, 0 replies; 10+ messages in thread
From: Max Nikulin @ 2023-09-10  4:22 UTC (permalink / raw)
  To: emacs-orgmode

On 09/09/2023 16:06, Ihor Radchenko wrote:
> Everything after the bullet and before the last " :: " is considered as
> tag. Everything after the last " :: " is description.

I have not realized that besides

   - <shell:echo "a :: b">

that is parsed as 'b">' description, another surprise is

   - or :: <shell:echo "c :: d">

where description is 'd">' and the link is truncated.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Description list with " :: " in the tag.
  2023-09-09  9:06 ` Ihor Radchenko
  2023-09-10  4:22   ` Max Nikulin
@ 2023-09-11 16:05   ` Tom Alexander
  2023-09-13 22:52     ` Tom Alexander
  1 sibling, 1 reply; 10+ messages in thread
From: Tom Alexander @ 2023-09-11 16:05 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

Thanks!

-- 
Tom Alexander

On Sat, Sep 9, 2023, at 5:06 AM, Ihor Radchenko wrote:
> "Tom Alexander" <tom@fizz.buzz> writes:
>
>> Emacs version: 29.1
>> Org-mode version: 163bafb43dcc2bc94a2c7ccaa77d3d1dd488f1af
>>
>> Found a conflict between the documentation and the parser behavior. The org-mode documentation[1] for description list items says that TAG '[...] does not contain the substring " :: "'
>>
>> Using this sample document, I have created a plain list item with a tag that contains that substring by wrapping it in a verbatim block:
>> ```
>> - =foo :: bar= :: baz
>> ```
>>    (item
>> ...
>>         ((1 0 "- " nil nil "=foo :: bar=" 23))
>> ...
>> It seems that "TAG-TEXT" is not just text but it can include objects and those objects can include the substring " :: ".
>
> It is simpler.
> Everything after the bullet and before the last " :: " is considered as
> tag. Everything after the last " :: " is description.
> Then, tag and description are parsed, allowing objects inside.
>
> org-syntax document is inaccurate here - it says that the _first_ " :: "
> is used as tag:description delimiter, not the _last_.
>
> I do not see any benefit changing the current parser. So, we probably
> need to update org-syntax document instead.
>
> -- 
> 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>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Description list with " :: " in the tag.
  2023-09-11 16:05   ` Tom Alexander
@ 2023-09-13 22:52     ` Tom Alexander
  2023-09-14 11:24       ` [PATCH] " Ihor Radchenko
  2023-09-14 11:25       ` Ihor Radchenko
  0 siblings, 2 replies; 10+ messages in thread
From: Tom Alexander @ 2023-09-13 22:52 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

I've written a patch (attached) with my proposed wording changes to the documentation, should I be starting another thread or does dropping it here work best? I do not have commit access so I'd need someone with such authority to do the last bit.

-- 
Tom Alexander

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-syntax.org-Fix-definition-of-description-list-ta.patch --]
[-- Type: text/x-patch; name="0001-org-syntax.org-Fix-definition-of-description-list-ta.patch", Size: 1359 bytes --]

From 20addaa5ab7d4e9420ade1125c2a337345ecdd31 Mon Sep 17 00:00:00 2001
From: Tom Alexander <tom@fizz.buzz>
Date: Wed, 13 Sep 2023 18:19:05 -0400
Subject: [PATCH] org-syntax.org: Fix definition of description list tags.

Description lists support objects in their tags and they support the substring " :: ".
---
 org-syntax.org | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/org-syntax.org b/org-syntax.org
index 123fc232..3046e26c 100644
--- a/org-syntax.org
+++ b/org-syntax.org
@@ -470,9 +470,10 @@ BULLET COUNTER-SET CHECK-BOX TAG CONTENTS
 + CHECK-BOX (optional) :: A single whitespace character, an =X=
   character, or a hyphen enclosed by square brackets (i.e. =[ ]=, =[X]=, or =[-]=).
 + TAG (optional) :: An instance of the pattern =TAG-TEXT ::= where
-  =TAG-TEXT= represents a string consisting of non-newline characters
-  that does not contain the substring =" :: "= (two colons surrounded by
-  whitespace, without the quotes).
+  =TAG-TEXT= is one of more objects from the standard set so long as
+  they do not contain a newline character, until the last occurrence
+  of the substring =" :: "= (two colons surrounded by whitespace,
+  without the quotes).
 + CONTENTS (optional) :: A collection of zero or more elements, ending
   at the first instance of one of the following:
   - The next item.
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH] Re: Description list with " :: " in the tag.
  2023-09-13 22:52     ` Tom Alexander
@ 2023-09-14 11:24       ` Ihor Radchenko
  2023-09-20  0:09         ` Tom Alexander
  2023-09-14 11:25       ` Ihor Radchenko
  1 sibling, 1 reply; 10+ messages in thread
From: Ihor Radchenko @ 2023-09-14 11:24 UTC (permalink / raw)
  To: Tom Alexander; +Cc: emacs-orgmode

"Tom Alexander" <tom@fizz.buzz> writes:

> I've written a patch (attached) with my proposed wording changes to
> the documentation, should I be starting another thread or does
> dropping it here work best?

You can just modify subject with [PATCH], as I did.

> ... I do not have commit access so I'd need
> someone with such authority to do the last bit.

Sure.

> +  =TAG-TEXT= is one of more objects from the standard set so long as
> +  they do not contain a newline character, until the last occurrence
> +  of the substring =" :: "= (two colons surrounded by whitespace,
> +  without the quotes).

It does not fully represent what is going on - Org parser is top-down
and does not parse objects before it is done parsing the descriptive
list item. So,

- *foo :: bar* does not actually contain bold markup

Rather it is "* foo" tag + "bar* does not actually contain bold markup" description.

What happens is that the parser splits the first line of the item by the
last " :: " and only then proceeds with parsing the tag and description
using standard set of objects:

- <....> :: <text not containing :: >

-- 
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>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] Re: Description list with " :: " in the tag.
  2023-09-13 22:52     ` Tom Alexander
  2023-09-14 11:24       ` [PATCH] " Ihor Radchenko
@ 2023-09-14 11:25       ` Ihor Radchenko
  1 sibling, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2023-09-14 11:25 UTC (permalink / raw)
  To: Tom Alexander; +Cc: emacs-orgmode

"Tom Alexander" <tom@fizz.buzz> writes:

> I've written a patch (attached) with my proposed wording changes to
> the documentation, should I be starting another thread or does
> dropping it here work best?

You can just modify subject with [PATCH], as I did.

> ... I do not have commit access so I'd need
> someone with such authority to do the last bit.

Sure.

> +  =TAG-TEXT= is one of more objects from the standard set so long as
> +  they do not contain a newline character, until the last occurrence
> +  of the substring =" :: "= (two colons surrounded by whitespace,
> +  without the quotes).

It does not fully represent what is going on - Org parser is top-down
and does not parse objects before it is done parsing the descriptive
list item. So,

- *foo :: bar* does not actually contain bold markup

Rather it is "* foo" tag + "bar* does not actually contain bold markup" description.

What happens is that the parser splits the first line of the item by the
last " :: " and only then proceeds with parsing the tag and description
using standard set of objects:

- <....> :: <text not containing :: >

-- 
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>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Re: Description list with " :: " in the tag.
  2023-09-14 11:24       ` [PATCH] " Ihor Radchenko
@ 2023-09-20  0:09         ` Tom Alexander
  2023-09-20  9:00           ` Ihor Radchenko
  0 siblings, 1 reply; 10+ messages in thread
From: Tom Alexander @ 2023-09-20  0:09 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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

Sorry for the delay, I've been busy in the IRLs. I've updated the patch to reflect that the parser grabs the text before the last " :: " and then parses it as objects. The new patch is attached.

-- 
Tom Alexander

On Thu, Sep 14, 2023, at 7:24 AM, Ihor Radchenko wrote:
> "Tom Alexander" <tom@fizz.buzz> writes:
>
>> I've written a patch (attached) with my proposed wording changes to
>> the documentation, should I be starting another thread or does
>> dropping it here work best?
>
> You can just modify subject with [PATCH], as I did.
>
>> ... I do not have commit access so I'd need
>> someone with such authority to do the last bit.
>
> Sure.
>
>> +  =TAG-TEXT= is one of more objects from the standard set so long as
>> +  they do not contain a newline character, until the last occurrence
>> +  of the substring =" :: "= (two colons surrounded by whitespace,
>> +  without the quotes).
>
> It does not fully represent what is going on - Org parser is top-down
> and does not parse objects before it is done parsing the descriptive
> list item. So,
>
> - *foo :: bar* does not actually contain bold markup
>
> Rather it is "* foo" tag + "bar* does not actually contain bold markup" 
> description.
>
> What happens is that the parser splits the first line of the item by the
> last " :: " and only then proceeds with parsing the tag and description
> using standard set of objects:
>
> - <....> :: <text not containing :: >
>
> -- 
> 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>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-syntax.org-Fix-definition-of-description-list-ta.patch --]
[-- Type: text/x-patch; name="0001-org-syntax.org-Fix-definition-of-description-list-ta.patch", Size: 1353 bytes --]

From c8812bf7d81dc824d8ecf2c03368f58884773ddf Mon Sep 17 00:00:00 2001
From: Tom Alexander <tom@fizz.buzz>
Date: Wed, 13 Sep 2023 18:19:05 -0400
Subject: [PATCH] org-syntax.org: Fix definition of description list tags.

Description lists support objects in their tags and they support the substring " :: ".
---
 org-syntax.org | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/org-syntax.org b/org-syntax.org
index 123fc232..fc5e9a37 100644
--- a/org-syntax.org
+++ b/org-syntax.org
@@ -470,9 +470,10 @@ BULLET COUNTER-SET CHECK-BOX TAG CONTENTS
 + CHECK-BOX (optional) :: A single whitespace character, an =X=
   character, or a hyphen enclosed by square brackets (i.e. =[ ]=, =[X]=, or =[-]=).
 + TAG (optional) :: An instance of the pattern =TAG-TEXT ::= where
-  =TAG-TEXT= represents a string consisting of non-newline characters
-  that does not contain the substring =" :: "= (two colons surrounded by
-  whitespace, without the quotes).
+  =TAG-TEXT= is the text up until the last occurrence of of the
+  substring =" :: "= (two colons surrounded by whitespace, without the
+  quotes) on that line. =TAG-TEXT= is then parsed with the standard
+  set of objects.
 + CONTENTS (optional) :: A collection of zero or more elements, ending
   at the first instance of one of the following:
   - The next item.
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] Re: Description list with " :: " in the tag.
  2023-09-20  0:09         ` Tom Alexander
@ 2023-09-20  9:00           ` Ihor Radchenko
  0 siblings, 0 replies; 10+ messages in thread
From: Ihor Radchenko @ 2023-09-20  9:00 UTC (permalink / raw)
  To: Tom Alexander; +Cc: emacs-orgmode

"Tom Alexander" <tom@fizz.buzz> writes:

> Sorry for the delay, I've been busy in the IRLs. I've updated the patch to reflect that the parser grabs the text before the last " :: " and then parses it as objects. The new patch is attached.

Thanks!
Applied, onto master, with minor amendments (fixed "of of").
https://git.sr.ht/~bzg/worg/commit/ae64e1a5

-- 
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>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-09-20  8:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 17:25 Description list with " :: " in the tag Tom Alexander
2023-09-09  3:15 ` Max Nikulin
2023-09-09  9:06 ` Ihor Radchenko
2023-09-10  4:22   ` Max Nikulin
2023-09-11 16:05   ` Tom Alexander
2023-09-13 22:52     ` Tom Alexander
2023-09-14 11:24       ` [PATCH] " Ihor Radchenko
2023-09-20  0:09         ` Tom Alexander
2023-09-20  9:00           ` Ihor Radchenko
2023-09-14 11:25       ` Ihor Radchenko

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).