emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Baoqiu Cui <cbaoqiu@yahoo.com>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <bycbpf2ob4d.fsf@muchbodyking-lm.corp.yahoo.com> (raw)
In-Reply-To: A7037220-C072-42F2-9EFF-64E3DE941B8C@gmail.com

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

Carsten Dominik <carsten.dominik@gmail.com> 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 "<listitem></listitem>" caused by inline
tasks.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: footnote-fix.diff --]
[-- Type: text/x-patch, Size: 3127 bytes --]

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</programlisting>\n")
+	    (insert "]]></programlisting>\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</programlisting>\n")
+	      (insert "]]></programlisting>\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<footnoteref linkend=\"%s%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</programlisting>\n")
+	(insert "]]></programlisting>\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]*\\(<para>\\)[ \r\n\t]*</para>[ \r\n\t]*" nil t)
 	(when (not (get-text-property (match-beginning 1) 'org-protected))
 	  (replace-match "\n")
+	  ;; Avoid empty <listitem></listitem> caused by inline tasks.
+	  ;; We should add an empty para to make everything valid.
+	  (when (and (looking-at "</listitem>")
+		     (save-excursion
+		       (backward-char (length "<listitem>\n"))
+		       (looking-at "<listitem>")))
+	    (insert "<para></para>"))
 	  (backward-char 1)))
       ;; Fill empty sections with <para></para>.  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 "<programlisting><![CDATA["
 					     rtn
-					     "]]>\n</programlisting>\n")
+					     "]]></programlisting>\n")
 			  '(org-protected t))
 		      "#+END_DOCBOOK\n"))
 	     ((eq backend 'html)

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


Thanks,

-- 
Baoqiu

[-- Attachment #4: 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

  reply	other threads:[~2010-03-05 18:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-04 19:50 org export as twiki - Failure to export with error: (wrong-type-argument stringp nil) Mario E. Munich
2010-03-05  5:08 ` Baoqiu Cui
2010-03-05  5:30 ` Baoqiu Cui
2010-03-05  7:47   ` Carsten Dominik
2010-03-05 18:51     ` Baoqiu Cui [this message]
2010-03-05  8:15   ` Mario E. Munich
  -- strict thread matches above, loose matches on Subject: below --
2010-03-03  8:48 Mario E. Munich
2010-03-04  2:26 ` Baoqiu Cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bycbpf2ob4d.fsf@muchbodyking-lm.corp.yahoo.com \
    --to=cbaoqiu@yahoo.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).