porting
Porting old wiki docs to GitHub wiki
If you have TextMate (or don’t mind some Ruby hacking), the following script will help transfer the exported HTML docs to textile format.- The script requires the ClothRed gem
- For easy use, make it a command in the TextMate HTML bundle and assign it a hot-key
#!/usr/bin/env ruby
require 'rubygems'
require 'clothred'
text = ClothRed.new(STDIN.read)
text = text.to_textile
text.sub!(/^.*?<\body.*?>\s*/im, '').sub!(/\s*<\/body>.*?$/im,'')
text.gsub!(/^\s*p\.\s/, "\n")
text.gsub!(/<\pre>@/,'<\pre><\code class="javascript">')
text.gsub!(/@<\/pre>/,"<\/code><\/pre>")
text.gsub!(/(\n\s*){2}(\n\s*)+/m,"\n\n")
text.gsub!(/(.*?)<\/a>/) {|s|
$1 == $2 ? "["+"[#{$1}]]" : "["+"[#{$1}|#{$2}]]"
}
print text
Last edited by tag, 4 months ago
Versions:
