Skip to content

Commit

Permalink
Highlight float number in nginx lexer (rouge-ruby#2017)
Browse files Browse the repository at this point in the history
* Highlight float number in nginx lexer

* Add more nginx lexer samples
  • Loading branch information
tancnle authored Jan 2, 2024
1 parent f99db81 commit 0ba3ba9
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/rouge/lexers/nginx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Nginx < RegexLexer
# mimetype
rule %r([a-z-]+/[a-z-]+)i, Name::Class

rule %r/\d+\.\d+/, Num::Float
rule %r/[0-9]+[kmg]?\b/i, Num::Integer
rule %r/(~)(\s*)([^\s{]+)/ do
groups Punctuation, Text, Str::Regex
Expand Down
88 changes: 88 additions & 0 deletions spec/visual/samples/nginx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ events {
worker_connections 1024;
}

server {
proxy_http_version 1.1;
}

http {
include mime.types;
Expand Down Expand Up @@ -117,3 +120,88 @@ http {
}

# comment at eof

# proxy.conf
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffers 32 4k;

# fastcgi.conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

fastcgi_index index.php;

fastcgi_param REDIRECT_STATUS 200;

# mime.types
types {
text/html html htm shtml;
text/css css;
text/xml xml rss;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
text/plain txt;
text/x-component htc;
text/mathml mml;
image/png png;
image/x-icon ico;
image/x-jng jng;
image/vnd.wap.wbmp wbmp;
application/java-archive jar war ear;
application/mac-binhex40 hqx;
application/pdf pdf;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/zip zip;
application/octet-stream deb;
application/octet-stream bin exe dll;
application/octet-stream dmg;
application/octet-stream eot;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/mpeg mp3;
audio/x-realaudio ra;
video/mpeg mpeg mpg;
video/quicktime mov;
video/x-flv flv;
video/x-msvideo avi;
video/x-ms-wmv wmv;
video/x-ms-asf asx asf;
video/x-mng mng;
}

0 comments on commit 0ba3ba9

Please sign in to comment.