<NME> Writers.jl
<BEF> ADDFILE
<MSG> Split Writers.jl into multiple files

In order accommodate multiple output formats the Writers module should
be in multiple files. In order for the internal code for each format
not to conflict with other code, it should be wrapped in submodules.

<DFF> @@ -0,0 +1,43 @@
+"""
+Provides a rendering function, [`render`](@ref), for writing each supported
+[`Formats.Format`](@ref) to file.
+
+Note that currently `Formats.Markdown` is the **only** supported format.
+
+"""
+module Writers
+
+import ..Documenter:
+    Anchors,
+    Builder,
+    Documents,
+    Expanders,
+    Formats,
+    Documenter,
+    Utilities
+
+using Compat
+
+# Driver method for document rendering.
+# -------------------------------------
+
+"""
+Writes a [`Documents.Document`](@ref) object to `build` directory in specified file format.
+"""
+function render(doc::Documents.Document)
+    mime = Formats.mimetype(doc.user.format)
+    for (src, page) in doc.internal.pages
+        open(Formats.extension(doc.user.format, page.build), "w") do io
+            for elem in page.elements
+                node = page.mapping[elem]
+                render(io, mime, node, page, doc)
+            end
+        end
+    end
+end
+
+include("MarkdownWriter.jl")
+include("HTMLWriter.jl")
+include("LaTeXWriter.jl")
+
+end

Split Writers.jl into multiple files