gctushar / java-wikipedia-parser

Automatically exported from code.google.com/p/java-wikipedia-parser
0 stars 0 forks source link

Table problem? #3

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Trying to convert 

{| border="1"
|-
| row 1, cell 1
|}

with the following:

String html_text_problem =
be.devijver.wikipedia.Parser.toHtml(text_problem, null);

i've got

be.devijver.wikipedia.parser.ast.parser.ASTParseException: Error while
handling AST object
[be.devijver.wikipedia.parser.ast.SpecialConstruct@6736dc]: Error while
handling AST object
[be.devijver.wikipedia.parser.ast.SpecialConstruct@6736dc]: Lexical error
at line 1, column 14.  Encountered: "\r" (13), after : ""
    be.devijver.wikipedia.parser.ast.parser.DefaultASTParser.doInvokeParseMethod(DefaultASTParser.java:31)
[...]

instead of the html table...
I'm using the wikipedia-parser-0.1 (jar) in a jsp-page on mac OSX

With other strings it works...

Original issue reported on code.google.com by armisael...@gmail.com on 23 Mar 2008 at 1:16

GoogleCodeExporter commented 8 years ago
I also have the same problem, can't get tables to work (windows XP). Is there a 
fix available please?

Original comment by scott.wi...@mac.com on 14 Apr 2008 at 4:04

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Parsing your example with:

  String wiki = "{| border=\"1\"\n" + 
                "|-\n" +
                "| row 1, cell 1\n" +
                "|}\n";

  String html = Parser.toHtml(wiki, null);

works fine for me.  But as soon as you replace the "\n" newlines with "\r" or 
"\r\n"
I get the error you encountered.  I suspect this has something to do with the
"wikipedia_table.jj" file which defines "\n" in a few places but not "\r".  I'm 
not a
javacc expert and don't know exactly which lines need to be changed.

A quick fix to this however, would be to create a Reader that reads characters 
from a
wrapped reader and discards all "\r" characters it encounters.  Not ideal, but 
you
then use your StringReader or FileReader (or whatever) with the wrapper and
everything should work out.

Original comment by bodhi.r...@gmail.com on 11 Dec 2008 at 9:33

GoogleCodeExporter commented 8 years ago
please let me know that is there any script available for converting normal 
text to wikitext through buttons ?

There is any problem of table n image insertion in jar file of wiki parser ?

Original comment by prashant...@gmail.com on 29 Mar 2011 at 9:38