Przejdź do treści
Biblioteka skilli
Programowanie · Nauka i wyjaśnianie

multiglossar-replacement-engine

/multiglossar-replacement-engine

Wyjaśnia wnętrze silnika zastąpień MultiGlossar: hook OUTPUT_FILTER w boot.php, parser, parsowanie DOMDocument, dopasowanie regex, szablony definicji i przestrzenie nazw URL, przy debugowaniu brakujących zastąpień.

Licencja
MIT
Ostatnia zmiana repozytorium
20.09.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
2
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 20.09.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co sprawdzić przed instalacją
  • SKILL.md zawiera komentarze HTML (2). Nie widać ich w podglądzie Markdown, a model je czyta.

Co robi i kiedy

Wyjaśnia wnętrze silnika zastąpień MultiGlossar: hook OUTPUT_FILTER w boot.php, parser, parsowanie DOMDocument, dopasowanie regex, szablony definicji i przestrzenie nazw URL, przy debugowaniu brakujących zastąpień.

Oryginalny opis (EN)

MultiGlossar replacement engine internals - boot.php OUTPUT_FILTER hook, the (internal) MultiGlossar\\Parser in lib/glossar/multiglossar.php, DOMDocument parsing, text_replace regex matching, replace_definition template placeholders, and URL namespace resolution via Url\\Profile/url_generator_profile. Stable integration is via OUTPUT_FILTER and the addon config — Parser is not a public API. Use when the user debugs missing replacements, broken tooltip HTML, URL addon integration, or replacement performance.

Jak działa

  1. Runtime flow
  2. Parser and DOM behavior
  3. Matching logic
  4. Output template placeholders
  5. URL addon integration
  6. UIkit tooltip normalization
  7. Common pitfalls
Sekcje z nagłówków SKILL.md, w oryginale · 68 linii, 424 słów
Podgląd SKILL.md
---
name: multiglossar-replacement-engine
description: MultiGlossar replacement engine internals - boot.php OUTPUT_FILTER hook, the (internal) MultiGlossar\\Parser in lib/glossar/multiglossar.php, DOMDocument parsing, text_replace regex matching, replace_definition template placeholders, and URL namespace resolution via Url\\Profile/url_generator_profile. Stable integration is via OUTPUT_FILTER and the addon config — Parser is not a public API. Use when the user debugs missing replacements, broken tooltip HTML, URL addon integration, or replacement performance.
---

# MultiGlossar Replacement Engine

Frontend replacement is executed in `boot.php` via `rex_extension::register('OUTPUT_FILTER', ...)` and delegated to `MultiGlossar\\Parser` (`lib/glossar/multiglossar.php`).

## Runtime flow

1. `OUTPUT_FILTER` receives the rendered page HTML.
2. MultiGlossar checks exclusion rules (error article, excluded IDs/templates/meta condition).
3. Optional cache read happens before parsing.
4. Parser initializes DOM and glossary data for current `clang_id`.
5. Text nodes are traversed and terms are replaced with configured output HTML.
6. Header/footer and exclude markers are restored.

This architecture avoids raw global string replacement and limits changes to parsed text nodes.

## Parser and DOM behavior

> `MultiGlossar\Parser` is **internal**. Don't construct or call it from your own code — the stable integration points are the `OUTPUT_FILTER` hook (which the addon already registers) and the addon's config. The methods below are documented so you can read along when debugging, not as an API to invoke.

Key parser methods:

- `init_dom($source)` - detects configured start/end scope, loads glossary rows, initializes ignored tags/classes
- `parse_dom()` - traverses the DOM and rebuilds final output
- `parse_childs($node)` - recursive node walk with lock checks
- `text_replace($content)` - regex-based term matching and replacement token strategy

`<!--exclude-->...<!--endexclude-->` comment pairs are transformed into temporary elements and excluded from matching.

## Matching logic

Replacement behavior includes:

- aliases from `term_alt` are additional searchable markers
- optional case-sensitive matching (`casesensitive`)
- per-term replacement control: usually first match only, except for configured `article_complete` IDs where all matches are replaced
- word-boundary regex matching (`\\b...\\b`) to reduce accidental substring hits

## Output template placeholders

Replacement markup is driven by config `replace_definition`. Supported placeholders include:

- `---DEFINITION---`, `---URL---`, `---TERM---` (escaped variants)
- `---DEFINITION_RAW---`, `---URL_RAW---`, `---TERM_RAW---` (raw variants)

This enables custom tooltip/link markup without touching PHP code.

## URL addon integration

`resolveUrlKey()` resolves the query key/namespace for glossary detail URLs:

- default fallback: `gloss_id_<clangId>`
- if URL addon is available, namespace is resolved from `Url\\Profile` or `rex_url_generator_profile`

This is important when URL profiles rewrite parameter names.

## UIkit tooltip normalization

The parser normalizes certain UIkit tooltip patterns so configured output remains valid with dynamic definitions (for example converting direct `data-uk-tooltip` usage to a `uk-tooltip="title: ..."` format when needed).

## Common pitfalls

- Running replacements against raw HTML with custom code instead of using parser hooks, causing broken markup in attributes/tags.
- Using raw placeholders in output without escaping when values come from editor content.
- Forgetting URL namespace/profile handling, resulting in broken glossary detail links.
- Expecting replacements inside ignored elements (`a`, headings, `script`, `style`, configured classes/tags).
- Debugging only with one language while issues are actually `clang_id` specific.

Wersje

W bazie nie ma innych skilli o nazwie multiglossar-replacement-engine.

Migawka bazy z 13.11.2026 · wersja paczki 1c7b5d92f310 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100multiglossar-configuration-exclusions
    Konfiguruje reguły i wyłączenia MultiGlossar: wybór zakresu przez znaczniki, ignorowane tagi i klasy, wyłączenia artykułów i szablonów, opcje cache i turbocache oraz mapowanie artykułów glosariusza do domen yrewrite.
  • 90multiglossar-content-management
    Zarządza hasłami i aliasami w backendzie MultiGlossar, aktywuje je, obsługuje języki i uprawnienia edytorów.
  • 100wp-html-api
    Używa HTML API WordPressa do strukturalnej inspekcji i zmiany HTML po stronie serwera zamiast regexów i DOMDocument: WP_HTML_Tag_Processor, WP_HTML_Processor, atrybuty, klasy i modyfikowalny tekst.
  • 100regex-master
    Buduje, wyjaśnia i debuguje wyrażenia regularne do dopasowywania wzorców, walidacji formatów i wydobywania danych z tekstu.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.