all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Aligning Columns in HTML Export Tables
@ 2010-10-20 16:42 Jeff Horn
  2010-10-20 17:16 ` Bernt Hansen
  0 siblings, 1 reply; 38+ messages in thread
From: Jeff Horn @ 2010-10-20 16:42 UTC (permalink / raw)
  To: Org-mode ml

Hi all,

Is there a way to specify a particular column in org-mode that will be
exported right-aligned in HTML?

| A | B | C |
| 1 | 2 | 3 |

For the table above, I would like column C right aligned when I export
to HTML, but the other column aligned in the default way (left
aligned?).

Thanks in advance,
Jeff

-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

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

* Re: Aligning Columns in HTML Export Tables
  2010-10-20 16:42 Aligning Columns in HTML Export Tables Jeff Horn
@ 2010-10-20 17:16 ` Bernt Hansen
  2010-10-20 19:04   ` Christian Moe
                     ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Bernt Hansen @ 2010-10-20 17:16 UTC (permalink / raw)
  To: Jeff Horn; +Cc: Org-mode ml

Jeff Horn <jrhorn424@gmail.com> writes:

> Is there a way to specify a particular column in org-mode that will be
> exported right-aligned in HTML?
>
> | A | B | C |
> | 1 | 2 | 3 |
>
> For the table above, I would like column C right aligned when I export
> to HTML, but the other column aligned in the default way (left
> aligned?).

I think this is supposed to work but it seems the exporters do not
honour the alignment details.

| <l> | <l> | <r> |
| A   | B   |   C |
| 1   | 2   |   3 |
| 12  | 13  | 300 |
| 9   | 11  |   4 |

Regards,
Bernt

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-20 17:16 ` Bernt Hansen
@ 2010-10-20 19:04   ` Christian Moe
  2010-10-20 20:11     ` Jeff Horn
  2010-10-21  0:25   ` Sebastian Rose
  2010-10-22  7:32   ` Carsten Dominik
  2 siblings, 1 reply; 38+ messages in thread
From: Christian Moe @ 2010-10-20 19:04 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Jeff Horn, Org-mode ml

On 10/20/10 7:16 PM, Bernt Hansen wrote:
> Jeff Horn<jrhorn424@gmail.com>  writes:
>
>> Is there a way to specify a particular column in org-mode that will be
>> exported right-aligned in HTML?
>>
>> | A | B | C |
>> | 1 | 2 | 3 |
>>
>> For the table above, I would like column C right aligned when I export
>> to HTML, but the other column aligned in the default way (left
>> aligned?).
>
> I think this is supposed to work but it seems the exporters do not
> honour the alignment details.
>
> |<l>  |<l>  |<r>  |
> | A   | B   |   C |
> | 1   | 2   |   3 |
> | 12  | 13  | 300 |
> | 9   | 11  |   4 |
>

That's what I find. Ironically, the HTML exporter even includes a 
=colgroup= with a local =align= attribute set on each =col=, but they 
all get set to ~align="right"~ despite the settings in the table. Not 
that it matters; e.g. Firefox doesn't honor colgroup formatting anyway.

As a CSS workaround for this particular example, you could add this to 
the header lines:

: #+style: <style>tr td + td + td {text-align: right;}</style>

-- but it would clearly be nicer if the exporter honored the settings.

Yours,
CM

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-20 19:04   ` Christian Moe
@ 2010-10-20 20:11     ` Jeff Horn
  0 siblings, 0 replies; 38+ messages in thread
From: Jeff Horn @ 2010-10-20 20:11 UTC (permalink / raw)
  To: mail; +Cc: Bernt Hansen, Org-mode ml

On Wed, Oct 20, 2010 at 3:04 PM, Christian Moe <mail@christianmoe.com> wrote:
> #+style: <style>tr td + td + td {text-align: right;}</style>

Thanks Christian, this workaround is OK for me at the moment since I'm
just making this change in one file.

+1 (naturally) for the exporter honoring column alignment settings.

-- 
Jeffrey Horn
Graduate Lecturer and PhD Student in Economics
George Mason University

(704) 271-4797
jhorn@gmu.edu
jrhorn424@gmail.com

http://www.failuretorefrain.com/jeff/

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-20 17:16 ` Bernt Hansen
  2010-10-20 19:04   ` Christian Moe
@ 2010-10-21  0:25   ` Sebastian Rose
  2010-10-21  7:36     ` Christian Moe
  2010-10-22  7:32   ` Carsten Dominik
  2 siblings, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-21  0:25 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: Jeff Horn, Org-mode ml

Bernt Hansen <bernt@norang.ca> writes:
> Jeff Horn <jrhorn424@gmail.com> writes:
>
>> Is there a way to specify a particular column in org-mode that will be
>> exported right-aligned in HTML?
>>
>> | A | B | C |
>> | 1 | 2 | 3 |
>>
>> For the table above, I would like column C right aligned when I export
>> to HTML, but the other column aligned in the default way (left
>> aligned?).
>
> I think this is supposed to work but it seems the exporters do not
> honour the alignment details.
>
> | <l> | <l> | <r> |
> | A   | B   |   C |
> | 1   | 2   |   3 |
> | 12  | 13  | 300 |
> | 9   | 11  |   4 |


I get 

<colgroup><col align="left" /><col align="left" /><col align="right" />
</colgroup>

as expected.

In Opera it works for me, if I remove the styles for `td' from my
stylesheet.  The styles for table data cells will overrule the align
attribute in the col tag.

Current Firefox seems to ignore the align attribute, although it's valid
XHTML.


The only save way to get the alignment right would be to use a "style"
attribute for each and every table cell directly:

   <td style="text-align:right">....




   Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-21  0:25   ` Sebastian Rose
@ 2010-10-21  7:36     ` Christian Moe
  2010-10-21  7:46       ` Carsten Dominik
  0 siblings, 1 reply; 38+ messages in thread
From: Christian Moe @ 2010-10-21  7:36 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml

On 10/21/10 2:25 AM, Sebastian Rose wrote:
(...)
>>
>> |<l>  |<l>  |<r>  |
>> | A   | B   |   C |
>> | 1   | 2   |   3 |
>> | 12  | 13  | 300 |
>> | 9   | 11  |   4 |
>
>
> I get
>
> <colgroup><col align="left" /><col align="left" /><col align="right" />
> </colgroup>
>
> as expected.

That's interesting. From the same example I get

<colgroup><col align="right" /><col align="right" /><col align="right" 
/></colgroup>

...using freshly pulled 7.01trans. What might account for the difference?

> In Opera it works for me, if I remove the styles for `td' from my
> stylesheet.  The styles for table data cells will overrule the align
> attribute in the col tag.
>
> Current Firefox seems to ignore the align attribute, although it's valid
> XHTML.

Good for Opera! I think Firefox generally ignores colgroup styling. 
Doesn't work on Safari, either.

CM

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-21  7:36     ` Christian Moe
@ 2010-10-21  7:46       ` Carsten Dominik
  2010-10-21 13:04         ` Sebastian Rose
  0 siblings, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-21  7:46 UTC (permalink / raw)
  To: mail; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml


On Oct 21, 2010, at 9:36 AM, Christian Moe wrote:

> On 10/21/10 2:25 AM, Sebastian Rose wrote:
> (...)
>>>
>>> |<l>  |<l>  |<r>  |
>>> | A   | B   |   C |
>>> | 1   | 2   |   3 |
>>> | 12  | 13  | 300 |
>>> | 9   | 11  |   4 |
>>
>>
>> I get
>>
>> <colgroup><col align="left" /><col align="left" /><col  
>> align="right" />
>> </colgroup>
>>
>> as expected.
>
> That's interesting. From the same example I get
>
> <colgroup><col align="right" /><col align="right" /><col  
> align="right" /></colgroup>
>
> ...using freshly pulled 7.01trans. What might account for the  
> difference?

Actually, I also get what Christian gets.  Sebastian, how did you get  
something different?

Currently alignment is only by the fraction of number in the column,  
not by the <l> and <r> markers.  Should be of cause...

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-21  7:46       ` Carsten Dominik
@ 2010-10-21 13:04         ` Sebastian Rose
  2010-10-21 13:25           ` Sebastian Rose
  0 siblings, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-21 13:04 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml, mail

Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Oct 21, 2010, at 9:36 AM, Christian Moe wrote:
>
>> On 10/21/10 2:25 AM, Sebastian Rose wrote:
>> (...)
>>>>
>>>> |<l>  |<l>  |<r>  |
>>>> | A   | B   |   C |
>>>> | 1   | 2   |   3 |
>>>> | 12  | 13  | 300 |
>>>> | 9   | 11  |   4 |
>>>
>>>
>>> I get
>>>
>>> <colgroup><col align="left" /><col align="left" /><col align="right" />
>>> </colgroup>
>>>
>>> as expected.
>>
>> That's interesting. From the same example I get
>>
>> <colgroup><col align="right" /><col align="right" /><col align="right"
>> /></colgroup>
>>
>> ...using freshly pulled 7.01trans. What might account for the difference?
>
> Actually, I also get what Christian gets.  Sebastian, how did you get something
> different?


I guess I just didn't pull for a few days.

Nononono, just kidding :)

I tried my own table, which is different:

a) The <l> line is the last one.
b) There's an empty extra column, the first one, as the docs propose.
   This column contains in the first cell of the "<l> | <r>" line  a
   slash: 

    |   | A   | B   |   C |
    |   | 1   | 2   |   3 |
    |   | 12  | 13  | 300 |
    |   | 9   | 11  |   4 |
    | / | <l> | <l> | <r> |


All this does not help.  But the third difference might be the key:

c) The table is a captured column view ("#+BEGIN: columnview...") with
   293 lines. 




  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-21 13:04         ` Sebastian Rose
@ 2010-10-21 13:25           ` Sebastian Rose
  0 siblings, 0 replies; 38+ messages in thread
From: Sebastian Rose @ 2010-10-21 13:25 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml, mail

Sebastian Rose <sebastian_rose@gmx.de> writes:
> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> On Oct 21, 2010, at 9:36 AM, Christian Moe wrote:
>>
>>> On 10/21/10 2:25 AM, Sebastian Rose wrote:
>>> (...)
>>>>>
>>>>> |<l>  |<l>  |<r>  |
>>>>> | A   | B   |   C |
>>>>> | 1   | 2   |   3 |
>>>>> | 12  | 13  | 300 |
>>>>> | 9   | 11  |   4 |
>>>>
>>>>
>>>> I get
>>>>
>>>> <colgroup><col align="left" /><col align="left" /><col align="right" />
>>>> </colgroup>
>>>>
>>>> as expected.
>>>
>>> That's interesting. From the same example I get
>>>
>>> <colgroup><col align="right" /><col align="right" /><col align="right"
>>> /></colgroup>
>>>
>>> ...using freshly pulled 7.01trans. What might account for the difference?
>>
>> Actually, I also get what Christian gets.  Sebastian, how did you get something
>> different?
>
>
> I guess I just didn't pull for a few days.
>
> Nononono, just kidding :)
>
> I tried my own table, which is different:
>
> a) The <l> line is the last one.
> b) There's an empty extra column, the first one, as the docs propose.
>    This column contains in the first cell of the "<l> | <r>" line  a
>    slash: 
>
>     |   | A   | B   |   C |
>     |   | 1   | 2   |   3 |
>     |   | 12  | 13  | 300 |
>     |   | 9   | 11  |   4 |
>     | / | <l> | <l> | <r> |
>
>
> All this does not help.  But the third difference might be the key:
>
> c) The table is a captured column view ("#+BEGIN: columnview...") with
>    293 lines. 


Well, OK, forget it...
It was just that my <l>s and <r>s matched with the sensible thing to do
for each column.

Seems it's just looking at the numbers and says "OK, numbers only, right
aligned",  just as you said in a previous mail.


 |   | A   | B    |   C  |
 |---+-----+------+------|
 |   | 1   | bar  | text |
 |   | 12  | test |  300 |
 |   | 9   | foo  |    4 |
 | / | <l> | <l>  |  <r> |


gives us

<colgroup><col align="right" /><col align="left" /><col align="left" />
</colgroup>


  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-20 17:16 ` Bernt Hansen
  2010-10-20 19:04   ` Christian Moe
  2010-10-21  0:25   ` Sebastian Rose
@ 2010-10-22  7:32   ` Carsten Dominik
  2010-10-22 11:20     ` Sebastian Rose
  2010-10-25  4:36     ` Baoqiu Cui
  2 siblings, 2 replies; 38+ messages in thread
From: Carsten Dominik @ 2010-10-22  7:32 UTC (permalink / raw)
  To: Bernt Hansen, Eric Schulte, Dan Davison, Baoqiu Cui
  Cc: Jeff Horn, Org-mode ml


On Oct 20, 2010, at 7:16 PM, Bernt Hansen wrote:

> Jeff Horn <jrhorn424@gmail.com> writes:
>
>> Is there a way to specify a particular column in org-mode that will  
>> be
>> exported right-aligned in HTML?
>>
>> | A | B | C |
>> | 1 | 2 | 3 |
>>
>> For the table above, I would like column C right aligned when I  
>> export
>> to HTML, but the other column aligned in the default way (left
>> aligned?).
>
> I think this is supposed to work but it seems the exporters do not
> honour the alignment details.
>
> | <l> | <l> | <r> |
> | A   | B   |   C |
> | 1   | 2   |   3 |
> | 12  | 13  | 300 |
> | 9   | 11  |   4 |

I have now fixed this issue, at least for the HTML exporter.

1. The HTML exporter now puts a style attribute onto each
    individual field to make sure the field is aligned correctly.
    Many Browsers need this, as pointed out by Sebastian.
    If you do not like this overhead, you can configure
    org-export-html-table-align-individual-fields.  If you
    do, the alignment will still be noted in the column tags,
    handled correctly by Opera, but not by Firefox and Safari.

2. The HTML exporter will also honor a "<c>" cookie.  Note that
    this will not change anything inside an Org buffer - this would
    be complex to implement because of all the extra magic Org does
    with limited column width etc etc.

3. The LaTeX exporter does not yet honor <c>, while it does honor
    <l> and <r>.  The reason for this is that currently the vector
    remembering the alignment is a vector of booleans, and larger
    changes are necessary in order to allow for a third value.
    This will come, but I do not have the time today.

Eric and Dan,

please take note of this change and make sure that the Babel routines
do not get in trouble by this new cookie.

Baoqiu,

(or any other users of the docbook exporter)
I am not sure if the docbook format has suffered from this change,
could you please run a few tests involving tables and report back?

Jeff, thanks for kicking this threat off, this is a nice improvement.

Cheers

- Carsten

Cheers


>
> Regards,
> Bernt
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22  7:32   ` Carsten Dominik
@ 2010-10-22 11:20     ` Sebastian Rose
  2010-10-22 11:27       ` Carsten Dominik
  2010-10-25  4:36     ` Baoqiu Cui
  1 sibling, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-22 11:20 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml, Baoqiu Cui

Carsten Dominik <carsten.dominik@gmail.com> writes:
>> | <l> | <l> | <r> |
>> | A   | B   |   C |
>> | 1   | 2   |   3 |
>> | 12  | 13  | 300 |
>> | 9   | 11  |   4 |
>
> I have now fixed this issue, at least for the HTML exporter.
>
> 1. The HTML exporter now puts a style attribute onto each
>    individual field to make sure the field is aligned correctly.
>    Many Browsers need this, as pointed out by Sebastian.
>    If you do not like this overhead, you can configure
>    org-export-html-table-align-individual-fields.  If you
>    do, the alignment will still be noted in the column tags,
>    handled correctly by Opera, but not by Firefox and Safari.
>
> 2. The HTML exporter will also honor a "<c>" cookie.  Note that
>    this will not change anything inside an Org buffer - this would
>    be complex to implement because of all the extra magic Org does
>    with limited column width etc etc.
>
> 3. The LaTeX exporter does not yet honor <c>, while it does honor
>    <l> and <r>.  The reason for this is that currently the vector
>    remembering the alignment is a vector of booleans, and larger
>    changes are necessary in order to allow for a third value.
>    This will come, but I do not have the time today.



Hi Carsten,


 |   | A   | B    |    C |
 |---+-----+------+------|
 |   | 1   | bar  | text |
 |   | 12  | test |  300 |
 |   | 9   | foo  |    4 |
 | / | <>  | <>   |  <>  |


now gives me:

<table border="0" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption></caption>
<colgroup><col align="right" /></colgroup>
<colgroup><col align="left" /></colgroup>
<colgroup><col align="left" /></colgroup>
<thead>


and I have no style attributes in the <td> tags. 



  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 11:20     ` Sebastian Rose
@ 2010-10-22 11:27       ` Carsten Dominik
  2010-10-22 13:59         ` Sebastian Rose
  0 siblings, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-22 11:27 UTC (permalink / raw)
  To: Sebastian Rose
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml, Baoqiu Cui

Hi Sebastian,

my guess would be that you have customized the td and th tags?  If  
yes, please reset the customization, you need the new default values  
(which you then can still modify).

Please check the variables org-export-table-header-tags and
org-export-table-data-tags.

- Carsten

On Oct 22, 2010, at 1:20 PM, Sebastian Rose wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> | <l> | <l> | <r> |
>>> | A   | B   |   C |
>>> | 1   | 2   |   3 |
>>> | 12  | 13  | 300 |
>>> | 9   | 11  |   4 |
>>
>> I have now fixed this issue, at least for the HTML exporter.
>>
>> 1. The HTML exporter now puts a style attribute onto each
>>   individual field to make sure the field is aligned correctly.
>>   Many Browsers need this, as pointed out by Sebastian.
>>   If you do not like this overhead, you can configure
>>   org-export-html-table-align-individual-fields.  If you
>>   do, the alignment will still be noted in the column tags,
>>   handled correctly by Opera, but not by Firefox and Safari.
>>
>> 2. The HTML exporter will also honor a "<c>" cookie.  Note that
>>   this will not change anything inside an Org buffer - this would
>>   be complex to implement because of all the extra magic Org does
>>   with limited column width etc etc.
>>
>> 3. The LaTeX exporter does not yet honor <c>, while it does honor
>>   <l> and <r>.  The reason for this is that currently the vector
>>   remembering the alignment is a vector of booleans, and larger
>>   changes are necessary in order to allow for a third value.
>>   This will come, but I do not have the time today.
>
>
>
> Hi Carsten,
>
>
> |   | A   | B    |    C |
> |---+-----+------+------|
> |   | 1   | bar  | text |
> |   | 12  | test |  300 |
> |   | 9   | foo  |    4 |
> | / | <>  | <>   |  <>  |
>
>
> now gives me:
>
> <table border="0" cellspacing="0" cellpadding="6" rules="groups"  
> frame="hsides">
> <caption></caption>
> <colgroup><col align="right" /></colgroup>
> <colgroup><col align="left" /></colgroup>
> <colgroup><col align="left" /></colgroup>
> <thead>
>
>
> and I have no style attributes in the <td> tags.
>
>
>
>  Sebastian

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 11:27       ` Carsten Dominik
@ 2010-10-22 13:59         ` Sebastian Rose
  2010-10-22 15:41           ` Carsten Dominik
  0 siblings, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-22 13:59 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml, Baoqiu Cui

Carsten Dominik <carsten.dominik@gmail.com> writes:
> Hi Sebastian,
>
> my guess would be that you have customized the td and th tags?  If yes, please
> reset the customization, you need the new default values  (which you then can
> still modify).
>
> Please check the variables org-export-table-header-tags and
> org-export-table-data-tags.


I've checked them, but they are not customized:

    Hide Org Export Table Data Tags:
         Opening tag: <td%s>
         Closing tag: </td>
              State : STANDARD.
    
    Hide Org Export Table Header Tags:
         Opening tag: <th scope="%s">
         Closing tag: </th>
              State : STANDARD.


The export of the OPs table works as expected.  But the table I've sent
is different in that it just uses empty `<>' marks for grouping and
creating lines.


  Sebastian



>> |   | A   | B    |    C |
>> |---+-----+------+------|
>> |   | 1   | bar  | text |
>> |   | 12  | test |  300 |
>> |   | 9   | foo  |    4 |
>> | / | <>  | <>   |  <>  |
>>
>>
>> now gives me:
>>
>> <table border="0" cellspacing="0" cellpadding="6" rules="groups"
>> frame="hsides">
>> <caption></caption>
>> <colgroup><col align="right" /></colgroup>
>> <colgroup><col align="left" /></colgroup>
>> <colgroup><col align="left" /></colgroup>
>> <thead>
>>
>>
>> and I have no style attributes in the <td> tags.

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 13:59         ` Sebastian Rose
@ 2010-10-22 15:41           ` Carsten Dominik
  2010-10-22 19:30             ` Sebastian Rose
  2010-10-22 19:37             ` Sebastian Rose
  0 siblings, 2 replies; 38+ messages in thread
From: Carsten Dominik @ 2010-10-22 15:41 UTC (permalink / raw)
  To: Sebastian Rose
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml, Baoqiu Cui


On Oct 22, 2010, at 3:59 PM, Sebastian Rose wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> Hi Sebastian,
>>
>> my guess would be that you have customized the td and th tags?  If  
>> yes, please
>> reset the customization, you need the new default values  (which  
>> you then can
>> still modify).
>>
>> Please check the variables org-export-table-header-tags and
>> org-export-table-data-tags.
>
>
> I've checked them, but they are not customized:
>
>    Hide Org Export Table Data Tags:
>         Opening tag: <td%s>
>         Closing tag: </td>
>              State : STANDARD.

This does look right.

>
>    Hide Org Export Table Header Tags:
>         Opening tag: <th scope="%s">
>         Closing tag: </th>
>              State : STANDARD.

This does not look right, it should be

         Opening tag: <th scope="%s"%s>
         Closing tag: </th>


>
>
> The export of the OPs table works as expected.  But the table I've  
> sent
> is different in that it just uses empty `<>' marks for grouping and
> creating lines.

While I do not think it is particularly nice that you
try to fool the parser in this way :-/
it actually behaves quite well :-D

Here is what I get when I export this table:

-------------------------------------------------------------------------------------------
<table border="2" cellspacing="0" cellpadding="6" rules="groups"  
frame="hsides">
<caption></caption>
<colgroup><col align="right" /></colgroup><colgroup><col align="left" / 
 ></colgroup><colgroup><col align="left" /></colgroup>
<thead>
<tr><th scope="col" style="text-align:right">A</th><th scope="col"  
style="text-align:left">B</th><th scope="col" style="text- 
align:left">C</th></tr>
</thead>
<tbody>
<tr><td style="text-align:right">1</td><td style="text- 
align:left">bar</td><td style="text-align:left">text</td></tr>
<tr><td style="text-align:right">12</td><td style="text- 
align:left">test</td><td style="text-align:left">300</td></tr>
<tr><td style="text-align:right">9</td><td style="text- 
align:left">foo</td><td style="text-align:left">4</td></tr>
</tbody>
</table>
-------------------------------------------------------------------------------------------


The left/right comes from the analysis of the number of numbers
in each column...

So I must assume that maybe some of your files did not
update correctly or you have some old compiled files... ?

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 15:41           ` Carsten Dominik
@ 2010-10-22 19:30             ` Sebastian Rose
  2010-10-23  5:42               ` Carsten Dominik
  2010-10-22 19:37             ` Sebastian Rose
  1 sibling, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-22 19:30 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml, Baoqiu Cui

Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Oct 22, 2010, at 3:59 PM, Sebastian Rose wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> Hi Sebastian,
>>>
>>> my guess would be that you have customized the td and th tags?  If yes,
>>> please
>>> reset the customization, you need the new default values  (which you then can
>>> still modify).
>>>
>>> Please check the variables org-export-table-header-tags and
>>> org-export-table-data-tags.
>>
>>
>> I've checked them, but they are not customized:
>>
>>    Hide Org Export Table Data Tags:
>>         Opening tag: <td%s>
>>         Closing tag: </td>
>>              State : STANDARD.
>
> This does look right.
>
>>
>>    Hide Org Export Table Header Tags:
>>         Opening tag: <th scope="%s">
>>         Closing tag: </th>
>>              State : STANDARD.
>
> This does not look right, it should be
>
>         Opening tag: <th scope="%s"%s>
>         Closing tag: </th>
>
>
>>
>>
>> The export of the OPs table works as expected.  But the table I've sent
>> is different in that it just uses empty `<>' marks for grouping and
>> creating lines.
>
> While I do not think it is particularly nice that you
> try to fool the parser in this way :-/
> it actually behaves quite well :-D
>
> Here is what I get when I export this table:
>
> -------------------------------------------------------------------------------------------
> <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
> <caption></caption>
> <colgroup><col align="right" /></colgroup><colgroup><col align="left" /
>></colgroup><colgroup><col align="left" /></colgroup>
> <thead>
> <tr><th scope="col" style="text-align:right">A</th><th scope="col"
> style="text-align:left">B</th><th scope="col" style="text- 
> align:left">C</th></tr>
> </thead>
> <tbody>
> <tr><td style="text-align:right">1</td><td style="text-
> align:left">bar</td><td style="text-align:left">text</td></tr>
> <tr><td style="text-align:right">12</td><td style="text-
> align:left">test</td><td style="text-align:left">300</td></tr>
> <tr><td style="text-align:right">9</td><td style="text-
> align:left">foo</td><td style="text-align:left">4</td></tr>
> </tbody>
> </table>
> -------------------------------------------------------------------------------------------
>
>
> The left/right comes from the analysis of the number of numbers
> in each column...
>
> So I must assume that maybe some of your files did not
> update correctly or you have some old compiled files... ?


OK, found it.  It was in my .emacs which I didn't use for ages...

But:

  <colgroup><col align="right" /></colgroup><colgroup><col align="left" /></colgroup><colgroup><col align="left" /></colgroup>

must be:

  <colgroup><col align="right" /><col align="left" /><col align="left" /></colgroup>


i.e. "<colgroup>" and "</colgroup>" have to occur only once each and
wrap the "<col ... />" definitions.

The </colgroup> after each "<col ... />" happens only for the second
table.  The rest is just fine :)


Correct:

 |   | A   | B    |    C |
 |---+-----+------+------|
 |   | 1   | bar  | text |
 |   | 12  | test |  300 |
 |   | 9   | foo  |    4 |
 | / | <l> | <l>  |  <r> |


Wrong:

 |   |  A | B    | C    |
 |---+----+------+------|
 |   |  1 | bar  | text |
 |   | 12 | test | 300  |
 |   |  9 | foo  | 4    |
 | / | <> | <>   | <>   |


Thanks for the fix!


  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 15:41           ` Carsten Dominik
  2010-10-22 19:30             ` Sebastian Rose
@ 2010-10-22 19:37             ` Sebastian Rose
  2010-10-23  5:53               ` Carsten Dominik
  1 sibling, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-22 19:37 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml, Baoqiu Cui

Carsten Dominik <carsten.dominik@gmail.com> writes:
> On Oct 22, 2010, at 3:59 PM, Sebastian Rose wrote:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> Hi Sebastian,
>>>
>>> my guess would be that you have customized the td and th tags?  If yes,
>>> please
>>> reset the customization, you need the new default values  (which you then can
>>> still modify).
>>>
>>> Please check the variables org-export-table-header-tags and
>>> org-export-table-data-tags.
>>
>>
>> I've checked them, but they are not customized:
>>
>>    Hide Org Export Table Data Tags:
>>         Opening tag: <td%s>
>>         Closing tag: </td>
>>              State : STANDARD.
>
> This does look right.
>
>>
>>    Hide Org Export Table Header Tags:
>>         Opening tag: <th scope="%s">
>>         Closing tag: </th>
>>              State : STANDARD.
>
> This does not look right, it should be
>
>         Opening tag: <th scope="%s"%s>
>         Closing tag: </th>
>
>
>>
>>
>> The export of the OPs table works as expected.  But the table I've sent
>> is different in that it just uses empty `<>' marks for grouping and
>> creating lines.
>
> While I do not think it is particularly nice that you
> try to fool the parser in this way :-/
> it actually behaves quite well :-D
>
> Here is what I get when I export this table:
>
> -------------------------------------------------------------------------------------------
> <table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
> <caption></caption>
> <colgroup><col align="right" /></colgroup><colgroup><col align="left" /
>></colgroup><colgroup><col align="left" /></colgroup>
> <thead>
> <tr><th scope="col" style="text-align:right">A</th><th scope="col"
> style="text-align:left">B</th><th scope="col" style="text-
> align:left">C</th></tr>
> </thead>
> <tbody>
> <tr><td style="text-align:right">1</td><td style="text-
> align:left">bar</td><td style="text-align:left">text</td></tr>
> <tr><td style="text-align:right">12</td><td style="text-
> align:left">test</td><td style="text-align:left">300</td></tr>
> <tr><td style="text-align:right">9</td><td style="text-
> align:left">foo</td><td style="text-align:left">4</td></tr>
> </tbody>
> </table>
> -------------------------------------------------------------------------------------------
>
>
> The left/right comes from the analysis of the number of numbers
> in each column...
>
> So I must assume that maybe some of your files did not
> update correctly or you have some old compiled files... ?
>
> - Carsten

Hi Carsten,


one more, sorry.


How about this (line-wrapped for readability):


 <tr>
  <td class="right">1</td>
  <td class="left">bar</td>
  <td class="left">text</td>
 <tr>

instead of

 <tr>
  <td style="text-align:right">1</td>
  <td style="text-align:left">bar</td>
  <td style="text-align:left">text</td>
 <tr>

??


Combined with the ways to add IDs and classes to tables, we could then style the
columns better.

I would like to set this for right aligned <td> tags as default:

   td.right { font-family:monospace;text-align:right; }

since most of the time I want fixed width fonts in right aligned cells.



  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 19:30             ` Sebastian Rose
@ 2010-10-23  5:42               ` Carsten Dominik
  2010-10-23 19:03                 ` Sebastian Rose
  0 siblings, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-23  5:42 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org-mode ml


On Oct 22, 2010, at 9:30 PM, Sebastian Rose wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> On Oct 22, 2010, at 3:59 PM, Sebastian Rose wrote:
>>
>>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>>> Hi Sebastian,
>>>>
>>>> my guess would be that you have customized the td and th tags?   
>>>> If yes,
>>>> please
>>>> reset the customization, you need the new default values  (which  
>>>> you then can
>>>> still modify).
>>>>
>>>> Please check the variables org-export-table-header-tags and
>>>> org-export-table-data-tags.
>>>
>>>
>>> I've checked them, but they are not customized:
>>>
>>>   Hide Org Export Table Data Tags:
>>>        Opening tag: <td%s>
>>>        Closing tag: </td>
>>>             State : STANDARD.
>>
>> This does look right.
>>
>>>
>>>   Hide Org Export Table Header Tags:
>>>        Opening tag: <th scope="%s">
>>>        Closing tag: </th>
>>>             State : STANDARD.
>>
>> This does not look right, it should be
>>
>>        Opening tag: <th scope="%s"%s>
>>        Closing tag: </th>
>>
>>
>>>
>>>
>>> The export of the OPs table works as expected.  But the table I've  
>>> sent
>>> is different in that it just uses empty `<>' marks for grouping and
>>> creating lines.
>>
>> While I do not think it is particularly nice that you
>> try to fool the parser in this way :-/
>> it actually behaves quite well :-D
>>
>> Here is what I get when I export this table:
>>
>> -------------------------------------------------------------------------------------------
>> <table border="2" cellspacing="0" cellpadding="6" rules="groups"  
>> frame="hsides">
>> <caption></caption>
>> <colgroup><col align="right" /></colgroup><colgroup><col  
>> align="left" /
>>> </colgroup><colgroup><col align="left" /></colgroup>
>> <thead>
>> <tr><th scope="col" style="text-align:right">A</th><th scope="col"
>> style="text-align:left">B</th><th scope="col" style="text-
>> align:left">C</th></tr>
>> </thead>
>> <tbody>
>> <tr><td style="text-align:right">1</td><td style="text-
>> align:left">bar</td><td style="text-align:left">text</td></tr>
>> <tr><td style="text-align:right">12</td><td style="text-
>> align:left">test</td><td style="text-align:left">300</td></tr>
>> <tr><td style="text-align:right">9</td><td style="text-
>> align:left">foo</td><td style="text-align:left">4</td></tr>
>> </tbody>
>> </table>
>> -------------------------------------------------------------------------------------------
>>
>>
>> The left/right comes from the analysis of the number of numbers
>> in each column...
>>
>> So I must assume that maybe some of your files did not
>> update correctly or you have some old compiled files... ?
>
>
> OK, found it.  It was in my .emacs which I didn't use for ages...
>
> But:
>
>  <colgroup><col align="right" /></colgroup><colgroup><col  
> align="left" /></colgroup><colgroup><col align="left" /></colgroup>
>
> must be:
>
>  <colgroup><col align="right" /><col align="left" /><col  
> align="left" /></colgroup>
>
>
> i.e. "<colgroup>" and "</colgroup>" have to occur only once each and
> wrap the "<col ... />" definitions.
>
> The </colgroup> after each "<col ... />" happens only for the second
> table.

Hi Sebastian,

Are you sure about this?  Because the <> is special syntax for Org to  
define
column groups, and I believe it is OK to have multiple column groups in
a table.

- Carsten

>
>
> Correct:
>
> |   | A   | B    |    C |
> |---+-----+------+------|
> |   | 1   | bar  | text |
> |   | 12  | test |  300 |
> |   | 9   | foo  |    4 |
> | / | <l> | <l>  |  <r> |
>
>
> Wrong:
>
> |   |  A | B    | C    |
> |---+----+------+------|
> |   |  1 | bar  | text |
> |   | 12 | test | 300  |
> |   |  9 | foo  | 4    |
> | / | <> | <>   | <>   |
>
>
> Thanks for the fix!
>
>
>  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22 19:37             ` Sebastian Rose
@ 2010-10-23  5:53               ` Carsten Dominik
  2010-10-23 19:20                 ` Sebastian Rose
  2010-10-23 19:28                 ` Sebastian Rose
  0 siblings, 2 replies; 38+ messages in thread
From: Carsten Dominik @ 2010-10-23  5:53 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org-mode ml


On Oct 22, 2010, at 9:37 PM, Sebastian Rose wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> On Oct 22, 2010, at 3:59 PM, Sebastian Rose wrote:
>>
>>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>>> Hi Sebastian,
>>>>
>>>> my guess would be that you have customized the td and th tags?   
>>>> If yes,
>>>> please
>>>> reset the customization, you need the new default values  (which  
>>>> you then can
>>>> still modify).
>>>>
>>>> Please check the variables org-export-table-header-tags and
>>>> org-export-table-data-tags.
>>>
>>>
>>> I've checked them, but they are not customized:
>>>
>>>   Hide Org Export Table Data Tags:
>>>        Opening tag: <td%s>
>>>        Closing tag: </td>
>>>             State : STANDARD.
>>
>> This does look right.
>>
>>>
>>>   Hide Org Export Table Header Tags:
>>>        Opening tag: <th scope="%s">
>>>        Closing tag: </th>
>>>             State : STANDARD.
>>
>> This does not look right, it should be
>>
>>        Opening tag: <th scope="%s"%s>
>>        Closing tag: </th>
>>
>>
>>>
>>>
>>> The export of the OPs table works as expected.  But the table I've  
>>> sent
>>> is different in that it just uses empty `<>' marks for grouping and
>>> creating lines.
>>
>> While I do not think it is particularly nice that you
>> try to fool the parser in this way :-/
>> it actually behaves quite well :-D
>>
>> Here is what I get when I export this table:
>>
>> -------------------------------------------------------------------------------------------
>> <table border="2" cellspacing="0" cellpadding="6" rules="groups"  
>> frame="hsides">
>> <caption></caption>
>> <colgroup><col align="right" /></colgroup><colgroup><col  
>> align="left" /
>>> </colgroup><colgroup><col align="left" /></colgroup>
>> <thead>
>> <tr><th scope="col" style="text-align:right">A</th><th scope="col"
>> style="text-align:left">B</th><th scope="col" style="text-
>> align:left">C</th></tr>
>> </thead>
>> <tbody>
>> <tr><td style="text-align:right">1</td><td style="text-
>> align:left">bar</td><td style="text-align:left">text</td></tr>
>> <tr><td style="text-align:right">12</td><td style="text-
>> align:left">test</td><td style="text-align:left">300</td></tr>
>> <tr><td style="text-align:right">9</td><td style="text-
>> align:left">foo</td><td style="text-align:left">4</td></tr>
>> </tbody>
>> </table>
>> -------------------------------------------------------------------------------------------
>>
>>
>> The left/right comes from the analysis of the number of numbers
>> in each column...
>>
>> So I must assume that maybe some of your files did not
>> update correctly or you have some old compiled files... ?
>>
>> - Carsten
>
> Hi Carsten,
>
>
> one more, sorry.
>
>
> How about this (line-wrapped for readability):
>
>
> <tr>
>  <td class="right">1</td>
>  <td class="left">bar</td>
>  <td class="left">text</td>
> <tr>
>
> instead of
>
> <tr>
>  <td style="text-align:right">1</td>
>  <td style="text-align:left">bar</td>
>  <td style="text-align:left">text</td>
> <tr>
>
> ??
>
>
> Combined with the ways to add IDs and classes to tables, we could  
> then style the
> columns better.
>
> I would like to set this for right aligned <td> tags as default:
>
>   td.right { font-family:monospace;text-align:right; }

OK, fair enough.  But I don't think I will make the monospace
the Org default, it looks a bit odd.  BUt of cause you can change
this.

I have now in the default style:

   td, th { vertical-align: top;  }
   th.right  { text-align:right;  }
   th.left   { text-align:left;   }
   th.center { text-align:center; }
   td.right  { text-align:right;  }
   td.left   { text-align:left;   }
   td.center { text-align:center; }

Is there a way to write this more compactly?

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-23  5:42               ` Carsten Dominik
@ 2010-10-23 19:03                 ` Sebastian Rose
  0 siblings, 0 replies; 38+ messages in thread
From: Sebastian Rose @ 2010-10-23 19:03 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-mode ml

Carsten Dominik <carsten.dominik@gmail.com> writes:
>> OK, found it.  It was in my .emacs which I didn't use for ages...
>>
>> But:
>>
>>  <colgroup><col align="right" /></colgroup><colgroup><col align="left"
>> /></colgroup><colgroup><col align="left" /></colgroup>
>>
>> must be:
>>
>>  <colgroup><col align="right" /><col align="left" /><col align="left"
>> /></colgroup>
>>
>>
>> i.e. "<colgroup>" and "</colgroup>" have to occur only once each and
>> wrap the "<col ... />" definitions.
>>
>> The </colgroup> after each "<col ... />" happens only for the second
>> table.
>
> Hi Sebastian,
>
> Are you sure about this?  Because the <> is special syntax for Org to define
> column groups, and I believe it is OK to have multiple column groups in
> a table.

No....

I've checked, and it is indeed valid!

Oups...

I've never seen it anywhere....


Everything is fine then.  Thanks again for the fix!


   Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-23  5:53               ` Carsten Dominik
@ 2010-10-23 19:20                 ` Sebastian Rose
  2010-10-23 19:28                 ` Sebastian Rose
  1 sibling, 0 replies; 38+ messages in thread
From: Sebastian Rose @ 2010-10-23 19:20 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-mode ml

Carsten Dominik <carsten.dominik@gmail.com> writes:
>> How about this (line-wrapped for readability):
>>
>>
>> <tr>
>>  <td class="right">1</td>
>>  <td class="left">bar</td>
>>  <td class="left">text</td>
>> <tr>
>>
>> instead of
>>
>> <tr>
>>  <td style="text-align:right">1</td>
>>  <td style="text-align:left">bar</td>
>>  <td style="text-align:left">text</td>
>> <tr>
>>
>> ??
>>
>>
>> Combined with the ways to add IDs and classes to tables, we could then style
>> the
>> columns better.
>>
>> I would like to set this for right aligned <td> tags as default:
>>
>>   td.right { font-family:monospace;text-align:right; }
>
> OK, fair enough.  But I don't think I will make the monospace
> the Org default, it looks a bit odd.  BUt of cause you can change
> this.

Great!


> I have now in the default style:
>
>   td, th { vertical-align: top;  }
>   th.right  { text-align:right;  }
>   th.left   { text-align:left;   }
>   th.center { text-align:center; }
>   td.right  { text-align:right;  }
>   td.left   { text-align:left;   }
>   td.center { text-align:center; }
>
> Is there a way to write this more compactly?
>
> - Carsten


No, if you don't want to remove all whitespace :)

Ahhhhhhhh, that's cool!!!  Thank you!!!




   Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-23  5:53               ` Carsten Dominik
  2010-10-23 19:20                 ` Sebastian Rose
@ 2010-10-23 19:28                 ` Sebastian Rose
  2010-10-25  6:48                   ` Carsten Dominik
  1 sibling, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-23 19:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-mode ml

Carsten Dominik <carsten.dominik@gmail.com> writes:
> I have now in the default style:
>
>   td, th { vertical-align: top;  }
>   th.right  { text-align:right;  }
>   th.left   { text-align:left;   }
>   th.center { text-align:center; }
>   td.right  { text-align:right;  }
>   td.left   { text-align:left;   }
>   td.center { text-align:center; }
>
> Is there a way to write this more compactly?
>
> - Carsten


But this is, what I often use:

  /* Aligns block elements, too: */
  .right  {margin-left:auto; margin-right:0px;  text-align:right;}
  .left   {margin-left:0px;  margin-right:auto; text-align:left;}
  .center {margin-left:auto; margin-right:auto; text-align:center;}

These are CSS classes I use frequently.  It works for all HTML elements
AND aligns table to the right in all important browsers.  I first
thought "OK, we can do this ourselves per stylesheet", but why not offer
this little goodie out-of-the-box?

Try:


(THERE'S A BUG: #+STYLE: lines are not wrapped in <style> tags anymore) 


--8<---------------cut here---------------start------------->8---
#+STYLE:  .right  {margin-left:auto; margin-right:0px;  text-align:right;}
#+STYLE:  .left   {margin-left:0px;  margin-right:auto; text-align:left;}
#+STYLE:  .center {margin-left:auto; margin-right:auto; text-align:center;}

* Tables

#+ATTR_HTML: class="left"
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |

#+ATTR_HTML: class="center"
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |

#+ATTR_HTML: class="right"
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
--8<---------------cut here---------------end--------------->8---



   Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-22  7:32   ` Carsten Dominik
  2010-10-22 11:20     ` Sebastian Rose
@ 2010-10-25  4:36     ` Baoqiu Cui
  2010-10-25  8:51       ` Christian Moe
  1 sibling, 1 reply; 38+ messages in thread
From: Baoqiu Cui @ 2010-10-25  4:36 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Baoqiu,
>
> (or any other users of the docbook exporter)
> I am not sure if the docbook format has suffered from this change,
> could you please run a few tests involving tables and report back?

Thanks for supporting this new feature.  DocBook exporter does not
really suffer from this change, but it does not benefit from it either.
After checking the documentation of DocBook and HTML table, it seems
that using the "class" attribute in <td> elements for alignment is not
the best solution.  Attribute "align" is officially supported by DocBook
and HTML based on the following two links:

  1. http://docbook.org/tdg5/en/html/html.td.html
  2. http://www.w3.org/TR/html401/struct/tables.html#h-11.3.2

If I change "class" to "align" in the following lines, the same table
can be recognized by both Firefox and DocBook.  I am wondering if there
is any special reason to use "class" instead of "align".  If not, can we
change the elisp code to use "align"?

<tbody>
<tr><td class="left">A</td><td class="left">B</td><td class="right">C</td></tr>
<tr><td class="left">1</td><td class="left">2</td><td class="right">3</td></tr>
<tr><td class="left">12</td><td class="left">13</td><td class="right">300</td></tr>
<tr><td class="left">9</td><td class="left">11</td><td class="right">4</td></tr>
</tbody>

Thanks!

-- 
Baoqiu

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-23 19:28                 ` Sebastian Rose
@ 2010-10-25  6:48                   ` Carsten Dominik
  2010-10-25  9:02                     ` Giovanni Ridolfi
  0 siblings, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-25  6:48 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org-mode ml


On Oct 23, 2010, at 9:28 PM, Sebastian Rose wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> I have now in the default style:
>>
>> td, th { vertical-align: top;  }
>> th.right  { text-align:right;  }
>> th.left   { text-align:left;   }
>> th.center { text-align:center; }

I am actually using right now:

th.right  { text-align:center;  }
th.left   { text-align:center;   }
th.center { text-align:center; }

because is seem right to me that a table header is centrally
aligned even if the fields are lift or right aligned.
Does anyone know enough rules of style to tell me
if this is the right way, of if header fields are supposed
to have the same alignments as the data fields?

>> td.right  { text-align:right;  }
>> td.left   { text-align:left;   }
>> td.center { text-align:center; }
>>
>> Is there a way to write this more compactly?
>>
>> - Carsten
>
>
> But this is, what I often use:
>
> /* Aligns block elements, too: */
> .right  {margin-left:auto; margin-right:0px;  text-align:right;}
> .left   {margin-left:0px;  margin-right:auto; text-align:left;}
> .center {margin-left:auto; margin-right:auto; text-align:center;}
>
> These are CSS classes I use frequently.  It works for all HTML  
> elements
> AND aligns table to the right in all important browsers.  I first
> thought "OK, we can do this ourselves per stylesheet", but why not  
> offer
> this little goodie out-of-the-box?

So you are suggesting I should add these
to the style sheet.  Sounds fine to me, with the
limitation that it might interfere with commonly
used classes?

I prefer to have at least the th.left/right/center in addition
due to the fact that I think I like centered headers.

>
> Try:
>
>
> (THERE'S A BUG: #+STYLE: lines are not wrapped in <style> tags  
> anymore)
>
>
> --8<---------------cut here---------------start------------->8---
> #+STYLE:  .right  {margin-left:auto; margin-right:0px;  text- 
> align:right;}
> #+STYLE:  .left   {margin-left:0px;  margin-right:auto; text- 
> align:left;}
> #+STYLE:  .center {margin-left:auto; margin-right:auto; text- 
> align:center;}

Did it ever do this?  I don't think so, because the documentation
of the corresponding variables is explicit about the fact that you need
to put the <style> tags.
The reason here is that you might want to put

#+STYLE: <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css 
\">

where automatic <style> tags would be problematic.

I think you can do it like this:

#+STYLE: <style>
#+STYLE:  .right  {margin-left:auto; margin-right:0px;  text- 
align:right;}
#+STYLE:  .left   {margin-left:0px;  margin-right:auto; text- 
align:left;}
#+STYLE:  .center {margin-left:auto; margin-right:auto; text- 
align:center;}
#+STYLE: </style>


- Carsten

>
> * Tables
>
> #+ATTR_HTML: class="left"
> | a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
>
> #+ATTR_HTML: class="center"
> | a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
>
> #+ATTR_HTML: class="right"
> | a | b | c |
> |---+---+---|
> | 1 | 2 | 3 |
> --8<---------------cut here---------------end--------------->8---
>
>
>
>  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25  4:36     ` Baoqiu Cui
@ 2010-10-25  8:51       ` Christian Moe
  2010-10-25  9:08         ` Carsten Dominik
  0 siblings, 1 reply; 38+ messages in thread
From: Christian Moe @ 2010-10-25  8:51 UTC (permalink / raw)
  To: Baoqiu Cui
  Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison,
	Carsten Dominik

On 10/25/10 6:36 AM, Baoqiu Cui wrote:
  I am wondering if there
> is any special reason to use "class" instead of "align".  If not, can we
> change the elisp code to use "align"?

I believe the "align" attribute is slated for obsoletion in HTML5, on 
the grounds that it's better handled by CSS.

http://www.w3.org/TR/html5/obsolete.html

It's a reason to go with "class" instead. Not a compelling one, perhaps.

My only strong opinion on this is that I absolutely agree with the 
choice not to set the "style" attribute locally on each table cell.

But Sebastian Rose's request that prompted it, /could/ equally well be 
addressed with the "align" attribute:

> How about this (line-wrapped for readability):
>
>
> <tr>
>  <td class="right">1</td>
>  <td class="left">bar</td>
>  <td class="left">text</td>
> <tr>
>
> instead of
>
> <tr>
>  <td style="text-align:right">1</td>
>  <td style="text-align:left">bar</td>
>  <td style="text-align:left">text</td>
> <tr>
>
> ??
>
>
> Combined with the ways to add IDs and classes to tables, we could then style the
> columns better.
>
> I would like to set this for right aligned <td> tags as default:
>
>   td.right { font-family:monospace;text-align:right; }

Using the "align" attribute as follows,

<tr>
  <td align="right">1</td>
  <td align="left">bar</td>
  <td align="left">text</td>
<tr>

Sebastian could achieve the same with CSS like

td[align="right"]  { font-family: monospace;}

In the same way one could even use CSS to override the alignment 
specified by the "align" attribute, if for whatever reason this seemed 
like a good idea...

One slight advantage of the "align" attribute over "class" is that it 
doesn't require the default style to contain the extra verbiage 
Carsten mentioned:

> I have now in the default style:
>
>   td, th { vertical-align: top;  }
>   th.right  { text-align:right;  }
>   th.left   { text-align:left;   }
>   th.center { text-align:center; }
>   td.right  { text-align:right;  }
>   td.left   { text-align:left;   }
>   td.center { text-align:center; }
>
> Is there a way to write this more compactly?

Yours,
Christian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25  6:48                   ` Carsten Dominik
@ 2010-10-25  9:02                     ` Giovanni Ridolfi
  2010-10-25  9:09                       ` Carsten Dominik
  0 siblings, 1 reply; 38+ messages in thread
From: Giovanni Ridolfi @ 2010-10-25  9:02 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Org-mode ml

Carsten Dominik <carsten.dominik@gmail.com> writes:

>
> I am actually using right now:
>
> th.right  { text-align:center;  }
> th.left   { text-align:center;   }
> th.center { text-align:center; }
>
> because is seem right to me that a table header is centrally
> aligned even if the fields are lift or right aligned.

yes, seems to be 'common sense' :-D [at least here in Italy(Europe) ;-)]

> Does anyone know enough rules of style to tell me
> if this is the right way, of if header fields are supposed
> to have the same alignments as the data fields?

"Headers are by default center aligned within table cells." [1]

[1] http://www.mcu.org.uk/articles/tables.html

cheers,
Giovanni

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25  8:51       ` Christian Moe
@ 2010-10-25  9:08         ` Carsten Dominik
  2010-10-25 13:13           ` Christian Moe
  0 siblings, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-25  9:08 UTC (permalink / raw)
  To: mail; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison, Baoqiu Cui


On Oct 25, 2010, at 10:51 AM, Christian Moe wrote:

> On 10/25/10 6:36 AM, Baoqiu Cui wrote:
> I am wondering if there
>> is any special reason to use "class" instead of "align".  If not,  
>> can we
>> change the elisp code to use "align"?
>
> I believe the "align" attribute is slated for obsoletion in HTML5,  
> on the grounds that it's better handled by CSS.
>
> http://www.w3.org/TR/html5/obsolete.html
>
> It's a reason to go with "class" instead. Not a compelling one,  
> perhaps.
>
> My only strong opinion on this is that I absolutely agree with the  
> choice not to set the "style" attribute locally on each table cell.

Hmm, butwe do now set the class in each cell.  Is that any better?

- Carsten

>
> But Sebastian Rose's request that prompted it, /could/ equally well  
> be addressed with the "align" attribute:
>
>> How about this (line-wrapped for readability):
>>
>>
>> <tr>
>> <td class="right">1</td>
>> <td class="left">bar</td>
>> <td class="left">text</td>
>> <tr>
>>
>> instead of
>>
>> <tr>
>> <td style="text-align:right">1</td>
>> <td style="text-align:left">bar</td>
>> <td style="text-align:left">text</td>
>> <tr>
>>
>> ??
>>
>>
>> Combined with the ways to add IDs and classes to tables, we could  
>> then style the
>> columns better.
>>
>> I would like to set this for right aligned <td> tags as default:
>>
>>  td.right { font-family:monospace;text-align:right; }
>
> Using the "align" attribute as follows,
>
> <tr>
> <td align="right">1</td>
> <td align="left">bar</td>
> <td align="left">text</td>
> <tr>
>
> Sebastian could achieve the same with CSS like
>
> td[align="right"]  { font-family: monospace;}
>
> In the same way one could even use CSS to override the alignment  
> specified by the "align" attribute, if for whatever reason this  
> seemed like a good idea...
>
> One slight advantage of the "align" attribute over "class" is that  
> it doesn't require the default style to contain the extra verbiage  
> Carsten mentioned:
>
>> I have now in the default style:
>>
>>  td, th { vertical-align: top;  }
>>  th.right  { text-align:right;  }
>>  th.left   { text-align:left;   }
>>  th.center { text-align:center; }
>>  td.right  { text-align:right;  }
>>  td.left   { text-align:left;   }
>>  td.center { text-align:center; }
>>
>> Is there a way to write this more compactly?
>
> Yours,
> Christian

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25  9:02                     ` Giovanni Ridolfi
@ 2010-10-25  9:09                       ` Carsten Dominik
  0 siblings, 0 replies; 38+ messages in thread
From: Carsten Dominik @ 2010-10-25  9:09 UTC (permalink / raw)
  To: Giovanni Ridolfi; +Cc: Org-mode ml


On Oct 25, 2010, at 11:02 AM, Giovanni Ridolfi wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>>
>> I am actually using right now:
>>
>> th.right  { text-align:center;  }
>> th.left   { text-align:center;   }
>> th.center { text-align:center; }
>>
>> because is seem right to me that a table header is centrally
>> aligned even if the fields are lift or right aligned.
>
> yes, seems to be 'common sense' :-D [at least here in  
> Italy(Europe) ;-)]
>
>> Does anyone know enough rules of style to tell me
>> if this is the right way, of if header fields are supposed
>> to have the same alignments as the data fields?
>
> "Headers are by default center aligned within table cells." [1]

OK, thanks for this.

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25  9:08         ` Carsten Dominik
@ 2010-10-25 13:13           ` Christian Moe
  2010-10-25 13:22             ` Carsten Dominik
  2010-10-25 13:43             ` Carsten Dominik
  0 siblings, 2 replies; 38+ messages in thread
From: Christian Moe @ 2010-10-25 13:13 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison, Baoqiu Cui

On 10/25/10 11:08 AM, Carsten Dominik wrote:
>
> On Oct 25, 2010, at 10:51 AM, Christian Moe wrote:
>
>> On 10/25/10 6:36 AM, Baoqiu Cui wrote:
>> I am wondering if there
>>> is any special reason to use "class" instead of "align". If not,
>>> can we
>>> change the elisp code to use "align"?
>>
>> I believe the "align" attribute is slated for obsoletion in HTML5,
>> on the grounds that it's better handled by CSS.
>>
>> http://www.w3.org/TR/html5/obsolete.html
>>
>> It's a reason to go with "class" instead. Not a compelling one,
>> perhaps.
>>
>> My only strong opinion on this is that I absolutely agree with the
>> choice not to set the "style" attribute locally on each table cell.
>
> Hmm, butwe do now set the class in each cell. Is that any better?
>
> - Carsten

It's a subtle difference, and every way works, so I don't want to 
waste more of your time.

#+begin_rant
But yes, I think it /is/ better, for the same reason Sebastian 
requested it: Setting class is the preferred way to make all cells of 
that class custom-styleable by changing a single line in the stylesheet.

As I pointed out below, though, it's not the only way. CSS lets you do 
the same, nearly as easily, if "align" is used instead of "class" as 
Baoqiu Cui suggested; "class" is more future-proof (HTML5), "align" 
more compact (the default is already defined).

(Heck, come to think of it, Sebastian could have monospaced the 
left-aligned column in his example even when Org set "style" on each 
cell, using a selector like:
: td[style="text-align: left;"] { font-family: monospace; }
-- but that, I think, would be perverse.)

Over-use of the style attribute to set styles locally works against 
the purpose of CSS. The local style attribute should be used for 
exceptions; general rules should be handled at a higher level of the 
cascade.

Having to set /anything/ on each cell just to align a column is not 
optimal either, but since some browsers don't honor colgroups, it's 
the most robust way.
#+end_rant

Christian

>>
>> But Sebastian Rose's request that prompted it, /could/ equally well
>> be addressed with the "align" attribute:
>>
>>> How about this (line-wrapped for readability):
>>>
>>>
>>> <tr>
>>> <td class="right">1</td>
>>> <td class="left">bar</td>
>>> <td class="left">text</td>
>>> <tr>
>>>
>>> instead of
>>>
>>> <tr>
>>> <td style="text-align:right">1</td>
>>> <td style="text-align:left">bar</td>
>>> <td style="text-align:left">text</td>
>>> <tr>
>>>
>>> ??
>>>
>>>
>>> Combined with the ways to add IDs and classes to tables, we could
>>> then style the
>>> columns better.
>>>
>>> I would like to set this for right aligned <td> tags as default:
>>>
>>> td.right { font-family:monospace;text-align:right; }
>>
>> Using the "align" attribute as follows,
>>
>> <tr>
>> <td align="right">1</td>
>> <td align="left">bar</td>
>> <td align="left">text</td>
>> <tr>
>>
>> Sebastian could achieve the same with CSS like
>>
>> td[align="right"] { font-family: monospace;}
>>
>> In the same way one could even use CSS to override the alignment
>> specified by the "align" attribute, if for whatever reason this
>> seemed like a good idea...
>>
>> One slight advantage of the "align" attribute over "class" is that
>> it doesn't require the default style to contain the extra verbiage
>> Carsten mentioned:
>>
>>> I have now in the default style:
>>>
>>> td, th { vertical-align: top; }
>>> th.right { text-align:right; }
>>> th.left { text-align:left; }
>>> th.center { text-align:center; }
>>> td.right { text-align:right; }
>>> td.left { text-align:left; }
>>> td.center { text-align:center; }
>>>
>>> Is there a way to write this more compactly?
>>
>> Yours,
>> Christian
>
> - Carsten
>
>

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 13:13           ` Christian Moe
@ 2010-10-25 13:22             ` Carsten Dominik
  2010-10-25 14:55               ` Sebastian Rose
  2010-10-25 13:43             ` Carsten Dominik
  1 sibling, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-25 13:22 UTC (permalink / raw)
  To: mail; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison, Baoqiu Cui


On Oct 25, 2010, at 3:13 PM, Christian Moe wrote:

> On 10/25/10 11:08 AM, Carsten Dominik wrote:
>>
>> On Oct 25, 2010, at 10:51 AM, Christian Moe wrote:
>>
>>> On 10/25/10 6:36 AM, Baoqiu Cui wrote:
>>> I am wondering if there
>>>> is any special reason to use "class" instead of "align". If not,
>>>> can we
>>>> change the elisp code to use "align"?
>>>
>>> I believe the "align" attribute is slated for obsoletion in HTML5,
>>> on the grounds that it's better handled by CSS.
>>>
>>> http://www.w3.org/TR/html5/obsolete.html
>>>
>>> It's a reason to go with "class" instead. Not a compelling one,
>>> perhaps.
>>>
>>> My only strong opinion on this is that I absolutely agree with the
>>> choice not to set the "style" attribute locally on each table cell.
>>
>> Hmm, butwe do now set the class in each cell. Is that any better?
>>
>> - Carsten
>
> It's a subtle difference, and every way works, so I don't want to  
> waste more of your time.
>
> #+begin_rant
> But yes, I think it /is/ better, for the same reason Sebastian  
> requested it: Setting class is the preferred way to make all cells  
> of that class custom-styleable by changing a single line in the  
> stylesheet.
>
> As I pointed out below, though, it's not the only way. CSS lets you  
> do the same, nearly as easily, if "align" is used instead of "class"  
> as Baoqiu Cui suggested; "class" is more future-proof (HTML5),  
> "align" more compact (the default is already defined).
>
> (Heck, come to think of it, Sebastian could have monospaced the left- 
> aligned column in his example even when Org set "style" on each  
> cell, using a selector like:
> : td[style="text-align: left;"] { font-family: monospace; }
> -- but that, I think, would be perverse.)
>
> Over-use of the style attribute to set styles locally works against  
> the purpose of CSS. The local style attribute should be used for  
> exceptions; general rules should be handled at a higher level of the  
> cascade.

I agree.  But in the context of text alignment in tables, not all  
browsers support
styles specified for entire columns.  I think it is ridiculous to have  
to specify the alignment (or a class) for each field, but the browser  
realities force me.

OK, I will use class.  I could make a special case for the docbook  
exporter......

>
> Having to set /anything/ on each cell just to align a column is not  
> optimal either, but since some browsers don't honor colgroups, it's  
> the most robust way.

:-)  Just what I think.  OK, a class it is.

- Carsten
>>>>
>>>> td.right { font-family:monospace;text-align:right; }
>>>
>>> Using the "align" attribute as follows,
>>>
>>> <tr>
>>> <td align="right">1</td>
>>> <td align="left">bar</td>
>>> <td align="left">text</td>
>>> <tr>
>>>
>>> Sebastian could achieve the same with CSS like
>>>
>>> td[align="right"] { font-family: monospace;}
>>>
>>> In the same way one could even use CSS to override the alignment
>>> specified by the "align" attribute, if for whatever reason this
>>> seemed like a good idea...
>>>
>>> One slight advantage of the "align" attribute over "class" is that
>>> it doesn't require the default style to contain the extra verbiage
>>> Carsten mentioned:
>>>
>>>> I have now in the default style:
>>>>
>>>> td, th { vertical-align: top; }
>>>> th.right { text-align:right; }
>>>> th.left { text-align:left; }
>>>> th.center { text-align:center; }
>>>> td.right { text-align:right; }
>>>> td.left { text-align:left; }
>>>> td.center { text-align:center; }
>>>>
>>>> Is there a way to write this more compactly?
>>>
>>> Yours,
>>> Christian
>>
>> - Carsten
>>
>>
>
>

- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 13:13           ` Christian Moe
  2010-10-25 13:22             ` Carsten Dominik
@ 2010-10-25 13:43             ` Carsten Dominik
  2010-10-25 20:04               ` Christian Moe
  1 sibling, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-25 13:43 UTC (permalink / raw)
  To: mail; +Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison, Baoqiu Cui


On Oct 25, 2010, at 3:13 PM, Christian Moe wrote:

> On 10/25/10 11:08 AM, Carsten Dominik wrote:
>>
>> On Oct 25, 2010, at 10:51 AM, Christian Moe wrote:
>>
>>> On 10/25/10 6:36 AM, Baoqiu Cui wrote:
>>> I am wondering if there
>>>> is any special reason to use "class" instead of "align". If not,
>>>> can we
>>>> change the elisp code to use "align"?
>>>
>>> I believe the "align" attribute is slated for obsoletion in HTML5,
>>> on the grounds that it's better handled by CSS.
>>>
>>> http://www.w3.org/TR/html5/obsolete.html
>>>
>>> It's a reason to go with "class" instead. Not a compelling one,
>>> perhaps.
>>>
>>> My only strong opinion on this is that I absolutely agree with the
>>> choice not to set the "style" attribute locally on each table cell.
>>
>> Hmm, butwe do now set the class in each cell. Is that any better?
>>
>> - Carsten
>
> It's a subtle difference, and every way works, so I don't want to  
> waste more of your time.
>
> #+begin_rant
> But yes, I think it /is/ better, for the same reason Sebastian  
> requested it: Setting class is the preferred way to make all cells  
> of that class custom-styleable by changing a single line in the  
> stylesheet.
>
> As I pointed out below, though, it's not the only way. CSS lets you  
> do the same, nearly as easily, if "align" is used instead of "class"  
> as Baoqiu Cui suggested; "class" is more future-proof (HTML5),  
> "align" more compact (the default is already defined).
>
> (Heck, come to think of it, Sebastian could have monospaced the left- 
> aligned column in his example even when Org set "style" on each  
> cell, using a selector like:
> : td[style="text-align: left;"] { font-family: monospace; }
> -- but that, I think, would be perverse.)
>
> Over-use of the style attribute to set styles locally works against  
> the purpose of CSS. The local style attribute should be used for  
> exceptions; general rules should be handled at a higher level of the  
> cascade.
>
> Having to set /anything/ on each cell just to align a column is not  
> optimal either, but since some browsers don't honor colgroups, it's  
> the most robust way.
> #+end_rant
>
> Christian
>
>>>
>>> But Sebastian Rose's request that prompted it, /could/ equally well
>>> be addressed with the "align" attribute:
>>>
>>>> How about this (line-wrapped for readability):
>>>>
>>>>
>>>> <tr>
>>>> <td class="right">1</td>
>>>> <td class="left">bar</td>
>>>> <td class="left">text</td>
>>>> <tr>
>>>>
>>>> instead of
>>>>
>>>> <tr>
>>>> <td style="text-align:right">1</td>
>>>> <td style="text-align:left">bar</td>
>>>> <td style="text-align:left">text</td>
>>>> <tr>
>>>>
>>>> ??
>>>>
>>>>
>>>> Combined with the ways to add IDs and classes to tables, we could
>>>> then style the
>>>> columns better.
>>>>
>>>> I would like to set this for right aligned <td> tags as default:
>>>>
>>>> td.right { font-family:monospace;text-align:right; }
>>>
>>> Using the "align" attribute as follows,
>>>
>>> <tr>
>>> <td align="right">1</td>
>>> <td align="left">bar</td>
>>> <td align="left">text</td>
>>> <tr>
>>>
>>> Sebastian could achieve the same with CSS like
>>>
>>> td[align="right"] { font-family: monospace;}
>>>
>>> In the same way one could even use CSS to override the alignment
>>> specified by the "align" attribute, if for whatever reason this
>>> seemed like a good idea...
>>>
>>> One slight advantage of the "align" attribute over "class" is that
>>> it doesn't require the default style to contain the extra verbiage
>>> Carsten mentioned:
>>>
>>>> I have now in the default style:
>>>>
>>>> td, th { vertical-align: top; }
>>>> th.right { text-align:right; }
>>>> th.left { text-align:left; }
>>>> th.center { text-align:center; }
>>>> td.right { text-align:right; }
>>>> td.left { text-align:left; }
>>>> td.center { text-align:center; }
>>>>
>>>> Is there a way to write this more compactly?
>>>
>>> Yours,
>>> Christian
>>
>> - Carsten
>>
>>
>
>


Actually,  I have one more question:

The exporter does now (in addition to setting classes for individual  
fields)

<colgroup><col align="left" /><col align="right" /><col  
align="center" />

Should this be classes instead of align attributes as well?

Thanks!

- Carsten





- Carsten

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 13:22             ` Carsten Dominik
@ 2010-10-25 14:55               ` Sebastian Rose
  2010-10-25 20:41                 ` Christian Moe
  2010-10-25 21:52                 ` Baoqiu Cui
  0 siblings, 2 replies; 38+ messages in thread
From: Sebastian Rose @ 2010-10-25 14:55 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Jeff Horn, mail, Dan Davison, Bernt Hansen, Org-mode ml,
	Baoqiu Cui

Carsten Dominik <carsten.dominik@gmail.com> writes:
> OK, I will use class.  I could make a special case for the docbook
> exporter......


+1

>> Having to set /anything/ on each cell just to align a column is not optimal
>> either, but since some browsers don't honor colgroups, it's  the most robust
>> way.


How refer to all right-aligned `td' elements in a certain tables without
some special attribute anyway.  `class' preferred since this is CSS2 and
will work in commen browsers.  I'm not sure how which browsers will
understand  the selector  `table#special td[align="right"] {...}'.





BTW: Org mode's exports to XHTML, not HTML 4.01 or HTML 5 (which is a
proposal, not a "standard" or recommendation yet).  Still,
'<td align="right">' is valid XHTML, too.

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 13:43             ` Carsten Dominik
@ 2010-10-25 20:04               ` Christian Moe
  2010-10-25 21:39                 ` Sebastian Rose
  0 siblings, 1 reply; 38+ messages in thread
From: Christian Moe @ 2010-10-25 20:04 UTC (permalink / raw)
  To: Carsten Dominik
  Cc: Bernt Hansen, Jeff Horn, Org-mode ml, Dan Davison, Baoqiu Cui


> Actually, I have one more question:
>
> The exporter does now (in addition to setting classes for individual
> fields)
>
> <colgroup><col align="left" /><col align="right" /><col align="center" />
>
> Should this be classes instead of align attributes as well?
>
> Thanks!
>
> - Carsten

Maybe someone with a browser where colgroups actually do work (Opera!) 
can check

1. if they only work with the align attribute, and not with CSS, and

2. whether they still work (take precedence) now that the individual 
cells are aligned with CSS for their class.

Unless the answer to both is "yes", I'd say classes there too, to be 
consistent with what you're doing on cells (and where HTML5 seems to 
be heading).

Christian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 14:55               ` Sebastian Rose
@ 2010-10-25 20:41                 ` Christian Moe
  2010-10-25 21:52                 ` Baoqiu Cui
  1 sibling, 0 replies; 38+ messages in thread
From: Christian Moe @ 2010-10-25 20:41 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: Org-mode ml

[Veering off-topic, just to round off a discussion]

On 10/25/10 4:55 PM, Sebastian Rose wrote:

>
> How refer to all right-aligned `td' elements in a certain tables without
> some special attribute anyway.

Fair point. (In an ideal world, as long as the whole column is 
right-aligned it should be enough to refer to all right-aligned `col' 
elements, but this clearly is not the case today.)

> `class' preferred since this is CSS2 and
> will work in commen browsers.  I'm not sure how which browsers will
> understand  the selector  `table#special td[align="right"] {...}'.

Firefox, Safari, ... The attribute selector is CSS2, too. But I agree 
`class' is preferred.

>
> BTW: Org mode's exports to XHTML, not HTML 4.01 or HTML 5 (which is a
> proposal, not a "standard" or recommendation yet).  Still,
> '<td align="right">' is valid XHTML, too.

Absolutely, I didn't mean to imply otherwise. But I think in this 
regard, at least, the thinking behind the HTML 5 proposal makes sense. 
(As for the relationship between HTML 5 and XHTML, let's not go there...)

Christian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 20:04               ` Christian Moe
@ 2010-10-25 21:39                 ` Sebastian Rose
  2010-10-26  5:12                   ` Carsten Dominik
  0 siblings, 1 reply; 38+ messages in thread
From: Sebastian Rose @ 2010-10-25 21:39 UTC (permalink / raw)
  To: mail
  Cc: Jeff Horn, Dan Davison, Bernt Hansen, Org-mode ml,
	Carsten Dominik, Baoqiu Cui

Christian Moe <mail@christianmoe.com> writes:
> Maybe someone with a browser where colgroups actually do work (Opera!) can check
>
> 1. if they only work with the align attribute, and not with CSS, and
>
> 2. whether they still work (take precedence) now that the individual cells are
> aligned with CSS for their class.

They _never_ took precedence, as soon as I used a style like this:

  /* My default for all td elements */
  td { text-align:left; }

The `td' style will alway be a "better" CSS-match than the col's style
or class attribute, even then the col's align attribute.  It's even the
expected behaviour according to CSS standards since that what's the `C'
in CSS means.  I have to remove my favourite default style for td
elements from my stylesheet to make that work in Opera, too.  In current
FF it does not work at all.

Here's another test:

CSS:
--8<---------------cut here---------------start------------->8---
  col.right  { text-align:right;vertical-align:top;background-color:red; }
  col.left   { text-align:left;vertical-align:top;background-color:green; }
  col.center { text-align:center;vertical-align:top;background-color:blue; }
--8<---------------cut here---------------end--------------->8---



A table:

--8<---------------cut here---------------start------------->8---
<table  border="0" summary="">
<caption></caption>
<colgroup><col class="left" /><col class="center" /><col class="right" />
</colgroup>
<thead>
<tr><th>A</th><th>B</th><th>C</th></tr>
</thead>
<tbody>
<tr><td>1</td><td >bar</td><td>text</td></tr>
<tr><td>12</td><td >test</td><td>300</td></tr>
<tr><td>9</td><td >foo</td><td>4</td></tr>
</tbody>
</table>
--8<---------------cut here---------------end--------------->8---


The only `style' that works that way is the `background-color'.  In
Opera and FF at least.

Means, the `class' attribute in <col> elements doesn't work very well
(but '<col class="odd" /><col class="even" />' might make sense with
alternating colors)..

Both, 'align' and the 'style' attribute will be overwritten by a default
style for a <td> element in the users stylesheet (some prefere center,
some left alignment as the default).



It's common practice to have `style' or `class' attribute in td
elements.  That's what classes are for in the end.  Make HTML elements
members of a group with certain properties.

Why not jut go with it?


Look at `magento's code, Drupal, whatever.  They even use more those
usefull classes, e.g. `first' and `last' for the first and last elements
of lists.  HTML elements without classes are hard to find.  The reason
is, that HTML is just a document structure.  Classes (and IDs) make
those elements live.

"first" "last" "right" "left" "content" "footnote" "menu" "comment"
"big" "small" "light" "dark" "pro" "contra" - classes make the
difference.

Plus 'class="right"' is easy to change in central place left
entrirely to the user:  the stylesheet.

XML is not meant to avoid clutter.  And if it was, something went
terribly wrong, I guess :)



  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 14:55               ` Sebastian Rose
  2010-10-25 20:41                 ` Christian Moe
@ 2010-10-25 21:52                 ` Baoqiu Cui
  2010-10-26  5:11                   ` Carsten Dominik
  1 sibling, 1 reply; 38+ messages in thread
From: Baoqiu Cui @ 2010-10-25 21:52 UTC (permalink / raw)
  To: Sebastian Rose
  Cc: Jeff Horn, mail, Dan Davison, Bernt Hansen, Org-mode ml,
	Carsten Dominik

Sebastian Rose <sebastian_rose@gmx.de> writes:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>> OK, I will use class.  I could make a special case for the docbook
>> exporter......
>
> +1

+1 for making a "special case for the docbook exporter". :-) (DocBook
documents can be rendered in different formats, some of which (like PDF)
may know nothing about CSS.)

> BTW: Org mode's exports to XHTML, not HTML 4.01 or HTML 5 (which is a
> proposal, not a "standard" or recommendation yet).  Still,
> '<td align="right">' is valid XHTML, too.

Maybe we should add a parameter to function org-format-org-table-html to
indicate whether we want to format pure standard XHTML tables that do
not use "class" or CSS related stuff.

Thanks,

-- 
Baoqiu

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 21:52                 ` Baoqiu Cui
@ 2010-10-26  5:11                   ` Carsten Dominik
  2010-10-26 16:03                     ` Baoqiu Cui
  0 siblings, 1 reply; 38+ messages in thread
From: Carsten Dominik @ 2010-10-26  5:11 UTC (permalink / raw)
  To: Baoqiu Cui; +Cc: Jeff Horn, mail, Dan Davison, Bernt Hansen, Org-mode ml


On Oct 25, 2010, at 11:52 PM, Baoqiu Cui wrote:

> Sebastian Rose <sebastian_rose@gmx.de> writes:
>
>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>> OK, I will use class.  I could make a special case for the docbook
>>> exporter......
>>
>> +1
>
> +1 for making a "special case for the docbook exporter". :-) (DocBook
> documents can be rendered in different formats, some of which (like  
> PDF)
> may know nothing about CSS.)
>
>> BTW: Org mode's exports to XHTML, not HTML 4.01 or HTML 5 (which is a
>> proposal, not a "standard" or recommendation yet).  Still,
>> '<td align="right">' is valid XHTML, too.
>
> Maybe we should add a parameter to function org-format-org-table- 
> html to
> indicate whether we want to format pure standard XHTML tables that do
> not use "class" or CSS related stuff.

This is exactly how I have done it now.

- Carsten

>
> Thanks,
>
> -- 
> Baoqiu

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-25 21:39                 ` Sebastian Rose
@ 2010-10-26  5:12                   ` Carsten Dominik
  0 siblings, 0 replies; 38+ messages in thread
From: Carsten Dominik @ 2010-10-26  5:12 UTC (permalink / raw)
  To: Sebastian Rose
  Cc: Jeff Horn, mail, Dan Davison, Bernt Hansen, Org-mode ml,
	Baoqiu Cui

OK, I think this change is now done.  Thank you all for sharing your
expertise!

- Carsten

On Oct 25, 2010, at 11:39 PM, Sebastian Rose wrote:

> Christian Moe <mail@christianmoe.com> writes:
>> Maybe someone with a browser where colgroups actually do work  
>> (Opera!) can check
>>
>> 1. if they only work with the align attribute, and not with CSS, and
>>
>> 2. whether they still work (take precedence) now that the  
>> individual cells are
>> aligned with CSS for their class.
>
> They _never_ took precedence, as soon as I used a style like this:
>
>  /* My default for all td elements */
>  td { text-align:left; }
>
> The `td' style will alway be a "better" CSS-match than the col's style
> or class attribute, even then the col's align attribute.  It's even  
> the
> expected behaviour according to CSS standards since that what's the  
> `C'
> in CSS means.  I have to remove my favourite default style for td
> elements from my stylesheet to make that work in Opera, too.  In  
> current
> FF it does not work at all.
>
> Here's another test:
>
> CSS:
> --8<---------------cut here---------------start------------->8---
>  col.right  { text-align:right;vertical-align:top;background- 
> color:red; }
>  col.left   { text-align:left;vertical-align:top;background- 
> color:green; }
>  col.center { text-align:center;vertical-align:top;background- 
> color:blue; }
> --8<---------------cut here---------------end--------------->8---
>
>
>
> A table:
>
> --8<---------------cut here---------------start------------->8---
> <table  border="0" summary="">
> <caption></caption>
> <colgroup><col class="left" /><col class="center" /><col  
> class="right" />
> </colgroup>
> <thead>
> <tr><th>A</th><th>B</th><th>C</th></tr>
> </thead>
> <tbody>
> <tr><td>1</td><td >bar</td><td>text</td></tr>
> <tr><td>12</td><td >test</td><td>300</td></tr>
> <tr><td>9</td><td >foo</td><td>4</td></tr>
> </tbody>
> </table>
> --8<---------------cut here---------------end--------------->8---
>
>
> The only `style' that works that way is the `background-color'.  In
> Opera and FF at least.
>
> Means, the `class' attribute in <col> elements doesn't work very well
> (but '<col class="odd" /><col class="even" />' might make sense with
> alternating colors)..
>
> Both, 'align' and the 'style' attribute will be overwritten by a  
> default
> style for a <td> element in the users stylesheet (some prefere center,
> some left alignment as the default).
>
>
>
> It's common practice to have `style' or `class' attribute in td
> elements.  That's what classes are for in the end.  Make HTML elements
> members of a group with certain properties.
>
> Why not jut go with it?
>
>
> Look at `magento's code, Drupal, whatever.  They even use more those
> usefull classes, e.g. `first' and `last' for the first and last  
> elements
> of lists.  HTML elements without classes are hard to find.  The reason
> is, that HTML is just a document structure.  Classes (and IDs) make
> those elements live.
>
> "first" "last" "right" "left" "content" "footnote" "menu" "comment"
> "big" "small" "light" "dark" "pro" "contra" - classes make the
> difference.
>
> Plus 'class="right"' is easy to change in central place left
> entrirely to the user:  the stylesheet.
>
> XML is not meant to avoid clutter.  And if it was, something went
> terribly wrong, I guess :)
>
>
>
>  Sebastian

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

* Re: Re: Aligning Columns in HTML Export Tables
  2010-10-26  5:11                   ` Carsten Dominik
@ 2010-10-26 16:03                     ` Baoqiu Cui
  0 siblings, 0 replies; 38+ messages in thread
From: Baoqiu Cui @ 2010-10-26 16:03 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Jeff Horn, mail, Dan Davison, Bernt Hansen, Org-mode ml

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Oct 25, 2010, at 11:52 PM, Baoqiu Cui wrote:
>
>> Sebastian Rose <sebastian_rose@gmx.de> writes:
>>
>>> Carsten Dominik <carsten.dominik@gmail.com> writes:
>>>> OK, I will use class.  I could make a special case for the docbook
>>>> exporter......
>>>
>>> +1
>>
>> +1 for making a "special case for the docbook exporter". :-) (DocBook
>> documents can be rendered in different formats, some of which (like
>> PDF)
>> may know nothing about CSS.)
>>
>>> BTW: Org mode's exports to XHTML, not HTML 4.01 or HTML 5 (which is a
>>> proposal, not a "standard" or recommendation yet).  Still,
>>> '<td align="right">' is valid XHTML, too.
>>
>> Maybe we should add a parameter to function org-format-org-table-
>> html to
>> indicate whether we want to format pure standard XHTML tables that do
>> not use "class" or CSS related stuff.
>
> This is exactly how I have done it now.

Thanks for the quick change, Carsten!  I just tested the latest code and
everything looks good.

-- 
Baoqiu

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

end of thread, other threads:[~2010-10-26 16:04 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-20 16:42 Aligning Columns in HTML Export Tables Jeff Horn
2010-10-20 17:16 ` Bernt Hansen
2010-10-20 19:04   ` Christian Moe
2010-10-20 20:11     ` Jeff Horn
2010-10-21  0:25   ` Sebastian Rose
2010-10-21  7:36     ` Christian Moe
2010-10-21  7:46       ` Carsten Dominik
2010-10-21 13:04         ` Sebastian Rose
2010-10-21 13:25           ` Sebastian Rose
2010-10-22  7:32   ` Carsten Dominik
2010-10-22 11:20     ` Sebastian Rose
2010-10-22 11:27       ` Carsten Dominik
2010-10-22 13:59         ` Sebastian Rose
2010-10-22 15:41           ` Carsten Dominik
2010-10-22 19:30             ` Sebastian Rose
2010-10-23  5:42               ` Carsten Dominik
2010-10-23 19:03                 ` Sebastian Rose
2010-10-22 19:37             ` Sebastian Rose
2010-10-23  5:53               ` Carsten Dominik
2010-10-23 19:20                 ` Sebastian Rose
2010-10-23 19:28                 ` Sebastian Rose
2010-10-25  6:48                   ` Carsten Dominik
2010-10-25  9:02                     ` Giovanni Ridolfi
2010-10-25  9:09                       ` Carsten Dominik
2010-10-25  4:36     ` Baoqiu Cui
2010-10-25  8:51       ` Christian Moe
2010-10-25  9:08         ` Carsten Dominik
2010-10-25 13:13           ` Christian Moe
2010-10-25 13:22             ` Carsten Dominik
2010-10-25 14:55               ` Sebastian Rose
2010-10-25 20:41                 ` Christian Moe
2010-10-25 21:52                 ` Baoqiu Cui
2010-10-26  5:11                   ` Carsten Dominik
2010-10-26 16:03                     ` Baoqiu Cui
2010-10-25 13:43             ` Carsten Dominik
2010-10-25 20:04               ` Christian Moe
2010-10-25 21:39                 ` Sebastian Rose
2010-10-26  5:12                   ` Carsten Dominik

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.