protected function expand_macros( $line, array $macros ) {
		if ( 0 < preg_match_all( '/\\\(?<name>\w+)\{(?<arg>[^\}]+)\}/u', $line, $matches, PREG_SET_ORDER ) ) {
			foreach ( $matches as $m ) {
				if ( ! empty( $macros[ $m['name'] ] ) ) {
					$expanded = preg_replace( '/#1/', $m['arg'], $macros[ $m['name'] ] );
					$pattern  = preg_quote( $m[0], '/' );
					$line     = preg_replace( "/{$pattern}/u", $expanded, $line );
				}
			}
		}

		return $line;
	}