+2 votes
by (380 points)
I would like to have a macro that does the equivalent of :

<div align="center"><<include TEST>></div>

with just:

 <<includec TEST>>

 as the macro instead.I have no understanding of javascript, but it feels like it should be fairly easy. Could anybody help me with this?


1 Answer

0 votes
by (63.1k points)

This is probably best handled as a widget, there's no real need to write a whole new macro just for that.  Put this in a widget-tagged passage:

<<widget 'includec'>>\
  <div align="center"><<include $args[0]>></div>

And use it like:

<<includec 'passage name'>>

You should always try to place passage names in quotes when passing them to macros and widgets like <<link>>, <<goto>> and <<include>>; you can wind up confusing the parser if you pass a macro a passage name that has a space or certain other special characters.

by (380 points)
Thanks a lot! I didn't know anything about widgets and writing a whole macro seemed like it was beyond me.