Jeff Trull <edas...@att.net> writes: >> During export, table may be not the same as it appears in the original >> document - some rows may be omitted. `org-export-table-row-number' >> returns the coordinates in as-exported table, not in the original table. >> > > Agreed. I believe this behavior contradicts its documentation string: > > "... Return value is zero-indexed and ignores separators. The function > returns nil > for special rows and separators." > > The language is different for what rows are ignored ("separators") and for > what cells it will > return nil ("special rows and separators"). This is consistent with the > user-facing addresses, > which do not consider separator rows, but do consider column alignment rows.
What about the attached patch?
>From 6457e6e3a9c112b9a1bc3a549a93f3cd6a64b2c3 Mon Sep 17 00:00:00 2001 Message-ID: <6457e6e3a9c112b9a1bc3a549a93f3cd6a64b2c3.1712062152.git.yanta...@posteo.net> From: Ihor Radchenko <yanta...@posteo.net> Date: Tue, 2 Apr 2024 15:49:01 +0300 Subject: [PATCH] lisp/ox.el (org-export-table-row-number): Clarify docstring --- lisp/ox.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/ox.el b/lisp/ox.el index c794c570f..8c7e092e3 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -5432,7 +5432,8 @@ (defun org-export-table-row-number (table-row info) "Return TABLE-ROW number. INFO is a plist used as a communication channel. Return value is zero-indexed and ignores separators. The function returns nil -for special rows and separators." +for separators and table rows that are marked to be ignored according +to the INFO plist." (when (eq (org-element-property :type table-row) 'standard) (let* ((cache (or (plist-get info :table-row-number-cache) (let ((table (make-hash-table :test #'eq))) -- 2.44.0
> In this case, it's not specific to any exporter. org-export--skip-p returns > true for column alignment rows with the following code: > > (table-cell > (and (org-export-table-has-special-column-p > (org-export-get-parent-table datum)) > (org-export-first-sibling-p datum options))) This part of the code is not for alignment rows, it is for special columns. > So these rows will be in the ignore-list for all exporters. This is no longer true on main. > ... And that's reasonable - when ignore-list is being used for > deciding what to export. The problem, as I see it, is that > org-export-table-row-number does not consider this when determining > the "address" of a cell. ?? `org-export-table-row-number' considers the ignore list because `org-element-map' considers it. > So, there is no bug here. >> > > I disagree :) and suggest the following change to org-export-row-number > (line 5390): > > info)) > > should become: > > (org-plist-delete info 'ignore-list))) > > which will make it consistent with its docstring and with user-facing > addresses. The docstring should be fixed, not the function behaviour. -- 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>