Last active
September 6, 2018 11:22
-
-
Save nedzadarek/053e01f4ed7decfc043f0b27bb73e9e1 to your computer and use it in GitHub Desktop.
This file contains 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
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