{"id":5723,"date":"2012-08-16T21:29:00","date_gmt":"2012-08-17T02:29:00","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=5723"},"modified":"2012-08-16T21:29:02","modified_gmt":"2012-08-17T02:29:02","slug":"injection-grammars-project-variables","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2012\/08\/16\/injection-grammars-project-variables\/","title":{"rendered":"Injection Grammars &#038; Project Variables"},"content":{"rendered":"<p><a href=\"http:\/\/blog.macromates.com\/2012\/injection-grammars-project-variables\/\">Allan Odgaard<\/a>:<\/p>\n<blockquote cite=\"http:\/\/blog.macromates.com\/2012\/injection-grammars-project-variables\/\"><p>We could modify this command to support the special <code>issue<\/code> scheme, but that is not elegant. Instead we make a minor but important change to the injection grammar from above. We change the <code>name<\/code> key to <code>markup.underline.link.$2.hyperlink<\/code>. What we did was add <code>$2<\/code> which is the second capture from the regular expression, namely the URL scheme (more about <a href=\"http:\/\/blog.macromates.com\/2011\/format-strings\/\">syntax allowed in format strings<\/a>).<\/p>\n<p>[&#8230;]<\/p>\n<p>What&rsquo;s great about this is that we can now create a new command, still using enter as key equivalent, but using a more specific <a href=\"http:\/\/manual.macromates.com\/en\/scope_selectors\">scope selector<\/a> so that it only targets <code>issue<\/code> links.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Allan Odgaard: We could modify this command to support the special issue scheme, but that is not elegant. Instead we make a minor but important change to the injection grammar from above. We change the name key to markup.underline.link.$2.hyperlink. What we did was add $2 which is the second capture from the regular expression, namely [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-5723","post","type-post","status-publish","format-standard","hentry","category-technology"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=5723"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5723\/revisions"}],"predecessor-version":[{"id":5725,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/5723\/revisions\/5725"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=5723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=5723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=5723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}