]> pere.pagekite.me Git - text-madewithcc.git/blob - fixup.rb
728b4f0bb491edcd397bcf31ee6adb4571255961
[text-madewithcc.git] / fixup.rb
1 #!/usr/bin/ruby
2 # coding: utf-8
3 raise ArgumentError, 'Source file not specified' if ARGV.size != 2
4 srcfile = ARGV[0]
5 dstfile = ARGV[1]
6
7 data=File.open(srcfile).readlines.map {|l| l.chomp!}
8
9 data.map {|lin| lin.gsub!(/<span id="anchor-?\d*"><\/span>/, '')}
10
11 # Join erroneously split paragraphs
12 ['At a minimum, a CC-',
13 'easier to trust a',
14 'free download, the',
15 'openness to fans remixing the game—give',
16 'Attribution-',
17 'both journal publishers and researchers. Figshare now provides',
18 'get the “network effect”—',
19 'access to scholarly books. For Frances, the current scholarly-',
20 'for-',
21 'sales',
22 'contributing to the open',
23 'doesn’t seem like it should be sung about',
24 'songwriter, and he has found a way to keep it interesting for',
25 'building trust is the top',
26 'license',
27 'authors and Shuttleworth; Mark remains incredibly proud of this',
28 'BY-SA and opting in others with collecting societies like',
29 'Cecilie Maria, Cedric Howe, Cefn Hoile,',
30 'Braddlee, Drew Spencer, Duncan',
31 'Elizabeth Holloway, Ellen Buecher, Ellen Kaye-',
32 'Helen',
33 ].each do |line|
34 at = data.index {|i| i == line}
35 if !at.nil? and data[at+1] == ''
36 data.delete_at(at+1)
37 end
38 end
39
40 File.open(dstfile, 'w') {|f| f.puts data.join("\n")}