nobiot / org-transclusion

Emacs package to enable transclusion with Org Mode
https://nobiot.github.io/org-transclusion/
GNU General Public License v3.0
917 stars 44 forks source link

How to friendly use with ox-hugo #156

Closed peng051410 closed 1 year ago

peng051410 commented 1 year ago

Hi: I have a buy for this package, can it be with ox-hugo package peaceful? now i found when i add org-transclusion item to hugo org file, and run org-hugo-export-to-md, message "text is read-only” raised . how can i handle this?

nobiot commented 1 year ago

How does hugo export work? If it has a pre-processor, it should be possible to temporarily remove the read-only property of the transcluded text.

peng051410 commented 1 year ago

I only found org-hugo-auto-export-hook, if there is an export hook, what next do?

peng051410 commented 1 year ago

I only found org-hugo-auto-export-hook, if there is an export hook, what next do?↳

I found can temporarily solve by this: (add-hook 'org-hugo-auto-export-mode-on-hook (lambda() (when (org-transclusion-within-transclusion-p) (org-transclusion-inhibit-read-only t))))

Is this right?

nobiot commented 1 year ago

When you activate org-transclusion-mode, this hook is added and should enable org-export in general; at least that is the intention.

(add-hook 'org-export-before-processing-hook
            #'org-transclusion-inhibit-read-only nil t)

Apparently, this is not the case for ox-hugo.

I don't use Hugo or ox-hugo so I cannot test your suggestion. But if org-hugo-auto-export-mode-on-hook works in the same way as org-export-before-processing-hook does, then I'd try the following:

(add-hook 'org-hugo-auto-export-mode-on-hook
            #'org-transclusion-inhibit-read-only nil t)
peng051410 commented 1 year ago

Copy. Thanks!

When you activate org-transclusion-mode, this hook is added and should enable org-export in general; at least that is the intention.↳

(add-hook 'org-export-before-processing-hook
            #'org-transclusion-inhibit-read-only nil t)

Apparently, this is not the case for ox-hugo.↳

I don't use Hugo or ox-hugo so I cannot test your suggestion. But if org-hugo-auto-export-mode-on-hook works in the same way as org-export-before-processing-hook does, then I'd try the following:↳

(add-hook 'org-hugo-auto-export-mode-on-hook
            #'org-transclusion-inhibit-read-only nil t)