|
@@ -1383,7 +1383,7 @@ value of `org-export-odt-fontify-srcblocks."
|
|
|
(org-lparse-insert-list-table
|
|
|
`((,(org-odt-format-entity
|
|
|
(if caption "CaptionedDisplayFormula" "DisplayFormula")
|
|
|
- href width height caption nil)
|
|
|
+ href width height :caption caption :label nil)
|
|
|
,(if (not label) ""
|
|
|
(org-odt-format-entity-caption label nil "__MathFormula__"))))
|
|
|
nil nil nil "OrgEquation" nil '((1 "c" 8) (2 "c" 1)))
|
|
@@ -1585,7 +1585,7 @@ ATTR is a string of other attributes of the a element."
|
|
|
(expand-file-name
|
|
|
(concat (sha1 file-name) "." (file-name-extension file-name)) "Pictures")))
|
|
|
|
|
|
-(defun org-export-odt-format-image (src href &optional embed-as)
|
|
|
+(defun org-export-odt-format-image (src href)
|
|
|
"Create image tag with source and attributes."
|
|
|
(save-match-data
|
|
|
(let* ((caption (org-find-text-property-in-string 'org-caption src))
|
|
@@ -1593,14 +1593,27 @@ ATTR is a string of other attributes of the a element."
|
|
|
(attr (org-find-text-property-in-string 'org-attributes src))
|
|
|
(label (org-find-text-property-in-string 'org-label src))
|
|
|
(latex-frag (org-find-text-property-in-string
|
|
|
- 'org-latex-src src))
|
|
|
+ 'org-latex-src src))
|
|
|
(category (and latex-frag "__DvipngImage__"))
|
|
|
- (embed-as (or embed-as
|
|
|
- (if latex-frag
|
|
|
- (or (org-find-text-property-in-string
|
|
|
- 'org-latex-src-embed-type src) 'character)
|
|
|
- 'paragraph)))
|
|
|
(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)))
|
|
|
+ (user-frame-style
|
|
|
+ (and user-frame-anchor (plist-get attr-plist :style)))
|
|
|
+ (user-frame-attrs
|
|
|
+ (and user-frame-anchor (plist-get attr-plist :attributes)))
|
|
|
+ (user-frame-params
|
|
|
+ (list user-frame-style user-frame-attrs user-frame-anchor))
|
|
|
+ (embed-as (cond
|
|
|
+ (latex-frag
|
|
|
+ (symbol-name
|
|
|
+ (or (org-find-text-property-in-string
|
|
|
+ 'org-latex-src-embed-type src) 'character)))
|
|
|
+ (user-frame-anchor)
|
|
|
+ (t "paragraph")))
|
|
|
(size (org-odt-image-size-from-file
|
|
|
src (plist-get attr-plist :width)
|
|
|
(plist-get attr-plist :height)
|
|
@@ -1609,15 +1622,12 @@ ATTR is a string of other attributes of the a element."
|
|
|
(when latex-frag
|
|
|
(setq href (org-propertize href :title "LaTeX Fragment"
|
|
|
:description latex-frag)))
|
|
|
- (cond
|
|
|
- ((not (or caption label))
|
|
|
- (case embed-as
|
|
|
- (paragraph (org-odt-format-entity "DisplayImage" href width height))
|
|
|
- (character (org-odt-format-entity "InlineImage" href width height))
|
|
|
- (t (error "Unknown value for embed-as %S" embed-as))))
|
|
|
- (t
|
|
|
+ (let ((frame-style-handle (concat (and (or caption label) "Captioned")
|
|
|
+ embed-as "Image")))
|
|
|
(org-odt-format-entity
|
|
|
- "CaptionedDisplayImage" href width height caption label category))))))
|
|
|
+ frame-style-handle href width height
|
|
|
+ :caption caption :label label :category category
|
|
|
+ :user-frame-params user-frame-params)))))
|
|
|
|
|
|
(defun org-odt-format-object-description (title description)
|
|
|
(concat (and title (org-odt-format-tags
|
|
@@ -1663,31 +1673,55 @@ 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
|
|
|
- '(("InlineImage" "__Figure__" ("OrgInlineImage" nil "as-char"))
|
|
|
- ("DisplayImage" "__Figure__" ("OrgDisplayImage" nil "paragraph"))
|
|
|
- ("CaptionedDisplayImage" "__Figure__"
|
|
|
+ '(("CharacterImage" "__Figure__" ("OrgInlineImage" nil "as-char"))
|
|
|
+ ("ParagraphImage" "__Figure__" ("OrgDisplayImage" nil "paragraph"))
|
|
|
+ ("PageImage" "__Figure__" ("OrgPageImage" nil "page"))
|
|
|
+ ("CaptionedParagraphImage" "__Figure__"
|
|
|
("OrgCaptionedImage"
|
|
|
" style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
|
|
|
- ("OrgImageCaptionFrame"))
|
|
|
+ ("OrgImageCaptionFrame" nil "paragraph"))
|
|
|
+ ("CaptionedPageImage" "__Figure__"
|
|
|
+ ("OrgCaptionedImage"
|
|
|
+ " style:rel-width=\"100%\" style:rel-height=\"scale\"" "paragraph")
|
|
|
+ ("OrgPageImageCaptionFrame" nil "page"))
|
|
|
("InlineFormula" "__MathFormula__" ("OrgInlineFormula" nil "as-char"))
|
|
|
("DisplayFormula" "__MathFormula__" ("OrgDisplayFormula" nil "as-char"))
|
|
|
("CaptionedDisplayFormula" "__MathFormula__"
|
|
|
("OrgCaptionedFormula" nil "paragraph")
|
|
|
("OrgFormulaCaptionFrame" nil "as-char"))))
|
|
|
|
|
|
-(defun org-odt-format-entity (entity href width height
|
|
|
- &optional caption label category)
|
|
|
- (let* ((entity-style (assoc entity org-odt-entity-frame-styles))
|
|
|
- (entity-frame (apply 'org-odt-format-frame
|
|
|
- href width height (nth 2 entity-style))))
|
|
|
- (if (not (or caption label)) entity-frame
|
|
|
+(defun org-odt-merge-frame-params(default-frame-params user-frame-params)
|
|
|
+ (if (not user-frame-params) default-frame-params
|
|
|
+ (assert (= (length default-frame-params) 3))
|
|
|
+ (assert (= (length user-frame-params) 3))
|
|
|
+ (loop for user-frame-param in user-frame-params
|
|
|
+ for default-frame-param in default-frame-params
|
|
|
+ collect (or user-frame-param default-frame-param))))
|
|
|
+
|
|
|
+(defun* org-odt-format-entity (entity href width height
|
|
|
+ &key caption label category
|
|
|
+ user-frame-params)
|
|
|
+ (let* ((entity-style (assoc-string entity org-odt-entity-frame-styles t))
|
|
|
+ default-frame-params frame-params)
|
|
|
+ (cond
|
|
|
+ ((not (or caption label))
|
|
|
+ (setq default-frame-params (nth 2 entity-style))
|
|
|
+ (setq frame-params (org-odt-merge-frame-params
|
|
|
+ default-frame-params user-frame-params))
|
|
|
+ (apply 'org-odt-format-frame href width height frame-params))
|
|
|
+ (t
|
|
|
+ (setq default-frame-params (nth 3 entity-style))
|
|
|
+ (setq frame-params (org-odt-merge-frame-params
|
|
|
+ default-frame-params user-frame-params))
|
|
|
(apply 'org-odt-format-textbox
|
|
|
(org-odt-format-stylized-paragraph
|
|
|
'illustration
|
|
|
- (concat entity-frame
|
|
|
- (org-odt-format-entity-caption
|
|
|
- label caption (or category (nth 1 entity-style)))))
|
|
|
- width height (nth 3 entity-style)))))
|
|
|
+ (concat
|
|
|
+ (apply 'org-odt-format-frame href width height
|
|
|
+ (nth 2 entity-style))
|
|
|
+ (org-odt-format-entity-caption
|
|
|
+ label caption (or category (nth 1 entity-style)))))
|
|
|
+ width height frame-params)))))
|
|
|
|
|
|
(defvar org-odt-embedded-images-count 0)
|
|
|
(defun org-odt-copy-image-file (path)
|