Compare commits
No commits in common. "ce2b8b39c07aa04b74ed2cee397574fe1837599b" and "b9ba894cc94a5b883ea4b30f6aeeede0a8b5f9de" have entirely different histories.
ce2b8b39c0
...
b9ba894cc9
27
README.adoc
27
README.adoc
@ -50,20 +50,15 @@ automatically.
|
|||||||
|
|
||||||
Dictionaries
|
Dictionaries
|
||||||
------------
|
------------
|
||||||
This application is intended for use with specific dictionaries: each line
|
Unfortunately, this application only really works with specific dictionaries.
|
||||||
should contain one short word definition. Moreover, the only supported content
|
Word definitions have to be in plain text, separated by newlines.
|
||||||
types are plain text, Pango markup, and XDXF (the visual format works better).
|
|
||||||
|
|
||||||
The `make dicts` command will build some examples from freely available sources:
|
The `make dicts` command will build some examples from freely available sources.
|
||||||
|
|
||||||
- GNU/FDL Czech-English dictionary
|
You may use the included 'transform' tool to convert already existing
|
||||||
- Czech foreign words
|
dictionaries that are almost good as they are, e.g., after stripping XML tags.
|
||||||
- Czech WordNet 1.9 PDT (synonyms, hypernyms, hyponyms)
|
You might want to fix up the `sametypesequence` of the resulting '.ifo' file
|
||||||
|
afterwards, and run 'dictzip' on the resulting '.dict' file to make it compact.
|
||||||
You can use the included 'transform' tool to convert already existing StarDict
|
|
||||||
dictionaries that are nearly good as they are. Remember that you can change
|
|
||||||
the `sametypesequence` of the resulting '.ifo' file to another format, or run
|
|
||||||
'dictzip' on '.dict' files to make them compact.
|
|
||||||
|
|
||||||
https://mega.co.nz/#!axtD0QRK!sbtBgizksyfkPqKvKEgr8GQ11rsWhtqyRgUUV0B7pwg[CZ <--> EN/DE/PL/RU dictionaries]
|
https://mega.co.nz/#!axtD0QRK!sbtBgizksyfkPqKvKEgr8GQ11rsWhtqyRgUUV0B7pwg[CZ <--> EN/DE/PL/RU dictionaries]
|
||||||
|
|
||||||
@ -71,10 +66,12 @@ Further Development
|
|||||||
-------------------
|
-------------------
|
||||||
While I've been successfully using 'sdtui' for many years now, some work has to
|
While I've been successfully using 'sdtui' for many years now, some work has to
|
||||||
be done yet before the software can be considered fit for inclusion in regular
|
be done yet before the software can be considered fit for inclusion in regular
|
||||||
Linux and/or BSD distributions:
|
Linux and/or BSD distributions.
|
||||||
|
|
||||||
- The tab bar and the text input field don't handle overflows well.
|
An approximate list of things that need to be resolved is as follows:
|
||||||
- Lacking configuration, standard StarDict locations should be scanned.
|
|
||||||
|
- the tab bar and the text input field don't handle overflows well,
|
||||||
|
- figure out a way to become capable of displaying most StarDict dictionaries.
|
||||||
|
|
||||||
Given the entangledness of this codebase, issues with the file format,
|
Given the entangledness of this codebase, issues with the file format,
|
||||||
and general undesirability of terminal UIs, it might be better to start anew.
|
and general undesirability of terminal UIs, it might be better to start anew.
|
||||||
|
24
src/sdtui.c
24
src/sdtui.c
@ -344,26 +344,6 @@ view_entry_split_add_pango (ViewEntry *ve, const gchar *markup)
|
|||||||
g_free (text);
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
view_entry_split_add_xdxf (ViewEntry *ve, const gchar *xml)
|
|
||||||
{
|
|
||||||
// Trivially filter out all tags we can't quite handle,
|
|
||||||
// then parse the reduced XML as Pango markup--this seems to work well.
|
|
||||||
// Given the nature of our display, also skip keyword elements.
|
|
||||||
GString *filtered = g_string_new ("");
|
|
||||||
while (*xml)
|
|
||||||
{
|
|
||||||
const gchar *p = NULL;
|
|
||||||
if (*xml != '<' || !*(p = xml + 1 + (xml[1] == '/'))
|
|
||||||
|| (strchr ("biu", *p) && p[1] == '>') || !(p = strchr (p, '>')))
|
|
||||||
g_string_append_c (filtered, *xml++);
|
|
||||||
else if (xml[1] != 'k' || xml[2] != '>' || !(xml = strstr (p, "</k>")))
|
|
||||||
xml = ++p;
|
|
||||||
}
|
|
||||||
view_entry_split_add_pango (ve, filtered->str);
|
|
||||||
g_string_free (filtered, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Decomposes a dictionary entry into the format we want.
|
/// Decomposes a dictionary entry into the format we want.
|
||||||
static ViewEntry *
|
static ViewEntry *
|
||||||
view_entry_new (StardictIterator *iterator)
|
view_entry_new (StardictIterator *iterator)
|
||||||
@ -392,10 +372,6 @@ view_entry_new (StardictIterator *iterator)
|
|||||||
view_entry_split_add_pango (ve, field->data);
|
view_entry_split_add_pango (ve, field->data);
|
||||||
found_anything_displayable = TRUE;
|
found_anything_displayable = TRUE;
|
||||||
break;
|
break;
|
||||||
case STARDICT_FIELD_XDXF:
|
|
||||||
view_entry_split_add_xdxf (ve, field->data);
|
|
||||||
found_anything_displayable = TRUE;
|
|
||||||
break;
|
|
||||||
case STARDICT_FIELD_PHONETIC:
|
case STARDICT_FIELD_PHONETIC:
|
||||||
g_string_append_printf (word, " /%s/", (const gchar *) field->data);
|
g_string_append_printf (word, " /%s/", (const gchar *) field->data);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user