Created
December 8, 2014 21:40
-
-
Save sideshowcoder/8e080cb866f535fc8564 to your computer and use it in GitHub Desktop.
OneNote to Text files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print OneNote to PDF | |
# Extract Text with | |
# http://www.extractpdf.com/ and name Main.txt | |
data = File.read "Main.txt" | |
data = data.split("\f") | |
data.each do |el| | |
next if el.empty? | |
title, *lines = el.split("\n") | |
next if title.nil? | |
filename = title.gsub(/[^0-9A-Za-z.\-]/, '_') | |
File.open("#{filename}.txt", "w") do |f| | |
contents = [title] + lines | |
contents = contents.join("\n") | |
f.puts contents | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment