Author: wfarner
Date: Sat Dec 12 03:19:40 2015
New Revision: 1719622
URL: http://svn.apache.org/viewvc?rev=1719622&view=rev
Log:
Clean up regex hack code.
Modified:
aurora/site/Rakefile
Modified: aurora/site/Rakefile
URL:
http://svn.apache.org/viewvc/aurora/site/Rakefile?rev=1719622&r1=1719621&r2=1719622&view=diff
==============================================================================
--- aurora/site/Rakefile (original)
+++ aurora/site/Rakefile Sat Dec 12 03:19:40 2015
@@ -38,24 +38,17 @@ task :update_docs do
Dir.glob('*.md').each { |doc|
puts "working on: #{doc}"
- # Hack to rewrite links to '../CONTRIBUTING.md'.
+ # Hacks to make markdown intended for GitHub work.
IO.write(doc, File.open(doc, :encoding => 'utf-8') { |f|
- f.read.gsub(/\.\.\/CONTRIBUTING\.md/, 'contributing/')
- })
-
- # Hack to rewrite links pointing to source files in the repository.
- IO.write(doc, File.open(doc, :encoding => 'utf-8') { |f|
- f.read.gsub(/\]\(\.\.\/([^\)]+\))/,
'](https://github.com/apache/aurora/blob/master/\1)')
- })
-
- IO.write(doc, File.open(doc, :encoding => 'utf-8') { |f|
- f.read.gsub(/\(([A-Za-z0-9-]+)\.md(#[^\)]+)?\)/,
'(/documentation/latest/\1/\2)')
- })
-
- # Hack to fix anchor links and names, which GitHub prefixes with
'user-content-'
- # See AURORA-726.
- IO.write(doc, File.open(doc, :encoding => 'utf-8') { |f|
- f.read.gsub(/#user-content\-/, '#')
+ f.read.
+ # Rewrite links to '../CONTRIBUTING.md'.
+ gsub(/\.\.\/CONTRIBUTING\.md/, 'contributing/').
+ # Rewrite links pointing to source files in the repository.
+ gsub(/\]\(\.\.\/([^\)]+\))/,
'](https://github.com/apache/aurora/blob/master/\1)').
+ gsub(/\(([A-Za-z0-9-]+)\.md(#[^\)]+)?\)/,
'(/documentation/latest/\1/\2)').
+ # Fix anchor links and names, which GitHub prefixes with
'user-content-'
+ # See AURORA-726.
+ gsub(/#user-content\-/, '#')
})
}
}