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