On 27 Jun 2017, at 10:29, deshengchuan
<chuandesheng54(a)gmail.com> wrote:
vmassol wrote
Some questions/remarks:
* I still need to review your code in the coming few days
* Does it work? Am I able to get a RedPen validation when I save a page?
(I need to test your extension now)
* In the ConfigurableClass, you should use a static list of Strings that
lets the user enter the exclusions so that they can enter regex. Something
similar to
http://extensions.xwiki.org/xwiki/bin/view/Extension/Multiselect%20custom%2…
I think this would be more powerful. IMO you should also have includes and
not just excludes to cover all use cases.
* I see that you have implemented a UI to allow entering some words to be
corrected. Does it mean that the RedPen execution not only validates
content but is also able to modify it?
Thanks for the update!
-Vincent
Hi! Thanks in advance for the review :)
I am still working through issues in my code one at a time, and I don't
think it would be working today. I will keep you updated on it, and if need
be I can commit an earlier version, without much of the UI capabilities,
which validates plain text on a page on save and appends the results at the
bottom of the page.
After getting my code to work I'll edit the configurable class. I can see
that includes and excludes would cover all use cases. I will work on editing
the class such that the user can choose to include or exclude.
RedPen can take in a dictionary of words or expressions(in JSON format), but
it doesn't alter the entries directly. Rather, it would output a message
along with the other validation messages, with this one suggesting the word
or expression replacement.
However, I think it is possible to implement a replacement function. Since
the validation message provides the location of the error, we can extract
the erroreous word or expression out and replace it with the corrected one.
What do you think?
I suggest that we focus on validation for the time being and get that to work nicely. When
this is done, we can think about auto-fixing stuff. This would be doable in the listener,
by changing the doc’s content before the save.
The part that worries me the most ATM is how to display nicely to the user the result of
the validation. I don’t see how we can do that for now. Do you have an idea? I think this
could go hand in hand with a feature we’ve been wanting for a long time (can’t fine the
jira right now): the ability to capture logs when rendering a page and display them as
notifications in the UI.
So the idea could be the following:
* The RedPen listener would issue warnings for example in the logs
* In the future when we implement the feature I mentioned, the user will be able to see
them in the UI
Do you have a better idea?
I also think you need to include the concept of Validation Severity (i.e. warning, error).
And when it’s a warning it should never stop saving the page. Only errors would do that.
WDYT?
Thanks
-Vincent