From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoqiu Cui Subject: Re: org export as twiki - Failure to export with error: (wrong-type-argument stringp nil) Date: Fri, 05 Mar 2010 10:51:30 -0800 Message-ID: References: <4B900F08.3070401@ieee.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nnccn-0001Fn-Tv for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 13:51:49 -0500 Received: from [140.186.70.92] (port=39707 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nnccm-0001FR-SZ for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 13:51:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nnccm-0005HL-4H for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 13:51:48 -0500 Received: from lo.gmane.org ([80.91.229.12]:51020) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nnccl-0005H8-QZ for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 13:51:48 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nncci-00018x-Ho for emacs-orgmode@gnu.org; Fri, 05 Mar 2010 19:51:44 +0100 Received: from nat-dip4.cfw-a-gci.corp.yahoo.com ([209.131.62.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Mar 2010 19:51:44 +0100 Received: from cbaoqiu by nat-dip4.cfw-a-gci.corp.yahoo.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 05 Mar 2010 19:51:44 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Carsten Dominik writes: > Hi Baoqiu and Mario, > > clearly, writing =double[3][3]= is the correct solution to this problem. > > As for the behavior of [3][3], this is not clearly defined. Neither > the LaTeX > nor the HTML exporter handle this case gracefully, as in producing > meaningful output. > > Maybe the right thing would be to have them both treated as a footnote > reference, but that would also require changes to org-footnote.el. > These changes are not entirely > trivial, as far as I can see now. > > So uness you are willing to dig into org-footnote.el to changes this, > the > easy solution would be to simply catch the problem we have now in the > docbook exporter, so that it does not crash. Thanks for the suggestion, Carsten. Attached below please find the patch for the easy solution for the DocBook exporter (HTML and LaTeX exporters do not report any visible errors). Note that this patch also includes another fix that I had in my local branch to avoid empty "" caused by inline tasks. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=footnote-fix.diff diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el index ab0a086..492a660 100644 --- a/lisp/org-docbook.el +++ b/lisp/org-docbook.el @@ -624,7 +624,7 @@ publishing directory." ;; End of quote section? (when (and inquote (string-match "^\\*+ " line)) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para) (setq inquote nil)) ;; Inside a quote section? @@ -644,7 +644,7 @@ publishing directory." (not (string-match "^[ \t]*\\(:.*\\)" (car lines)))) (setq infixed nil) - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (throw 'nextline nil)) @@ -912,7 +912,8 @@ publishing directory." (while (string-match "\\([^* \t].*?\\)\\[\\([0-9]+\\)\\]" line start) (if (get-text-property (match-beginning 2) 'org-protected line) (setq start (match-end 2)) - (let ((num (match-string 2 line))) + (let* ((num (match-string 2 line)) + (footnote-def (assoc num footnote-list))) (if (assoc num footref-seen) (setq line (replace-match (format "%s" @@ -924,9 +925,10 @@ publishing directory." (match-string 1 line) org-export-docbook-footnote-id-prefix num - (save-match-data - (org-docbook-expand - (cdr (assoc num footnote-list))))) + (if footnote-def + (save-match-data + (org-docbook-expand (cdr footnote-def))) + (format "FOOTNOTE DEFINITION NOT FOUND: %s" num))) t t line)) (push (cons num 1) footref-seen)))))) @@ -1092,7 +1094,7 @@ publishing directory." ;; Properly close all local lists and other lists (when inquote - (insert "]]>\n\n") + (insert "]]>\n") (org-export-docbook-open-para)) (when in-local-list ;; Close any local lists before inserting a new header line @@ -1121,6 +1123,13 @@ publishing directory." "[ \r\n\t]*\\(\\)[ \r\n\t]*[ \r\n\t]*" nil t) (when (not (get-text-property (match-beginning 1) 'org-protected)) (replace-match "\n") + ;; Avoid empty caused by inline tasks. + ;; We should add an empty para to make everything valid. + (when (and (looking-at "") + (save-excursion + (backward-char (length "\n")) + (looking-at ""))) + (insert "")) (backward-char 1))) ;; Fill empty sections with . This is to make sure ;; that the DocBook document generated is valid and well-formed. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index f20b511..91feb3c 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2423,7 +2423,7 @@ INDENT was the original indentation of the block." (concat "\n#+BEGIN_DOCBOOK\n" (org-add-props (concat "\n\n") + "]]>\n") '(org-protected t)) "#+END_DOCBOOK\n")) ((eq backend 'html) --=-=-= Thanks, -- Baoqiu --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--