nlplab / brat

brat rapid annotation tool (brat) - for all your textual annotation needs
http://brat.nlplab.org
Other
1.82k stars 509 forks source link

save SVG: xlink namespace; Chrome (22) bug? #948

Open jjon opened 12 years ago

jjon commented 12 years ago

probably of low priority (or a wontfix type of deal), but as I was idly trying to break things I noted this:

In the Data dialog, if I click on the visualization: SVG button, the svg image is rendered correctly, but displayed with the following error message:

Namespace prefix xlink for href on a is not defined

When the svg is generated it ends with a <g> element containing anchors. I don't know what its function is, but it looks like this:

<g class="sentnum">
  <a xlink:href="#/testing/xlinkTest?focus=sent~1" xmlns="http://www.w3.org/1999/xlink">
    <text xmlns="http://www.w3.org/2000/svg" x="18" y="16" data-sent="1">1</text>
  </a>
  <a xlink:href="#/testing/xlinkTest?focus=sent~2" xmlns="http://www.w3.org/1999/xlink">
    <text xmlns="http://www.w3.org/2000/svg" x="18" y="106" data-sent="2">2</text>
  </a>
  <path d="M20,0L20,110" />
</g>

If I manually edit the ns declaration to this xmlns:xlink the error goes away. Also, if I include the ns declaration in the svg element, the error goes away. jquery.svg appears to be responsible for generating ns declarations and the comment at client/src/visualizer.js 2964 suggests somebody's already aware of this: pardon if I'm redundant here.

This appears to be a webkit problem (see here). This error does not appear, for example, in Opera (12.01).

spyysalo commented 12 years ago

@jjon : thank you for another detailed report. In a "live" brat document, those links serve to "focus" a sentence, but they are almost certainly non-functional in an exported SVG.

@amadanmath : can you confirm my understanding? Would it be better not to include these links on export?

amadanmath commented 12 years ago

@spyysalo: correct on all counts

spyysalo commented 12 years ago

Thanks. Let's take it out then. Does the client know it's generating an SVG for export or do we need to do serverside post-processing to do this?

Setting for 1.4 (non-critical).

amadanmath commented 12 years ago

AFAICR the server is doing postprocessing anyway (like inserting CSS).

spyysalo commented 12 years ago

OK, assigning @ninjin for implementation serverside.

ghost commented 12 years ago

Okay, I'll implement this by ripping out the elements when it is retrieved from the server.