-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Accordion: web example not working #2465
Comments
There is problem with the |
Not sure if this will solve the issue, but we might want to try wrapping whole strings in |
Adding 'from' to other examples will also cause same error. from -> {'from'} not working either...Although {'fro' + 'm'} works. I took a look around but couldn't find out where it happens |
It is caused by this line: |
changing
to
fixes it given the current format Should I make a pull request, or should I try something else? |
@nieroda A PR would be fantastic, thanks! The issue was that the current regex is looking for the last occurrence of You might want to run similar scenarios with your solution by adding the words |
I only saw the edit after I created the PR, let me check |
I tried a few things, nothing is breaking. However if I add ("export default" or "export default *")inside one of the <p> tags, it does omit it from showing above, but thats due to the 2 chained replace functions I believe. edit: only matches export class, which breaks other things. Will look for a fix |
This is a step forward at least. Odds that we'll need to put that language in an example snippet are low. The live edit is quite the hack as it is :) |
Sorry about that, just looked through the other examples and saw the components were defined in these 3 ways, class * extends Component
const * = () => (
export default class Sometimes variables were declared above the class, but it would match with the top 'const' (would be an issue if var is used) const data = [foo, bar];
class * extends Component {} Would something like this be better? const body = _.get(/(export\sdefault\sclass|const|class\s\S*\sextends)[\s\S]*/.exec(sourceCode), '[0]', '')
.replace(/export\s+default\s+(?!class|function)\w+([\s\n]+)?/, '') // remove `export default Foo` statements
.replace(/export\s+default\s+/, '') Or does it make too many assumptions? |
@levithomason what do you think? |
Apologies, I don't have the bandwidth to grok each solution 😞 Whichever one works with all existing examples and is the most robust against future possibilities, let's go with that. |
There has been no activity in this thread for 90 days. While we care about every issue and we’d love to see this fixed, the core team’s time is limited so we have to focus our attention on the issues that are most pressing. Therefore, we will likely not be able to get to this one. However, PRs for this issue will of course be accepted and welcome! If there is no more activity in the next 90 days, this issue will be closed automatically for housekeeping. To prevent this, simply leave a reply here. Thanks! |
I looked at the Accordion - inverted variation today and it seems to work fine with its edit code feature. The problem no longer exists. Can one of us verify it and close if this is the case? New link for Accordion - inverted variation: http://react.semantic-ui.com/modules/accordion/#variations-inverted |
Steps to Reproduce
Expected
you should be able to edit the code
Result
There are errors: unknown: Unterminated regular expression (8:12)
The text was updated successfully, but these errors were encountered: