Permalink
Browse files

Quick bugfixes tag-extract

  • Loading branch information...
1 parent d94bbb4 commit 157ec6dbd2e79eeef05e1ea7bae63819442c6b10 @houshuang committed Apr 27, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 tag-extract.rb
View
@@ -2,7 +2,7 @@
$:.push(File.dirname($0))
require 'utility-functions'
-unless ARGV.size == 3
+unless ARGV.size >= 2
puts "Usage: ruby taskpaper-extract.rb <scrivener|taskpaper> <infile> [outfile]\n
For example: ruby taskpaper-extract.rb scrivener litreview.taskpaper litreview
(Scrivener outputs to a directory, with each tag in a separate textfile, taskpaper to a single hierarchical textfile)
@@ -97,12 +97,11 @@
end
outdir = ARGV[2]
-outdir ||= ARGV[0].remove(".taskpaper)") + ".out"
+outdir ||= ARGV[1].remove(".taskpaper") + ".out"
if ARGV[0] == 'scrivener'
- outdir = 'litreview'
- `mkdir #{outdir}`
- `rm -rf #{outdir}/*.txt`
+ `mkdir '#{outdir}'`
+ `rm -rf '#{outdir}/*.txt'`
tags.each do |tag, content|
out = ''
@@ -122,9 +121,11 @@
else #Taskpaper
outdir = outdir + ".taskpaper" unless outdir.index(".taskpaper")
+ out = ''
tags.each do |tag, content|
nockey = ''
+
out << "#{tag}:\n"
content.each do |fragments|

0 comments on commit 157ec6d

Please sign in to comment.