> Now, ox-odt.el
>
>> (defcustom org-odt-latex-image-options
>>   '(:foreground "Black" :background "Transparent"
>>     :page-width 1.0 :scale 1.0 :inline nil)
>
> :inline does nothing here and is not documented.

Removed.

>> -  (cl-assert (equal "file" (org-element-property :type element)))
>> -  (let* ((src (let ((raw-path (org-element-property :path element)))
>> -            (cond ((file-name-absolute-p raw-path)
>> -                   (expand-file-name raw-path))
>> -                  (t raw-path))))
>> +  (let* ((src (let* ((type (org-element-property :type element))
>> +                 (raw-path (org-element-property :path element)))
>> +                (if (file-name-absolute-p raw-path) raw-path
>> +                  (expand-file-name raw-path))))
>
> This change makes no sense to me.
> 1. Why removing cl-assert? Are non-file links supported now?
> 2. The new code is
> (src (let* ((type (org-element-property :type element))
>                    (raw-path (org-element-property :path element)))
>                 (if (file-name-absolute-p raw-path) raw-path
>                   (expand-file-name raw-path))))
>        (src-expanded (if (file-name-absolute-p src) src
>                        (expand-file-name src (file-name-directory
>                                               (plist-get info :input-file)))))
>
> So, you effectively removed the else branch in src-expanded. This is not 
> right.

Not sure what was happening here.  Restored the old version.

>>       (--em-to-cm
>>          ;; FIXME: Hardcoded default font-size to 12 according to the
>>          ;; default value of styles.xml in org-odt-styles-dir.  I
>>          ;; don't know how how to determine this dynamically.
>>          (lambda (size) (and size (* 12 0.0352778 size))))
>> ...
>>         (size (org-odt--image-size
>>              src-expanded info width height
>>              (let ((scale (plist-get attr-plist :scale)))
>>                (and scale (read scale)))
>>              nil                     ; embed-as
>>              "paragraph"             ; FIXME
>>              ))
> Why can't you use org-odt--image-size as is?

Unfortunately I'm not sure any more, but I tested that the equations
have the right size in the exported doc.

>>                      (link (list 'link
>>                                  (list :type "file"
>>                                        :path path
>>                                        :format 'bracket
>>                                        :raw-link (format "file:%s" path))))
>
> Please use org-element-create. Same later.

Done.

>>            (if-let ((latex-frag (org-element-property :value latex))
>> ... (replacement ...))
>>                   (org-element-put-property replacement :replaces
>>                                            (list (org-element-type latex)
>>                                                  (list :value latex-frag)))
>
> It is not guaranteed that replacement is non-nil in the else clause of
> if-let. Looks fishy.

"replacement" can't be nil here, it's either a paragraph element or a
link element.

> Also, you have a lot of code duplication here. Why is it necessary? Can
> it be avoided?

Maybe it can be avoided, but this code duplication is from before my
edits.  I only swapped out the pipeline parts that create the preview
images.

Karthik

Reply via email to