\begin{figure}[H]
    \centering
    \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 adjustbox}
    \ifdefined\adjustbox
        \BLOCK{if link}\href{\VAR{link}}{%
        \adjustbox{max width=\textwidth}{%
            \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}
        \adjustbox{max width=\textwidth}{%
            \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}
    \else
        \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}
    \fi
    \BLOCK{else}
    \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{endif}
    \BLOCK{-if caption}
    \caption\BLOCK{if shortcaption}[\VAR{shortcaption}]\BLOCK{endif}{\VAR{caption}}
    \BLOCK{-endif}
\end{figure}
