mirror of
https://github.com/foo-dogsquared/asciidoctor-foodogsquared-extensions.git
synced 2025-01-30 22:57:56 +00:00
Create a helper file for the Asciidoctor extension
This commit is contained in:
parent
809f08e382
commit
86a1afa512
@ -2,6 +2,9 @@
|
||||
|
||||
require 'asciidoctor'
|
||||
require 'asciidoctor/extensions'
|
||||
|
||||
require_relative 'helpers'
|
||||
|
||||
require_relative 'man-inline-macro/extension'
|
||||
require_relative 'swhid-inline-macro/extension'
|
||||
require_relative 'swhid-include-processor/extension'
|
||||
|
10
lib/asciidoctor/helpers.rb
Normal file
10
lib/asciidoctor/helpers.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Code copied from https://gist.github.com/komasaru/b3f22d5bcb8555deea1707b84d294045.
|
||||
class String
|
||||
def to_snake
|
||||
self.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
||||
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
||||
.downcase
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user