DocOnce is a very simple and minimally tagged markup language that
looks like ordinary ASCII text, much like what you would use in an
email, but the text can be transformed to numerous other formats,
including HTML, Sphinx, LaTeX, PDF, reStructuredText (reST), Markdown,
MediaWiki, Creole wiki, blogger.com, wordpress.com,
Epytext, and also plain (untagged) text for email.
From reST or Markdown you can go to XML, OpenOffice, MS
Word, HTML, LaTeX, PDF, DocBook, GNU Texinfo, and more.

DocOnce supports a working strategy of never duplicating information.
Text is written in a single place and then transformed to a number of
different destinations of diverse type: scientific reports, software
manuals, books, thesis, software source code, wikis, blog posts, emails,
etc.  The slogan is: ``Document once, include anywhere''.

Here are some DocOnce features:

  * DocOnce addresses small and large documents containing
    *text with much computer source code and
    LaTeX mathematics*, where the output is desired in different formats
    such as LaTeX, pdfLaTeX, Sphinx, HTML,
    MediaWiki, blogger.com, and wordpress.com.
    A piece of DocOnce text can enter (e.g.) a classical
    science book, an ebook, a web document, and a blog post.
  * DocOnce offers a range of HTML designs, including many
    Bootstrap and Sphinx styles and "solarized color schemes": "http://ethanschoonover.com/solarized".
    A special feature is the many styles for admonitions (boxes for
    warning, notice, question, etc.) in HTML and LaTeX.
  * DocOnce targets in particular large book projects where many different
    pieces of text and software can be assembled in different ways
    and published in different formats for different devices
    (see "example": "http://hplgit.github.io/setup4book-doconce/doc/web/index.html").
  * DocOnce enables authors who write for many types of media
    (blog posts, wikis, LaTeX manuscripts, Sphinx, HTML) to use a common
    source language such that lots of different pieces can easily be
    brought together later to form a coherent (big) document.
  * DocOnce has good support for copying computer code
    directly from the source code files via regular expressions
    for the start and end lines.
  * DocOnce first runs two preprocessors (Preprocess and Mako), which
    allow programming constructs (includes, if-tests, function calls, variables)
    as part of the text. This feature makes it easy to write *one text*
    with different flavors: long vs short text, Python vs Matlab code
    examples, experimental vs mature content.
  * DocOnce can be converted to plain *untagged* text,
    often desirable for email and computer code documentation.
  * DocOnce markup does include tags, so the format is more tagged than
    Markdown, but less than reST, and very much less than
    LaTeX and HTML.
  * Compared to the related tools Sphinx and Markdown, DocOnce
    allows more types of equations (especially systems of
    equations with references), has more flexible
    inclusion of source code, integrates preprocessors, has
    special support for exercises, and produces
    cleaner LaTeX and HTML output.

# #ifdef EXTRA
DocOnce was particularly written for the following sample applications:

  * Large books written in LaTeX, but where many pieces (computer demos,
    projects, examples) can be written in DocOnce to appear in other
    contexts in other formats, including plain HTML, Sphinx, wiki, or MS Word
    (see "example": "http://hplgit.github.io/setup4book-doconce/doc/web/index.html").
  * Software documentation, primarily Python doc strings, which one wants
    to appear as plain untagged text for viewing in Pydoc, as reStructuredText
    for use with Sphinx, as wiki text when publishing the software at
    web sites, and as LaTeX integrated in, e.g., a thesis.

  * Quick memos, which start as plain text in email, then some small
    amount of DocOnce tagging is added, before the memos can appear as
    Sphinx web pages, MS Word documents, or in wikis.
# #endif

__History.__ The DocOnce development started in 2006 at a time when
most popular markup languages used quite some tagging (LaTeX,
reStructuredText, HTML).  Later, almost untagged markup languages
became popular, especially "Markdown":
"http://daringfireball.net/projects/markdown/" and its sisters
"MultiMarkdown": "http://fletcherpenney.net/multimarkdown/",
"Pandoc-extended Markdown":"http://johnmacfarlane.net/pandoc/", and
"Markua": "https://leanpub.com/markua/".  DocOnce looks much like
Markdown and is in particular close to the functionality and nature of
MultiMarkdown. The advantage of DocOnce, however, is a series of
features for supporting both small and large documents (books in
particular) with much mathematics and computer code. While Markdown
tools are heavily geared toward HTML, DocOnce has strong support for
LaTeX since this is the dominating format for books and articles
on mathematical subjects.
DocOnce can also output Sphinx (not supported by Pandoc or
MultiMarkdown), a format that is very attractive for presenting
scientific material and software documentation on the web.  (DocOnce
allows basic "Markdown syntax":
"https://guides.github.com/features/mastering-markdown/" as input,
extended with DocOnce syntax as you like.)

__Disclaimer.__ DocOnce applies *text transformations*, mostly via
regular expressions. This is not a fool-proof method of translation
compared to real parsing. Moreover, the possibility for tweaking the
layout in the DocOnce document is obviously limited (at least compared
to LaTeX and HTML) since the text can go to all sorts of markup
languages. This disadvantage can be quite easily compensated, however,
by clever use of the programmable Mako preprocessor used by DocOnce
and by automatic editing of the generated output (e.g., via regular
expressions).
