Page 1 of 1

Hope goldendict could support separate css file

PostPosted: Sun Feb 17, 2013 10:43 am
by hanyl05
Hope goldendict could support separate css file for stardict dictionaries.

Re: Hope goldendict could support separate css file

PostPosted: Sun Feb 17, 2013 11:12 am
by Tvangeste
To be honest, I'm not that familiar with Stardict format. If some css file is listed in the dictionary itself, where is it located?

I mean, if somebody needs to adjust formatting for the specific dictionary then that particular dictionary needs to be updated. I'm sure there is a way to extract the contents from stardict dictionary and redo it with adjustments.

Re: Hope goldendict could support separate css file

PostPosted: Sun Feb 17, 2013 1:22 pm
by hanyl05
Thanks Tvangeste.
I want to express my question in another way as follows:
Is it possible to build a series of css files, named a.css, b.css, d.css,e.css...
and let specified css files support a specified dictionary, for example, a.css is used for Longman dictionary, and b.css is used for
another dictionary?

Thanks!

Re: Hope goldendict could support separate css file

PostPosted: Sun Feb 17, 2013 2:35 pm
by chulai
I just committed the change to support loading external CSS files in the same way you can load images. The css file has to be stored in the "res" subfolder located at the same level as the stardict dictionary files.

location of css files.PNG
CSS files must be located in the RES subfolder
location of css files.PNG (52.25 KiB) Viewed 12171 times



I only tested this with "Oxford English-Chinese dictionary", the only dictionary I have which contains a CSS file:

Before:
Oxford English-Chinese Stardict dictionary with no css external file handling.PNG
Oxford English-Chinese Stardict dictionary with no css external file handling
Oxford English-Chinese Stardict dictionary with no css external file handling.PNG (114.64 KiB) Viewed 12171 times


After:
Oxford English-Chinese Stardict dictionary with css external file handling.PNG
Oxford English-Chinese Stardict dictionary with css external file handling
Oxford English-Chinese Stardict dictionary with css external file handling.PNG (98.5 KiB) Viewed 12171 times


As you can see after the fix the CSS is loaded and the text is formatted correctly.

You can compile from source code or wait until next Developer or Early Access build.

Regards

Re: Hope goldendict could support separate css file

PostPosted: Sun Feb 17, 2013 3:14 pm
by hanyl05
Fantastic!!!
I am eagerly waiting for the coming early build.o(∩_∩)o

Re: Hope goldendict could support separate css file

PostPosted: Sun Feb 17, 2013 6:31 pm
by Tvangeste
hanyl05 wrote:Fantastic!!!
I am eagerly waiting for the coming early build.o(∩_∩)o

The dev build that includes this fix has been posted in the dev builds thread, so you can take a look.