emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org table proposal: merge and split cells in org-tables


From: Jean Louis
Subject: Re: org table proposal: merge and split cells in org-tables
Date: Mon, 31 Oct 2022 08:56:26 +0300
User-agent: Mutt/2.2.7+37 (a90f69b) (2022-09-02)

* Ihor Radchenko <yantar92@posteo.net> [2022-10-30 12:27]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > To solve that problem personally, I use Asciidoctor, see how it is
> > done there:
> >
> > Example 76. Table with formatted, aligned and merged cells:
> > https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#ex-cell-format
> 
> I am sorry, but this looks unreadable. I would avoid re-using such
> syntax ideas.

You have got an extreme reference on what can be done. Other people
and other projects have faced same issues as you are facing in Org
mode, and have resolved it. To understand anything one cannot just
read simple reference, but better understand the surrounding meanings,
the context.

Org tables are nothing harder or simpler than tables in other
lightweight markup languages.

What appears "unreadable" to you is readable to other
person. In fact, there is no single char in the extreme example of
Asciidoc table below that you can't read. The meaning of
"unreadable" is most probably "not understandable". That is why I
said, one has to inspect the context and look for definitions.

[cols="e,m,^,>s",width="25%"]
|===
|1 >s|2 |3 |4
^|5 2.2+^.^|6 .3+<.>m|7
^|8
|9 2+>|10nnp
|===

In fact, looking into functionality of other lightweigh markup
languages may only be helpful for Org development.

For [cols="e,m,^p,>s",width="25%"] look here:
https://docs.asciidoctor.org/asciidoc/latest/tables/format-column-content/

Thus `e' before first comma, means emphasized (I guess) and in fact on
the original demonstration one can see that first column is
emphasized. 

The fact that one may "describe" column's font style in Asciidoc(tor)  could
be adopted as well in Org mode.

`m' after first comma says that text of that column shall be in
monospaced font, which I find very useful for table columns.

`^' signifies centered column in `[cols="e,m,^,>s",width="25%"]'

and `>s' means right centered, bold column;

`width=25%' tells about table width.

I would like it if Org mode could provide such functionality for
tables, to specify various attributes for columns. It does provide,
though I am not sure if it can provide so many.

And in that extreme example then we have following lines:

|===
for begin of the table

|1 >s|2 |3 |4
the second `|' has attribute `>s' or complete `>s|' which specifically
formats number "2" to be bold and right centered. 

^|5 2.2+^.^|6 .3+<.>m|7

It is good to read about span factor:
https://docs.asciidoctor.org/asciidoc/latest/tables/span-cells/

2.2+^.^|6 -- talks about spanning 2 columns, two rows and its alignment.

while .3+<.>m|7 talks about spanning 3 rows, that is where number 7 comes.

|===
for end of the table

It is surely good to try to make visual tables with merged cells as
general Org functionality. 

It is also very useful to look how other people implement various
functionalities and try to see if such could be useful in Org as well.

But when you don't have the functionality yet, due to the Babel and
inclusion of other files, one may achieve the final result by
including HTML directly, or by using external tools.

Org is integrator of almost anything. Babel and integration of, to the
Org external tools, allows user to include almost any value or results
from outside the file.

I do agree that it is "hard" to understand at once what it is, but it
is a solution for reason that Org allows external tools' values to be
included in the Org file. In this case it is the HTML output from
Asciidoctor. 

This elaboration is for opening the mind of Org user, it is to
understand that extensibility, due to Babel and inclusion of any
external tools has no limits at any point of time.

One need not wait for that feature X to be implemented in Org, while
there is plenty of available options to reach the purpose of feature
X.

#+BEGIN_SRC shell :results raw
echo "
[cols=\"e,m,^,>s\",width=\"25%\"]
|===
|1 >s|2 |3 |4
^|5 2.2+^.^|6 .3+<.>m|7
^|8
|9 2+>|10nnp
|===
" | asciidoctor -e -o - -

#+END_SRC

#+RESULTS:
<table class="tableblock frame-all grid-all" style="width: 25%;">
<colgroup>
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
<col style="width: 25%;">
</colgroup>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p 
class="tableblock"><em>1</em></p></td>
<td class="tableblock halign-right valign-top"><p 
class="tableblock"><strong>2</strong></p></td>
<td class="tableblock halign-center valign-top"><p class="tableblock">3</p></td>
<td class="tableblock halign-right valign-top"><p 
class="tableblock"><strong>4</strong></p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top"><p 
class="tableblock"><em>5</em></p></td>
<td class="tableblock halign-center valign-middle" colspan="2" rowspan="2"><p 
class="tableblock"><code>6</code></p></td>
<td class="tableblock halign-left valign-bottom" rowspan="3"><p 
class="tableblock"><code>7</code></p></td>
</tr>
<tr>
<td class="tableblock halign-center valign-top"><p 
class="tableblock"><em>8</em></p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p 
class="tableblock"><em>9</em></p></td>
<td class="tableblock halign-right valign-top" colspan="2"><p 
class="tableblock"><code>10nnp</code></p></td>
</tr>
</tbody>
</table>

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]