diff --git a/example-site/posts.yml b/example-site/posts.yml index f362367..050325c 100644 --- a/example-site/posts.yml +++ b/example-site/posts.yml @@ -40,6 +40,14 @@ posts: - donuts - coffee + - file_path: 2023-06-30-qbasic-is-fun.md + title: QBasic Is Fun + date: 2023-06-30 + slug: qbasic-is-fun + tags: + - qbasic + - testing + rss: title: My Site description: This is my site. There are others like it, but this one is mine. diff --git a/example-site/posts/2023-06-30-qbasic-is-fun.md b/example-site/posts/2023-06-30-qbasic-is-fun.md new file mode 100644 index 0000000..5daa53c --- /dev/null +++ b/example-site/posts/2023-06-30-qbasic-is-fun.md @@ -0,0 +1,17 @@ +QBasic is fun. And we can syntax highlight the below code here via loading custom syntax definitions from a path +specified in the `server.yml` file. Unfortunately, this only supports loading from `.sublime-text` files, **not** +from `.tmLanguage` files. + +```bas +DEFINT A-Z +SCREEN 13 +DEF SEG = &HA000 + +CLS +DO UNTIL INKEY$ = CHR$(27) + x = RND * 320 + y = RND * 200 + clr = RND * 256 + POKE (y * 320) + x, clr +LOOP +``` \ No newline at end of file diff --git a/example-site/server.yml b/example-site/server.yml index 51d02b7..88e1396 100644 --- a/example-site/server.yml +++ b/example-site/server.yml @@ -4,3 +4,4 @@ static_files_path: static templates_path: templates pages_path: pages posts_path: posts +syntaxes_path: syntaxes \ No newline at end of file diff --git a/example-site/syntaxes/QBasic.sublime-syntax b/example-site/syntaxes/QBasic.sublime-syntax new file mode 100644 index 0000000..79d9907 --- /dev/null +++ b/example-site/syntaxes/QBasic.sublime-syntax @@ -0,0 +1,72 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: QBasic +file_extensions: + - bas + - qb +scope: source.qbasic +contexts: + main: + - match: (').* + comment: Comment + scope: comment.line.qbasic + captures: + 1: punctuation.definition.comment.qbasic + - match: "[,:;]" + comment: Delimiter + scope: meta.delimiter.object.qbasic + - match: \b((END )?IF|(END )?SELECT|(RESUME )?NEXT|CASE|CLOSE|DO|ELSE|FOR|GOSUB|GOTO|LOOP|ON|OPEN|RETURN|THEN|TO|UNTIL|WHILE)\b + comment: Keyword + scope: keyword.control.qbasic + - match: (\+|=|<|>|<>|AND|OR) + comment: Operator + scope: keyword.operator.qbasic + - match: \b(CHR\$|CLS|COLOR|DATA|INPUT|INT|KEY|LEN|LINE|LOCATE|PALETTE|PLAY|PRINT|PSET|PUT|REDIM|RND|SCREEN|TAB|VIEW)\b + comment: Function + scope: support.function.qbasic + - match: \b(\d(\.\d)?)+ + comment: Numeric + scope: constant.numeric.qbasic + - match: \b\w+\$ + comment: Global + scope: constant.global.qbasic + - match: '^(\w+):' + comment: SUB + scope: meta.function.qbasic + captures: + 1: entity.name.function.qbasic + - match: '[\(\)]' + comment: Brace, round + scope: meta.brace.round.qbasic + - match: '[\{\}]' + comment: Brace, curly + scope: meta.brace.curly.qbasic + - match: (\w+\() + comment: Array + captures: + 1: constant.array.qbasic + push: + - meta_scope: other.array.qbasic + - match: (\)) + captures: + 1: constant.array.qbasic + pop: true + - include: main + - match: (") + comment: String, double-quoted + captures: + 1: punctuation.definition.string.begin.qbasic + push: + - meta_scope: string.quoted.double.qbasic + - match: (") + captures: + 1: punctuation.definition.string.begin.qbasic + pop: true + - match: (\\") + comment: Escaped double-quote inside double-quoted string + scope: constant.character.escape.qbasic + - match: (') + comment: Single quote inside double-quoted string + scope: other.qbasic + - include: main