From 1d12b88b09282aa0b360da52f24d709aea86f23b Mon Sep 17 00:00:00 2001 From: Daniel Felder Date: Thu, 5 Jun 2014 18:00:07 +0200 Subject: [PATCH] Ignore commented lines when setting root doc #52 Same code I used in public/coffee/pdf/CompiledView.coffee. I didn't test it locally though. --- .../app/coffee/Features/Project/ProjectRootDocManager.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Project/ProjectRootDocManager.coffee b/services/web/app/coffee/Features/Project/ProjectRootDocManager.coffee index 80f2c70eb3..1c8202ac71 100644 --- a/services/web/app/coffee/Features/Project/ProjectRootDocManager.coffee +++ b/services/web/app/coffee/Features/Project/ProjectRootDocManager.coffee @@ -10,7 +10,8 @@ module.exports = ProjectRootDocManager = root_doc_id = null for path, doc of docs for line in doc.lines || [] - if Path.extname(path).match(/\.R?tex$/) and line.match(/\\documentclass/) + match = line.match /(.*)\\documentclass/ # no lookbehind in js regexp :( + if Path.extname(path).match(/\.R?tex$/) and match and !match[1].match /%/ root_doc_id = doc._id if root_doc_id? ProjectEntityHandler.setRootDoc project_id, root_doc_id, sl_req_id, callback