* [ox-html] bug in documentation of org-html-table-row-tags
@ 2013-03-27 9:35 Stefan Vollmar
2013-04-07 21:23 ` Bastien
0 siblings, 1 reply; 13+ messages in thread
From: Stefan Vollmar @ 2013-03-27 9:35 UTC (permalink / raw)
To: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1589 bytes --]
Hallo,
according to the documentation of org-html-table-row-tags in ox-html.el the following code can be used to assign different CSS classes to alternating rows:
(setq org-html-table-row-tags
(cons '(if head
\"<tr>\"
(if (= (mod nline 2) 1)
\"<tr class=\\\"tr-odd\\\">\"
\"<tr class=\\\"tr-even\\\">\"))
\"</tr>\"))
This does not work for me because of these problems:
eval: Symbol's value as variable is void: head
=: Symbol's value as variable is void: nline
My knowledge of elisp is very limited, but I assume fixing these errors would require defining head and a line counter nline around ll. 2976 in ox-html, at least the latter might be simple to fix.
However, I would suggest to implement this differently: have an option "org-html-alternating-table-row-classes" (or similar) that - if not nil - is used for alternating class names. Or - in keeping with hardwired class names like "org-ul" - always use "org-row-odd" and "org-row-even" if "org-html-alternating-table-row-classes" is not nil. Users who would prefer different class names could then still come up with their own definition of org-html-table-row-tags if needed.
Warm regards,
Stefan
--
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213 FAX +49-221-4726-298
Tel.: +49-221-478-5713 Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de http://www.nf.mpg.de
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4409 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-03-27 9:35 [ox-html] bug in documentation of org-html-table-row-tags Stefan Vollmar
@ 2013-04-07 21:23 ` Bastien
2013-04-09 10:52 ` Stefan Vollmar
0 siblings, 1 reply; 13+ messages in thread
From: Bastien @ 2013-04-07 21:23 UTC (permalink / raw)
To: Stefan Vollmar; +Cc: Org Mode Mailing List
Hi Stefan,
Stefan Vollmar <vollmar@nf.mpg.de> writes:
> according to the documentation of org-html-table-row-tags in
> ox-html.el the following code can be used to assign different CSS
> classes to alternating rows:
Obviously, this option has been simply copied from org-html.el
and the docstring was obsolete, because `head' is not dynamically
bound anymore.
> However, I would suggest to implement this differently: have an
> option "org-html-alternating-table-row-classes" (or similar) that -
> if not nil - is used for alternating class names. Or - in keeping
> with hardwired class names like "org-ul" - always use "org-row-odd"
> and "org-row-even" if "org-html-alternating-table-row-classes" is
> not nil. Users who would prefer different class names could then
> still come up with their own definition of org-html-table-row-tags
> if needed.
I pushed a fix which preserves the spirit of the previous option,
but with more variables to check against. I know this is not the
most user-friendly we can do here, but at least it is consistent
with what the code allows.
Thanks for reporting this!
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-07 21:23 ` Bastien
@ 2013-04-09 10:52 ` Stefan Vollmar
2013-04-09 11:46 ` Bastien
0 siblings, 1 reply; 13+ messages in thread
From: Stefan Vollmar @ 2013-04-09 10:52 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1466 bytes --]
Dear Bastien,
On 07.04.2013, at 23:23, Bastien wrote:
> [...] I pushed a fix which preserves the spirit of the previous option,
> but with more variables to check against. I know this is not the
> most user-friendly we can do here, but at least it is consistent
> with what the code allows.
Thanks for the fix!
But I think the lisp example is faulty in two respects: it needs to include the closing "</tr>" and the default case without class name.
The example given in the documentation:
(setq org-html-table-row-tags
(cons '(cond (top-row-p "<tr class=\"tr-top\">")
(bottom-row-p "<tr class=\"tr-bottom\">"))))
should probably be:
(setq org-html-table-row-tags
(cons '(cond (top-row-p "<tr class=\"tr-top\">")
(bottom-row-p "<tr class=\"tr-bottom\">")
(t "<tr>"))
"</tr>"))
This is already very useful. However, in addition to rowgroup-number, top-row-p and bottom-row-p it would be really helpful to have a row counter variable. Is this difficult to implement (I honestly tried but did not see an obvious way)?
Warm regards,
Stefan
--
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213 FAX +49-221-4726-298
Tel.: +49-221-478-5713 Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de http://www.nf.mpg.de
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4490 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 10:52 ` Stefan Vollmar
@ 2013-04-09 11:46 ` Bastien
2013-04-09 11:56 ` Stefan Vollmar
2013-04-09 14:56 ` Nicolas Goaziou
0 siblings, 2 replies; 13+ messages in thread
From: Bastien @ 2013-04-09 11:46 UTC (permalink / raw)
To: Stefan Vollmar; +Cc: Org Mode Mailing List
Hi Stefan,
Stefan Vollmar <vollmar@nf.mpg.de> writes:
> should probably be:
>
> (setq org-html-table-row-tags
> (cons '(cond (top-row-p "<tr class=\"tr-top\">")
> (bottom-row-p "<tr class=\"tr-bottom\">")
> (t "<tr>"))
> "</tr>"))
Of course, you're right, I fixed this.
> This is already very useful. However, in addition to
> rowgroup-number, top-row-p and bottom-row-p it would be really
> helpful to have a row counter variable. Is this difficult to
> implement (I honestly tried but did not see an obvious way)?
I think it is non-trivial -- as least non-trivial enough so that I
can't do it at the moment, sorry.
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 11:46 ` Bastien
@ 2013-04-09 11:56 ` Stefan Vollmar
2013-04-09 14:56 ` Nicolas Goaziou
1 sibling, 0 replies; 13+ messages in thread
From: Stefan Vollmar @ 2013-04-09 11:56 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1404 bytes --]
Dear Bastien,
On 09.04.2013, at 13:46, Bastien wrote:
>> (setq org-html-table-row-tags
>> (cons '(cond (top-row-p "<tr class=\"tr-top\">")
>> (bottom-row-p "<tr class=\"tr-bottom\">")
>> (t "<tr>"))
>> "</tr>"))
>
> Of course, you're right, I fixed this.
great, thanks!
>> This is already very useful. However, in addition to
>> rowgroup-number, top-row-p and bottom-row-p it would be really
>> helpful to have a row counter variable. Is this difficult to
>> implement (I honestly tried but did not see an obvious way)?
>
> I think it is non-trivial -- as least non-trivial enough so that I
> can't do it at the moment, sorry.
not a problem - "non-trivial" was my assessment, too, as this kind of counter probably needs to be part of some infrastructure several levels above org-html-table-row. But it would be desirable in the long run, for semi-cosmetic stuff like alternating row colours in tables, but potentially also for more concise error messages or more complex formatting options.
Warm regards,
Stefan
--
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213 FAX +49-221-4726-298
Tel.: +49-221-478-5713 Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de http://www.nf.mpg.de
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4490 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 11:46 ` Bastien
2013-04-09 11:56 ` Stefan Vollmar
@ 2013-04-09 14:56 ` Nicolas Goaziou
2013-04-09 15:19 ` Bastien
` (2 more replies)
1 sibling, 3 replies; 13+ messages in thread
From: Nicolas Goaziou @ 2013-04-09 14:56 UTC (permalink / raw)
To: Bastien; +Cc: Org Mode Mailing List
Hello,
Bastien <bzg@gnu.org> writes:
>> This is already very useful. However, in addition to
>> rowgroup-number, top-row-p and bottom-row-p it would be really
>> helpful to have a row counter variable. Is this difficult to
>> implement (I honestly tried but did not see an obvious way)?
>
> I think it is non-trivial -- as least non-trivial enough so that I
> can't do it at the moment, sorry.
Indeed. I had forgotten to implement such a tool in ox.el. I added
`org-export-table-row-number'.
Could you patch `org-html-table-row' accordingly?
Thanks.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 14:56 ` Nicolas Goaziou
@ 2013-04-09 15:19 ` Bastien
2013-04-09 17:18 ` Achim Gratz
2013-04-09 17:29 ` Stefan Vollmar
2 siblings, 0 replies; 13+ messages in thread
From: Bastien @ 2013-04-09 15:19 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Org Mode Mailing List
Hi Nicolas,
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Indeed. I had forgotten to implement such a tool in ox.el. I added
> `org-export-table-row-number'.
>
> Could you patch `org-html-table-row' accordingly?
Done, thanks!
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 14:56 ` Nicolas Goaziou
2013-04-09 15:19 ` Bastien
@ 2013-04-09 17:18 ` Achim Gratz
2013-04-09 20:50 ` Nicolas Goaziou
2013-04-09 17:29 ` Stefan Vollmar
2 siblings, 1 reply; 13+ messages in thread
From: Achim Gratz @ 2013-04-09 17:18 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou writes:
> Indeed. I had forgotten to implement such a tool in ox.el. I added
> `org-export-table-row-number'.
Sorry, but using this has quadratic complexity with the number of
rows...
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 17:18 ` Achim Gratz
@ 2013-04-09 20:50 ` Nicolas Goaziou
2013-04-10 16:32 ` Achim Gratz
0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Goaziou @ 2013-04-09 20:50 UTC (permalink / raw)
To: Achim Gratz; +Cc: emacs-orgmode
Hello,
Achim Gratz <Stromeko@nexgo.de> writes:
> Nicolas Goaziou writes:
>> Indeed. I had forgotten to implement such a tool in ox.el. I added
>> `org-export-table-row-number'.
>
> Sorry, but using this has quadratic complexity with the number of
> rows...
That's true. But that doesn't matter unless you plan to export thousand
row tables. Anyway, patches welcome.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 20:50 ` Nicolas Goaziou
@ 2013-04-10 16:32 ` Achim Gratz
2013-04-10 17:04 ` Nicolas Goaziou
0 siblings, 1 reply; 13+ messages in thread
From: Achim Gratz @ 2013-04-10 16:32 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou writes:
>> Sorry, but using this has quadratic complexity with the number of
>> rows...
>
> That's true. But that doesn't matter unless you plan to export thousand
> row tables. Anyway, patches welcome.
I've been thinking about this… the way I currently see it is that the
row-number should be a property of the table-row, just like the
rwo-group is.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-10 16:32 ` Achim Gratz
@ 2013-04-10 17:04 ` Nicolas Goaziou
0 siblings, 0 replies; 13+ messages in thread
From: Nicolas Goaziou @ 2013-04-10 17:04 UTC (permalink / raw)
To: Achim Gratz; +Cc: emacs-orgmode
Hello,
Achim Gratz <Stromeko@nexgo.de> writes:
> Nicolas Goaziou writes:
>>> Sorry, but using this has quadratic complexity with the number of
>>> rows...
>>
>> That's true. But that doesn't matter unless you plan to export thousand
>> row tables. Anyway, patches welcome.
>
> I've been thinking about this… the way I currently see it is that the
> row-number should be a property of the table-row, just like the
> rwo-group is.
The row-group isn't a property of the table-row. It is computed in
`org-export-table-row-group'.
A simple optimization would be to memoize row numbers. But, as I stated
earlier, this is not the bottleneck here. Huge tables are not, IMO,
common enough to justify this.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 14:56 ` Nicolas Goaziou
2013-04-09 15:19 ` Bastien
2013-04-09 17:18 ` Achim Gratz
@ 2013-04-09 17:29 ` Stefan Vollmar
2013-04-09 17:40 ` Bastien
2 siblings, 1 reply; 13+ messages in thread
From: Stefan Vollmar @ 2013-04-09 17:29 UTC (permalink / raw)
To: Nicolas Goaziou, Bastien; +Cc: Org Mode Mailing List
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
Dear Nicolas,
dear Bastien,
On 09.04.2013, at 16:56, Nicolas Goaziou wrote:
> [...] Indeed. I had forgotten to implement such a tool in ox.el. I added
> `org-export-table-row-number'.
>
> Could you patch `org-html-table-row' accordingly?
I suggest to replace the current lisp example in the documentation of org-html-table-row with (or similar):
(setq org-html-table-row-tags
(cons '(cond (top-row-p "<tr class=\"tr-top\">")
(bottom-row-p "<tr class=\"tr-bottom\">")
(t
(if (= (mod row-number 2) 1)
"<tr class=\"tr-odd\">"
"<tr class=\"tr-even\">")))
"</tr>"))
It now generates HTML code the way the old exporter used to work for alternating row colours/styles.
Thank you!
Warm regards,
Stefan
--
Dr. Stefan Vollmar, Dipl.-Phys.
Head of IT group
Max-Planck-Institut für neurologische Forschung
Gleueler Str. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213 FAX +49-221-4726-298
Tel.: +49-221-478-5713 Mobile: 0160-93874279
E-Mail: vollmar@nf.mpg.de http://www.nf.mpg.de
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 4490 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [ox-html] bug in documentation of org-html-table-row-tags
2013-04-09 17:29 ` Stefan Vollmar
@ 2013-04-09 17:40 ` Bastien
0 siblings, 0 replies; 13+ messages in thread
From: Bastien @ 2013-04-09 17:40 UTC (permalink / raw)
To: Stefan Vollmar; +Cc: Org Mode Mailing List, Nicolas Goaziou
Stefan Vollmar <vollmar@nf.mpg.de> writes:
> I suggest to replace the current lisp example in the documentation of org-html-table-row with (or similar):
>
> (setq org-html-table-row-tags
> (cons '(cond (top-row-p "<tr class=\"tr-top\">")
> (bottom-row-p "<tr class=\"tr-bottom\">")
> (t
> (if (= (mod row-number 2) 1)
> "<tr class=\"tr-odd\">"
> "<tr class=\"tr-even\">")))
> "</tr>"))
Done, thanks!
--
Bastien
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-04-10 17:04 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-27 9:35 [ox-html] bug in documentation of org-html-table-row-tags Stefan Vollmar
2013-04-07 21:23 ` Bastien
2013-04-09 10:52 ` Stefan Vollmar
2013-04-09 11:46 ` Bastien
2013-04-09 11:56 ` Stefan Vollmar
2013-04-09 14:56 ` Nicolas Goaziou
2013-04-09 15:19 ` Bastien
2013-04-09 17:18 ` Achim Gratz
2013-04-09 20:50 ` Nicolas Goaziou
2013-04-10 16:32 ` Achim Gratz
2013-04-10 17:04 ` Nicolas Goaziou
2013-04-09 17:29 ` Stefan Vollmar
2013-04-09 17:40 ` Bastien
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).