mkdir /tmp/build-sdwv
cd /tmp/build-sdwv
cmake path/to/source/code/of/sdwv
make
make install
you can use "DESTDIR" variable to change installation path
NOTE: You may copy the Web resource files and format.conf in dist
directory to the place of your dictionary files. see below.
Copy the directory dist/html
to the dictionary path(default is /usr/share/stardict/dic
), so that all .css and .js assets are in /usr/share/stardict/dic/html/
.
StarDict supports many dict formats. While sdwv is focusing on HTML.
- xdxf(code name 'x') format is the best supported.
- html(code name 'h') the look and feel would depend on the dict itself.
- text(code name 'm') is showed with basic HTML support.
You can customize the output theme by editing dist/format.conf
, and the copy it to dictionary path.
The format.conf is split into lines. each line makes up a single config. There are four types of line:
- Comment. it must start with '#'.
- Dictionary type specifier. it must start with ':', following a single char that is the same as "sametypesequence" in the .ifo file.
- Plain string replace: x=y replaces all x to y. note there is no space in between.
- Regular expression replace: x~y replaces any text that matches x, with y as Regex replacement string.
NOTE: For 3, 4: x or y can contain variable {{DICT_PATH}} as the dictionary files' absolute path, or {{DICT_NAME}} as the dictionary name.
The out.htm is the template of output.
- Text is written directly.
- Variables and control structures are in {{...}}.
-
A variable is represented as {{varName}}. In the nested
{{for:}}
loop, these variables can be used.{{word}}
actual word{{bookname}}
dictionary name{{definition}}
the definition in dictionary{{idx}}
the loop auto-increment index. -
A control structure is
{{c:t}}
, where 'c' can be one of ("m", "for", "endfor"),t
is text label of the control.{{m: }}
can be used for output control:{{m:j}}
is a indication of JSON format.{{m:h}}
is a header.{{m:b}}
is a result body(the search result list, usually the {{for:}} loops){{m:f}}
is a footer.
Actually there is only one rule for sdwv to find dictionaries in dictionary path: each dictionary has one unique file name but with different extentions. Using identical name in different directories will make a lot of confusion. For the sake of ease, one directory for one dictionary. Besides the CLI -u option, the ordering depends on the full path of the dictionary file name. rename the directory of each dictionary and prefix it with 01-, 12-, 32-, etc. to make them ordered. For example:
$ find /usr/share/stardict/dic/ | sort | grep -v res
/usr/share/stardict/dic/
/usr/share/stardict/dic/01-Dictionary-A
/usr/share/stardict/dic/01-Dictionary-A/Dictionary-A.dict.dz
/usr/share/stardict/dic/01-Dictionary-A/Dictionary-A.idx
/usr/share/stardict/dic/01-Dictionary-A/Dictionary-A.idx.oft
/usr/share/stardict/dic/01-Dictionary-A/Dictionary-A.ifo
/usr/share/stardict/dic/13-Dictionary-X
/usr/share/stardict/dic/13-Dictionary-X/Dictionary-X.dict.dz
/usr/share/stardict/dic/13-Dictionary-X/Dictionary-X.idx
/usr/share/stardict/dic/13-Dictionary-X/Dictionary-X.idx.oft
/usr/share/stardict/dic/13-Dictionary-X/Dictionary-X.ifo
/usr/share/stardict/dic/70-Dictionary-B
/usr/share/stardict/dic/70-Dictionary-B/AdictB-fix1.dict.dz
/usr/share/stardict/dic/70-Dictionary-B/AdictB-fix1.idx
/usr/share/stardict/dic/70-Dictionary-B/AdictB-fix1.idx.oft
/usr/share/stardict/dic/70-Dictionary-B/AdictB-fix1.ifo
/usr/share/stardict/dic/format.conf
/usr/share/stardict/dic/html
/usr/share/stardict/dic/html/autohint.js
/usr/share/stardict/dic/html/jquery.js
/usr/share/stardict/dic/html/jquery-ui.css
/usr/share/stardict/dic/html/jquery-ui.js
/usr/share/stardict/dic/out.htm
For other helps. see sdwv -h
.
If you find bug reports it via email to tomgrean at github dot com. Be sure to include the word "sdwv" somewhere in the "Subject:" field.