-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend for yields
& raises
docstrings
#141
Conversation
a5af068
to
12e3040
Compare
1ee6f1d
to
8a881a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
kit/preprocess.js
Outdated
svelteComponent += ` returnDescription={${JSON.stringify(code)}} `; | ||
} | ||
|
||
if (docstringBody.match(REGEX_YIELDTYPE)) { | ||
const yieldType = docstringBody.match(REGEX_YIELDTYPE)[1]; | ||
const { code } = await mdsvexPreprocess.markup({ content: yieldType, filename }); | ||
svelteComponent += ` returnType={${JSON.stringify(code)}} isYield={true} `; | ||
} | ||
|
||
if (docstringBody.match(REGEX_RAISEDESC)) { | ||
const raiseDesc = docstringBody.match(REGEX_RAISEDESC)[1]; | ||
const { code } = await mdsvexPreprocess.markup({ content: raiseDesc, filename }); | ||
svelteComponent += ` raiseDescription={${JSON.stringify(code)}} `; | ||
} | ||
|
||
if (docstringBody.match(REGEX_RAISETYPE)) { | ||
const raiseType = docstringBody.match(REGEX_RAISETYPE)[1]; | ||
const { code } = await mdsvexPreprocess.markup({ content: raiseType, filename }); | ||
svelteComponent += ` raiseType={${JSON.stringify(code)}} `; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually, something like a key/value map for the properties and generating the component string at once seems cleaner (rather than multiple svellteComponent += ...
followed by a closing tag)
I know @LysandreJik was using warning blocks for the raises block to have something in color. Not sure whether it's something we want or not. |
I like the current approach! Thanks @mishig25! |
do you mean: you prefer using for the raise? |
Sorry, just realized I didn't answer: I was mentioning I like the approach you have taken in your PR, @mishig25 |
Bump on this, we're using cc @Wauplin |
closes #172