From b4524501a006518313f6f303bf3e7d3e1d1d60bd Mon Sep 17 00:00:00 2001 From: Tavish Armstrong Date: Tue, 15 Nov 2011 15:38:04 -0500 Subject: [PATCH] Fixed googless macro nil sheet key bug. --- lib/google_docs_macros.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/google_docs_macros.rb b/lib/google_docs_macros.rb index aafcb9d..c38be51 100644 --- a/lib/google_docs_macros.rb +++ b/lib/google_docs_macros.rb @@ -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 @@ -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. @@ -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"