CDSoft / pp

PP - Generic preprocessor (with pandoc in mind) - macros, literate programming, diagrams, scripts...
http://cdelord.fr/pp
GNU General Public License v3.0
252 stars 21 forks source link

How to define a macro that accepts link_attributes? #47

Closed lf-araujo closed 6 years ago

lf-araujo commented 6 years ago

Thank you for the help and for the tool.

I am trying to define a macro that accepts link_attributes (thinking of width=30%), but how do I do that?

The following macro:

!define(figure)
(
\begin{figure}
\includegraphics{!2}
\caption{!1}
\end{figure}
)

Naturally breakes the preprocessing if it is called with: !img(Exports and Imports to and from Denmark & Norway from 1700 to 1780)(source/figures/exports-imports.png { width = 20% } )

CDSoft commented 6 years ago

What about using a third optional parameter for the link attributes?

In the macro:

!ifdef(3)(do something with !3)

The macro could be called as:

 !img(Exports and Imports to and from Denmark & Norway from 1700 to 1780)(source/figures/exports-imports.png)( width = 20% )