From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: #+LABEL: in HTML export Date: Sat, 3 Apr 2010 08:33:27 +0200 Message-ID: References: Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NxwvJ-0004NM-GE for emacs-orgmode@gnu.org; Sat, 03 Apr 2010 02:33:37 -0400 Received: from [140.186.70.92] (port=58340 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NxwvF-0004JC-LI for emacs-orgmode@gnu.org; Sat, 03 Apr 2010 02:33:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NxwvD-0002BZ-Gg for emacs-orgmode@gnu.org; Sat, 03 Apr 2010 02:33:33 -0400 Received: from ey-out-1920.google.com ([74.125.78.144]:21038) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NxwvD-0002BQ-87 for emacs-orgmode@gnu.org; Sat, 03 Apr 2010 02:33:31 -0400 Received: by ey-out-1920.google.com with SMTP id 4so141449eyg.34 for ; Fri, 02 Apr 2010 23:33:29 -0700 (PDT) In-Reply-To: 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: Baoqiu Cui Cc: emacs-orgmode@gnu.org Hi Baoqiu, I did apply the patch - by hand because the Emai program did wrap one or two lines. Please check if everything went well. Thanks! - Carsten On Apr 3, 2010, at 12:51 AM, Baoqiu Cui wrote: > Hi Carsten, > > I've made corresponding changes in org-docbook.el to support this > feature in the DocBook exporter. Please check the attached patch, in > which I also fixed a minor bug that was introduced in your recent > change > of "new and better support for entities". > > diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el > index 7c43211..700f1db 100644 > --- a/lisp/org-docbook.el > +++ b/lisp/org-docbook.el > @@ -1259,13 +1259,13 @@ string, don't modify these." > (if org-export-with-sub-superscripts > (setq s (org-export-docbook-convert-sub-super s))) > (if org-export-with-TeX-macros > - (let ((start 0) wd rep ass) > + (let ((start 0) wd rep) > (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)\\({}\\)?" > s start)) > (if (get-text-property (match-beginning 0) 'org-protected s) > (setq start (match-end 0)) > (setq wd (match-string 1 s)) > - (if (setq ass (org-entity-get-representation wd 'html)) > + (if (setq rep (org-entity-get-representation wd 'html)) > (setq s (replace-match rep t t s)) > (setq start (+ start (length wd)))))))) > s) > @@ -1349,18 +1349,33 @@ string, don't modify these." > (replace-match "")))) > > (defun org-export-docbook-finalize-table (table) > - "Change TABLE to informaltable if caption does not exist. > + "Clean up TABLE and turn it into DocBook format. > +This function adds a label to the table if it is available, and > +also changes TABLE to informaltable if caption does not exist. > TABLE is a string containing the HTML code generated by > `org-format-table-html' for a table in Org-mode buffer." > - (if (string-match > - "^\n\\(\\(.\\|\n > \\)+\\)
" > - table) > - (replace-match (concat " - (match-string 1 table) > - (match-string 3 table) > + (let ((table-with-label label)) > + ;; Get the label if it exists, and move it into the > element. > + (setq table-with-label > + (if (string-match > + "^
\">\n\\(\\(.\\|\n\\)+\\)
" > + table) > + (replace-match (concat " table) "\" " > + (match-string 1 table) > + (match-string 4 table) > + "
") > + nil nil table) > + table)) > + ;; Change into if caption does not exist. > + (if (string-match > + "^
\n\\(\\(.\\|\n\\)+\ > \)
" > + table-with-label) > + (replace-match (concat " + (match-string 1 table-with-label) > + (match-string 3 table-with-label) > "") > - nil nil table) > - table)) > + nil nil table-with-label) > + table-with-label))) > > ;; Note: This function is very similar to > ;; org-export-html-convert-sub-super. They can be merged in the > future. > > Carsten Dominik writes: > >> Hi Thomas, >> >> Are you talking about figures or about tables? >> >> For figures, the label is attached to the figure as the id of >> the div surrounding figure plus caption. However, this only >> works if you also specify a caption. But I think that only >> figures with caption should be targets for links. >> >> For tables, I have just made a change so that the label >> is inserted as an anchor just as you propose: >> >> > frame="hsides"> >> >> >> >> Finally, I am now converting \ref{xxx} macros into links >> for the HTML backend. One problem is that, so the same >> \ref macro will lead to the figure in both backends. >> >> Hope this helps. > > Thanks, > > -- > Baoqiu > _______________________________________________ > 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
This is a table