0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-22 06:10:43 +00:00

org-odt.el: Allow images to be anchored as characters

* lisp/org-odt.el (org-odt-entity-frame-styles): Add frame params
for images that are anchored as character.
(org-export-odt-format-image): Handle new anchor type
"as-char".
(org-export-odt-default-image-sizes-alist): Misc. change.
(org-export-odt-format-formula): Misc. change.

With this change, one can use the below snippet to produce
images that are laid out side-by-side.
    #+ATTR_ODT: :width 7 :height 7 :anchor as-char
    #+header: :file foo.png
    [[./foo.png]]
    #+caption: bar
    #+ATTR_ODT: :width 7 :height 7 :anchor as-char
    #+header: :file bar.png
    [[./bar.png]]

See http://lists.gnu.org/archive/html/emacs-orgmode/2012-01/msg00677.html.
This commit is contained in:
Jambunathan K 2012-01-24 00:26:03 +05:30
parent cb8847f6fe
commit 1d99fd7010

View file

@ -1534,15 +1534,13 @@ value of `org-export-odt-fontify-srcblocks."
(org-odt-copy-image-file thefile) thelink))))
(org-export-odt-format-image thefile href)))
(defun org-export-odt-format-formula (src href &optional embed-as)
"Create image tag with source and attributes."
(defun org-export-odt-format-formula (src href)
(save-match-data
(let* ((caption (org-find-text-property-in-string 'org-caption src))
(caption (and caption (org-xml-format-desc caption)))
(label (org-find-text-property-in-string 'org-label src))
(latex-frag (org-find-text-property-in-string 'org-latex-src src))
(embed-as (or embed-as
(and latex-frag
(embed-as (or (and latex-frag
(org-find-text-property-in-string
'org-latex-src-embed-type src))
(if (or caption label) 'paragraph 'character)))
@ -1773,9 +1771,7 @@ ATTR is a string of other attributes of the a element."
(attr-plist (org-lparse-get-block-params attr))
(user-frame-anchor
(car (assoc-string (plist-get attr-plist :anchor)
(if (or caption label)
'(("paragraph") ("page"))
'(("character") ("paragraph") ("page"))) t)))
'(("as-char") ("paragraph") ("page")) t)))
(user-frame-style
(and user-frame-anchor (plist-get attr-plist :style)))
(user-frame-attrs
@ -1785,8 +1781,10 @@ ATTR is a string of other attributes of the a element."
(embed-as (cond
(latex-frag
(symbol-name
(or (org-find-text-property-in-string
'org-latex-src-embed-type src) 'character)))
(case (org-find-text-property-in-string
'org-latex-src-embed-type src)
(paragraph 'paragraph)
(t 'as-char))))
(user-frame-anchor)
(t "paragraph")))
(size (org-odt-image-size-from-file
@ -1849,9 +1847,13 @@ ATTR is a string of other attributes of the a element."
content) nil nil "OrgInlineTaskFrame" " style:rel-width=\"100%\"")))
(defvar org-odt-entity-frame-styles
'(("CharacterImage" "__Figure__" ("OrgInlineImage" nil "as-char"))
'(("As-CharImage" "__Figure__" ("OrgInlineImage" nil "as-char"))
("ParagraphImage" "__Figure__" ("OrgDisplayImage" nil "paragraph"))
("PageImage" "__Figure__" ("OrgPageImage" nil "page"))
("CaptionedAs-CharImage" "__Figure__"
("OrgCaptionedImage"
" style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
("OrgInlineImage" nil "as-char"))
("CaptionedParagraphImage" "__Figure__"
("OrgCaptionedImage"
" style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
@ -1928,7 +1930,7 @@ ATTR is a string of other attributes of the a element."
image.")
(defvar org-export-odt-default-image-sizes-alist
'(("character" . (5 . 0.4))
'(("as-char" . (5 . 0.4))
("paragraph" . (5 . 5)))
"Hardcoded image dimensions one for each of the anchor
methods.")