all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Baoqiu Cui <cbaoqiu@yahoo.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Re: #+LABEL: in HTML export
Date: Sat, 3 Apr 2010 08:33:27 +0200	[thread overview]
Message-ID: <B455A459-FBA1-4EE1-B4A1-0DEB05ADF811@gmail.com> (raw)
In-Reply-To: <bycmxxlxybp.fsf@yahoo-inc.com>

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
> -       "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n 
> \\)+\\)</table>"
> -       table)
> -      (replace-match (concat "<informaltable "
> -			     (match-string 1 table)
> -			     (match-string 3 table)
> +  (let ((table-with-label label))
> +    ;; Get the label if it exists, and move it into the <table>  
> element.
> +    (setq table-with-label
> +	  (if (string-match
> +	       "^<table \\(\\(.\\|\n\\)+\\)<a name=\"\\(.+\\)\" id=\".+ 
> \"></a>\n\\(\\(.\\|\n\\)+\\)</table>"
> +	       table)
> +	      (replace-match (concat "<table xml:id=\"" (match-string 3  
> table) "\" "
> +				     (match-string 1 table)
> +				     (match-string 4 table)
> +				     "</table>")
> +			     nil nil table)
> +	    table))
> +    ;; Change <table> into <informaltable> if caption does not exist.
> +    (if (string-match
> +	 "^<table \\(\\(.\\|\n\\)+\\)<caption></caption>\n\\(\\(.\\|\n\\)+\ 
> \)</table>"
> +	 table-with-label)
> +	(replace-match (concat "<informaltable "
> +			     (match-string 1 table-with-label)
> +			     (match-string 3 table-with-label)
> 			     "</informaltable>")
> -		     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 <carsten.dominik@gmail.com> 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:
>>
>>   <table border="2" cellspacing="0" cellpadding="6" rules="groups"
>> frame="hsides">
>>   <a name="tab:yyy" id="tab:yyy"></a>
>>   <caption>This is a table</caption>
>>
>> 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

  reply	other threads:[~2010-04-03  6:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-28 20:29 #+LABEL: in HTML export Thomas S. Dye
2010-03-29 12:20 ` Carsten Dominik
2010-04-02 22:51   ` Baoqiu Cui
2010-04-03  6:33     ` Carsten Dominik [this message]
2010-04-03  7:15       ` Baoqiu Cui
2010-04-03  9:23         ` Carsten Dominik
2010-04-03 16:46           ` Baoqiu Cui
2010-04-04  6:53             ` Carsten Dominik

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

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

  git send-email \
    --in-reply-to=B455A459-FBA1-4EE1-B4A1-0DEB05ADF811@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.