\begin{center}
\BLOCK{-if label}\label{\VAR{label}}
\BLOCK{endif-}
\BLOCK{if width}\BLOCK{set width_value = width.rstrip('%') if width.endswith('%') else width}\BLOCK{endif}
\BLOCK{-if caption}\captionsetup{type=figure}\BLOCK{endif}
\BLOCK{if link}\href{\VAR{link}}{%
\includegraphics[width=\BLOCK{if width}\BLOCK{if width.endswith('%')}\VAR{(width_value|float) / 100}\linewidth\BLOCK{else}\VAR{width}\BLOCK{endif}\BLOCK{else}\linewidth\BLOCK{endif}]{\VAR{path}}
}
\BLOCK{else}
\includegraphics[width=\BLOCK{if width}\BLOCK{if width.endswith('%')}\VAR{(width_value|float) / 100}\linewidth\BLOCK{else}\VAR{width}\BLOCK{endif}\BLOCK{else}\linewidth\BLOCK{endif}]{\VAR{path}}
\BLOCK{endif}
\BLOCK{-if caption}
\captionof{figure}\BLOCK{if shortcaption}[\VAR{shortcaption}]\BLOCK{endif}{\VAR{caption}}
\BLOCK{-endif}
\end{center}
