emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Alignment problem with org-format-org-table-html
@ 2010-04-27 18:39 Stephen Peters
  2010-04-29 13:01 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Peters @ 2010-04-27 18:39 UTC (permalink / raw)
  To: emacs-orgmode

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

When creating a table, I was noticing that the
<colgroup><col>... provides useful alignment information based on
whether or not the column has numbers in it.  I think, however, that
there is a mistake in this routine.  Take, for example, the following
table:

|  Id | Task         | Developer | Estimate | Spent | Remaining | Comp.% 
| Updated         |
|-----+--------------+-----------+----------+-------+-----------+--------+-----------------|
|   1 | Task One     | SLP       |        1 |     0 |         1 |      0 
| SLP, 2010-04-27 |
|   2 | Task Two     | SLP       |        1 |     0 |         1 |      0 
| SLP, 2010-04-27 |
|   3 | Task Three   | SLP       |        2 |     0 |         2 |      0 
| SLP, 2010-04-27 |
|   4 | Task Four    | SLP       |        2 |     0 |         2 |      0 
| SLP, 2010-04-27 |
|   5 | Task Five    | SLP       |      .25 |     0 |      0.25 |      0 
| SLP, 2010-04-27 |
| 5.1 | Another Task | XML team  |        0 |     1 |         0 |      0 
| SLP, 2010-04-27 |
|   6 | Task Six     | SLP       |      .25 |     0 |      0.25 |      0 
| SLP, 2010-04-27 |
| 6.1 | More Tasks   | DB team   |        3 |     0 |         3 |      0 
| SLP, 2010-04-27 |
|   7 | Task Seven   | SLP       |        3 |     0 |         3 |      0 
| SLP, 2010-04-27 |

When the colgroup list is created for this table, it reads:

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

Note that the first columns are correct, but the last few are not.
It should read right, left, left, right, right, right, right, left.

I believe that this is due to the (< i nline) comparison within 
org-format-org-table-html, which is nonsensical because it's trying to 
compare a column number with a number of rows.  I've attached a patch 
for the problem.




[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 418 bytes --]

diff --git a/lisp/org-html.el b/lisp/org-html.el
index 3ac2b18..0ffde15 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1659,8 +1659,7 @@ lang=\"%s\" xml:lang=\"%s\">
 		      (mapconcat
 		       (lambda (x)
 			 (setq i (1+ i))
-			 (if (and (< i nline)
-				  (string-match org-table-number-regexp x))
+			 (if (string-match org-table-number-regexp x)
 			     (incf (aref fnum i)))
 			 (cond
 			  (head

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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 related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Alignment problem with org-format-org-table-html
  2010-04-27 18:39 [PATCH] Alignment problem with org-format-org-table-html Stephen Peters
@ 2010-04-29 13:01 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-04-29 13:01 UTC (permalink / raw)
  To: Stephen Peters; +Cc: emacs-orgmode

Hi Stephen, nice catch, thank you very much!

I have applied the patch.

- Carsten

On Apr 27, 2010, at 8:39 PM, Stephen Peters wrote:

> When creating a table, I was noticing that the
> <colgroup><col>... provides useful alignment information based on
> whether or not the column has numbers in it.  I think, however, that
> there is a mistake in this routine.  Take, for example, the following
> table:
>
> |  Id | Task         | Developer | Estimate | Spent | Remaining |  
> Comp.% | Updated         |
> |-----+--------------+-----------+----------+-------+----------- 
> +--------+-----------------|
> |   1 | Task One     | SLP       |        1 |     0 |         1  
> |      0 | SLP, 2010-04-27 |
> |   2 | Task Two     | SLP       |        1 |     0 |         1  
> |      0 | SLP, 2010-04-27 |
> |   3 | Task Three   | SLP       |        2 |     0 |         2  
> |      0 | SLP, 2010-04-27 |
> |   4 | Task Four    | SLP       |        2 |     0 |         2  
> |      0 | SLP, 2010-04-27 |
> |   5 | Task Five    | SLP       |      .25 |     0 |      0.25  
> |      0 | SLP, 2010-04-27 |
> | 5.1 | Another Task | XML team  |        0 |     1 |         0  
> |      0 | SLP, 2010-04-27 |
> |   6 | Task Six     | SLP       |      .25 |     0 |      0.25  
> |      0 | SLP, 2010-04-27 |
> | 6.1 | More Tasks   | DB team   |        3 |     0 |         3  
> |      0 | SLP, 2010-04-27 |
> |   7 | Task Seven   | SLP       |        3 |     0 |         3  
> |      0 | SLP, 2010-04-27 |
>
> When the colgroup list is created for this table, it reads:
>
> <colgroup><col align="right" /><col align="left" /><col  
> align="left" /><col align="right" /><col align="right" /><col  
> align="left" /><col align="left" /><col align="left" />
> </colgroup>
>
> Note that the first columns are correct, but the last few are not.
> It should read right, left, left, right, right, right, right, left.
>
> I believe that this is due to the (< i nline) comparison within org- 
> format-org-table-html, which is nonsensical because it's trying to  
> compare a column number with a number of rows.  I've attached a  
> patch for the problem.
>
>
>
> diff --git a/lisp/org-html.el b/lisp/org-html.el
> index 3ac2b18..0ffde15 100644
> --- a/lisp/org-html.el
> +++ b/lisp/org-html.el
> @@ -1659,8 +1659,7 @@ lang=\"%s\" xml:lang=\"%s\">
> 		      (mapconcat
> 		       (lambda (x)
> 			 (setq i (1+ i))
> -			 (if (and (< i nline)
> -				  (string-match org-table-number-regexp x))
> +			 (if (string-match org-table-number-regexp x)
> 			     (incf (aref fnum i)))
> 			 (cond
> 			  (head
> _______________________________________________
> 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

- Carsten

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

end of thread, other threads:[~2010-04-29 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-27 18:39 [PATCH] Alignment problem with org-format-org-table-html Stephen Peters
2010-04-29 13:01 ` Carsten Dominik

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