| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,7 +32,11 @@ Prism.languages.liquid = { | |||
| 32 | 32 | // https://github.com/Shopify/liquid/blob/698f5e0d967423e013f6169d9111bd969bd78337/lib/liquid/lexer.rb#L21 | |
| 33 | 33 | 'number': /\b\d+(?:\.\d+)?\b/, | |
| 34 | 34 | 'operator': /[!=]=|<>|[<>]=?|[|?:=-]|\b(?:and|or|contains(?=\s))\b/, | |
| 35 | - 'punctuation': /[.,\[\]()]/ | ||
| 35 | + 'punctuation': /[.,\[\]()]/, | ||
| 36 | + 'empty': { | ||
| 37 | + pattern: /\bempty\b/, | ||
| 38 | + alias: 'keyword' | ||
| 39 | + }, | ||
| 36 | 40 | }; | |
| 37 | 41 | ||
| 38 | 42 | Prism.hooks.add('before-tokenize', function (env) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,78 @@ | |||
| 1 | + {% unless pages == empty %} | ||
| 2 | + <!-- This will only print if the page with handle "about" is not empty --> | ||
| 3 | + <h1>{{ pages.frontpage.not_empty_title }}</h1> | ||
| 4 | + <div>{{ pages.frontpage.content }}</div> | ||
| 5 | + {% endunless %} | ||
| 6 | + | ||
| 7 | + ---------------------------------------------------- | ||
| 8 | + | ||
| 9 | + [ | ||
| 10 | + ["liquid", [ | ||
| 11 | + ["delimiter", "{%"], | ||
| 12 | + ["keyword", "unless"], | ||
| 13 | + " pages ", | ||
| 14 | + ["operator", "=="], | ||
| 15 | + ["empty", "empty"], | ||
| 16 | + ["delimiter", "%}"] | ||
| 17 | + ]], | ||
| 18 | + | ||
| 19 | + ["comment", "<!-- This will only print if the page with handle \"about\" is not empty -->"], | ||
| 20 | + | ||
| 21 | + ["tag", [ | ||
| 22 | + ["tag", [ | ||
| 23 | + ["punctuation", "<"], | ||
| 24 | + "h1" | ||
| 25 | + ]], | ||
| 26 | + ["punctuation", ">"] | ||
| 27 | + ]], | ||
| 28 | + ["liquid", [ | ||
| 29 | + ["delimiter", "{{"], | ||
| 30 | + " pages", | ||
| 31 | + ["punctuation", "."], | ||
| 32 | + "frontpage", | ||
| 33 | + ["punctuation", "."], | ||
| 34 | + "not_empty_title ", | ||
| 35 | + ["delimiter", "}}"] | ||
| 36 | + ]], | ||
| 37 | + ["tag", [ | ||
| 38 | + ["tag", [ | ||
| 39 | + ["punctuation", "</"], | ||
| 40 | + "h1" | ||
| 41 | + ]], | ||
| 42 | + ["punctuation", ">"] | ||
| 43 | + ]], | ||
| 44 | + | ||
| 45 | + ["tag", [ | ||
| 46 | + ["tag", [ | ||
| 47 | + ["punctuation", "<"], | ||
| 48 | + "div" | ||
| 49 | + ]], | ||
| 50 | + ["punctuation", ">"] | ||
| 51 | + ]], | ||
| 52 | + ["liquid", [ | ||
| 53 | + ["delimiter", "{{"], | ||
| 54 | + " pages", | ||
| 55 | + ["punctuation", "."], | ||
| 56 | + "frontpage", | ||
| 57 | + ["punctuation", "."], | ||
| 58 | + "content ", | ||
| 59 | + ["delimiter", "}}"] | ||
| 60 | + ]], | ||
| 61 | + ["tag", [ | ||
| 62 | + ["tag", [ | ||
| 63 | + ["punctuation", "</"], | ||
| 64 | + "div" | ||
| 65 | + ]], | ||
| 66 | + ["punctuation", ">"] | ||
| 67 | + ]], | ||
| 68 | + | ||
| 69 | + ["liquid", [ | ||
| 70 | + ["delimiter", "{%"], | ||
| 71 | + ["keyword", "endunless"], | ||
| 72 | + ["delimiter", "%}"] | ||
| 73 | + ]] | ||
| 74 | + ] | ||
| 75 | + | ||
| 76 | + ---------------------------------------------------- | ||
| 77 | + | ||
| 78 | + Test for the 'empty' keyword / special thing. | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments