Skip to content

Instantly share code, notes, and snippets.

@zenhob
Created January 15, 2010 08:10
Show Gist options
  • Save zenhob/277893 to your computer and use it in GitHub Desktop.
Save zenhob/277893 to your computer and use it in GitHub Desktop.
/**
* discount.ooc
* copyright 2010 Zack Hobson <zack@zackhobson.com>
*
* This is an interface to the discount markdown library in the ooc
* programming language.
*
* http://www.pell.portland.or.us/~orc/Code/markdown/
* http://ooc-lang.org/
*
* = Synopsis
*
* m := MarkdownDocument new("= hi world!\n\nwhat is up\n")
* m to_file("hiworld.html")
*
*/
include mkdio
// markdown
mkd_string: extern func(String, SizeT, Int) -> MarkdownDocument
markdown: extern func(MarkdownDocument, FILE*, Int) -> Int
// stdio
fclose: extern func(FILE*) -> Int
fopen: extern func(filename: Char*, mode: Char*) -> FILE*
MarkdownDocument: cover from MMIOT* {
new: static func(mkd_str: String) -> This {
mkd_string(mkd_str, mkd_str length(), 0)
}
to_file: func(name: String) -> Int {
file := fopen(name, "w")
result := markdown(this, file, 0)
fclose(file)
return result
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment