Hi Juan,

Great to see the progress you are making on this !

I'm definitely excited to try this out;  and will surely have a look at the
W.Snips.Markdown.js.


BR
dirk

On Tue, Mar 22, 2022 at 1:17 PM Juan Pablo Santos Rodríguez <
juanpablo.san...@gmail.com> wrote:

> Hi Dirk!
>
> finally had some time to work on this. Latest push on master should
> load a Markdown specific Wiki.Snips.js file ([#1]) when
> jspwiki.syntax=markdown is provided as a wiki property :-) I finally
> went with separate files instead of overwritting the snips b/c I
> thought this way is easier to extend in the case anyone wants to
> develop support for another wiki syntax (btw, throughout the week I'll
> try to update [#2] with a link to Markdown support and a new section
> on developing an extension for supporting another wiki syntax)
>
> However, right now, the plain editor should be working only for a big
> part of the Markdown syntax, as there were sections I didn't knew how
> to approach them:
>
> * <span/> separators
> JSPWiki syntax allows to set some css class/style by using the %%.. %%
> directives which render span elements. On Markdown you do this by
> adding a {.your_css_class} constructs at the end of the paragraph, and
> the Markdown engine infers where to start applying it (ussually, the
> start of the paragraph). To explicit only a section of a paragraph (a
> span) you have to add an empty html comment, some like <!---->my text
> here{.bg-info} (f.ex, on the sign: snip). There are a lot of places on
> the Wiki.Snips file that rely on this separator. It's ugly for a
> Markdown file, but I haven't found any other way to note where to
> begin..
>
> *nScope property on tabs: and font: snips
> In these cases, the ending element of the value on the nScope contains
> some variable text, so I've thrown a \\w+ in hopes that this would
> automagically catch that variable part, but I'm afraid it is not
> enough.
>
> Something similar occurs on scope property of fontDlg:, colorDlg: and
> iconDlg: snips
>
> * suggest property on *Dlg: snips
> The suggest: property usually contains an element with one or several
> regular expressions. I haven't touched any of those as a) I don't
> understand most of them, b) not sure where or how they're used, and c)
> also a) again.
>
> Something similar happens on linkPart2:, linkPart3:, linkDlg: and
> pluginDlg: snips, with the lback and match properties
>
> * lipstick: snips
> Lastly, I think I've managed to correctly implement the lipstick
> element: but anoher pair of eyes would be more than welcome. Alas,
> properly speaking, another pair of eyes looking at the whole file
> would be more than welcome.
>
> Would you mind taking a look at those issues? O:-) I'd like to focus
> on providing initial sets of Markdown pages by using some sort of
> yet-to-be-codified jspwiki-to-markdown conversor. Not a complete one,
> but something enough to convert the markup on the available wiki
> pages..
>
>
> cheers,
> juan pablo
>
> [#1]:
> https://github.com/apache/jspwiki/blob/master/jspwiki-markdown/src/main/javascript/Wiki.Snips.Markdown.js
> [#2]: https://jspwiki-wiki.apache.org/Wiki.jsp?page=Wiki%20Syntax
>
> On Mon, Jan 17, 2022 at 11:57 PM Dirk Frederickx
> <dirk.frederi...@gmail.com> wrote:
> >
> > Hi Juan,
> >
> > >> inline feedback,
> >
> >
> > On Mon, Jan 17, 2022 at 12:43 AM Juan Pablo Santos Rodríguez <
> > juanpablo.san...@gmail.com> wrote:
> >
> > > Hi Dirk!,
> > >
> > > I've been looking at the source, and I'm not sure I'm following.
> > > Wiki.Snip.js seems to be responsible of the wiki syntax displayed by
> > > the editor, right?
> > >
> > >>> Yes, right.   Wiki.Snip.js is the right file.  (not the
> > Snipe.Command.js)
> >
> > >
> > > I was thinking of providing one Wiki.Snip.js via
> > > wiki:IncludeResources. The specific file would be selected depending
> > > on a property on jspwiki-custom.properties file, something like
> > >
> > > >>> That would be an option,  but then you'd need to move the
> Wiki.Snip.js
> > outside of the Haddock-edit.js file.
> > (change the wro-haddock.xml build file)  and load it separately.
> >
> >
> > <%
> > > final String editor = engine.getWikiProperties().get(
> > > "jspwiki.syntax.editor" ); // or default to something
> > > %>
> > > [...]
> > > <script type="text/javascript">//<![CDATA[
> > > <wiki:IncludeResources type="editor"/>
> > > <%-- outputs something like
> > > Wiki.Snips = {... }
> > > --%>
> > > //]]></script>
> > >
> > > In order to be loaded through wiki:IncludeResources, current
> > > Wiki.Snip.js file would move to the jspwiki-main module, being
> > > minified there; the jspwiki-markdown module would also hold a
> > > Markdown.Wiki.Snip.js, following the same structure, but with Markdown
> > > snippets.
> > >
> > > >>> Better is to keep it then separately;
> > >>> In plain.jsp you could do this
> > <wiki:RequestResource type="script" resource="scripts/haddock-edit.js" />
> > ->this is a reduced haddock-edit.js
> > <c:if test="....this is normal editing session....">
> > <wiki:RequestResource type="script" resource="scripts/haddock-snips.js"
> />
> > <c:if>
> > <c:if test="....this is a markdown editing session....">
> > <wiki:RequestResource type="script" resource="scripts/markdown-snips.js"
> />
> > </c:if>
> >
> >
> > > Other 3rd party syntax extensions would hold their js file too, but
> > > only one would be loaded, based on a property on
> > > jspwiki-custom.properties file. This "pluggability" would be the
> > > important thing to me when implementing support for other wiki
> > > syntaxes, so there's no need to overwrite JSPs or provide templates
> > > that overwrite a few JSPs for markdown (or other wiki syntaxes).
> > >
> > > That's was what I was heading, and I still have to make a POC to see
> > > if this is feasible (I think it should, but have to make the POC).
> > >
> > > Re-reading your e-mail, it seems that your approach is different.
> > > Given that you know way more on the editor / js in general, I feel
> > > your approach is most probably the way to go. How would the wiki
> > > syntax displayed by the editor be chosen?
> > >
> >
> > >>> Alternatively,  you could just leave the whole build unchanged.
> > >>> And only load the markdown snippets on-top-of the defaults. Actually
> > overwriting them.
> > >>> In plain.jsp you could do this
> > <wiki:RequestResource type="script" resource="scripts/haddock-edit.js" />
> > ->this is the full haddock-edit.js
> > <c:if test="....this is a markdown editing session....">
> > <wiki:RequestResource type="script" resource="scripts/markdown-snips.js"
> />
> > </c:if>
> >
> >
> > BR,
> > dirk
> >
> >
> >
> > > best regards,
> > > juan pablo
> > >
> > > On Fri, Jan 14, 2022 at 12:51 PM Dirk Frederickx
> > > <dirk.frederi...@gmail.com> wrote:
> > > >
> > > > Hi Pablo,
> > > >
> > > > Good to see how this is progressing.
> > > >
> > > > Happy to help on building the markdown support into the editor.
> > > > The SNIP editor is build to be pluggable,  and this would be a good
> test
> > > > case.
> > > > You should only provide a specific "Markdown.Snipe.Command.js" file.
> > > >
> > > > Would you have a specific markdown editor JSP file or not ?
> > > >
> > > >
> > > > BR,
> > > >      dirk
> > > >
> > > > On Thu, Jan 13, 2022 at 2:52 PM Juan Pablo Santos Rodríguez <
> > > > juanpablo.san...@gmail.com> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > last push completed markdown support on the WYIWYG editor. Right
> now
> > > > > there's a markdown parser, a markdown renderer, a WYIWYG editor
> > > > > renderer, and an html from the WYIWYG editor to markdown syntax
> > > > > converter. [#1] has a bit more info on this.
> > > > >
> > > > > The only item left, in order to have full Markdown support inside
> > > > > JSPWiki, is making the plain editor able to also output Markdown
> > > > > syntax when using the "snips" functionality, but I have no idea on
> > > > > what's the best way to accomodate this requirement. Right now the
> > > > > aforementioned parser, renderers, etc. are pluggable, so if anyone
> > > > > would want to write an extension to provide, say JIRA wiki markup
> > > > > support, it is possible to do so.
> > > > >
> > > > > Ideally, markdown support on the plain editor should be pluggable
> as
> > > > > well and allow third party wiki syntaxes.
> > > > >
> > > > > I've thought of providing the appropiate wiki syntax to the js
> files
> > > > > the same way I18N texts are passed, using the IncludeResources tag
> on
> > > > > the commonheader.jsp file, but I'm neither sure which files should
> be
> > > > > provided, nor javascript is one of my strong suits. Or maybe if it
> > > > > should be output a javascript object with the appropiate syntax,
> and
> > > > > modify whatever js files are required to read the markup snips (or
> > > > > whatever is needed) from this object?
> > > > >
> > > > > Dirk, WDYT?
> > > > >
> > > > >
> > > > > best regards,
> > > > > juan pablo
> > > > >
> > > > > [#1]:
> https://jspwiki-wiki.apache.org/Wiki.jsp?page=Markdown%20Support
> > > > >
> > >
>

Reply via email to