Sha256: be772cfe68f255457ad569a0917f8790b4bbb6d361a1eacb697ea7f291590017

Contents?: true

Size: 1.35 KB

Versions: 20

Compression:

Stored size: 1.35 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

input = IO.read('doing.rdoc')

input.gsub!(/^===== Options/, "##### Options\n\n")
input.gsub!(/^=== Commands/, "## Commands\n")
input.gsub!(/(?<=\n)===== (.*?)\n+((.|\n)+?)(?=\n=|$)/s) do
  m = Regexp.last_match
  "`#{m[1]}`\n: #{m[2].gsub(/\|/, '\\|')}"
end
input.gsub!(/^==== Command: <tt>(.*?) ( .*?)?<\/tt>\n(.*?)$/) do
  m = Regexp.last_match
  r = "### #{m[1].sub(/\|(.*?)$/, ' (*or* \1)')}"
  r += " #{m[2]}" if m[2]
  r += " {##{m[1].gsub(/\|.*?$/, '')}}\n\n"
  "#{r}**#{m[3]}**{:.description}\n"
end

input.gsub!(/^=== Global Options/, "## Global Options\n")
input.gsub!(/^=== (.*?)\n+(.*?)$/) do
  m = Regexp.last_match
  "`#{m[1]}`\n: #{m[2].gsub(/\|/, '\\|')}"
end
input.gsub!(/^== (.*?) - (.*?)$\n\n(.*?)$/, "**\\1: \\2**\n\n*\\3*\n\n## Table of Contents\n{:.no_toc}\n\n* Table of Contents\n{:toc}")
input.gsub!(/^\[(Default Value|Must Match)\] (.*?)$/, ': *\1:* `\2`')
input.gsub!(/\n  (?=\S)/, ' ')
input.gsub!(/^([^:`\n#*](.*?))$/, "\\1\n")
input.gsub!(/\n{3,}/, "\n\n")
input.gsub!(/^(: .*?)\n\n(:.*?)$/, "\\1\n\\2")
input.gsub!(/^\[Default Command\] (.*?)$/, '## Default Command: [`\1`](#\1)')
input.gsub!(/\/Users\/ttscoff\/scripts\/editor.sh/, '$EDITOR')
input.gsub!(/\/Users\/ttscoff/, '~')
puts %(---
layout: page
title: "Doing - All Commands"
comments: false
footer: true
body_id: doingcommands
---
)
puts input

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
doing-2.0.24 rdoc_to_mmd.rb
doing-2.0.23 rdoc_to_mmd.rb
doing-2.0.22 rdoc_to_mmd.rb
doing-2.0.21 rdoc_to_mmd.rb
doing-2.0.20 rdoc_to_mmd.rb
doing-2.0.19 rdoc_to_mmd.rb
doing-2.0.18 rdoc_to_mmd.rb
doing-2.0.17 rdoc_to_mmd.rb
doing-2.0.16 rdoc_to_mmd.rb
doing-2.0.15 rdoc_to_mmd.rb
doing-2.0.13 rdoc_to_mmd.rb
doing-2.0.11 rdoc_to_mmd.rb
doing-2.0.10 rdoc_to_mmd.rb
doing-2.0.9.pre rdoc_to_mmd.rb
doing-2.0.8.pre rdoc_to_mmd.rb
doing-2.0.7.pre rdoc_to_mmd.rb
doing-2.0.6.pre rdoc_to_mmd.rb
doing-2.0.5.pre rdoc_to_mmd.rb
doing-2.0.3.pre rdoc_to_mmd.rb
doing-2.0.2.pre rdoc_to_mmd.rb