Table of contents position in HTML export

2021-10-04 Thread Kodi Arfer

When I export this file to HTML with `emacs -Q` and Org 9.5

#+TITLE: example document

text before headline

* headline!

after headline

the table of contents appears before "text before headline", although the manual says "Org 
normally inserts the table of contents directly before the first headline of the file". So shouldn't it 
be after "text before headline"? Or is it the manual that's wrong?



Re: How is the return value of `org-babel-execute:FOO` interpreted?

2021-10-03 Thread Kodi Arfer

On 2021 Oct 03 Sun 8:39:37 AM -0400, Ihor Radchenko  wrote:

Ihor Radchenko  writes:


Kodi Arfer  writes:


Are you sure that you have :file parameter in the source block you tried
to execute?


Yes, this is my code block:

#+begin_src hy :file g/foo.png
(plt.scatter [1 2 3] [4 5 -9])
#+end_src


What about

#+begin_src hy :results file :file g/foo.png
(plt.scatter [1 2 3] [4 5 -9])
#+end_src

?


If this code works for you, the problem is the folloing incompatible
change in Org 9.3 (see etc/ORG-NEWS file in the repo):

* Version 9.3
** Incompatible changes
*** ~:file~ header argument no longer assume "file" ~:results~

The "file" ~:results~ value is now mandatory for a code block
returning a link to a file.  The ~:file~ or ~:file-ext~ header
arguments no longer imply a "file" result is expected.


It works, thank you. I should've looked at the changelog more closely. I wonder 
why this change was made. It would be annoyingly redundant to put `:results 
file` next to every `:file`. I already have code to change the default value of 
`:results` when `:file` is set, for a different Babel language, so I should be 
able to adapt that to this language.



Re: How is the return value of `org-babel-execute:FOO` interpreted?

2021-10-03 Thread Kodi Arfer

On 2021 Oct 03 Sun 5:38:10 AM -0400, Ihor Radchenko  wrote:

Kodi Arfer  writes:

I have an `org-babel-execute` function for the Hy programming
language that seems to have partly broken when I upgraded Org (from
9.1.14 to 9.4.6). …


I just tested using ob-gnuplot and :file link is correctly inserted when
org-babel-execute:gnuplot returns nil.

Are you sure that you have :file parameter in the source block you tried
to execute?


Yes, this is my code block:

#+begin_src hy :file g/foo.png
(plt.scatter [1 2 3] [4 5 -9])
#+end_src

And it looks like `org-babel-execute:hy` is indeed receiving the argument, since `(message 
"%s" (assq :file (org-babel-process-params params)))` prints "(:file . 
g/foo.png)".



How is the return value of `org-babel-execute:FOO` interpreted?

2021-10-02 Thread Kodi Arfer

I have an `org-babel-execute` function for the Hy programming language that 
seems to have partly broken when I upgraded Org (from 9.1.14 to 9.4.6). It has 
code to write a plot to a file when a `:file` argument is given to the code 
block. It returns `nil` in this case, and previously, Org would automatically 
insert a link to the file in the results block, as desired. Now, however, the 
`nil` is printed in the results block. So I guess have to edit the function to 
return a link instead, but I can't find documentation for how Org interprets 
the return value of an `org-babel-execute` function: as I vaguely recall, you 
have to use a certain cons structure to produce a table, another to produce a 
link, and so on. So the concrete question in this case is: what do I return to 
put a link in the document?

Here's my code in case it's helpful, but it isn't pretty: 
https://github.com/Kodiologist/Daylight/blob/37e38d216ffe41ad3537522c40ccf1cdb134bbbc/daylight.el#L430



How is the return value of `org-babel-execute:FOO` interpreted?

2021-10-02 Thread Kodi Arfer

I have an `org-babel-execute` function for the Hy programming language that 
seems to have partly broken when I upgraded Org (from 9.1.14 to 9.4.6). It has 
code to write a plot to a file when a `:file` argument is given to the code 
block. It returns `nil` in this case, and previously, Org would automatically 
insert a link to the file in the results block, as desired. Now, however, the 
`nil` is printed in the results block. So I guess have to edit the function to 
return a link instead, but I can't find documentation for how Org interprets 
the return value of an `org-babel-execute` function: as I vaguely recall, you 
have to use a certain cons structure to produce a table, another to produce a 
link, and so on. So the concrete question in this case is: what do I return to 
put a link in the document?

Here's my code in case it's helpful, but it isn't pretty: 
https://github.com/Kodiologist/Daylight/blob/37e38d216ffe41ad3537522c40ccf1cdb134bbbc/daylight.el#L430



[O] Automatically save the archive file after org-archive-subtree

2018-10-06 Thread Kodi Arfer

As of

https://code.orgmode.org/bzg/org-mode/commit/b186d1d7236c0dc397eadeb004c9a17eaffd3aab

archiving a subtree no longer automatically saves the archive file. How 
can I get this behavior back?


A Debian bug was also opened for this issue:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=887332



[O] Error when using :session :colnames yes :results graphics on an R code block

2016-12-28 Thread Kodi Arfer

If I run Emacs with

emacs -Q --eval '(progn (add-to-list (quote load-path) 
"/home/hippo/.emacs.d/elpa/org-20161224") (add-to-list (quote load-path) 
"/home/hippo/.emacs.d/elpa/ess-20161223.108/lisp") (require (quote 
ess-site)))'


, open an Org file containing

#+BEGIN_SRC R :session :file /tmp/foo.png :results graphics 
:colnames yes

library(ggplot2)
qplot(c(1, 2, 3), c(2, 4, 9))
#+END_SRC

#+RESULTS:
[[file:/tmp/foo.png]]

, add R to org-babel-load-languages, and hit C-c C-c on the
code block, I get the error:

cons: Wrong type argument: listp, "x
1"

If I remove ":colnames yes", the error doesn't happen and the
file is produced as expected.

The full backtrace is:

org-babel-R-process-value-result("x\n1" t)
org-babel-R-evaluate-session("*R*" "png(filename=\"/tmp/foo.png\"); 
tryCatch({\nlibrary(ggplot2)\nqplot(c(1, 2, 3), c(2, 4, 
9))\n},error=function(e){plot(x=-1:1, y=-1:1, type='n', xlab='', 
ylab='', axes=FALSE); text(x=0, y=0, labels=e$message, col='red'); 
paste('ERROR', e$message, sep=' : ')}); dev.off()" value ("file" 
"graphics" "replace") t nil)
org-babel-R-evaluate("*R*" "png(filename=\"/tmp/foo.png\"); 
tryCatch({\nlibrary(ggplot2)\nqplot(c(1, 2, 3), c(2, 4, 
9))\n},error=function(e){plot(x=-1:1, y=-1:1, type='n', xlab='', 
ylab='', axes=FALSE); text(x=0, y=0, labels=e$message, col='red'); 
paste('ERROR', e$message, sep=' : ')}); dev.off()" value ("file" 
"graphics" "replace") t nil)
org-babel-execute:R("library(ggplot2)\nqplot(c(1, 2, 3), c(2, 4, 
9))" ((:colname-names) (:rowname-names) (:result-params "file" 
"graphics" "replace") (:result-type . value) (:results . "file graphics 
replace") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . 
"no") (:tangle . "no") (:session) (:file . "/tmp/foo.png") (:colnames . 
"yes")))
funcall(org-babel-execute:R "library(ggplot2)\nqplot(c(1, 2, 3), 
c(2, 4, 9))" ((:colname-names) (:rowname-names) (:result-params "file" 
"graphics" "replace") (:result-type . value) (:results . "file graphics 
replace") (:exports . "code") (:cache . "no") (:noweb . "no") (:hlines . 
"no") (:tangle . "no") (:session) (:file . "/tmp/foo.png") (:colnames . 
"yes")))
(let ((r (funcall cmd body params))) (if (and (eq (cdr (assq 
:result-type params)) (quote value)) (or (member "vector" result-params) 
(member "table" result-params)) (not (listp r))) (list (list r)) r))
(setq result (let ((r (funcall cmd body params))) (if (and (eq (cdr 
(assq :result-type params)) (quote value)) (or (member "vector" 
result-params) (member "table" result-params)) (not (listp r))) (list 
(list r)) r)))
(if (member "none" result-params) (progn (funcall cmd body params) 
(message "result silenced")) (setq result (let ((r (funcall cmd body 
params))) (if (and (eq (cdr (assq :result-type params)) (quote value)) 
(or (member "vector" result-params) (member "table" result-params)) (not 
(listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params 
(if file (progn (if result (progn (let (... ...) (unwind-protect ... 
... (setq result file))) (let ((post (cdr (assq :post params (if 
post (progn (let ((*this* ...)) (setq result (org-babel-ref-resolve 
post)) (if file (progn ...)) (org-babel-insert-result result 
result-params info new-hash lang)))
(let* ((lang (nth 0 info)) (result-params (cdr (assq :result-params 
params))) (body (let ((coderef (nth 6 info)) (expand (if 
(org-babel-noweb-p params :eval) (org-babel-expand-noweb-references 
info) (nth 1 info (if (not coderef) expand (replace-regexp-in-string 
(org-src-coderef-regexp coderef) "" expand nil nil 1 (dir (cdr (assq 
:dir params))) (default-directory (or (and dir (file-name-as-directory 
(expand-file-name dir))) default-directory)) (cmd (intern (concat 
"org-babel-execute:" lang))) result) (if (fboundp cmd) nil (error "No 
org-babel-execute function for %s!" lang)) (message "executing %s code 
block%s..." (capitalize lang) (let ((name (nth 4 info))) (if name 
(format " (%s)" name) ""))) (if (member "none" result-params) (progn 
(funcall cmd body params) (message "result silenced")) (setq result (let 
((r (funcall cmd body params))) (if (and (eq (cdr ...) (quote value)) 
(or (member "vector" result-params) (member "table" result-params)) (not 
(listp r))) (list (list r)) r))) (let ((file (cdr (assq :file params 
(if file (progn (if result (progn (let ... ...))) (setq result file))) 
(let ((post (cdr (assq :post params (if post (progn (let (...) (setq 
result ...) (if file ...) (org-babel-insert-result result 
result-params info new-hash lang))) (run-hooks (quote 
org-babel-after-execute-hook)) result)
(cond (current-cache (save-excursion (goto-char 
(org-babel-where-is-src-block-result nil info)) (forward-line) 
(skip-chars-forward " 	") (let ((result (org-babel-read-result))) 
(message (replace-regexp-in-string "%" "%%" (format "%S" result))) 
result))) ((org-babel-confirm-evaluate info) (let* ((lang (nth 0 

[O] :results none doesn't seem to be documented

2015-01-14 Thread Kodi Arfer
none is allowed as an argument to :results (see, for example, 
ob-core.el line 704 as of Git d36bd8d), but this isn't mentioned in 
results.html. I just learned of its existence while reading ob-core.el.


To me, by the way, :results none seems like a useful feature rather 
than being redundant with :results silent, because it won't attempt to 
print a massive object to the echo area. (Pehaps silent wasn't a great 
choice of name.)




[O] Should comments break paragraphs?

2013-07-15 Thread Kodi Arfer

If you export

some text
# a comment
more text

then you get two paragraphs, not one. Is this intentional? The old 
export engine gave you one paragraph. I liked that behavior better, 
since it allowed me to insert notes in the middle of paragraphs. The 
manual still says Paragraphs are separated by at least one empty line. 
On the other hand, it's probably a little cleaner to treat a comment 
just like a blank linke.




Re: [O] [PATCH] ox-html: Allow Figure %d:, etc. to be styled

2013-07-09 Thread Kodi Arfer
On 2013 Jul 09 Tue 3:53:26 PM -0400, Nicolas Goaziou 
n.goaz...@gmail.com wrote:

Kodi Arfer k...@arfer.net writes:


 From a873d204b2c4f3facf2d8658f69764acbd063246 Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Wed, 3 Jul 2013 17:51:56 -0400
Subject: [PATCH] ox-html: Allow Figure %d:, etc. to be styled

* lisp/ox-html.el (org-html-paragraph): Wrap Figure %d: in
   span class=figure-number.
   (org-html-list-of-tables, org-html-table): Wrap Table %d: in
span class=table-number.
   (org-html-list-of-listings): Wrap Listing %d: in
   span class=listing-number.
* doc/org.text (CSS support): Mention .figure-number,
   .listing-number, and .table-number.


Thank you for the patch.


De nada.


Wouldn't it be more future-proof to wrap them within the same CSS entry?
Otherwise, if we ever introduce other caption types, we'll need to
remember to add another entry for it.

Obviously, my question assume it is very unlikely that someone would
want different styles for captions. But I may be wrong.


One case I know of is APA style. Here are some examples from the APA 
publication manual. Figure 1 is supposed to be italicized and inline 
with the caption ( http://i.imgur.com/u6jsfJx.png ), whereas Table 1 
is supposed to be upright and on its own line ( 
http://i.imgur.com/3gvxEdd.png ). Admittedly, APA style is crazy, and 
you have to be additionally crazy to want APA style in HTML.


We could still use the same class and then expect people to use 
selectors to be as specific as they want (e.g., if the generic class is 
~.caption-number~, one could use the selector ~caption .caption-number~ 
for tables and ~figcaption .caption-number~ for figures, at least in 
HTML5). I think using different classes is actually simpler, though, 
because then we don't have to keep track of how selectable the different 
caption types are.



BTW, do you have any news about your FSF papers?


I got an assignment form back from the FSF, and I returned scans of the 
signed form on July 1, but I haven't heard back since.


I guess there's not much of a hurry. I won't be firing off these little 
patches as much now that I've released http://arfer.net/daylight .




[O] [PATCH] ox-html: Allow Figure %d:, etc. to be styled

2013-07-03 Thread Kodi Arfer
 From a873d204b2c4f3facf2d8658f69764acbd063246 Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Wed, 3 Jul 2013 17:51:56 -0400
Subject: [PATCH] ox-html: Allow Figure %d:, etc. to be styled

* lisp/ox-html.el (org-html-paragraph): Wrap Figure %d: in
  span class=figure-number.
  (org-html-list-of-tables, org-html-table): Wrap Table %d: in
   span class=table-number.
  (org-html-list-of-listings): Wrap Listing %d: in
  span class=listing-number.
* doc/org.text (CSS support): Mention .figure-number,
  .listing-number, and .table-number.

I didn't change org-html-style-default, so these labels won't
appear special by default.

TINYCHANGE
---
 doc/org.texi|  3 +++
 lisp/ox-html.el | 14 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 4eb9a45..ce4f715 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -11337,6 +11337,9 @@ p.creator   @r{creator info, about org mode version}
 div.outline-N   @r{div for outline level N (headline plus text))}
 div.outline-text-N  @r{extra div for text at outline level N}
 .section-number-N   @r{section number in headlines, different for each level}
+.figure-number  @r{label like Figure 1:}
+.table-number   @r{label like Table 1:}
+.listing-number @r{label like Listing 1:}
 div.figure  @r{how to format an inlined image}
 pre.src @r{formatted source code}
 pre.example @r{normal example}
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 9ce73c4..b0417e8 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2009,7 +2009,8 @@ of listings as a string, or nil if it is empty.
 		  org-html-toplevel-hlevel)
 	  div id=\text-list-of-listings\\nul\n
 	  (let ((count 0)
-		(initial-fmt (org-html--translate Listing %d: info)))
+		(initial-fmt (format span class=\listing-number\%s/span
+	 (org-html--translate Listing %d: info
 		(mapconcat
 		 (lambda (entry)
 		   (let ((label (org-element-property :name entry))
@@ -2043,7 +2044,8 @@ of tables as a string, or nil if it is empty.
 		  org-html-toplevel-hlevel)
 	  div id=\text-list-of-tables\\nul\n
 	  (let ((count 0)
-		(initial-fmt (org-html--translate Table %d: info)))
+		(initial-fmt (format span class=\table-number\%s/span
+	 (org-html--translate Table %d: info
 		(mapconcat
 		 (lambda (entry)
 		   (let ((label (org-element-property :name entry))
@@ -2790,12 +2792,13 @@ the plist used as a communication channel.
 		'org-html--has-caption-p))
 	   (if (not (org-string-nw-p raw)) raw
 		 (concat
+  span class=\figure-number\
 		  (format (org-html--translate Figure %d: info)
 			  (org-export-get-ordinal
 			   (org-element-map paragraph 'link
 			 'identity info t)
 			   info nil 'org-html-standalone-image-p))
-		raw
+		  /span  raw
 	(label (org-element-property :name paragraph)))
 	(org-html--wrap-image contents info caption label)))
  ;; Regular paragraph.
@@ -3204,8 +3207,9 @@ contextual information.
 			 caption align=\above\%s/caption
 			   caption align=\bottom\%s/caption)
 			 (concat
-			  (format (org-html--translate Table %d: info) number)
-			(org-export-data caption info
+			  span class=\table-number\
+  (format (org-html--translate Table %d: info) number)
+			  /span  (org-export-data caption info
 	   (funcall table-column-specs table info)
 	   contents)
 
-- 
1.8.1.2



Re: [O] Standalone hyperlinked images in HTML export

2013-07-01 Thread Kodi Arfer
On 2013 Jul 01 Mon 5:01:46 PM -0400, Nicolas Goaziou 
n.goaz...@gmail.com wrote:

Hello,

Kodi Arfer k...@arfer.net writes:


The manual explains in Images in HTML export that you can make an
image a hyperlink like this:

[[file:highres.jpg][file:thumb.jpg]]

where thumb.jpg becomes the img 'src' and highres.jpg becomes the a
'href'. One might infer it should also be possible to link to something
other than an image, like this:

[[http://gnu.org][http://example.com/gnu-head.jpg]]

For example, try exporting this file:

#+begin_src org
Some initial text.

[[http://example.com/a.png]]

Some text between images 1 and 2.

[[http://eeyup.com][http://example.com/b.png]]

Some text between images 2 and 3.

http://example.com/c.png

Some trailing text.
#+end_src

You do indeed get

a href=http://eeyup.com;img  src=http://example.com/b.png;
alt=b.png //a

in the output, but the exporter doesn't regard the image as standalone,
so it doesn't get put in a div (or, in HTML5 mode, figure) like the
others, and if you add a #+CAPTION, no caption will be included.


Indeed. Would you mind testing the following patch against master? It
should fix the issues.


I tried it with captions, :html5-fancy, and paths to images as well as 
path to non-images. All looks good. You're awesome.


I see your patch also affects math export somehow, but I haven't tested 
that.




[O] Standalone hyperlinked images in HTML export

2013-06-30 Thread Kodi Arfer
The manual explains in Images in HTML export that you can make an 
image a hyperlink like this:


[[file:highres.jpg][file:thumb.jpg]]

where thumb.jpg becomes the img 'src' and highres.jpg becomes the a 
'href'. One might infer it should also be possible to link to something 
other than an image, like this:


[[http://gnu.org][http://example.com/gnu-head.jpg]]

For example, try exporting this file:

#+begin_src org
Some initial text.

[[http://example.com/a.png]]

Some text between images 1 and 2.

[[http://eeyup.com][http://example.com/b.png]]

Some text between images 2 and 3.

http://example.com/c.png

Some trailing text.
#+end_src

You do indeed get

a href=http://eeyup.com;img  src=http://example.com/b.png; 
alt=b.png //a


in the output, but the exporter doesn't regard the image as standalone, 
so it doesn't get put in a div (or, in HTML5 mode, figure) like the 
others, and if you add a #+CAPTION, no caption will be included.


The attached patch to master shows how this can be fixed, but I hesitate 
to recommend applying it because two new bugs are immediately apparent:


1. Figure numbers are screwed up. If you add #+CAPTIONs to each image in 
the above file, the figure numbers go Figure 1, Figure 3, Figure 4.


2. The a ... ... /a gets wrapped around the whole div or figure, 
not just the img. This breaks markup validity (div isn't allowed in 
a) and makes the caption, if you have one, into a giant hyperlink.


I think I'm going to stop working on this issue for now, but at least 
what I've done could be helpful for anybody else who wants to go further 
down the rabbit hole.


P.S. I sent a request for a copyright-assignment form earlier today.
From fe74b3507795f2664291250250bc24b943f8f12b Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Sun, 30 Jun 2013 15:40:33 -0400
Subject: [PATCH] ox-html: Allow standalone images to be hyperlinked

* lisp/ox-html.el (org-html-standalone-image-p): If the link is
  the description of another link, look one more element up the
  tree to find `paragraph'.
* lisp/ox.el (org-export-inline-image-p): When the description
  is a link, test the description instead of the path.

TINYCHANGE
---
 lisp/ox-html.el |  9 ++---
 lisp/ox.el  | 38 --
 2 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 4753e66..4091bcc 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2579,9 +2579,12 @@ standalone images, do the following.
 	  \(org-element-property :caption paragraph\)\)\)
   (let ((paragraph (case (org-element-type element)
 		 (paragraph element)
-		 (link (and (org-export-inline-image-p
- element org-html-inline-image-rules)
-(org-export-get-parent element)))
+		 (link (let ((x (and (org-export-inline-image-p
+	  element org-html-inline-image-rules)
+	 (org-export-get-parent element
+			 (if (eq (org-element-type x) 'link)
+ (org-export-get-parent x)
+			 x)))
 		 (t nil
 (when (eq (org-element-type paragraph) 'paragraph)
   (when (or (not (and (boundp 'org-html-standalone-image-predicate)
diff --git a/lisp/ox.el b/lisp/ox.el
index 08fbddd..9179576 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -3919,20 +3919,30 @@ type is TYPE.  The function will return a non-nil value if any of
 the provided rules is non-nil.  The default rule is
 `org-export-default-inline-image-rule'.
 
-This only applies to links without a description.
-  (and (not (org-element-contents link))
-   (let ((case-fold-search t)
-	 (rules (or rules org-export-default-inline-image-rule)))
-	 (catch 'exit
-	   (mapc
-	(lambda (rule)
-	  (and (string= (org-element-property :type link) (car rule))
-		   (string-match (cdr rule)
- (org-element-property :path link))
-		   (throw 'exit t)))
-	rules)
-	   ;; Return nil if no rule matched.
-	   nil
+This only applies to links without a description, unless the
+description is itself a link, as for hyperlinked images in HTML.
+In this case, the test is applied to the description instead of
+the path.
+  (let* ((cs (org-element-contents link))
+ (dlink (and (= (length cs) 1)
+ (eq (org-element-type (car cs)) 'link)
+ (car cs
+(when (or dlink (not (org-element-contents link)))
+  (message dlink: %s (show-org-element dlink))
+  (when dlink
+(setq link dlink))
+  (let ((case-fold-search t)
+(rules (or rules org-export-default-inline-image-rule)))
+(catch 'exit
+  (mapc
+   (lambda (rule)
+ (and (string= (org-element-property :type link) (car rule))
+  (string-match (cdr rule)
+(org-element-property :path link))
+  (throw 'exit t)))
+   rules)
+  ;; Return nil if no rule matched.
+  nil)
 
 (defun org-export-resolve-coderef (ref info)
   Resolve a code reference

[O] [PATCH] ox-html: Restore wrongly omitted table attributes under HTML5.

2013-06-29 Thread Kodi Arfer
 From edd97671641e28c3e240efe6ea8fa8d77b4b7eae Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Sat, 29 Jun 2013 10:43:07 -0400
Subject: [PATCH] ox-html: Restore wrongly omitted table attributes under
 HTML5.

* lisp/ox-html.el (org-html-table): For HTML5,
  omit :html-table-attributes but not :id or :attr_html.

TINYCHANGE
---
 lisp/ox-html.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 4a2b6ec..bcf86ee 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -3163,12 +3163,12 @@ contextual information.
 	(number (org-export-get-ordinal
 		 table info nil 'org-html--has-caption-p))
 	(attributes
-	 (if (org-html-html5-p info) 
-	   (org-html--make-attribute-string
-		(org-combine-plists
-		 (and label (list :id (org-export-solidify-link-text label)))
-		 (plist-get info :html-table-attributes)
-		 (org-export-read-attribute :attr_html table)
+	 (org-html--make-attribute-string
+	  (org-combine-plists
+	   (and label (list :id (org-export-solidify-link-text label)))
+	   (unless (org-html-html5-p info)
+		 (plist-get info :html-table-attributes))
+	   (org-export-read-attribute :attr_html table
 	(alignspec
 	 (if (and (boundp 'org-html-format-table-no-css)
 		  org-html-format-table-no-css)
-- 
1.8.1.2



Re: [O] [PATCH] ox-html: Restore wrongly omitted table attributes under HTML5.

2013-06-29 Thread Kodi Arfer
On 2013 Jun 29 Sat 6:37:33 PM -0400, Nicolas Goaziou 
n.goaz...@gmail.com wrote:

Kodi Arfer k...@arfer.net writes:


 From edd97671641e28c3e240efe6ea8fa8d77b4b7eae Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Sat, 29 Jun 2013 10:43:07 -0400
Subject: [PATCH] ox-html: Restore wrongly omitted table attributes under
  HTML5.

* lisp/ox-html.el (org-html-table): For HTML5,
   omit :html-table-attributes but not :id or :attr_html.


Thank you for your patch. Could you rebase it against maint? I cannot
apply it at the moment.


I don't think I can. I'm not clear about the relationship between maint 
and master in general, but it looks like maint doesn't have the bug my 
patch is supposed to fix, because it doesn't treat an HTML5 doctype 
specially at all.



+  (unless (org-html-html5-p info)
+(plist-get info :html-table-attributes))


One nitpick. It is more explicit to use:

   (and (not (org-html-html5-p info))
(plist-get info :html-table-attributes))

since you are using the returned value.


Sure, I can change that. Should I base the patch off master again?



[O] [PATCH] ox-html: Under html5-fancy, use nav for the ToC

2013-06-01 Thread Kodi Arfer
While I admit I'm not totally sure, in general, when a given fancy HTML5 
element is appropriate, this case (an intra-page table of contents) 
seems right in line with the second code example here:


http://www.w3.org/html/wg/drafts/html/master/sections.html#the-nav-element
From a1aa357f75cd37ef676f5ac4dbbe66ad66d76aa8 Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Sat, 1 Jun 2013 17:41:38 -0400
Subject: [PATCH] ox-html: Under html5-fancy, use nav for the ToC

* lisp/ox-html.el (org-html-toc): Use nav instead of div
  for the root element when appropriate.

TINYCHANGE
---
 lisp/ox-html.el | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index facd84c..10891ce 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1912,9 +1912,13 @@ contents as a string, or nil if it is empty.
 	 (mapcar (lambda (headline)
 		   (cons (org-html--format-toc-headline headline info)
 			 (org-export-get-relative-level headline info)))
-		 (org-export-collect-headlines info depth
+		 (org-export-collect-headlines info depth)))
+	(outer-tag (if (and (org-html-html5-p info)
+			(plist-get info :html-html5-fancy))
+		   nav
+		 div)))
 (when toc-entries
-  (concat div id=\table-of-contents\\n
+  (concat (format %s id=\table-of-contents\\n outer-tag)
 	  (format h%d%s/h%d\n
 		  org-html-toplevel-hlevel
 		  (org-html--translate Table of Contents info)
@@ -1922,7 +1926,7 @@ contents as a string, or nil if it is empty.
 	  div id=\text-table-of-contents\
 	  (org-html--toc-text toc-entries)
 	  /div\n
-	  /div\n
+	  (format /%s\n outer-tag)
 
 (defun org-html--toc-text (toc-entries)
   Return innards of a table of contents, as a string.
-- 
1.8.1.2



[O] [PATCH] ox-html: Fix handling of time-stamp-file

2013-05-30 Thread Kodi Arfer
 From 10814da65829d6918d736188027723dde30b4a3c Mon Sep 17 00:00:00 2001
From: Kodi Arfer g...@arfer.net
Date: Thu, 30 May 2013 15:19:57 -0400
Subject: [PATCH] ox-html: Fix handling of time-stamp-file

* lisp/ox-html.el (org-html--build-meta-info): Insert no timestamp
  when :time-stamp-file is nil.

TINYCHANGE
---
 lisp/ox-html.el | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 297cb55..949c3ba 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1506,10 +1506,9 @@ INFO is a plist used as a communication channel.
 		 iso-8859-1)))
 (concat
  (format title%s/title\n title)
- (format
-  (when :time-stamp-file
-	(format-time-string
-	 (concat !--  org-html-metadata-timestamp-format  --\n
+ (when (plist-get info :time-stamp-file)
+   (format-time-string
+	 (concat !--  org-html-metadata-timestamp-format  --\n)))
  (format
   (if (org-html-html5-p info)
 	  (org-html-close-tag meta  charset=\%s\ info)
-- 
1.8.1.2



Re: [O] Bug with automatic alignment of table columns in HTML export

2013-03-19 Thread Kodi Arfer

On 2013 Mar 19 Tue 1:26:13 PM -0400, Bastien b...@altern.org wrote:

Hi Kodi,

Kodi Arfer k...@arfer.net writes:


Consider an Org file with the following content:

|   a | b |
|-+---|
| 100 | 1 |
|   1 | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |

Within Emacs, Org right-aligns the left column, as it should, since most
nonempty cells in the column are numeric. In HTML export, though (starting
from emacs -Q -l /tmp/minimal-org.el), the column comes out
left-aligned. The problem seems to be with how the exporter treats empty
cells, since if you put numbers in all the empty cells above, the column
comes out right-aligned in HTML export.


Fixed, thanks.


You're quite welcome. That was prompt! I see this case now works in 
master. The catch is that there are still some cases which give 
inconsistent alignment between Emacs and HTML export, such as:


|   a | b |
|-+---|
| 100 | 1 |
|   1 | 1 |
|   1 | 1 |
|   1 | 1 |
|   a | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |

I believe the heuristic used for in-buffer display is that empty cells 
are ignored entirely when doing the comparison against 
org-table-number-fraction.





[O] Bug with automatic alignment of table columns in HTML export

2013-03-17 Thread Kodi Arfer

Consider an Org file with the following content:

|   a | b |
|-+---|
| 100 | 1 |
|   1 | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |
| | 1 |

Within Emacs, Org right-aligns the left column, as it should, since most 
nonempty cells in the column are numeric. In HTML export, though 
(starting from emacs -Q -l /tmp/minimal-org.el), the column comes out 
left-aligned. The problem seems to be with how the exporter treats empty 
cells, since if you put numbers in all the empty cells above, the column 
comes out right-aligned in HTML export.


Emacs  : GNU Emacs 24.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.12)
 of 2012-09-22 on batsu, modified by Debian
Package: Org-mode version 7.9.4 (7.9.4-dist @ 
/usr/share/emacs/site-lisp/org/)