Differences between revisions 1 and 2
Deletions are marked like this. Additions are marked like this.
Line 44: Line 44:

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 on the file to catch mistakes.

.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, which also serves as the example file found in dev/scripts/template.help.xml:

emacs dev/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 (in dev/mri_my_program), do this:

  • cp dev/mris_inflate/mris_inflate.help.xml dev/mri_my_program/mri_my_program.help.xml
  • add this to your .c file, whereever --help is called:

#include "mris_inflate.help.xml.h"
static void
print_usage(void)
{
  outputHelpXml(mris_inflate_help_xml,
                mris_inflate_help_xml_len);
}
  • add these lines to the Makefile.am file:

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)
  • edit mri_my_program.help.xml as appropriate
  • cvs add mri_my_program.help.xml
  • cvs commit

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 on the file to catch mistakes.

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