/**
 * Default options for GPub API.
 */
gpub.defaultOptions = {
  /** See gpub.bookFormat. */
  outputFormat: 'LATEX',

  /** See gpub.bookPurpose. */
  bookPurpose: 'GAME_COMMENTARY',

  /** See glift.enums.boardRegions. */
  boardRegion: 'AUTO',

  /** See glift.diagrams.diagramType. */
  diagramType: 'GNOS',


  /** Skip the first N diagrams. Allows users to generate parts of a book. */
  skipDiagrams: 0,

  /**
   * Maximum diagrams generated -- allows users to specify a section of the
   * book. 0 indicates that all subsequent diagrams are generated.
   */
  maxDiagrams: 0,

  /**
   * Override the default template.
   * A false-y template will result in using the default template.
   */
  template: null,

  /** Options specifically for book processors */

  // TODO(kashomon): Rename this to view so that we can have the book options be
  // separate.
  bookOptions: {},

  /**
   * Text supporting the bulk of the the work that comes before the mainmatter
   * of the book. Note: Not all of these will be supported by all the
   * book-generators.
   */
  frontmatter: {
    colophon: null, // AKA Copyright Page
    epigraph: null, // AKA Quote Page
    // TOC comes here
    forward: null, // Author or unrelated person
    preface: null, // Author
    acknowledgements: null,
    introduction: null,
    glossary: null
  }
};


/**
 * The type general type of the book.  Specifes roughly how we generate the
 * Glift spec.
 */
gpub.bookPurpose = {
  /** Game with commentary. */
  GAME_COMMENTARY: 'GAME_COMMENTARY',

  /** Set of problems and, optionally, anwsers. */
  PROBLEM_SET: 'PROBLEM_SET',

  /** A set of problems processed specifically for book consumption. */
  PROBLEM_BOOK: 'PROBLEM_BOOK'
};


/**
 * The format for gpub output.
 */
gpub.outputFormat = {
  /** Construct a book with a LaTeX format. */
  LATEX: 'LATEX',

  /** Constructs a full HTML page. This is often useful for testing. */
  HTMLPAGE: 'HTMLPAGE',

  /** Construct a book in ASCII format. */
  ASCII: 'ASCII'

  /** Construct a book in Smart Go format. */
  // SMART_GO: 'SMART_GO'

  // Future Work:
  // - ONLY_DIAGRAMS
  // - ASCII
  // - SmartGo Books
};

/**
 * Process the incoming options and set any missing values.
 */
gpub.processOptions = function(options) {
  if (!options) {
    options = {};
  }
  for (var key in gpub.defaultOptions) {
    var val = options[key];
    if (!val) {
      options[key] = gpub.defaultOptions[key];
    }
  }
  if (options.skipDiagrams < 0) {
    throw new Error('skipDiagrams cannot be less than 0');
  }
  if (options.maxDiagrams < 0) {
    throw new Error('maxDiagrams cannot be less than 0');
  }
  return options;
};

@@ -59,24 +59,92 @@
 ns = %7B%0A  /**
+%0A   * The format of the 'book' output that is produced by GPub.%0A   *
  See gpub.bo
@@ -148,24 +148,27 @@
 .bookFormat.
+%0A  
  */%0A  output
@@ -186,24 +186,123 @@
 TEX',%0A%0A  /**
+%0A   * What is the purpose for the book? I.e., Commentary, Problem book,%0A   * Combination-book.%0A   *
  See gpub.bo
@@ -311,16 +311,19 @@
 Purpose.
+%0A  
  */%0A  bo
@@ -350,32 +350,37 @@
 MENTARY',%0A%0A  /**
+%0A   *
  See glift.enums
@@ -397,40 +397,479 @@
 ons.
+%0A  
  */%0A  
-boardRegion: 'AUTO',%0A%0A  /*
+// TODO(kashomon): Should this even be here?%0A  boardRegion: 'AUTO',%0A%0A  /**%0A   * The type of diagrams produced by GPub.%0A   *%0A   * Ideally you would be able to use any diagramType in an outputFormat, but%0A   * that is not currently the case.  Moreover, some output formats (e.g.,%0A   * glift, smartgo) take charge of generating the diagrams.%0A   *%0A   * However, there are some types that are output format independent:%0A   *  - ASCII,%0A   *  - PDF,%0A   *  - EPS%0A   *%0A   
 * Se
@@ -897,16 +897,19 @@
 ramType.
+%0A  
  */%0A  di
@@ -1193,32 +1193,33 @@
 axDiagrams: 0,%0A%0A
+%0A
   /**%0A   * Overr
@@ -1572,16 +1572,22 @@
 s before
+/after
  the mai
@@ -1615,14 +1615,18 @@
 ook.
- Note:
+%0A   *%0A   *
  Not
@@ -1663,29 +1663,24 @@
 d by all the
-%0A   *
  book-genera
@@ -1682,16 +1682,140 @@
 enerator
+s. For those%0A   * that do support the relevant sections, the frontmatter and backmatter are%0A   * dumped into the book option
 s.%0A   */
@@ -1921,24 +1921,87 @@
    /
-/ TOC comes here
+** Generate the Table of Contents or just 'Contents'. */%0A    generateToc: true,
 %0A   
@@ -2121,25 +2121,45 @@
 uction: null
-,
+%0A  %7D,%0A  backmatter: %7B
 %0A    glossar

Add more detailed comments to the options. Move the glossary to the backmatter.