मैंने सभी विकी पृष्ठों और उनके संस्करणों को मार्कडाउन में बदलने के लिए एक रेक कार्य लिखा था।
lib/tasks/convert_textile_to_markdown.rake
में इस रखो:
task :convert_textile_to_markdown => :environment do
require 'tempfile'
WikiContent.all.each do |wiki|
([wiki] + wiki.versions).each do |version|
textile = version.text
src = Tempfile.new('textile')
src.write(textile)
src.close
dst = Tempfile.new('markdown')
dst.close
command = [
"pandoc",
"--no-wrap",
"--smart",
"--strict",
"-f",
"textile",
"-t",
"markdown",
src.path,
"-o",
dst.path,
]
system(*command) or raise "pandoc failed"
dst.open
markdown = dst.read
# remove the \ pandoc puts before * and > at begining of lines
markdown.gsub!(/^((\\[*>])+)/) { $1.gsub("\\", "") }
# add a blank line before lists
markdown.gsub!(/^([^*].*)\n\*/, "\\1\n\n*")
version.update_attribute(:text, markdown)
end
end
end
और चलाएँ:
bundle exec rake convert_textile_to_markdown RAILS_ENV=production
स्रोत
2013-11-09 12:36:03
कि पहली जगह में मेरे मन के लिए आया था, लेकिन मैं कबाल स्थापित मेरे CentOS 5 पर कबाल: स्थापित करने में विफल रहा है कि यह एक अगली बार कोशिश दे देंगे। – hSATAC
बस एक त्वरित नोट: यदि कोई [Redmine CKEditor] (http://www.redmine.org/plugins/redmine-ckeditor) प्लगइन का उपयोग करने के लिए होता है, तो [1.0.18] के बाद से सभी संस्करण (https: // github .com/a-ono/redmine_ckeditor/commit/383da5d60b2832757493cf65dc418c8ce2cff91C# diff-cb3e0f2c76a671c083e8f001970f4631) एक रेक कार्य शामिल करें जो स्रोत और लक्ष्य प्रारूप को निर्दिष्ट करने की अनुमति देता है। – ZaLiTHkA