private RmdFrontMatterOutputOptions transferOptions(
RmdFrontMatter frontMatter,
RmdTemplate template,
String format)
{
RmdFrontMatterOutputOptions result = RmdFrontMatterOutputOptions.create();
// loop over each option applicable to the new format; if it's
// transferable, try to find it in one of the other formats
JsArrayString options = template.getFormat(format).getOptions();
for (int i = 0; i < options.length(); i++)
{
String optionName = options.get(i);
RmdTemplateFormatOption option = template.getOption(optionName);
if (!option.isTransferable())
continue;
// option is transferable, is it present in another front matter entry?
JsArrayString formats = frontMatter.getFormatList();
for (int j = 0; j < formats.length(); j++)
{
RmdFrontMatterOutputOptions outOptions =
frontMatter.getOutputOption(formats.get(j));
if (outOptions == null)
continue;
String val = outOptions.getOptionValue(optionName);
if (val != null)
result.setOptionValue(option, val);
}
}