soshial / xdxf_makedict

XDXF — an open and free dictionary format, that stores word articles in a structural and semantic way. The most convertible format
223 stars 54 forks source link

kref link displaying one piece of text and linking to another? #34

Closed darnn closed 5 years ago

darnn commented 5 years ago

Hi. I'm trying to convert a dictionary I have to XDXF. Using makedict, I get a file with things like this in it: <A href="bword://aaa">bbb</A> That's meant to link to "aaa" while displaying the text "bbb". Is there any way to achieve this with kref?

nikita-moor commented 5 years ago

Yes, first you define an anchor id (as the attribute of <k> or <def>) and then reference it with <kref> tag:

<ar>
  <k id="aaa">first</k>
  <def><deftext>Something about the word "first".</deftext></def>
</ar>
<ar>
  <k>second</k>
  <def>
    <deftext>
      Here is a <kref idref="aaa">link</kref> to the previous article.
    </deftext>
  </def>
</ar>

However, it was not yet implemented in GoldenDict, i.e. you can write it in XDXF, but it will not work in that computer shell.

darnn commented 5 years ago

I see! Thank you! Would I have any way of knowing when they do implement it, or should I just be trying every new Windows build until I see it works?

nikita-moor commented 5 years ago

I'm not a developer of GoldenDict. As far as I know, developing of all dictionary shells for desktop computers stopped 5 or 6 years ago. GoldenDict developers do commit patches, but it's only small bugfixes. (Howevere, they were very kind to adapt new hunspell output for me.)

If you create a dictionary especially for GoldenDict, then this kind of link does work:

Here is a <a href="first">link</a> to the previous article.
darnn commented 5 years ago

Oh, great! Thank you! And yeah, I realized you weren't a GoldenDict developer, I just figured maybe you'd know what to look for in their changelog or something. It's too bad they're not actively developing it, I always recommend it to my translator friends whenever they complain about how poor Babylon's support is, but it doesn't seem to work properly on certain versions of Windows 10, for instance. Anyway, this solves everything for me, so I'm closing it. Thanks again.

k-sl commented 5 years ago

If <kref> has idref attribute, then it references the <def> tag that has an id equal to this attribute. The word "answered" in code <kref idref"nf0837glo9">answered</kref> will link to the verb "answer" (and not the noun because of the specific id).

This has been part of the specification for quite some time, I'd expect it to be supported in GoldenDict, although I haven't tried it myself. If it isn't you can create an issue on their project. GoldenDict isn't dead, just not very active. In any case, that's an issue for their project.

nikita-moor commented 5 years ago

Our master @soshial already opened the issue "links not to the whole article" (2013 year).

GodlenDict does not recognize attributes in quotations too, author and source:

<ex author="Plutarch" source="Life of Caesar">
  <ex_orig >Veni, vidi, vici</ex_orig>
  <ex_tran>I came; I saw; I conquered</ex_tran>
</ex>

would be

Veni, vidi, vici ~ I came; I saw; I conquered

Several things are needed to be improved in GoldenDict's support of XDXF format.