yozhic / DSL-Reference

Справочник по DSL (Dictionary Specification Language)
2 stars 1 forks source link

GoldenDict's handling of `[url]` and `[s]` #3

Open shenlebantongying opened 1 day ago

shenlebantongying commented 1 day ago

Not sure if these are worth mentioning, but I will just put them down here 😅.

[s] will fall back to text link that opens any type of resources

[s]a.pdf[/s]

can open the a.pdf inside .dsl.files.zip

Because it falls back to become a link. GD will put that file in a temporal folder so that external programs can open it.

https://github.com/goldendict/goldendict/blob/b2366124ef0d5c02ef208c40e1de709507faa19d/dsl.cc#L962-L972

Open local file relative to main .dsl file

Added in https://github.com/goldendict/goldendict/commit/b2366124ef0d5c02ef208c40e1de709507faa19d

[url target="file:///a.pdf"] some text [/url]
[url target="file://./a.pdf"] some text [/url]

will open the PDF file like this:

.
├── a.dsl
└── asd.pdf
Auto adding http://

https://github.com/yozhic/DSL-Reference/blob/602402b953efeb8a72fdf008edda0e2436ffe627/server/DSLReference_HTML/tag_links.html#L137

In GD, any link without scheme will have http:// added.

https://github.com/goldendict/goldendict/blob/d9ef605e58eeca95acadcab758ac7587b2943752/dsl.cc#L1047-L1048

yozhic commented 17 hours ago

Thank you, those are substantive comments.

The original plan was to describe in the guide only the interaction of dsl with Lingvo, since Lingvo is the parent of dsl. GoldenDict was mentioned in rare cases, only for comparison. But times are changing. Now, perhaps, it would not be superfluous to list all the specifics of interaction between dsl and GoldenDict.

Only I will have to think how to do it better, because sometimes processing depends not on GoldenDict, but on QWebKit built into it.