Skip to content

Commit

Permalink
Detailed parsing and styling of HTTP request and status lines.
Browse files Browse the repository at this point in the history
  • Loading branch information
isagalaev committed May 10, 2012
1 parent 140172d commit b2ccd4c
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 30 deletions.
6 changes: 4 additions & 2 deletions classref.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ VBScript ("vbscript"):

HTTP ("http"):

title first line of a request or a response
request first line of a request
status first line of a response
attribute header name
string header value
string header value or query string in a request line
number status code

Lua ("lua"):

Expand Down
14 changes: 11 additions & 3 deletions src/languages/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ hljs.LANGUAGES.http = {
illegal: '\\S',
contains: [
{
className: 'title',
className: 'status',
begin: '^HTTP/[0-9\\.]+', end: '$',
contains: [{className: 'number', begin: '\\b\\d{3}\\b'}]
},
{
className: 'title',
begin: '^[A-Z]+ .*?HTTP/[0-9\\.]+$',
className: 'request',
begin: '^[A-Z]+ (.*?) HTTP/[0-9\\.]+$', returnBegin: true, end: '$',
contains: [
{
className: 'string',
begin: ' ', end: ' ',
excludeBegin: true, excludeEnd: true
}
]
},
{
className: 'attribute',
Expand Down
4 changes: 3 additions & 1 deletion src/styles/arta.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ pre .css .pseudo,
pre .css .attr_selector,
pre .lisp .title,
pre .winutils,
pre .tex .command
pre .tex .command,
pre .request,
pre .status
{
color: #6644aa;
}
Expand Down
4 changes: 3 additions & 1 deletion src/styles/ascetic.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ pre .flow,
pre .lisp .title,
pre .apache .tag,
pre .tex .command,
pre .http .title {
pre .http .title,
pre .request,
pre .status {
font-weight: bold;
}
4 changes: 3 additions & 1 deletion src/styles/brown_paper.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ pre .change,
pre .winutils,
pre .flow,
pre .lisp .title,
pre .tex .special {
pre .tex .special,
pre .request,
pre .status {
color:#005599;
font-weight:bold;
}
Expand Down
4 changes: 3 additions & 1 deletion src/styles/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ pre .chunk,
pre .winutils,
pre .bash .variable,
pre .apache .tag,
pre .tex .special {
pre .tex .special,
pre .request,
pre .status {
font-weight: bold;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ pre .bash .variable,
pre .apache .tag,
pre .go .typename,
pre .tex .command,
pre .markdown .strong {
pre .markdown .strong,
pre .request,
pre .status {
font-weight: bold;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/far.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ pre .flow,
pre .apache .tag,
pre .nginx .built_in,
pre .tex .command,
pre .tex .special {
pre .tex .special,
pre .request,
pre .status {
font-weight: bold;
}
4 changes: 3 additions & 1 deletion src/styles/github.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ pre .css .rule .keyword,
pre .winutils,
pre .javascript .title,
pre .lisp .title,
pre .subst {
pre .subst,
pre .request,
pre .status {
color: #000;
font-weight: bold
}
Expand Down
7 changes: 3 additions & 4 deletions src/styles/googlecode.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ pre .comment * {
}

pre .keyword,
pre .ruby .function .keyword,
pre .function .keyword,
pre .sub .keyword,
pre .method,
pre .list .title,
pre .tag .title,
pre .setting .value,
pre .winutils,
pre .tex .command,
pre .http .title {
pre .http .title,
pre .request,
pre .status {
color: #008;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/idea.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ pre .css .function,
pre .ini .title,
pre .css .class,
pre .list .title,
pre .tex .command {
pre .tex .command,
pre .request,
pre .status {
font-weight: bold;
color: #000080;
}
Expand Down
4 changes: 3 additions & 1 deletion src/styles/ir_black.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ pre .javadoc {

pre .keyword,
pre .tag,
pre .tex .command {
pre .tex .command,
pre .request,
pre .status {
color: #96CBFE;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/magula.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ pre .winutils,
pre .bash .variable,
pre .apache .tag,
pre .xml .tag,
pre .tex .command {
pre .tex .command,
pre .request,
pre .status {
font-weight: bold;
color: navy;
}
Expand Down
4 changes: 3 additions & 1 deletion src/styles/monokai.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ pre .chunk,
pre .winutils,
pre .bash .variable,
pre .apache .tag,
pre .tex .special {
pre .tex .special,
pre .request,
pre .status {
font-weight: bold;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/school_book.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ pre .chunk,
pre .winutils,
pre .bash .variable,
pre .apache .tag,
pre .tex .command {
pre .tex .command,
pre .request,
pre .status {
font-weight: bold;
}

Expand Down
5 changes: 3 additions & 2 deletions src/styles/solarized_dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ pre .javadoc {
}

pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .method,
pre .addition,
pre .css .tag {
pre .css .tag,
pre .request,
pre .status {
color: #859900;
}

Expand Down
5 changes: 3 additions & 2 deletions src/styles/solarized_light.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ pre .javadoc {
}

pre .keyword,
pre .css .rule .keyword,
pre .winutils,
pre .method,
pre .addition,
pre .css .tag {
pre .css .tag,
pre .request,
pre .status {
color: #859900;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/sunburst.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ pre .javadoc {
}

pre .keyword,
pre .ruby .function .keyword {
pre .ruby .function .keyword,
pre .request,
pre .status {
color: #E28964;
}

Expand Down
4 changes: 3 additions & 1 deletion src/styles/vs.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ pre .built_in,
pre .smalltalk .class,
pre .winutils,
pre .bash .variable,
pre .tex .command {
pre .tex .command,
pre .request,
pre .status {
color: rgb(0, 0, 255);
}

Expand Down
6 changes: 3 additions & 3 deletions src/styles/zenburn.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ pre code {

pre .keyword,
pre .tag,
pre .django .tag,
pre .django .keyword,
pre .css .class,
pre .css .id,
pre .lisp .title {
pre .lisp .title,
pre .request,
pre .status {
color: #E3CEAB;
}

Expand Down

0 comments on commit b2ccd4c

Please sign in to comment.