Last modified: 2014-07-07 18:37:15 UTC
Feature request: A feature that supports insertion and simple editing of source code snippets in a general article. It may include a simple grammar checking mechanism which checks some fundamental grammatical errors such as having a { without closing it, having a () with a trailing period and nothing else, having solely a pair of brackets, etc.; an indentation correction tool which will perform indentation formatting on the codes; a beautify code tool which will reorganize code formatting, including indentation to make the code more reader-friendly in format.
*** This bug has been marked as a duplicate of bug 43133 ***
I believe that request is too broad and this one is more specific. (In reply to comment #1) > > *** This bug has been marked as a duplicate of bug 43133 ***
If anything, it seems like this request would build on top of that one. It's currently just not possible to edit almost anything else than plaintext in VisualEditor (and it's not just an interface issue, but a backend one as well). I'm reopening and marking as dependent on that one, then. Feel free to adjust this :)
Making sure that arbitrary wikitext does not interact with other parts of the page is difficult. It is possible to enforce this for extension content, but generally not for arbitrary parts of a page.
Ah, it seems I misunderstood, sorry. I though you are talking about the source code *of the article itself*, and it appears like you meant source code in different languages, such as what's included in a <syntaxhighlight> tag. Sorry and please disregard my comments :)
I understand that the rich text is just a presentation and I can see in article source that the formats are defined using a set of markups. What I'm proposing is a plugin/feature which will take care of write the markup(plaintext) for the user when editing code snippets, just like what VisualEditor is intended to do (in my opinion). In addition source code needs special formatting that is different from natural written human language, so that's why I think the feature should include automatic indentation and such. For editing just a part of the text, I'm thinking of an interface similar to a pop-up window, obscuring parts of the editing window. Just like when you insert an image the editor will have a new window pop up asking image url, alt text, target, etc. When you click insert the editor will convert your choice in that pop-up window to the plaintext with tags and other markups, which will be visually reflected in the main WYSIWYG editor. (In reply to comment #5) > Ah, it seems I misunderstood, sorry. I though you are talking about the > source > code *of the article itself*, and it appears like you meant source code in > different languages, such as what's included in a <syntaxhighlight> tag. > > Sorry and please disregard my comments :) (In reply to comment #4) > Making sure that arbitrary wikitext does not interact with other parts of the > page is difficult. It is possible to enforce this for extension content, but > generally not for arbitrary parts of a page.
Given that this is about desired enhancements to a VisualEditor plugin for the SyntaxHighlight extension - bug 43126 - moving this there and marking as a dependency.
In a nutshell it would be a major front-end JS work and will leave backend as-is as much as possible. I'm pretty sure that it will only utilize tags currently available and won't affect backend at all.(In reply to comment #6)
Just a note to say that Tongbo Sui has submitted a GSoC proposal related to this report: https://www.mediawiki.org/wiki/User:Beanixster Good luck!
Related URL: https://gerrit.wikimedia.org/r/68615 (Gerrit Change I4adede9e05fd2236cee50ce03f597e8ff6b1914d)
Somebody with the power could you change the bug status to assigned, and it was assigned to me. Also anyone who is interested please feel free to give code review at the following patch. > Related URL: https://gerrit.wikimedia.org/r/68615 (Gerrit Change > I4adede9e05fd2236cee50ce03f597e8ff6b1914d)
Change 68615 had a related patch set uploaded by Jforrester: Source code editing https://gerrit.wikimedia.org/r/68615
If you don't have permission to do it yourself, it's probably because you don't have the 'editbugs' right. Hopefully, someone on this bug can give it you. If not, ask on IRC.
CCing Andre who can give you editbugs.
Tongbo: Re: your implmementation so far: Is the language spec something you've come up with yourself? Have you considered using an existing highlighter library, or at least basing your implementation on a existing language spec format (e.g. implementing GeSHi language specs in JS?)
The highlighter spec is ported from GeSHi's php into js. I didn't find spec for validator so I came up with myself. (In reply to comment #15) > Tongbo: Re: your implmementation so far: Is the language spec something > you've > come up with yourself? Have you considered using an existing highlighter > library, or at least basing your implementation on a existing language spec > format (e.g. implementing GeSHi language specs in JS?)
(In reply to comment #15) > Have you considered using an existing highlighter > library, or at least basing your implementation on a existing language spec > format (e.g. implementing GeSHi language specs in JS?) GeSHi is GPLv2+, whereas VisualEditor is MIT. So if any GeSHi code is reused, the authorship and licensing should be made clear.
For now no codes from GeSHi are directly reused. I just used them as reference for regex patterns. I said 'port' due to this fact. (In reply to comment #17) > (In reply to comment #15) > > Have you considered using an existing highlighter > > library, or at least basing your implementation on a existing language spec > > format (e.g. implementing GeSHi language specs in JS?) > > GeSHi is GPLv2+, whereas VisualEditor is MIT. So if any GeSHi code is > reused, > the authorship and licensing should be made clear.
GSoC "soft pencils down" date was yesterday and all coding must stop on 23 September. Has this project been completed?
Yes. (In reply to comment #19) > GSoC "soft pencils down" date was yesterday and all coding must stop on 23 > September. Has this project been completed?
Marking this also as fixed by Gerrit change #68615 - congratulations again!
Re-opening as this is now unmerged.
Change 114529 had a related patch set uploaded by Jforrester: [WIP] Add VisualEditor support https://gerrit.wikimedia.org/r/114529