Skip to content

Add a public API to process a customized LiterateDocument. - #282

Merged
tpetricek merged 2 commits into
fsprojects:masterfrom
matthid:custom_literate_document
Apr 20, 2015
Merged

tpetricek merged 2 commits into
fsprojects:masterfrom
matthid:custom_literate_document

Conversation

@matthid

@matthid matthid commented Apr 6, 2015

Copy link
Copy Markdown
Member

Now that Literate if internal my fix for #251 doesn't work anymore :(.
See also dd03c61.

Do you like another optional parameter for that? Alternatively we could use a03fcfb.

@tpetricek

Copy link
Copy Markdown
Member

Oh, hmm - I guess we don't need to make it internal. I did that just to cleanup the public API reference, but we can just [omit] the module.

For individual document, you should be able to use ParseScriptFile, then do the transform and then call WriteHtml. Or is there some reason why this wouldn't work?

Now, I see that this cannot be done for ProcessDirectory. I'm not a very big fan of complex callbacks (see this blog post), so I'd probably prefer an API where you can call ParseDirectory (which returns a list of files with parsed documents) and then WriteHtml taking the list and writing all documents. Would that let you solve the problem?

@matthid

matthid commented Apr 7, 2015

Copy link
Copy Markdown
Member Author

WriteHtml is very limited and it doesn't do the same processing that https://github.com/tpetricek/FSharp.Formatting/blob/master/src/FSharp.Literate/Formatting.fs#L88 does.

Sure there are a lot of ways to solve this, I think the callback is reasonably simple though (basically LiterateDocument -> LiterateDocument).
Besides that I first experimented with a03fcfb (an alternative solution) which would also solve my problem (and is a unification of WriteHtml and WriteLatex actually). What do you think about that API?

@tpetricek

Copy link
Copy Markdown
Member

The ProcessDocument looks like a nice addition to me.

If that solves your problem too, I'd be much happier to accept that (and yes, you're right - the WriteHtml and WriteLatex functions wouldn't work because they omit the transformations...). I think adding ProcessDocument would be good even if we had the callback, actually...

tpetricek added a commit that referenced this pull request Apr 20, 2015
Add a public API to process a customized LiterateDocument.
@tpetricek
tpetricek merged commit c06f115 into fsprojects:master Apr 20, 2015
@matthid
matthid deleted the custom_literate_document branch September 13, 2015 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants