index.js
function preamble(opts) {
  var str = '';
  var index = opts.section || SECTION;
  var date = opts.date || new Date().toISOString();
  var version = opts.version || '1.0';
  // section name
  var sname = section(index);
  var title = opts.title || opts.name;
  if(!title) {
    throw new TypeError('manual preamble requires a name or title');
  }

  // use comment
  if(opts.comment) {
    str += util.format(elements.comment, opts.comment);
  }

  //console.dir(title)

  str += util.format(
    elements.th,
    strip(title.toUpperCase()),
    index, date,
    (strip(opts.name || title)).replace(/\s+.*$/, '') + ' ' + version, sname);

  // add name section
  if(opts.name) {
    var name = strip(opts.name);
    str += util.format(elements.sh, header(constants.NAME));
    if(opts.description) {
      str += util.format('%s \\- %s' + EOL, name, opts.description);
    }else{
      str += util.format('%s' + EOL, name);
    }
  }
  return str;
}
function preamble(opts) {
  var str = '';
  var index = opts.section || SECTION;
  var date = opts.date || new Date().toISOString();
  var version = opts.version || '1.0';
  // section name
  var sname = section(index);
  var title = opts.title || opts.name;
  if(!title) {
    throw new TypeError('manual preamble requires a name or title');
  }

  // use comment
  if(opts.comment) {
    str += util.format(elements.comment, opts.comment);
  }

  //console.dir(title)

  str += util.format(
    elements.th,
    strip(title.toUpperCase()),
    index, date,
    (strip(opts.name || title)).replace(/\s+.*$/, '') + ' ' + version, sname);

  // add name section
  if(opts.name) {
    var name = strip(opts.name);
    str += util.format(elements.sh, header(constants.NAME));
    if(opts.description) {
      str += util.format('%s \\- %s' + EOL, name, opts.description);
    }else{
      str += util.format('%s' + EOL, name);
    }
  }
  return str;
}
function preamble ( opts ) { var str = '' ; var index = opts . section || SECTION ; var date = opts . date || new Date ( ) . toISOString ( ) ; var version = opts . version || '1.0' ; // section name var sname = section ( index ) ; var title = opts . title || opts . name ; if ( ! title ) { throw new TypeError ( 'manual preamble requires a name or title' ) ; } // use comment if ( opts . comment ) { str += util . format ( elements . comment , opts . comment ) ; } //console.dir(title) str += util . format ( elements . th , strip ( title . toUpperCase ( ) ) , index , date , ( strip ( opts . name || title ) ) . replace ( / \s+.*$ / , '' ) + ' ' + version , sname ) ; // add name section if ( opts . name ) { var name = strip ( opts . name ) ; str += util . format ( elements . sh , header ( constants . NAME ) ) ; if ( opts . description ) { str += util . format ( '%s \\- %s' + EOL , name , opts . description ) ; } else { str += util . format ( '%s' + EOL , name ) ; } } return str ; }
Gets the preamble for a man page.

@param options The preamble options.
@param options.title The document title.
@param options.version A version number.
@param options.date Document generation date.
@param options.section The man section number (1-8).
@param options.comment A comment string.
@param options.name A name that indicates the name section should be
added.
@param options.description A short description to go aside the name.
Gets the preamble for a man page .