Skip to content

Commit

Permalink
Fixed googless macro nil sheet key bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarmstrong committed Nov 15, 2011
1 parent ee96df9 commit b452450
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/google_docs_macros.rb
Expand Up @@ -11,6 +11,7 @@ def self.googless_macro(googless_wiki_content, args, nohead=false)
key = escape_javascript(CGI.unescape(args[0]))


sheet = "0"
if args.length > 1
# check to see if the second argument is a sheet. Otherwise, continue
# assuming it's part of the query. @badidea
Expand All @@ -21,6 +22,8 @@ def self.googless_macro(googless_wiki_content, args, nohead=false)
rescue ArgumentError
querystart = 1
sheet = "0"
rescue
raise "Invalid sheet code"
end

# Queries can have commas in them, which the macro thinks are extra macro arguments.
Expand All @@ -34,6 +37,9 @@ def self.googless_macro(googless_wiki_content, args, nohead=false)

def self.render_spreadsheet(key, query, sheet="0", nohead=false)

if sheet.nil?
raise "Sheet is nil"
end
sheet = sheet.strip()

if nohead != "true"
Expand Down

0 comments on commit b452450

Please sign in to comment.