diff options
| author | Vincenzo Imperati <61617279+VincenzoImp@users.noreply.github.com> | 2025-12-27 18:04:08 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 14:04:08 -0300 |
| commit | fa9281af8b7c964542dd1145ba61a9fd851af713 (patch) | |
| tree | 3926219da67999671e4f58a2fb463e9de34f2eb9 | |
| parent | f5a15ea27e06ce8f5635117931f06318f532a713 (diff) | |
NIP-54: Fix d-tag normalization for non-Latin scripts (#2177)
| -rw-r--r-- | 54.md | 30 |
1 files changed, 23 insertions, 7 deletions
| @@ -8,7 +8,7 @@ Wiki | |||
| 8 | 8 | ||
| 9 | This NIP defines `kind:30818` (an _addressable event_) for descriptions (or encyclopedia entries) of particular subjects, and it's expected that multiple people will write articles about the exact same subjects, with either small variations or completely independent content. | 9 | This NIP defines `kind:30818` (an _addressable event_) for descriptions (or encyclopedia entries) of particular subjects, and it's expected that multiple people will write articles about the exact same subjects, with either small variations or completely independent content. |
| 10 | 10 | ||
| 11 | Articles are identified by lowercase, normalized ascii `d` tags. | 11 | Articles are identified by lowercase, normalized `d` tags. |
| 12 | 12 | ||
| 13 | ## Articles | 13 | ## Articles |
| 14 | ```json | 14 | ```json |
| @@ -16,15 +16,30 @@ Articles are identified by lowercase, normalized ascii `d` tags. | |||
| 16 | "content": "A wiki is a hypertext publication collaboratively edited and managed by its own audience.", | 16 | "content": "A wiki is a hypertext publication collaboratively edited and managed by its own audience.", |
| 17 | "tags": [ | 17 | "tags": [ |
| 18 | ["d", "wiki"], | 18 | ["d", "wiki"], |
| 19 | ["title", "Wiki"], | 19 | ["title", "Wiki"] |
| 20 | ] | 20 | ] |
| 21 | } | 21 | } |
| 22 | ``` | 22 | ``` |
| 23 | 23 | ||
| 24 | ## `d` tag normalization rules | 24 | ## `d` tag normalization rules |
| 25 | 25 | ||
| 26 | - Any non-letter character MUST be converted to a `-`. | 26 | - All letters with uppercase/lowercase variants MUST be converted to lowercase. |
| 27 | - All letters MUST be converted to lowercase. | 27 | - Whitespace MUST be converted to `-`. |
| 28 | - Punctuation and symbols SHOULD be removed. | ||
| 29 | - Multiple consecutive `-` SHOULD be collapsed to a single `-`. | ||
| 30 | - Leading and trailing `-` SHOULD be removed. | ||
| 31 | - Non-ASCII letters (e.g., Japanese, Chinese, Arabic, Cyrillic) MUST be preserved as UTF-8. | ||
| 32 | - Numbers MUST be preserved. | ||
| 33 | |||
| 34 | For example: | ||
| 35 | - `"Wiki Article"` → `"wiki-article"` | ||
| 36 | - `"What's Up?"` → `"whats-up"` | ||
| 37 | - `" Hello World "` → `"hello-world"` | ||
| 38 | - `"Article 1"` → `"article-1"` | ||
| 39 | - `"ウィキペディア"` → `"ウィキペディア"` (Japanese, no case change) | ||
| 40 | - `"Ñoño"` → `"ñoño"` (Spanish, lowercased) | ||
| 41 | - `"Москва"` → `"москва"` (Russian, lowercased) | ||
| 42 | - `"日本語 Article"` → `"日本語-article"` (mixed scripts) | ||
| 28 | 43 | ||
| 29 | ## Content | 44 | ## Content |
| 30 | 45 | ||
| @@ -32,10 +47,11 @@ The `content` should be Asciidoc with two extra functionalities: **wikilinks** a | |||
| 32 | 47 | ||
| 33 | Unlike normal Asciidoc links `http://example.com[]` that link to external webpages, wikilinks `[[]]` link to other articles in the wiki. In this case, the wiki is the entirety of Nostr. Clicking on a wikilink should cause the client to ask relays for events with `d` tags equal to the target of that wikilink. | 48 | Unlike normal Asciidoc links `http://example.com[]` that link to external webpages, wikilinks `[[]]` link to other articles in the wiki. In this case, the wiki is the entirety of Nostr. Clicking on a wikilink should cause the client to ask relays for events with `d` tags equal to the target of that wikilink. |
| 34 | 49 | ||
| 35 | Wikilinks can take these two forms: | 50 | Wikilinks can take these forms: |
| 36 | 51 | ||
| 37 | 1. `[[Target Page]]` -- in this case it will link to the page `target-page` (according to `d` tag normalization rules above) and be displayed as `Target Page`; | 52 | 1. `[[Target Page]]` -- links to `target-page` and displays as `Target Page`; |
| 38 | 2. `[[target page|see this]]` -- in this case it will link to the page `target-page`, but will be displayed as `see this`. | 53 | 2. `[[target page|see this]]` -- links to `target-page` but displays as `see this`; |
| 54 | 3. `[[日本語 Topic|Japanese Topic]]` -- links to `日本語-topic` and displays as `Japanese Topic`. | ||
| 39 | 55 | ||
| 40 | `nostr:...` links, as per [NIP-21](21.md), should link to profiles or arbitrary Nostr events. Although it is not recommended to link to specific versions of articles -- instead the _wikilink_ syntax should be preferred, since it should be left to the reader and their client to decide what version of any given article they want to read. | 56 | `nostr:...` links, as per [NIP-21](21.md), should link to profiles or arbitrary Nostr events. Although it is not recommended to link to specific versions of articles -- instead the _wikilink_ syntax should be preferred, since it should be left to the reader and their client to decide what version of any given article they want to read. |
| 41 | 57 | ||