3

I'd like to define my own interpretor for special blocks for a custom backend.

I've written this sort of thing, mostly copy/pasting from the src-block interpreter

(defun org-leanpub-special-block (special-block contents info)
  (replace-regexp-in-string
   "^" "A> "
   (org-remove-indentation
    (org-element-property :value special-block))))

I've also registered it as a translator and it's being called.

The goal is that this

#+BEGIN_aside
/wibble/
wibble
I'm a fish
#+END_aside

will be rendered as

A> *wibble*
A> wibble
A> I'm a fish

(note that the text is processed by the usual processor, which is derived from markdown).

But the debugger is kicking in with

(replace-regexp-in-string "^" "A> " (org-remove-indentation (org-element-property :value special-block)))

which would imply that my call to org-element-property is not doing what I thought. So how do I get the rendered version of the special-block body?

(I plan on switching on the TYPE of special block, but one step at a time...)

1
  • 1
    ooh, I found org-html-special-block and reading for inspiration – fommil Apr 20 '17 at 20:27
3

oh, I'm an idiot

(defun org-leanpub-special-block (special-block contents info)
  (replace-regexp-in-string
   "^" "A> " contents))

and now I can consider switching on the type of block, falling back to org-html-special-block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.