From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: feature request: save LaTeX as title for ltxpng html images Date: Tue, 30 Mar 2010 00:26:25 -0600 Message-ID: <87ljdaba0e.fsf@gmail.com> References: <87aatv2kkj.fsf@gmail.com> 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 1NwUuI-0002WG-9t for emacs-orgmode@gnu.org; Tue, 30 Mar 2010 02:26:34 -0400 Received: from [140.186.70.92] (port=56927 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NwUuG-0002VR-Hv for emacs-orgmode@gnu.org; Tue, 30 Mar 2010 02:26:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NwUuE-0003Hh-QA for emacs-orgmode@gnu.org; Tue, 30 Mar 2010 02:26:32 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:49749) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NwUuE-0003Hc-LY for emacs-orgmode@gnu.org; Tue, 30 Mar 2010 02:26:30 -0400 Received: by pwi2 with SMTP id 2so5025086pwi.0 for ; Mon, 29 Mar 2010 23:26:29 -0700 (PDT) In-Reply-To: (Carsten Dominik's message of "Fri, 26 Mar 2010 21:42:16 +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: Carsten Dominik Cc: Org Mode --=-=-= Hi, The attached patch places the latex source into alt html image tags as described below. I think it should be safe, in that I remove all "s from inside of the alt string. Thanks for the implementation advice -- Eric --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=ltx-src-alt.patch diff --git a/lisp/org-html.el b/lisp/org-html.el index b8925e7..2246daf 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1529,7 +1529,8 @@ lang=\"%s\" xml:lang=\"%s\"> "Create image tag with source and attributes." (save-match-data (if (string-match "^ltxpng/" src) - (format "" src) + (format "\"%s\"/" + src (org-find-text-property-in-string 'org-latex-src src)) (let* ((caption (org-find-text-property-in-string 'org-caption src)) (attr (org-find-text-property-in-string 'org-attributes src)) (label (org-find-text-property-in-string 'org-label src))) Modified lisp/org.el diff --git a/lisp/org.el b/lisp/org.el index e30c49a..480e9f1 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15183,7 +15183,12 @@ Some of the options can be changed using the variable (push ov org-latex-fragment-image-overlays) (goto-char end)) (delete-region beg end) - (insert link)))))))) + (let ((link-beg (point)) + (link-end (progn (insert link) (point)))) + (add-text-properties + link-beg link-end + (list 'org-latex-src + (replace-regexp-in-string "\"" "" txt))))))))))) ;; This function borrows from Ganesh Swami's latex2png.el (defun org-create-formula-image (string tofile options buffer) --=-=-= Carsten Dominik writes: > On Mar 26, 2010, at 4:01 PM, Eric Schulte wrote: > >> Hi, >> >> HTML tags allow both alternate text (rendered when the image >> can't >> be rendered), as well as titles which show as tooltips on hover. I >> wonder if it would be difficult to place the text latex used in >> generating an image into these two fields. If not then I at least >> would >> find it useful. > > It is not trivial, but not too hard either. > > It is not trivial because Org first produces the images and inserts > org-style links. Later, in a second step, these links are replaced > (formatted for HTML). > One way to solve this is that `org-format-latex' will add this > information > as text properties to the link. Then later, when the HTML formatting > is done, > the text property could be retrieved and converted into the attributes > you are mentioning. > > You have worked on org-format-latex before, I think this should be > relatively easy for you. > > - Carsten --=-=-= 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 --=-=-=--