{"action":"created","issue":{"url":"https://api.github.com/repos/Aratramba/pug-code-block/issues/7","repository_url":"https://api.github.com/repos/Aratramba/pug-code-block","labels_url":"https://api.github.com/repos/Aratramba/pug-code-block/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/Aratramba/pug-code-block/issues/7/comments","events_url":"https://api.github.com/repos/Aratramba/pug-code-block/issues/7/events","html_url":"https://github.com/Aratramba/pug-code-block/issues/7","id":133855166,"number":7,"title":"Doesn't work with non-syntactic indentation","user":{"login":"TimothyGu","id":1538624,"avatar_url":"https://avatars.githubusercontent.com/u/1538624?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyGu","html_url":"https://github.com/TimothyGu","followers_url":"https://api.github.com/users/TimothyGu/followers","following_url":"https://api.github.com/users/TimothyGu/following{/other_user}","gists_url":"https://api.github.com/users/TimothyGu/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyGu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyGu/subscriptions","organizations_url":"https://api.github.com/users/TimothyGu/orgs","repos_url":"https://api.github.com/users/TimothyGu/repos","events_url":"https://api.github.com/users/TimothyGu/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyGu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"Aratramba","id":580312,"avatar_url":"https://avatars.githubusercontent.com/u/580312?v=3","gravatar_id":"","url":"https://api.github.com/users/Aratramba","html_url":"https://github.com/Aratramba","followers_url":"https://api.github.com/users/Aratramba/followers","following_url":"https://api.github.com/users/Aratramba/following{/other_user}","gists_url":"https://api.github.com/users/Aratramba/gists{/gist_id}","starred_url":"https://api.github.com/users/Aratramba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aratramba/subscriptions","organizations_url":"https://api.github.com/users/Aratramba/orgs","repos_url":"https://api.github.com/users/Aratramba/repos","events_url":"https://api.github.com/users/Aratramba/events{/privacy}","received_events_url":"https://api.github.com/users/Aratramba/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-02-16T01:11:01Z","updated_at":"2016-02-16T06:16:49Z","closed_at":null,"body":"E.g.\r\n\r\n```jade\r\nbody\r\n  a(href='afds'\r\nasdf='asfd'\r\n)\r\n```"},"comment":{"url":"https://api.github.com/repos/Aratramba/pug-code-block/issues/comments/184536031","html_url":"https://github.com/Aratramba/pug-code-block/issues/7#issuecomment-184536031","issue_url":"https://api.github.com/repos/Aratramba/pug-code-block/issues/7","id":184536031,"user":{"login":"TimothyGu","id":1538624,"avatar_url":"https://avatars.githubusercontent.com/u/1538624?v=3","gravatar_id":"","url":"https://api.github.com/users/TimothyGu","html_url":"https://github.com/TimothyGu","followers_url":"https://api.github.com/users/TimothyGu/followers","following_url":"https://api.github.com/users/TimothyGu/following{/other_user}","gists_url":"https://api.github.com/users/TimothyGu/gists{/gist_id}","starred_url":"https://api.github.com/users/TimothyGu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TimothyGu/subscriptions","organizations_url":"https://api.github.com/users/TimothyGu/orgs","repos_url":"https://api.github.com/users/TimothyGu/repos","events_url":"https://api.github.com/users/TimothyGu/events{/privacy}","received_events_url":"https://api.github.com/users/TimothyGu/received_events","type":"User","site_admin":false},"created_at":"2016-02-16T06:16:49Z","updated_at":"2016-02-16T06:16:49Z","body":"There are a bunch more of these weird indentations in Pug's test suite (which I added myself ;): https://github.com/pugjs/pug-lexer/blob/master/test/cases/attrs.pug#L25-L36\r\n\r\nIf this tool is solely for Pug, then I'd recommend using the `pug-lexer` module which will output tokens in a format like this:\r\n\r\n```js\r\n[ { type: 'tag', line: 1, col: 1, val: 'body' },\r\n  { type: 'indent', line: 2, col: 1, val: 2 },\r\n  { type: 'tag', line: 2, col: 3, val: 'a' },\r\n  { type: 'start-attributes', line: 2, col: 4 },\r\n  { type: 'attribute',\r\n    line: 2,\r\n    col: 5,\r\n    name: 'href',\r\n    val: '\\'afds\\'',\r\n    mustEscape: true },\r\n  { type: 'attribute',\r\n    line: 3,\r\n    col: 1,\r\n    name: 'asdf',\r\n    val: '\\'asfd\\'',\r\n    mustEscape: true },\r\n  { type: 'end-attributes', line: 4, col: 1 },\r\n  { type: 'outdent', line: 4, col: 2 },\r\n  { type: 'eos', line: 4, col: 2 } ]\r\n```\r\n\r\nYou can then track `indent`, `outdent`, `start-pipeless-text` (and maybe some more – I forgot) tokens and the line numbers to figure out where a block begins and stops. \r\n\r\n(In case you are wondering – yes, trying to write templates that break Pug and then trying to fix it is a favorite pastime of mine.)"}}