Hi Hel-o, On Aug 17, 2009, at 2:50 PM, hel-o wrote:
Hi,
just wanted to know if theres a script available replacing wrong heading syntax (<h1> </h1>... <h3></h3> ...) with wiki syntax (1 ... 1.1.1 ....).
Note that 1, 1.1, etc are xwiki syntax 1.0 and not 2.0. For 2.0 it's =, ==, ===, etc.
We are switching to syntax 2.0 and we want to convert the old pages to the new syntax.
Nobody has written such a script but it shouldn't be too hard to write it if you want. Something along the lines of: Pattern pattern = Pattern.compile("<h([1-6])>(.*)</h[1-6]>"); Matcher matcher = pattern.matcher($mydoc.content()); // perform replacements using Matcher api here $mydoc.setContent(modifiedcontent) $mydoc.save(...) You could even use grooy regex support: http://groovy.codehaus.org/Regular+Expressions Thanks -Vincent
vmassol wrote:
Hi,
On Mar 6, 2009, at 11:02 AM, Helmut Lehner wrote:
Hi Vincent
I don't know if there's much we can do here since the tinymce-based wysiwyg will have saved the content of the page in HTML in your case and the converter cannot distinguish this from someone typing HTML in the page.
I get this code editing a page in WYSIWYG-Mode with Syntax 1.0 and only the headings are html. The rest is wiki syntax. This behavior started somwhere around Version 1.5 i think. before headings were created correctly in wiki syntax (as the rest).
If you have an idea of how to do it let us know. For me you'll need to correct the 1.0 content for your pages that have this problem.
I know how to correct this i just wanted to mention that this could be a problem not only for me but for every user who creates pages in syntax 1.0 in WYSIWYG and converts them to syntax 2.0 afterwards.
Yes it's a problem. One thing that can be done is to write/provide a small velocity/groovy script that scans all wiki pages and replaces the heading with the wiki syntax.
The best thing would be to make the tiny mce editor create headings again in wiki syntax:)
That will not solve the problem for all page contents which have now HTML for headings.
The next best thing would be to convert html headings like the ones created (without class, or style information) to headings in xwiki syntax 2.0 because i think there are fewer headings created intentionally in html with that code than by accident through that editor bug.
I think I'd prefer the script solution since otherwise that'll make the converter heavier and with some hacks.
WDYT?
Thanks -Vincent ____________