From aaa6256e09fe0ee2f71af55ab03c2ef575626682 Mon Sep 17 00:00:00 2001 From: Alex Kotov Date: Fri, 18 Oct 2024 00:04:34 +0400 Subject: [PATCH] Allow Unicode slugs --- examples/full.chapters.json | 2 +- examples/full.html | 2 +- examples/full.repub | 2 +- lib/repubmark.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/full.chapters.json b/examples/full.chapters.json index c1fdff8..1123d13 100644 --- a/examples/full.chapters.json +++ b/examples/full.chapters.json @@ -7,7 +7,7 @@ ] }, { - "slug": "2", + "slug": "2-юникод", "title": "Chapter 2", "chapters": [ diff --git a/examples/full.html b/examples/full.html index 1192053..78c5109 100644 --- a/examples/full.html +++ b/examples/full.html @@ -69,7 +69,7 @@ The Rty Chapter 1 paragraph text

-

Chapter 2

+

Chapter 2

Chapter 2 paragraph text diff --git a/examples/full.repub b/examples/full.repub index c4f91d4..dc27595 100644 --- a/examples/full.repub +++ b/examples/full.repub @@ -41,7 +41,7 @@ end -article.chapter '2', 'Chapter 2' do |chapter| +article.chapter '2-юникод', 'Chapter 2' do |chapter| chapter.paragraph do |paragraph| paragraph.text 'Chapter 2 paragraph text' end diff --git a/lib/repubmark.rb b/lib/repubmark.rb index 8f79d5b..0a5f568 100644 --- a/lib/repubmark.rb +++ b/lib/repubmark.rb @@ -66,7 +66,7 @@ require_relative 'repubmark/elems/footnote' module Repubmark FORMATS = %i[chapters gemtext html summary_plain word_count].freeze - SLUG_RE = /\A\w+(-\w+)*\z/ + SLUG_RE = /\A[[:word:]]+(-[[:word:]]+)*\z/ UNICODE_SUPS = { '0' => '⁰',