|
@@ -181,56 +181,6 @@ task :autofix do
|
|
|
"[[#{link}]#{link_mods}]"
|
|
|
end
|
|
|
end
|
|
|
-=begin
|
|
|
- .map do |link|
|
|
|
- case link.scan('->').length
|
|
|
- when 0
|
|
|
- #link contains no ->, probably not a problem
|
|
|
- text = dest = link
|
|
|
- passages[title][:outbound_links] << \
|
|
|
- { passage: dest, source_line: "#{file.source_file}:#{lineno}" }
|
|
|
- when 1
|
|
|
- # no problem
|
|
|
- text, dest = link.split('->')
|
|
|
- passages[title][:outbound_links] << \
|
|
|
- { passage: dest, source_line: "#{file.source_file}:#{lineno}" }
|
|
|
- else
|
|
|
- puts "#{file.source_file}:#{lineno} link contains multiple -> definitely a problem".colorize(:red)
|
|
|
- next
|
|
|
- end
|
|
|
- if text.start_with?('\'')
|
|
|
- if !text.end_with?('\'')
|
|
|
- puts "#{file.source_file}:#{lineno} link text (#{text.inspect}) does not end with single quote despite starting with one".colorize(:red)
|
|
|
- next
|
|
|
- end
|
|
|
- text = text[1..-2]
|
|
|
- text
|
|
|
- .to_enum(:scan, '\'')
|
|
|
- .map {Regexp.last_match.offset(0)[0]}
|
|
|
- .each do |offset|
|
|
|
- if text[offset - 1] != '\\'
|
|
|
- puts "#{file.source_file}:#{lineno} link text (#{text.inspect}) contains unquoted single quote in body".colorize(:red)
|
|
|
- end
|
|
|
- end
|
|
|
- elsif text.start_with?('"')
|
|
|
- if !text.end_with?('"')
|
|
|
- puts "#{file.source_file}:#{lineno} link text (#{text.inspect}) does not end with double quote despite starting with one".colorize(:red)
|
|
|
- next
|
|
|
- end
|
|
|
- text = text[1..-2]
|
|
|
- text
|
|
|
- .to_enum(:scan, '"')
|
|
|
- .map {Regexp.last_match.offset(0)[0]}
|
|
|
- .each do |offset|
|
|
|
- if text[offset - 1] != '\\'
|
|
|
- puts "#{file.source_file}:#{lineno} link text (#{text.inspect}) contains unquoted double quote in body".colorize(:red)
|
|
|
- end
|
|
|
- end
|
|
|
- elsif text =~ /\A[\[\]'"\\]*\z/
|
|
|
- puts "#{file.source_file}:#{lineno} link text (#{text.inspect}) contains special characters but is not quoted with single or double quotes".colorize(:red)
|
|
|
- end
|
|
|
- end
|
|
|
-=end
|
|
|
end.join("\n") + "\n"
|
|
|
File.write(file.source_file, twee_source)
|
|
|
end
|