W dniu 2012-05-30 00:07, Dominique Pellé pisze:
> Dominique Pellé<dominique.pe...@gmail.com>  wrote:
>
>> Marcin Miłkowski wrote:
>>
>>> W dniu 2012-05-27 11:35, Jan Schreiber pisze:
>>>>    >    However, when I use LanguageTool in the command line, I don't see
>>>>    >    anything about the URL information:
>>>> For all I know, the URL is displayed in LibreOffice only.
>>> I just added it to the commandline interface.
>> Thanks a lot, that was quick!
>>
>>> BTW, we might need to add a new element to our XML format (used by the
>>> API), to convey this piece of info.
>>>
>>> What about<url>?
>> Fine with me, that's the most natural choice.
>>
>> Regards
>> -- Dominique
> Actually, all the information about errors are currently inside attributes
> of the<error ...>  tag.  So I think it's better to follow the same principle.
>
> So how about this:
>
> <error fromy="..." fromx="..." toy="..." tox="..." ruleId="..."
> subId="1"  msg="...." url="..." replacements="..." context="..."
> contextoffset="..." errorlength="..."/>
>
>
> (the url="..." is the new part)
>

Yes, definitely!


> The following patch does just that.  If you're OK with it,
> I can checkin:
>
> $ svn diff src/java/org/languagetool/tools/StringTools.java
> Index: src/java/org/languagetool/tools/StringTools.java
> ===================================================================
> --- src/java/org/languagetool/tools/StringTools.java  (revision 7099)
> +++ src/java/org/languagetool/tools/StringTools.java  (working copy)
> @@ -345,6 +345,11 @@
>         final String msg = match.getMessage().replaceAll("</?suggestion>", 
> "'");
>         xml.append(subId);
>         xml.append(" msg=\"" + escapeXMLForAPIOutput(msg) + "\"");
> +      if (match.getRule().getUrl() != null) {
> +        xml.append(" url=\""
> +            + escapeXMLForAPIOutput(match.getRule().getUrl().toString())
> +            + "\"");
> +      }
>         final String START_MARKER = "__languagetool_start_marker";
>         String context = Tools.getContext(match.getFromPos(), 
> match.getToPos(),
>             text, contextSize, START_MARKER, "", false);

Sorry, Dominique, I didn't notice your patch, I was committing mine but 
it is almost the same. I don't think we need escaping for API output as 
URLs should be XML-safe. If you want, change it.

I had to change the api-output.dtd and some docs as well.

Regards,
Marcin

>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Languagetool-devel mailing list
> Languagetool-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/languagetool-devel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to