Created
January 15, 2010 08:10
-
-
Save zenhob/277893 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* discount.ooc | |
* copyright 2010 Zack Hobson <[email protected]> | |
* | |
* 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