emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] Clock report produces malformed table when contributed headings contain "|" in their title [9.7-pre (release_9.6.16-1060-g1aa455 @ /home/yantar92/.emacs.d/straight/build/org/)]
@ 2024-01-14 13:56 Ihor Radchenko
  2024-01-14 20:18 ` Mark Barton
  0 siblings, 1 reply; 3+ messages in thread
From: Ihor Radchenko @ 2024-01-14 13:56 UTC (permalink / raw)
  To: emacs-orgmode

 
Consider the following Org file:  #+BEGIN: clocktable :scope file 
:maxlevel 2 #+END: 

* Heading with vertical bar | in its name
:LOGBOOK:
CLOCK: [2018-02-28 Wed 20:28]--[2018-02-28 Wed 22:29] =>  2:01 
:END: 

* Heading without vertical bar \vert in its name
:LOGBOOK:
CLOCK: [2018-02-28 Wed 20:28]--[2018-02-28 Wed 22:29] =>  2:01 
:END:  *  src_elisp{"|"} in its name
:LOGBOOK:
CLOCK: [2018-02-28 Wed 20:28]--[2018-02-28 Wed 22:29] =>  2:01 
:END: 
 

With point at the clock table, press C-c C-c.

Observe:

#+CAPTION: Clock summary at [2024-01-14 Sun 14:53]
| Headline                           | Time           |         |
|------------------------------------+----------------+---------|
| *Total time*                         | *6h 3min*        |         |
|------------------------------------+----------------+---------|
| Heading with vertical bar          | in its name    | 2h 1min |
| Heading without vertical bar \vert in... | 2h 1min        |         |
| src_elisp{"                        | "} in its name | 2h 1min |

Note how the first and last headings produce two table columns instead
of one.

The first heading is relatively easy to fix - we may replace "|" in
title with \vert entity.

Not so easy for src block and other verbatim text - there is simply no
way to escape "|" in tables.


Emacs  : GNU Emacs 30.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0)
 of 2024-01-13
Package: Org mode version 9.7-pre (release_9.6.16-1060-g1aa455 @ /home/yantar92/.emacs.d/straight/build/org/)
-- 
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] 3+ messages in thread

* Re: [BUG] Clock report produces malformed table when contributed headings contain "|" in their title [9.7-pre (release_9.6.16-1060-g1aa455 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2024-01-14 13:56 [BUG] Clock report produces malformed table when contributed headings contain "|" in their title [9.7-pre (release_9.6.16-1060-g1aa455 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
@ 2024-01-14 20:18 ` Mark Barton
  2024-01-15 13:04   ` Ihor Radchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Barton @ 2024-01-14 20:18 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode

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



> On Jan 14, 2024, at 5:56 AM, Ihor Radchenko <yantar92@posteo.net> wrote:
> 
> The first heading is relatively easy to fix - we may replace "|" in
> title with \vert entity.
> 
> Not so easy for src block and other verbatim text - there is simply no
> way to escape "|" in tables.

I have encountered this a couple times, usually in org captured items for Meetings that someone else typed for the Meeting name. I could not figure out how to escape them and just ended up modifying the header to not include the pipe char.

In your example of the src block, I don't normally make those headers, but could the pipe char be replaced only in the clock table? If clock table links are turned on then the header link should point to the header and just the description changes. 

Mark Barton

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

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

* Re: [BUG] Clock report produces malformed table when contributed headings contain "|" in their title [9.7-pre (release_9.6.16-1060-g1aa455 @ /home/yantar92/.emacs.d/straight/build/org/)]
  2024-01-14 20:18 ` Mark Barton
@ 2024-01-15 13:04   ` Ihor Radchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2024-01-15 13:04 UTC (permalink / raw)
  To: Mark Barton; +Cc: emacs-orgmode

Mark Barton <mbarton98@gmail.com> writes:

>> Not so easy for src block and other verbatim text - there is simply no
>> way to escape "|" in tables.
>
> ...
> In your example of the src block, I don't normally make those headers, but could the pipe char be replaced only in the clock table? If clock table links are turned on then the header link should point to the header and just the description changes. 

That's one option.
Another observation is that Org parser does not even allow inline src
blocks inside table cells. So, it might make more sense to remove all
the inline src blocks before creating the table cell.

Although, unlike inline src blocks, verbatim/code markup is allowed.
And something like =this|is|verbatim= is problematic - similar to inline
src blocks, altering the "|" inside may change the meaning.

To be clear, it is quite easy to write some kind of
`org-table-cell-escape' that will make sure that text inserted into a
table cell will not cause problems with table formatting. However, I'd
prefer to solve this problem in a more generic way, alongside with
similar problem of escaping "=" inside verbatim markup, edge cases with
link paths like

=should not be verbatim [[https:/example.com/?foo=?]], yet it is

and other edge cases.

-- 
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] 3+ messages in thread

end of thread, other threads:[~2024-01-15 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-14 13:56 [BUG] Clock report produces malformed table when contributed headings contain "|" in their title [9.7-pre (release_9.6.16-1060-g1aa455 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
2024-01-14 20:18 ` Mark Barton
2024-01-15 13:04   ` 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).