emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Regression in table.el detection? [maint]
@ 2021-01-04 18:47 Kaushal Modi
  2021-01-05  6:15 ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2021-01-04 18:47 UTC (permalink / raw)
  To: emacs-org list

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

Hello,

There has been a recent regression in table.el detection.

Earlier, this used to be detected as a table.el table, but now it's not
(entirely):


+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+----------+----------+----------+
| a        | b        | c        |
+----------+----------+----------+
| d        | e        | f        |
+----------+----------+----------+


Before:

<table border="1">
  <tr>
    <td align="left" valign="top">
      &nbsp;Header&nbsp;1&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;Header&nbsp;2&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;Header&nbsp;3&nbsp;
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
      &nbsp;a&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;b&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;c&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
  </tr>
  <tr>
    <td align="left" valign="top">
      &nbsp;d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;e&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;f&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </td>
  </tr>
</table>


After:

<table border="1">
  <tr>
    <td align="left" valign="top">
      &nbsp;Header&nbsp;1&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;Header&nbsp;2&nbsp;
    </td>
    <td align="left" valign="top">
      &nbsp;Header&nbsp;3&nbsp;
    </td>
  </tr>
</table>

I stumbled across this regression as I was looking into why my weekly cron
for ox-hugo tests failed:
https://travis-ci.org/github/kaushalmodi/ox-hugo/jobs/752831865


--
Kaushal Modi

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

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

* Re: Regression in table.el detection? [maint]
  2021-01-04 18:47 Regression in table.el detection? [maint] Kaushal Modi
@ 2021-01-05  6:15 ` Kyle Meyer
  2021-01-05  6:36   ` Kaushal Modi
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2021-01-05  6:15 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Kaushal Modi writes:

> Hello,
>
> There has been a recent regression in table.el detection.
>
> Earlier, this used to be detected as a table.el table, but now it's not
> (entirely):
>
>
> +----------+----------+----------+
> | Header 1 | Header 2 | Header 3 |
> +----------+----------+----------+
> | a        | b        | c        |
> +----------+----------+----------+
> | d        | e        | f        |
> +----------+----------+----------+

> Before:

Exporting that table to html, I see "Before" on release_9.4.4, maint
(273391c97), and master (00b4de329).

You're able to trigger the issue with a vanilla configuration on maint?


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

* Re: Regression in table.el detection? [maint]
  2021-01-05  6:15 ` Kyle Meyer
@ 2021-01-05  6:36   ` Kaushal Modi
  2021-01-05  6:43     ` Kaushal Modi
  0 siblings, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2021-01-05  6:36 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-org list

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

On Tue, Jan 5, 2021 at 1:15 AM Kyle Meyer <kyle@kyleam.com> wrote:

>
>
> Exporting that table to html, I see "Before" on release_9.4.4, maint
> (273391c97), and master (00b4de329).
>
> You're able to trigger the issue with a vanilla configuration on maint?
>

Hi Kyle,

Thanks for checking. Indeed ox-html export does not show that issue.

But the weekly cron (and even local) ox-hugo exports started showing this
issue after the update to table.el table detection change that happened a
few weeks ago.

I'll investigate why only ox-hugo is showing this issue.. I am simply
calling the table.el related function from ox-html:

=====
(defun org-blackfriday-table (table contents info)
  "Transcode TABLE element into Blackfriday Markdown format.

CONTENTS is contents of the table.  INFO is a plist holding
contextual information."
  ;; (message "[ox-bf-table DBG] In contents: %s" contents)
  (if (eq (org-element-property :type table) 'table.el)
      ;; "table.el" table.  Convert it using appropriate tools.
      (let ((tbl (org-html-table--table.el-table table info)))
        (message "%S" table) ; just added this for debug
        (message "%S" tbl) ; just added this for debug
=====

and I am getting only partial table in the "tbl" variable

=====
(table (:begin 1860 :end 2062 :type table\.el :tblfm nil :contents-begin
nil :contents-end nil :value "+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+----------+----------+----------+
| a | b | c |
+----------+----------+----------+
| d | e | f |
+----------+----------+----------+" :post-blank 1 :post-affiliated 1860
:parent (section (:begin 1703 :end 2062 :contents-begin 1703 :contents-end
2062 :post-blank 1 :post-affiliated 1703 :parent (org-data nil #2))
(special-block (:type "description" :begin 1703 :end 1783 :contents-begin
1723 :contents-end 1765 :post-blank 1 :post-affiliated 1703 :parent #2)
(paragraph (:begin 1723 :end 1765 :contents-begin 1723 :contents-end 1765
:post-blank 1 :post-affiliated 1723 :parent #3) #("Support tables written
in table.el format
" 0 42 (:parent #4)))) (paragraph (:begin 1783 :end 1860 :contents-begin
1783 :contents-end 1859 :post-blank 1 :post-affiliated 1783 :parent #2)
(verbatim (:value "ox-hugo" :begin 1783 :end 1793 :post-blank 1 :parent
#3)) #("Issue #" 0 7 (:parent #3)) (link (:type "https" :path "//
github.com/kaushalmodi/ox-hugo/issues/374" :format bracket :raw-link "
https://github.com/kaushalmodi/ox-hugo/issues/374" :application nil
:search-option nil :begin 1800 :end 1858 :contents-begin 1853 :contents-end
1856 :post-blank 0 :parent #3) #("374" 0 3 (:parent #4))) #("
" 0 1 (:parent #3))) #0)))
"<!-- This HTML table template is generated by emacs 28.0.50 -->
<table border=\"1\">
  <tr>
    <td align=\"left\" valign=\"top\">
      &nbsp;Header&nbsp;1&nbsp;
    </td>
    <td align=\"left\" valign=\"top\">
      &nbsp;Header&nbsp;2&nbsp;
    </td>
    <td align=\"left\" valign=\"top\">
      &nbsp;Header&nbsp;3&nbsp;
    </td>
  </tr>
</table>"
=====

I'll keep looking..

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

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

* Re: Regression in table.el detection? [maint]
  2021-01-05  6:36   ` Kaushal Modi
@ 2021-01-05  6:43     ` Kaushal Modi
  2021-01-05  7:19       ` Kaushal Modi
  0 siblings, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2021-01-05  6:43 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-org list

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

On Tue, Jan 5, 2021 at 1:36 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:

>
> I'll keep looking..
>

OK, when I added the same debug messages to ox-html.el, I see:

=====
(table (:begin 1860 :end 2104 :type table\.el :tblfm nil :contents-begin
nil :contents-end nil :value "+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+----------+----------+----------+
| a        | b        | c        |
+----------+----------+----------+
| d        | e        | f        |
+----------+----------+----------+" :post-blank 1 :post-affiliated 1860
:parent (section (:begin 1703 :end 2104 :contents-begin 1703 :contents-end
2104 :post-blank 1 :post-affiliated 1703 :parent (org-data nil #2))
(special-block (:type "description" :begin 1703 :end 1783 :contents-begin
1723 :contents-end 1765 :post-blank 1 :post-affiliated 1703 :parent #2)
(paragraph (:begin 1723 :end 1765 :contents-begin 1723 :contents-end 1765
:post-blank 1 :post-affiliated 1723 :parent #3) #("Support tables written
in table.el format
" 0 42 (:parent #4)))) (paragraph (:begin 1783 :end 1860 :contents-begin
1783 :contents-end 1859 :post-blank 1 :post-affiliated 1783 :parent #2)
(verbatim (:value "ox-hugo" :begin 1783 :end 1793 :post-blank 1 :parent
#3)) #("Issue #" 0 7 (:parent #3)) (link (:type "https" :path "//
github.com/kaushalmodi/ox-hugo/issues/374" :format bracket :raw-link "
https://github.com/kaushalmodi/ox-hugo/issues/374" :application nil
:search-option nil :begin 1800 :end 1858 :contents-begin 1853 :contents-end
1856 :post-blank 0 :parent #3) #("374" 0 3 (:parent #4))) #("
" 0 1 (:parent #3))) #0)))
"<!-- This HTML table template is generated by emacs 28.0.50 -->
=====

ox-hugo is stripping the leading/trailing spaces from the table cells,
while ox-html is not. Somehow that doesn't play with the recent change to
table.el detection.

I'll try fixing that in ox-hugo.

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

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

* Re: Regression in table.el detection? [maint]
  2021-01-05  6:43     ` Kaushal Modi
@ 2021-01-05  7:19       ` Kaushal Modi
  2021-01-05 17:09         ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Kaushal Modi @ 2021-01-05  7:19 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-org list

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

Hi Kyle,

I was able to reproduce with issue with ox-html as well.

Please copy paste this in a new temp.org file and run `C-c C-e h H':

* Subtree 1
+----------+----------+----------+
| Header 1 | Header 2 | Header 3 |
+----------+----------+----------+
| a        | b        | c        |
+----------+----------+----------+
| d        | e        | f        |
+----------+----------+----------+
* Subtree 2


The issue is when the "* Subtree 2" begins in the very next line after that
last line of table.el table ending in "--+".

When I export that, I see that ox-html fails to detect that table.el table
because I see this in the exported buffer:

=====
<table border="2" cellspacing="0" cellpadding="6" rules="groups"
frame="hsides" align="center" class="table-striped">


<colgroup>
<col  class="org-left" />

<col  class="org-left" />

<col  class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left">Header 1</td>
<td class="org-left">Header 2</td>
<td class="org-left">Header 3</td>
</tr>
</tbody>
</table>
<p>
<del>----------</del>----------<del>----------</del>
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups"
frame="hsides" align="center" class="table-striped">
=====

But if I introduce a newline before "* Subtree 2", the table.el table
detection works fine.



--
Kaushal Modi

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

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

* Re: Regression in table.el detection? [maint]
  2021-01-05  7:19       ` Kaushal Modi
@ 2021-01-05 17:09         ` Nicolas Goaziou
  2021-01-05 17:22           ` Kaushal Modi
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2021-01-05 17:09 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Kyle Meyer, emacs-org list

Hello,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> I was able to reproduce with issue with ox-html as well.
>
> Please copy paste this in a new temp.org file and run `C-c C-e h H':
>
> * Subtree 1
> +----------+----------+----------+
> | Header 1 | Header 2 | Header 3 |
> +----------+----------+----------+
> | a        | b        | c        |
> +----------+----------+----------+
> | d        | e        | f        |
> +----------+----------+----------+
> * Subtree 2
>
>
> The issue is when the "* Subtree 2" begins in the very next line after that
> last line of table.el table ending in "--+".

Oops. Fixed. Thank you.

Regards,
-- 
Nicolas Goaziou


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

* Re: Regression in table.el detection? [maint]
  2021-01-05 17:09         ` Nicolas Goaziou
@ 2021-01-05 17:22           ` Kaushal Modi
  0 siblings, 0 replies; 7+ messages in thread
From: Kaushal Modi @ 2021-01-05 17:22 UTC (permalink / raw)
  To: Kaushal Modi, Kyle Meyer, emacs-org list

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

On Tue, Jan 5, 2021 at 12:09 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Oops. Fixed. Thank you.
>

Thank you! for fixing this so quick :)

I confirm that fix you made in
https://code.orgmode.org/bzg/org-mode/commit/332da69b3c3ca222943728c20287e4ace6d40e61
.

Can you also please add a test for that? [My ox-hugo test suite will
anyways keep on serving via its weekly crons :) ]

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

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

end of thread, other threads:[~2021-01-05 17:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-04 18:47 Regression in table.el detection? [maint] Kaushal Modi
2021-01-05  6:15 ` Kyle Meyer
2021-01-05  6:36   ` Kaushal Modi
2021-01-05  6:43     ` Kaushal Modi
2021-01-05  7:19       ` Kaushal Modi
2021-01-05 17:09         ` Nicolas Goaziou
2021-01-05 17:22           ` Kaushal Modi

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