mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-31 01:57:54 +00:00
chat-block-processor: create the helper functions
This commit is contained in:
parent
fc2aec087d
commit
6aed7fda1e
@ -1,5 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
def to_kebab_case string
|
||||
string.gsub(/\s+/, '-') # Replace all spaces with dashes.
|
||||
.gsub(/[^a-zA-Z0-9-]/, '') # Remove all non-alphanumerical (and dashes) characters.
|
||||
.gsub(/-+/, '-') # Reduce all dashes into only one.
|
||||
.gsub(/^-|-+$/, '') # Remove all leading and trailing dashes.
|
||||
.downcase
|
||||
end
|
||||
|
||||
class ChatBlock < Asciidoctor::Extensions::BlockProcessor
|
||||
use_dsl
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user