2020-05-31 09:49:20 +02:00
|
|
|
# TODO:
|
2020-05-31 18:04:40 +02:00
|
|
|
# - 1. Improve argument handling
|
|
|
|
# - 2. Update code to use UnPack.jl to make it more readable
|
|
|
|
# - 3. Export new interface
|
|
|
|
# - 4. Document Interface
|
|
|
|
|
2020-06-01 14:32:18 +02:00
|
|
|
using Mustache, Highlights, .WeaveMarkdown, Markdown, Dates, Printf
|
2020-05-31 09:49:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
const FORMATS = Dict{String,WeaveFormat}()
|
|
|
|
|
|
|
|
# TODO: do some assertion for necessary fields of `format`
|
|
|
|
register_format!(format_name::AbstractString, format::WeaveFormat) = push!(FORMATS, format_name => format)
|
2020-06-01 15:36:48 +02:00
|
|
|
register_format!(_, format) = error("Format needs to be a subtype of WeaveFormat.")
|
2020-05-31 09:49:20 +02:00
|
|
|
|
2020-06-14 08:06:44 +02:00
|
|
|
set_format_options!(doc; kwargs...) = set_format_options!(doc.format; kwargs...)
|
2020-06-01 15:36:48 +02:00
|
|
|
|
2020-06-02 12:03:30 +02:00
|
|
|
function render_doc(doc::WeaveDoc)
|
2020-05-15 16:51:52 +02:00
|
|
|
restore_header!(doc)
|
2016-12-14 20:50:29 +01:00
|
|
|
|
2020-06-02 12:03:30 +02:00
|
|
|
docformat = doc.format
|
2020-06-14 10:06:52 +02:00
|
|
|
body = joinlines(render_chunk.(Ref(docformat), copy(doc.chunks)))
|
2020-06-01 15:36:48 +02:00
|
|
|
return render_doc(docformat, body, doc)
|
2016-12-13 12:26:34 +01:00
|
|
|
end
|
|
|
|
|
2020-05-31 18:04:40 +02:00
|
|
|
|
|
|
|
include("common.jl")
|
|
|
|
include("htmlformats.jl")
|
|
|
|
include("texformats.jl")
|
|
|
|
include("variousformats.jl")
|
|
|
|
include("markdownformats.jl")
|