Skip to content

Commit

Permalink
Add HTTP Request/Response syntax as a git submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
keith-hall authored and sharkdp committed Jul 29, 2021
1 parent ffdf349 commit 6d5ff67
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,6 @@
[submodule "assets/syntaxes/02_Extra/Groff"]
path = assets/syntaxes/02_Extra/Groff
url = https://github.com/carsonoid/sublime_man_page_support
[submodule "assets/syntaxes/02_Extra/http-request-response"]
path = assets/syntaxes/02_Extra/http-request-response
url = https://github.com/keith-hall/http-request-response-syntax.git
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
## Syntaxes

- Groff, see #1685 (@scop)
- HTTP Requests and Responses, see #1748 (@keith-hall)

## New themes

Expand Down
1 change: 1 addition & 0 deletions assets/syntaxes/02_Extra/http-request-response
Submodule http-request-response added at f58bff
7 changes: 5 additions & 2 deletions doc/assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ in the `.sublime-syntax` format.
**Important:** Before proceeding, verify that the syntax you wish to add meets the [criteria for inclusion](#Criteria-for-inclusion-of-new-syntaxes).

1. Find a Sublime Text syntax for the given language, preferably in a separate Git repository
which can be included as a submodule (under `assets/syntaxes`).
which can be included as a submodule (under `assets/syntaxes`) using
`git submodule add <https github link> ./assets/syntaxes/02_Extra/<repo name>`, replacing
the contents of the angle brackets as appropriate.

2. If the Sublime Text syntax is only available as a `.tmLanguage` file, open the file in
Sublime Text and convert it to a `.sublime-syntax` file via *Tools* -> *Developer* ->
Expand All @@ -26,7 +28,8 @@ in the `.sublime-syntax` format.
6. Add a syntax test for the new language. See [below](#Syntax-tests) for details.

7. If you send a pull request with your changes, please do *not* include the changed `syntaxes.bin`
file. A new binary cache file will be created once before every new release of `bat`.
file. A new binary cache file will be created once before every new release of `bat`. This
avoids bloating the repository size unnecessarily.

### Syntax tests

Expand Down
44 changes: 44 additions & 0 deletions tests/syntax-tests/highlighted/http-request-response/example.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
POST /foo/bar?id=4&x=y%20z HTTP/1.1
X-Forwarded-For: 127.0.0.1
Content-Length: 124
Cache-Control: no-cache
X-Forwarded-Proto: https
Content-Type: application/json; charset=utf-8
Host: example.com
Accept: */*; q=0.5, application/xml
Accept-Encoding: gzip

{
 "id": "blahblahblahblah",
 "object": "event",
 "api_version": "2020-03-02",
 "created": 1626790174,
 "data": {
 }
}


HTTP/1.1 200 OK
Server: nginx
Date: Fri, 23 Jul 2021 10:15:12 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: private; max-age=0
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin
Strict-Transport-Security: max-age=31556900

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title>Hello World</title>
</head>
<body>

</body>
</html>
44 changes: 44 additions & 0 deletions tests/syntax-tests/source/http-request-response/example.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
POST /foo/bar?id=4&x=y%20z HTTP/1.1
X-Forwarded-For: 127.0.0.1
Content-Length: 124
Cache-Control: no-cache
X-Forwarded-Proto: https
Content-Type: application/json; charset=utf-8
Host: example.com
Accept: */*; q=0.5, application/xml
Accept-Encoding: gzip

{
"id": "blahblahblahblah",
"object": "event",
"api_version": "2020-03-02",
"created": 1626790174,
"data": {
}
}


HTTP/1.1 200 OK
Server: nginx
Date: Fri, 23 Jul 2021 10:15:12 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: private; max-age=0
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Referrer-Policy: origin
Strict-Transport-Security: max-age=31556900

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>

</body>
</html>

0 comments on commit 6d5ff67

Please sign in to comment.