You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jspwiki.apache.org by Emanuele Pecchioli <ep...@florence-consulting.it> on 2020/11/23 11:55:08 UTC

Fwd: How to extract PlainText from JSPWiki syntax

Hello everybody,

we have to convert a String containing JSPWiki syntax into Plain Text.
We would like to do this conversion without having installed the JSPWiki
application.
Is there any way to do it? Any available library?

We found some very useful classes in *jspwiki-main* jar on maven central
(classes JSPWikiMarkupParser and CleanTextRenderer)
http://jspwiki.apache.org/apidocs/2.11.0.M6/org/apache/wiki/render/CleanTextRenderer.html
https://jspwiki.apache.org/apidocs/2.11.0.M4/org/apache/wiki/parser/JSPWikiMarkupParser.html

however they both require a WikiContext that, from what we understood, can
be obtained only by a running JSPWiki engine.

Just for more information we are doing an integration with *codebeamer
*software
that we found out is using JSPWiki modules inside to support rich text.
Please find below the credit we found on their system:
*Credit:* CodeBeamer's Wiki implementation includes many source code
modules and ideas from the Open Source JSPWiki <http://www.jspwiki.org/>system.
It uses the same Wiki syntax. Many JSPWiki plugins were implemented and
ported to CodeBeamer. Thanks to *Janne Jalkanen* and to the JSPWiki
community for the contribution.

*P.S: if this is not the correct place to ask about this topic, I
apologize, but could you please point us in the right direction?*

Thanks a lot in advance for your support
Best regards
Emanuele Pecchioli


-- 
------------------------------
[image: Logo Florence]
*Emanuele Pecchioli *
Senior Software Developer - Integration Architect
Viale Luciano Lama, 23 Centralino: +39055.5383250
Interno: +39055.5383277
Sede Milano: +3902.87323142
Viale Luciano Lama, 23 - 50019 Sesto F.no (FI)
Viale Enrico Forlanini, 23 - 20134 Milano
https://www.florence-consulting.it/  <https://www.florence-consulting.it/>
<no...@florence-consulting.it>
epecchioli@florence-consulting.it
<no...@florence-consulting.it>
------------------------------
PRIVACY NOTICEThe information contained in this transmittal, including any
attachments hereto, are confidential and privileged, and intended solely
for the specified addressee(s). This e-mail has a confidential nature which
is protected by the Italian law. Moreover, the recipient(s) may not
disclose, forward, or copy this e-mail or attachments, or any portion
thereof, or permit the use of this information, by anyone not entitled to
it, or in a way that may be damaging to the sender. If you are not the
intended addressee, or if you receive this message by error, please notify
the sender and delete this information from your computer. The statements
and opinions expressed in this e-mail message are those of the author of
the message and do not necessarily represent those of Florence Consulting
Group Srl. Besides, The contents of this message shall be understood as
neither given nor endorsed by Florence Consulting Group Srl. Florence
Consulting Group Srl does not accept liability for corruption, interception
or amendment, if any, or the consequences thereof.


-- 
------------------------------
[image: Logo Florence]
*Emanuele Pecchioli *
Senior Software Developer - Integration Architect
Viale Luciano Lama, 23 Centralino: +39055.5383250
Interno: +39055.5383277
Sede Milano: +3902.87323142
Viale Luciano Lama, 23 - 50019 Sesto F.no (FI)
Viale Enrico Forlanini, 23 - 20134 Milano
https://www.florence-consulting.it/  <https://www.florence-consulting.it/>
<no...@florence-consulting.it>
epecchioli@florence-consulting.it
<no...@florence-consulting.it>
------------------------------
PRIVACY NOTICEThe information contained in this transmittal, including any
attachments hereto, are confidential and privileged, and intended solely
for the specified addressee(s). This e-mail has a confidential nature which
is protected by the Italian law. Moreover, the recipient(s) may not
disclose, forward, or copy this e-mail or attachments, or any portion
thereof, or permit the use of this information, by anyone not entitled to
it, or in a way that may be damaging to the sender. If you are not the
intended addressee, or if you receive this message by error, please notify
the sender and delete this information from your computer. The statements
and opinions expressed in this e-mail message are those of the author of
the message and do not necessarily represent those of Florence Consulting
Group Srl. Besides, The contents of this message shall be understood as
neither given nor endorsed by Florence Consulting Group Srl. Florence
Consulting Group Srl does not accept liability for corruption, interception
or amendment, if any, or the consequences thereof.

Re: How to extract PlainText from JSPWiki syntax

Posted by Juan Pablo Santos Rodríguez <ju...@gmail.com>.
+ Emanuele, thought you were subscribed to user@jspwiki.a.o


best regards,
juan pablo


El lun., 23 nov. 2020 22:41, Juan Pablo Santos Rodríguez <
juanpablo.santos@gmail.com> escribió:

> Hi Emanuele,
>
> I'm afraid to say that the WikiEngine is very needed: JSPWiki syntax not
> only covers direct to html syntax (i.e., * translating
> to an html list), but also variable resolution, plugin
> execution,authorization.. There are also filters which, not being present
> in
> the syntax, modify the html presented to the user. All those things need a
> WikiEngine to be parsed. And there's also some
> markup which is directly tied to configuration present on the Engine,
> f.ex., interwiki links, or toggling image inlining.
>
> A WikiEngine acts nowadays mostly as a DI container, so, given that it may
> take a bit to start, it shouldn't affect too much
> to your application, and doesn't force you to declare JSPWiki's servlets /
> filters whatever on your application. In fact, for tests
> we tend to use a TestEngine (an implementation of the WikiEngine suitable
> for tests), so it's not that it will make your application
> unusable.
>
> A couple of things could be done to speed up the Engine initialization.
> Easiest that comes to mind would be to provide mock
> implementations for most of the Engine's managers.
>
> As for the syntax to text conversion, JSPWiki's markup parsers generate a
> WikiDocument, which is a specialization of a JDom2's
> Document. Providing that to the CleanTextRenderer should be enough for
> what you want.
>
> HTH,
> juan pablo
>
> p.s.: out of curiosity, which version of JSPWiki are you working with? Do
> you know in what version Codebeamer forked the wiki,
> or if they keep it up to date with latest JSPWiki?
>
>
>
> On Mon, Nov 23, 2020 at 1:18 PM Emanuele Pecchioli <
> epecchioli@florence-consulting.it> wrote:
>
>> Hello everybody,
>>
>> we have to convert a String containing JSPWiki syntax into Plain Text.
>> We would like to do this conversion without having installed the JSPWiki
>> application.
>> Is there any way to do it? Any available library?
>>
>> We found some very useful classes in *jspwiki-main* jar on maven central
>> (classes JSPWikiMarkupParser and CleanTextRenderer)
>>
>> http://jspwiki.apache.org/apidocs/2.11.0.M6/org/apache/wiki/render/CleanTextRenderer.html
>>
>> https://jspwiki.apache.org/apidocs/2.11.0.M4/org/apache/wiki/parser/JSPWikiMarkupParser.html
>>
>> however they both require a WikiContext that, from what we understood, can
>> be obtained only by a running JSPWiki engine.
>>
>> Just for more information we are doing an integration with *codebeamer
>> *software
>> that we found out is using JSPWiki modules inside to support rich text.
>> Please find below the credit we found on their system:
>> *Credit:* CodeBeamer's Wiki implementation includes many source code
>> modules and ideas from the Open Source JSPWiki <http://www.jspwiki.org/
>> >system.
>> It uses the same Wiki syntax. Many JSPWiki plugins were implemented and
>> ported to CodeBeamer. Thanks to *Janne Jalkanen* and to the JSPWiki
>> community for the contribution.
>>
>> *P.S: if this is not the correct place to ask about this topic, I
>> apologize, but could you please point us in the right direction?*
>>
>> Thanks a lot in advance for your support
>> Best regards
>> Emanuele Pecchioli
>>
>>
>> --
>> ------------------------------
>> [image: Logo Florence]
>> *Emanuele Pecchioli *
>> Senior Software Developer - Integration Architect
>> Viale Luciano Lama, 23 Centralino: +39055.5383250
>> Interno: +39055.5383277
>> Sede Milano: +3902.87323142
>> Viale Luciano Lama, 23 - 50019 Sesto F.no (FI)
>> Viale Enrico Forlanini, 23 - 20134 Milano
>> https://www.florence-consulting.it/  <https://www.florence-consulting.it/
>> >
>> <no...@florence-consulting.it>
>> epecchioli@florence-consulting.it
>> <no...@florence-consulting.it>
>> ------------------------------
>> PRIVACY NOTICEThe information contained in this transmittal, including any
>> attachments hereto, are confidential and privileged, and intended solely
>> for the specified addressee(s). This e-mail has a confidential nature
>> which
>> is protected by the Italian law. Moreover, the recipient(s) may not
>> disclose, forward, or copy this e-mail or attachments, or any portion
>> thereof, or permit the use of this information, by anyone not entitled to
>> it, or in a way that may be damaging to the sender. If you are not the
>> intended addressee, or if you receive this message by error, please notify
>> the sender and delete this information from your computer. The statements
>> and opinions expressed in this e-mail message are those of the author of
>> the message and do not necessarily represent those of Florence Consulting
>> Group Srl. Besides, The contents of this message shall be understood as
>> neither given nor endorsed by Florence Consulting Group Srl. Florence
>> Consulting Group Srl does not accept liability for corruption,
>> interception
>> or amendment, if any, or the consequences thereof.
>>
>>
>> --
>> ------------------------------
>> [image: Logo Florence]
>> *Emanuele Pecchioli *
>> Senior Software Developer - Integration Architect
>> Viale Luciano Lama, 23 Centralino: +39055.5383250
>> Interno: +39055.5383277
>> Sede Milano: +3902.87323142
>> Viale Luciano Lama, 23 - 50019 Sesto F.no (FI)
>> Viale Enrico Forlanini, 23 - 20134 Milano
>> https://www.florence-consulting.it/  <https://www.florence-consulting.it/
>> >
>> <no...@florence-consulting.it>
>> epecchioli@florence-consulting.it
>> <no...@florence-consulting.it>
>> ------------------------------
>> PRIVACY NOTICEThe information contained in this transmittal, including any
>> attachments hereto, are confidential and privileged, and intended solely
>> for the specified addressee(s). This e-mail has a confidential nature
>> which
>> is protected by the Italian law. Moreover, the recipient(s) may not
>> disclose, forward, or copy this e-mail or attachments, or any portion
>> thereof, or permit the use of this information, by anyone not entitled to
>> it, or in a way that may be damaging to the sender. If you are not the
>> intended addressee, or if you receive this message by error, please notify
>> the sender and delete this information from your computer. The statements
>> and opinions expressed in this e-mail message are those of the author of
>> the message and do not necessarily represent those of Florence Consulting
>> Group Srl. Besides, The contents of this message shall be understood as
>> neither given nor endorsed by Florence Consulting Group Srl. Florence
>> Consulting Group Srl does not accept liability for corruption,
>> interception
>> or amendment, if any, or the consequences thereof.
>>
>

Re: How to extract PlainText from JSPWiki syntax

Posted by Juan Pablo Santos Rodríguez <ju...@gmail.com>.
Hi Emanuele,

I'm afraid to say that the WikiEngine is very needed: JSPWiki syntax not
only covers direct to html syntax (i.e., * translating
to an html list), but also variable resolution, plugin
execution,authorization.. There are also filters which, not being present
in
the syntax, modify the html presented to the user. All those things need a
WikiEngine to be parsed. And there's also some
markup which is directly tied to configuration present on the Engine,
f.ex., interwiki links, or toggling image inlining.

A WikiEngine acts nowadays mostly as a DI container, so, given that it may
take a bit to start, it shouldn't affect too much
to your application, and doesn't force you to declare JSPWiki's servlets /
filters whatever on your application. In fact, for tests
we tend to use a TestEngine (an implementation of the WikiEngine suitable
for tests), so it's not that it will make your application
unusable.

A couple of things could be done to speed up the Engine initialization.
Easiest that comes to mind would be to provide mock
implementations for most of the Engine's managers.

As for the syntax to text conversion, JSPWiki's markup parsers generate a
WikiDocument, which is a specialization of a JDom2's
Document. Providing that to the CleanTextRenderer should be enough for what
you want.

HTH,
juan pablo

p.s.: out of curiosity, which version of JSPWiki are you working with? Do
you know in what version Codebeamer forked the wiki,
or if they keep it up to date with latest JSPWiki?



On Mon, Nov 23, 2020 at 1:18 PM Emanuele Pecchioli <
epecchioli@florence-consulting.it> wrote:

> Hello everybody,
>
> we have to convert a String containing JSPWiki syntax into Plain Text.
> We would like to do this conversion without having installed the JSPWiki
> application.
> Is there any way to do it? Any available library?
>
> We found some very useful classes in *jspwiki-main* jar on maven central
> (classes JSPWikiMarkupParser and CleanTextRenderer)
>
> http://jspwiki.apache.org/apidocs/2.11.0.M6/org/apache/wiki/render/CleanTextRenderer.html
>
> https://jspwiki.apache.org/apidocs/2.11.0.M4/org/apache/wiki/parser/JSPWikiMarkupParser.html
>
> however they both require a WikiContext that, from what we understood, can
> be obtained only by a running JSPWiki engine.
>
> Just for more information we are doing an integration with *codebeamer
> *software
> that we found out is using JSPWiki modules inside to support rich text.
> Please find below the credit we found on their system:
> *Credit:* CodeBeamer's Wiki implementation includes many source code
> modules and ideas from the Open Source JSPWiki <http://www.jspwiki.org/
> >system.
> It uses the same Wiki syntax. Many JSPWiki plugins were implemented and
> ported to CodeBeamer. Thanks to *Janne Jalkanen* and to the JSPWiki
> community for the contribution.
>
> *P.S: if this is not the correct place to ask about this topic, I
> apologize, but could you please point us in the right direction?*
>
> Thanks a lot in advance for your support
> Best regards
> Emanuele Pecchioli
>
>
> --
> ------------------------------
> [image: Logo Florence]
> *Emanuele Pecchioli *
> Senior Software Developer - Integration Architect
> Viale Luciano Lama, 23 Centralino: +39055.5383250
> Interno: +39055.5383277
> Sede Milano: +3902.87323142
> Viale Luciano Lama, 23 - 50019 Sesto F.no (FI)
> Viale Enrico Forlanini, 23 - 20134 Milano
> https://www.florence-consulting.it/  <https://www.florence-consulting.it/>
> <no...@florence-consulting.it>
> epecchioli@florence-consulting.it
> <no...@florence-consulting.it>
> ------------------------------
> PRIVACY NOTICEThe information contained in this transmittal, including any
> attachments hereto, are confidential and privileged, and intended solely
> for the specified addressee(s). This e-mail has a confidential nature which
> is protected by the Italian law. Moreover, the recipient(s) may not
> disclose, forward, or copy this e-mail or attachments, or any portion
> thereof, or permit the use of this information, by anyone not entitled to
> it, or in a way that may be damaging to the sender. If you are not the
> intended addressee, or if you receive this message by error, please notify
> the sender and delete this information from your computer. The statements
> and opinions expressed in this e-mail message are those of the author of
> the message and do not necessarily represent those of Florence Consulting
> Group Srl. Besides, The contents of this message shall be understood as
> neither given nor endorsed by Florence Consulting Group Srl. Florence
> Consulting Group Srl does not accept liability for corruption, interception
> or amendment, if any, or the consequences thereof.
>
>
> --
> ------------------------------
> [image: Logo Florence]
> *Emanuele Pecchioli *
> Senior Software Developer - Integration Architect
> Viale Luciano Lama, 23 Centralino: +39055.5383250
> Interno: +39055.5383277
> Sede Milano: +3902.87323142
> Viale Luciano Lama, 23 - 50019 Sesto F.no (FI)
> Viale Enrico Forlanini, 23 - 20134 Milano
> https://www.florence-consulting.it/  <https://www.florence-consulting.it/>
> <no...@florence-consulting.it>
> epecchioli@florence-consulting.it
> <no...@florence-consulting.it>
> ------------------------------
> PRIVACY NOTICEThe information contained in this transmittal, including any
> attachments hereto, are confidential and privileged, and intended solely
> for the specified addressee(s). This e-mail has a confidential nature which
> is protected by the Italian law. Moreover, the recipient(s) may not
> disclose, forward, or copy this e-mail or attachments, or any portion
> thereof, or permit the use of this information, by anyone not entitled to
> it, or in a way that may be damaging to the sender. If you are not the
> intended addressee, or if you receive this message by error, please notify
> the sender and delete this information from your computer. The statements
> and opinions expressed in this e-mail message are those of the author of
> the message and do not necessarily represent those of Florence Consulting
> Group Srl. Besides, The contents of this message shall be understood as
> neither given nor endorsed by Florence Consulting Group Srl. Florence
> Consulting Group Srl does not accept liability for corruption, interception
> or amendment, if any, or the consequences thereof.
>