emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Sebastian Rose <sebastian_rose@gmx.de>
Cc: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Images in div and p
Date: Fri, 2 Oct 2009 08:21:50 +0200	[thread overview]
Message-ID: <6722E1ED-4904-4310-9690-F2E71754DE9E@gmail.com> (raw)
In-Reply-To: <87ws3epuvp.fsf@gmx.de>

Applied, thanks!

Maybe your example can be turned into an image-placing tutorial or FAQ?

- Carsten

On Oct 2, 2009, at 1:16 AM, Sebastian Rose wrote:

>
>
> OK, this is my proposal (don't know, why I didn't send a patch in the
> first place...).
>
> If a caption is provided, wrap the image as before.
>
> If no caption is provided, just insert the image tag.
>
>
>
> diff --git a/lisp/org-html.el b/lisp/org-html.el
> index 0e06919..a9adf30 100644
> --- a/lisp/org-html.el
> +++ b/lisp/org-html.el
> @@ -1505,17 +1505,22 @@ lang=\"%s\" xml:lang=\"%s\">
>       (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)))
> -	(format "%s<div %sclass=\"figure\">
> -<p><img src=\"%s\"%s /></p>%s
> -</div>%s"
> -		(if org-par-open "</p>\n" "")
> -		(if label (format "id=\"%s\" " label) "")
> +	(concat
> +	(if caption
> +	    (format "%s<div %sclass=\"figure\">
> +<p>"
> +		    (if org-par-open "</p>\n" "")
> +		    (if label (format "id=\"%s\" " label) "")))
> +	(format "<img src=\"%s\"%s />"
> 		src
> 		(if (string-match "\\<alt=" (or attr ""))
> 		    (concat " " attr )
> -		  (concat " " attr " alt=\"" src "\""))
> -		(if caption (concat "\n<p>" caption "</p>") "")
> -		(if org-par-open "\n<p>" ""))))))
> +		  (concat " " attr " alt=\"" src "\"")))
> +	(if caption
> +	    (format "</p>%s
> +</div>%s"
> +		(concat "\n<p>" caption "</p>")
> +		(if org-par-open "\n<p>" ""))))))))
>
> (defun org-export-html-get-bibliography ()
>   "Find bibliography, cut it out and return it."
>
>
> A little Org-file for testing:
>
>
>
> #+OPTIONS:   toc:nil
> #+MACRO: imageurl ./intranet/img/powered-by-mysql-167x86.png
> #+STYLE: <style type="text/css">
> #+STYLE:  #content { width:780px; }
> #+STYLE: </style>
>
> * Images aligned
>
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="right"
>  [[{{{imageurl}}}]]
>  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
> nonummy
>  nibh euismod tincidunt ut laoreet dolore magna aliquam erat  
> volutpat. Ut wisi
>  enim ad minim veniam, quis nostrud exerci tation ullamcorper  
> suscipit lobortis
>  nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure  
> dolor in
>  hendrerit in vulputate velit esse molestie consequat, vel illum  
> dolore eu
>  feugiat nulla facilisis at vero et accumsan et iusto odio dignissim  
> qui
>  blandit praesent luptatum zzril delenit augue duis dolore te  
> feugait nulla
>  facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit,  
> sed diam
>  nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
>  volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation  
> ullamcorper
>  suscipit lobortis nisl ut aliquip ex ea commodo
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="left"
>  [[{{{imageurl}}}]]
>  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
> nonummy
>  nibh euismod tincidunt ut laoreet dolore magna aliquam erat  
> volutpat. Ut wisi
>  enim ad minim veniam, quis nostrud exerci tation ullamcorper  
> suscipit lobortis
>  nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure  
> dolor in
>  hendrerit in vulputate velit esse molestie consequat, vel illum  
> dolore eu
>  feugiat nulla facilisis at vero et accumsan et iusto odio dignissim  
> qui
>  blandit praesent luptatum zzril delenit augue duis dolore te  
> feugait nulla
>  facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit,  
> sed diam
>  nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
>  volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation  
> ullamcorper
>  suscipit lobortis nisl ut aliquip ex ea commodo...
>
> * Images with Captions
>
>  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
> nonummy
>  nibh euismod tincidunt ut laoreet dolore magna aliquam erat  
> volutpat. Ut wisi
>  enim ad minim veniam, quis nostrud exerci tation ullamcorper  
> suscipit lobortis
>  nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure  
> dolor in
>  hendrerit in vulputate velit esse molestie consequat, vel illum  
> dolore eu
>  feugiat nulla facilisis at vero et accumsan et iusto odio dignissim  
> qui
>  #+CAPTION: My favourite image
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10"
>  [[{{{imageurl}}}]]
>  Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam  
> nonummy
>  nibh euismod tincidunt ut laoreet dolore magna aliquam erat  
> volutpat. Ut wisi
>  enim ad minim veniam, quis nostrud exerci tation ullamcorper  
> suscipit lobortis
>  nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure  
> dolor in
>  hendrerit in vulputate velit esse molestie consequat, vel illum  
> dolore eu
>  feugiat nulla facilisis at vero et accumsan et iusto odio dignissim  
> qui
>  blandit praesent luptatum zzril delenit augue duis dolore te  
> feugait nulla
>  facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit,  
> sed diam
>  nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat
>  volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation  
> ullamcorper
>  suscipit lobortis nisl ut aliquip ex ea commodo...
>
> * Images in a row
>
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]
>  #+ATTR_HTML: alt="image" hspace="10" vspace="10" align="absmiddle"
>  [[{{{imageurl}}}]]

      reply	other threads:[~2009-10-02  7:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01  4:24 Images in div and p Sebastian Rose
2009-10-01  4:53 ` Carsten Dominik
2009-10-01 15:10   ` Sebastian Rose
2009-10-01 23:16     ` Sebastian Rose
2009-10-02  6:21       ` Carsten Dominik [this message]

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=6722E1ED-4904-4310-9690-F2E71754DE9E@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sebastian_rose@gmx.de \
    /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).