Skip to content

Instantly share code, notes, and snippets.

@nedzadarek
Last active September 6, 2018 11:22
Show Gist options
  • Save nedzadarek/053e01f4ed7decfc043f0b27bb73e9e1 to your computer and use it in GitHub Desktop.
Save nedzadarek/053e01f4ed7decfc043f0b27bb73e9e1 to your computer and use it in GitHub Desktop.
s1: {This is a description without example.
}
s2: {doc: description of s2
example: foo <baz> <bar>
}
s3: {example: foo3 <baz> <bar>
}
f: func [str][
parse str [
[
"doc: " copy _description to "example: "
"example: " copy _example to end
]
| ["example: " copy _example to end]
| copy _description to end
]
]
p: does [
unless empty? _description [
print "Description: "
prin " " print _description
]
unless empty? _example [
print "Example: "
prin " " print _example
]
]
_description: copy "" _example: copy ""
f s1
p
comment {
Description:
This is a description without example.
}
_description: copy "" _example: copy ""
f s2
p
comment {
Description:
description of s2
Example:
foo <baz> <bar>
}
_description: copy "" _example: copy ""
f s3
p
comment {
Example:
foo3 <baz> <bar>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment