def generate_id
      raise "generate_id only makes sense for headers" unless node_type == :header
      generated_id = children_to_s.tr(' ', '_').downcase.gsub(/\W/, '').strip
      num_occurs = (@doc.header_ids[generated_id] += 1)
      generated_id += "_#{num_occurs}" if num_occurs > 1
      generated_id
    end
def generate_id
      raise "generate_id only makes sense for headers" unless node_type == :header
      generated_id = children_to_s.tr(' ', '_').downcase.gsub(/\W/, '').strip
      num_occurs = (@doc.header_ids[generated_id] += 1)
      generated_id += "_#{num_occurs}" if num_occurs > 1
      generated_id
    end
Generate an id for headers. Assumes @children is set.