From cb4ba55a5877ef28b2eb64c5ddc71c14db0d34f2 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Fri, 13 Dec 2024 17:36:05 +0330 Subject: [PATCH] move last 2 sections of README.md to doc/internals.md --- README.md | 37 +++---------------------------------- doc/internals.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 34 deletions(-) create mode 100644 doc/internals.md diff --git a/README.md b/README.md index dea23f1cd..e398d15d9 100644 --- a/README.md +++ b/README.md @@ -268,7 +268,7 @@ you can place it in this directory: - Mac: `~/Library/Preferences/PyGlossary/plugins/` - Windows: `C:\Users\USERNAME\AppData\Roaming\PyGlossary\plugins\` -## Linux Packaging status +## Linux packaging status [![Packaging status](https://repology.org/badge/vertical-allrepos/pyglossary.svg?columns=3&header=PyGlossary)](https://repology.org/project/pyglossary/versions) @@ -276,37 +276,6 @@ you can place it in this directory: See [doc/lib-usage.md](./doc/lib-usage.md) for how to use PyGlossary as a Python library. -## Internal glossary structure +## Internals -A glossary contains a number of entries. - -Each entry contains: - -- Headword (title or main phrase for lookup) -- Alternates (some alternative phrases for lookup) -- Definition - -In PyGlossary, headword and alternates together are accessible as a single Python list `entry.l_word` - -`entry.defi` is the definition as a Python Unicode `str`. Also `entry.b_defi` is definition in UTF-8 byte array. - -`entry.defiFormat` is definition format. If definition is plaintext (not rich text), the value is `m`. And if it's in HTML (contains any html tag), then `defiFormat` is `h`. The value `x` is also allowed for XFXF, but XDXF is not widely supported in dictionary applications. - -There is another type of entry which is called **Data Entry**, and generally contains an image, audio, css, or any other file that was included in input glossary. For data entries: - -- `entry.s_word` is file name (and `l_word` is still a list containing this string), -- `entry.defiFormat` is `b` -- `entry.data` gives the content of file in `bytes`. - -## Entry filters - -Entry filters are internal objects that modify words/definition of entries, -or remove entries (in some special cases). - -Like several filters in a pipe which connects a `reader` object to a `writer` object -(with both of their classes defined in plugins and instantiated in `Glossary` class). - -You can enable/disable some of these filters using config parameters / command like flags, which -are documented in [doc/config.rst](./doc/config.rst). - -The full list of entry filters is also documented in [doc/entry-filters.md](./doc/entry-filters.md). +See [doc/internals.md](./doc/internals.md) for information about internal glossary structure and entry filters. diff --git a/doc/internals.md b/doc/internals.md new file mode 100644 index 000000000..094d029a6 --- /dev/null +++ b/doc/internals.md @@ -0,0 +1,34 @@ +## Internal glossary structure + +A glossary contains a number of entries. + +Each entry contains: + +- Headword (title or main phrase for lookup) +- Alternates (some alternative phrases for lookup) +- Definition + +In PyGlossary, headword and alternates together are accessible as a single Python list `entry.l_word` + +`entry.defi` is the definition as a Python Unicode `str`. Also `entry.b_defi` is definition in UTF-8 byte array. + +`entry.defiFormat` is definition format. If definition is plaintext (not rich text), the value is `m`. And if it's in HTML (contains any html tag), then `defiFormat` is `h`. The value `x` is also allowed for XFXF, but XDXF is not widely supported in dictionary applications. + +There is another type of entry which is called **Data Entry**, and generally contains an image, audio, css, or any other file that was included in input glossary. For data entries: + +- `entry.s_word` is file name (and `l_word` is still a list containing this string), +- `entry.defiFormat` is `b` +- `entry.data` gives the content of file in `bytes`. + +## Entry filters + +Entry filters are internal objects that modify words/definition of entries, +or remove entries (in some special cases). + +Like several filters in a pipe which connects a `reader` object to a `writer` object +(with both of their classes defined in plugins and instantiated in `Glossary` class). + +You can enable/disable some of these filters using config parameters / command like flags, which +are documented in [doc/config.rst](./doc/config.rst). + +The full list of entry filters is also documented in [doc/entry-filters.md](./doc/entry-filters.md).