Sha256: a7f3a08f9b01a5bfd9854a9f8183998cbcbd95fa325c0e10a8974c4e5495906c
Contents?: true
Size: 724 Bytes
Versions: 5
Compression:
Stored size: 724 Bytes
Contents
# encoding: UTF-8 require 'thor' class ClerqSrc < Thor include Thor::Actions namespace 'clerq:src'.to_sym desc 'docs', 'Prepare docs' def docs # to wrap all '{{}}' of README.md with `{% raw %} <> {% endraw %} text = File.read(SOURCE) SUBS.each{|patt, subs| text.scan(patt).uniq.each{|e| text.gsub!(e, subs.call(e))} } File.write(TARGET, text) say "'#{TARGET}' created!" end SOURCE = 'README.md' TARGET = 'docs/README.md' REX1, REX2 = /`{{[\s\S]*?}}`/, /```markdown[\s\S]*?```/ SUBS = {}.tap do |curly| curly[REX1] = lambda {|e| "{% raw %}#{e}{% endraw %}" } curly[REX2] = lambda {|e| "{% raw %}\n#{e}\n{% endraw %}" } end.freeze end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
clerq-0.3.4 | clerq.thor |
clerq-0.3.3 | clerq.thor |
clerq-0.3.2 | clerq.thor |
clerq-0.3.1 | clerq.thor |
clerq-0.3.0 | clerq.thor |