slomkowski / nginx-config-formatter

nginx config file formatter/beautifier written in Python with no additional dependencies.
Apache License 2.0
380 stars 64 forks source link

unmatched single-quote in comments breaking parsing #20

Closed deltamualpha closed 3 years ago

deltamualpha commented 4 years ago

given:

location /nginx_status {
# Don't break 
    stub_status on;
  access_log off;
  allow 127.0.0.1;
    deny all;
}

we expect:

location /nginx_status {
    # Don't break
    stub_status on;
    access_log off;
    allow 127.0.0.1;
    deny all;
}

but instead we get:

location /nginx_status {
    # Don't break
    stub_status on;
    access_log off;
    allow 127.0.0.1;
    deny all;
    }

and all subsequent lines are aligned to the indentation of the comment with ' in it. Looks like it's trying to parse the comment as an nginx string and then never escaping the comment alignment? Probably related to #11.