From: Sebastian Rose <sebastian_rose@gmx.de>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Images in div and p
Date: Fri, 02 Oct 2009 01:16:58 +0200 [thread overview]
Message-ID: <87ws3epuvp.fsf@gmx.de> (raw)
In-Reply-To: <87my4bcfps.fsf@gmx.de> (Sebastian Rose's message of "Thu, 01 Oct 2009 17:10:39 +0200")
[-- Attachment #1: Type: text/plain, Size: 200 bytes --]
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-html-div-if-caption.patch --]
[-- Type: text/x-diff, Size: 1210 bytes --]
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."
[-- Attachment #3: Type: text/plain, Size: 4205 bytes --]
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}}}]]
[-- Attachment #4: Type: text/plain, Size: 204 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2009-10-01 23:17 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 [this message]
2009-10-02 6:21 ` 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
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=87ws3epuvp.fsf@gmx.de \
--to=sebastian_rose@gmx.de \
--cc=carsten.dominik@gmail.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).