Hi,
On 14 May 2017, at 10:36, deshengchuan
<chuandesheng54(a)gmail.com> wrote:
Hi these are my thoughts and questions on your suggestions.
I have also updated the design page. Thank you for the guidance!
* Provide a UI in XWiki so that RedPen can be
executed in a job on various
pages of the wiki (let the >user select on what
pages to run it: all
(sub)wikis, a given wiki, a given page and children, a given >page only. It
would generate some report about violations.
Note that by “job” I meant
http://extensions.xwiki.org/xwiki/bin/view/Extension/Job%20Module
* Note that
the RedPen integration should be developed as an XWiki
extension in xwiki-contrib.
If it were an extension, I would think to create an Xwiki component then
export as JAR, instead of creating wiki pages and exporting as XAR.
There’s no such thing as “export as JAR” :)
But yes the extension will have several maven modules, some for JAR files and some for
wiki pages. Check other extensions to understand, for example
https://github.com/xwiki-contrib/application-ircbot
This is
because I’m not sure if functionality implemented through separate wiki
pages would be able to operate throughout the platform. Also, I am not sure
if I can configure RedPen Validators through creating an extension within an
XWiki instance. Correct me if I’m wrong.
Maybe you’re misunderstanding what an XWiki extension is. An XWiki extension can be a JAR
or a XAR. Each single JAR or XAR is an extension but an extension can depend on other
extensions. Users would install the “RedPen Integration Application” (the UI part, ie the
XAR one) and doing so will install the dependent JAR extension.
So first thing to do is request a repository on xwiki-contrib, you need to read fully
http://contrib.xwiki.org/.
* Provide an Admin part to configure the RedPen
rules to execute
This can be integrated in the UI component so there should be no
problems.
Most likely component will pass props using an EventListener that will
determine the command line to execute towards RedPen
I don’t understand what you mean… In any case the first step is to verify if we can embed
redpen as a library.
* Provide the ability to add new rules defined in
wiki pages (through a
mechanism similar to >UIExtensions - See
http://redpen.cc/docs/latest/#extending-with-java on the redPen side).
I’ll create a Validator plugin, which is the harder method but ensures I can
edit the Validator source code without touching RedPen’s source tree.
Indeed, you absolutely must noy touch RedPen core sources nor rebuild RedPen :)
* Provide a Script Service so that scripts in
wiki pages can validate any
content using RedPen. Same >from Java (the Script
Service would call the
Java Component).
I was reading this
http://extensions.xwiki.org/xwiki/bin/view/Extension/Script%20Module but I
am still unable to grasp the concept of scripts and how the Java Component
interacts with it. Do you have any other articles that I can reference from?
http://extensions.xwiki.org/xwiki/bin/view/Extension/Script%20Module is really pretty
clear. So I need to know what you don’t understand in order to help you further.
* ScriptService component implementations (in Java) calls other Java Components.
* Scripts in wiki pages call ScriptService through the “services” binding. e.g.
$services.<component hint>.<…> in Velocity.
Actually I have an idea. Maybe you could follow this tutorial since it includes writing a
script service too:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents
* Provide an Admin option so that RedPen executes
when a wiki page is saved
(turned off by default). >This would be implemented as
an XWiki Event
Listener and would cancel the save if there are >violations.
If I’m writing a JAR based extension, then I guess I’ll write the
EventListener as a Java component as well. Please correct me here if you
feel that there are other easier methods.
Correct. But you’re not writing only a JAR based extension. You’ll be writing several
extensions: one or several JARs and one XAR.
* Research how to embed redPen as a library (as a
JAR dependency) and not
as a standalone server. >That should probably be your
first task. If not
possible we’ll need to have it installed as a server but >that would make
using the XWiki RedPen Extension much more complex.
As stated, I will ask around first to get started. Will update the design
page with what I find.
Yep. Could you paste the link to the thread where you asked so that we can follow?
* (Optional and to be done after the rest is
implemented and if enough time
is left) Contribute to the >RedPen project itself
by contributing support
for the XWiki Syntax 2.1 markup text format. This would >allow to make XWiki
and XWiki Rendering more known to users of RedPen.
I can find time when I’m free to look at the contributing community at
RedPen. Perhaps I can also establish communication with them, while asking
them about the possibility of using RedPen without setting up a server.
Sure.
Thanks!
-Vincent