.help.xml

This page describes how the help text associated with a freesurfer executable is created in XML format and displayed. This page documents the work output of ProjectHelp by Greg Terrono, focusing only on the .help.xml file which contains the help text.

To get right to it, assuming you have a CVS checkout of the dev tree, look at this file (from the 'dev' dir), which also serves as the example file found in dev/scripts/template.help.xml:

emacs mris_inflate/mris_inflate.help.xml

This is an example help text file. The DTD is at the top of the file, and the entities it contains closely match what you would see in a unix man page. To see the help text:

mris_inflate --help

The routines /dev/utils/fsPrintHelp.c are used in the source code (mris_inflate.c) to print the .help.xml file to screen (after converting to a .h file and embedding).

So to create the help text file for a new program (for example in dev/mri_my_program), do this:

#include "mris_inflate.help.xml.h"
static void
print_usage(void)
{
  outputHelpXml(mris_inflate_help_xml,
                mris_inflate_help_xml_len);
}

BUILT_SOURCES=mris_inflate.help.xml.h

foodir=$(prefix)/docs/xml
foo_DATA=mris_inflate.help.xml

TESTS=$(top_builddir)/scripts/help_xml_validate

EXTRA_DIST=$(foo_DATA) $(BUILT_SOURCES)

Some things to note: emacs understands .xml files, and one step to take before commiting a file is to run SGML->Validate, to check your .help.xml file. The 'make check' for the Makefile.am will also run xmllint (via scripts/help_xml_validate) on the file to catch mistakes.

The DTD can be editted to add new stuff if desired.

XmlHelpText (last edited 2011-02-09 17:12:41 by NickSchmansky)