# File lib/asciidoctor/converter/manpage.rb, line 73
    def document node
      unless node.attr? 'mantitle'
        raise 'asciidoctor: ERROR: doctype must be set to manpage when using manpage backend'
      end
      mantitle = node.attr 'mantitle'
      manvolnum = node.attr 'manvolnum', '1'
      manname = node.attr 'manname', mantitle
      docdate = (node.attr? 'reproducible') ? nil : (node.attr 'docdate')
      # NOTE the first line enables the table (tbl) preprocessor, necessary for non-Linux systems
      result = [%('\\" t
.\\"     Title: #{mantitle}
.\\"    Author: #{(node.attr? 'authors') ? (node.attr 'authors') : '[see the "AUTHORS" section]'}
.\\" Generator: Asciidoctor #{node.attr 'asciidoctor-version'})]
      result << %(.\\"      Date: #{docdate}) if docdate
      result << %(.\\"    Manual: #{(manual = node.attr 'manmanual') || '\ \&'}
.\\"    Source: #{(source = node.attr 'mansource') || '\ \&'}
.\\"  Language: English
.\\")
      # TODO add document-level setting to disable capitalization of manname
      result << %(.TH "#{manify manname.upcase}" "#{manvolnum}" "#{docdate}" "#{source ? (manify source) : '\ \&'}" "#{manual ? (manify manual) : '\ \&'}")
      # define portability settings
      # see http://bugs.debian.org/507673
      # see http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
      result << '.ie \n(.g .ds Aq \(aq'
      result << '.el       .ds Aq \''
      # set sentence_space_size to 0 to prevent extra space between sentences separated by a newline
      # the alternative is to add \& at the end of the line
      result << '.ss \n[.ss] 0'
      # disable hyphenation
      result << '.nh'
      # disable justification (adjust text to left margin only)
      result << '.ad l'
      # define URL macro for portability
      # see http://web.archive.org/web/20060102165607/http://people.debian.org/~branden/talks/wtfm/wtfm.pdf
      #
      # Use: .URL "http://www.debian.org" "Debian" "."
      #
      # * First argument: the URL
      # * Second argument: text to be hyperlinked
      # * Third (optional) argument: text that needs to immediately trail
      #   the hyperlink without intervening whitespace
      result << '.de URL
\\\\$2 \(laURL: \\\\$1 \(ra\\\\$3
..
.if \n[.g] .mso www.tmac'
      result << %(.LINKSTYLE #{node.attr 'man-linkstyle', 'blue R < >'})

      unless node.noheader
        if node.attr? 'manpurpose'
          result << %(.SH "#{node.attr 'manname-title'}"
#{manify mantitle} \\- #{manify node.attr 'manpurpose'})
        end
      end

      result << node.content

      # QUESTION should NOTES come after AUTHOR(S)?
      if node.footnotes? && !(node.attr? 'nofootnotes')
        result << '.SH "NOTES"'
        result.concat(node.footnotes.map {|fn| %(#{fn.index}. #{fn.text}) })
      end

      # FIXME detect single author and use appropriate heading; itemize the authors if multiple
      if node.attr? 'authors'
        result << %(.SH "AUTHOR(S)"
.sp
\\fB#{node.attr 'authors'}\\fP
.RS 4
Author(s).
.RE)
      end

      result * LF
    end