Permalink
Browse files

Fix tools.

  • Loading branch information...
SaberUK committed Oct 3, 2012
1 parent fd7d6bc commit 9aadf850aed1c5555a16e77b0a79464cdd5f0d6a
Showing with 10 additions and 10 deletions.
  1. +4 −5 _tools/find-missing-pages
  2. +6 −5 _tools/find-orphaned-pages
@@ -2,11 +2,10 @@
require 'uri'
available_files = Dir.glob("**/*.md")
available_files.each do |file|
- uris = URI.extract(File.read(file))
- uris.each do |uri|
- next unless uri[0..44] == 'https://github.com/inspircd/wiki/blob/master/'
- path = uri[45..-1].split(')')[0]
+ pages = File.read(file).scan(/\(\/wiki\/(\S+)\.html\)/)
+ pages.each do |page|
+ path = "#{page[0]}.md"
next if File.exists?(path)
puts "MISSING PAGE: #{path} (linked from #{file})"
end
-end
+end
View
@@ -3,13 +3,14 @@ require 'uri'
available_files = Dir.glob("**/*.md")
linked_files = []
available_files.each do |file|
- uris = URI.extract(File.read(file))
- uris.each do |uri|
- next unless uri[0..44] == 'https://github.com/inspircd/wiki/blob/master/'
- linked_files << uri[45..-1].split(')')[0]
+ next if file[0] == '_'
+ pages = File.read(file).scan(/\(\/wiki\/(\S+)\.html\)/)
+ pages.each do |page|
+ linked_files << "#{page[0]}.md"
end
end
available_files.each do |file|
+ next if file[0] == '_'
next if linked_files.include?(file)
puts "ORPHANED PAGE: #{file}"
-end
+end

0 comments on commit 9aadf85

Please sign in to comment.