rehamaltamimi / gwtwiki

Automatically exported from code.google.com/p/gwtwiki
0 stars 0 forks source link

Issues when rendering french wikitionary #39

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here are some problems I had when rendering fr.wikitionary articles. I made 
some patches in the 
code, 

1.  there are templates with this construct: {{{{{1}}}}} (which means {{ 
{{{1}}} }}). The parser can't handle 
this.

I fixed it by adding a test to be sure that after the 3rd '{' there is 
something else than '{' (in 
wikipediaParser.java) 

2. There where trailing args because when reading the calling arguments, the 
parser will puts in the 
map the named arguments and put them a second time with a numeric key. For some 
french template 
it is not good (a named arg is given and the numeric one must be empty). I 
fixed it by changing the 
map assignation in TemplateParser.createSingleParameter:

   } finally {
            if (currOffset > lastOffset) {
                if (trimNewlineRight) {
                    value = Utils.trimNewlineRight(srcString.substring(lastOffset, currOffset));
                } else {
                    value = srcString.substring(lastOffset, currOffset).trim();
                }

                if (parameter != null) {
                    map.put(parameter, value);
                } else {
                    map.put(Integer.toString(parameterCounter), value); // PG
                }
            }
        }

3. There is cases where a named arg is not given on the call. bliki will then 
ask the 
Model.getRawWikiContent() for something like "Modèle:lang/{{{1}}}" (which is 
wrong) instead of asking 
for "Modèle:lang/" (which is wright) .

My workaround is to wipe the "{...}" elements in Model.getRawWikiContent(), but 
it would be a lot 
better to filter it somewhere in the parser (when a parameter is not given, 
wipe it).

I have yet to test extensively my workarounds.

What version of the product are you using? On what operating system?
Bliki 3.0.13

Please provide any additional information below.
I have attached a copy of my modified files. I added a "//PG" comment on the 
modified lines.

Original issue reported on code.google.com by Philippe...@gmail.com on 6 May 2010 at 3:24

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 6 May 2010 at 4:27

GoogleCodeExporter commented 8 years ago
I adde part 2 of your patches to SVN:
http://code.google.com/p/gwtwiki/source/detail?r=1155

I'm not sure about part 1 at the moment, because a JUnit test fails if I change 
the
sources as suggested.

Original comment by axelclk@gmail.com on 6 May 2010 at 4:29

GoogleCodeExporter commented 8 years ago

Original comment by axelclk@gmail.com on 3 Jul 2012 at 5:40