mirror of
https://github.com/RGBCube/Site
synced 2025-07-30 12:37:50 +00:00
site: fix callouts
This commit is contained in:
parent
ccf7a1c422
commit
7827c47756
2 changed files with 19 additions and 18 deletions
7
site.ts
7
site.ts
|
@ -181,18 +181,19 @@ site.process([".html"], (pages) =>
|
||||||
const { document } = page;
|
const { document } = page;
|
||||||
|
|
||||||
document.querySelectorAll("pre code").forEach((code) => {
|
document.querySelectorAll("pre code").forEach((code) => {
|
||||||
const matches = code.innerHTML.match(/\(\(\(\d+\)\)\)/g);
|
const matches = code.innerHTML.match(/\{\[\([^\)]+\)\]\}/g);
|
||||||
if (!matches) return;
|
if (!matches) return;
|
||||||
|
console.log(matches);
|
||||||
|
|
||||||
let newHTML = code.innerHTML;
|
let newHTML = code.innerHTML;
|
||||||
|
|
||||||
matches.forEach((match) => {
|
matches.forEach((match) => {
|
||||||
console.log(
|
console.log(
|
||||||
`<span class="callout">${match.replaceAll(/\(|\)/g, "")}</span>`,
|
`<span class="callout">${match.replaceAll(/[^\d]/g, "")}</span>`,
|
||||||
);
|
);
|
||||||
newHTML = newHTML.replace(
|
newHTML = newHTML.replace(
|
||||||
match,
|
match,
|
||||||
`<span class="callout">${match.replaceAll(/\(|\)/g, "")}</span>`,
|
`<span class="callout">${match.replaceAll(/[^\d]/g, "")}</span>`,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,25 +24,25 @@ First, let's take a look at how
|
||||||
```c
|
```c
|
||||||
// in ngx_http_set_etag @ src/http/ngx_http_core_module.c:1681
|
// in ngx_http_set_etag @ src/http/ngx_http_core_module.c:1681
|
||||||
|
|
||||||
(((1)))
|
{[(1)]}
|
||||||
etag = ngx_list_push(&r->headers_out.headers); (((1)))
|
etag = ngx_list_push(&r->headers_out.headers);
|
||||||
if (etag == NULL) {
|
if (etag == NULL) {
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
(((2)))
|
{[(2)]}
|
||||||
etag->hash = 1;
|
etag->hash = 1;
|
||||||
etag->next = NULL;
|
etag->next = NULL;
|
||||||
ngx_str_set(&etag->key, "ETag");
|
ngx_str_set(&etag->key, "ETag");
|
||||||
|
|
||||||
(((3)))
|
{[(3)]}
|
||||||
etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
|
etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
|
||||||
if (etag->value.data == NULL) {
|
if (etag->value.data == NULL) {
|
||||||
etag->hash = 0;
|
etag->hash = 0;
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
(((4)))
|
{[(4)]}
|
||||||
etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
|
etag->value.len = ngx_sprintf(etag->value.data, "\"%xT-%xO\"",
|
||||||
r->headers_out.last_modified_time,
|
r->headers_out.last_modified_time,
|
||||||
r->headers_out.content_length_n)
|
r->headers_out.content_length_n)
|
||||||
|
@ -105,7 +105,7 @@ index 97a91aee2..2d07d71e6 100644
|
||||||
{
|
{
|
||||||
ngx_table_elt_t *etag;
|
ngx_table_elt_t *etag;
|
||||||
ngx_http_core_loc_conf_t *clcf;
|
ngx_http_core_loc_conf_t *clcf;
|
||||||
(((2)))
|
{[(2)]}
|
||||||
+ u_char *real, *ptr1, *ptr2;
|
+ u_char *real, *ptr1, *ptr2;
|
||||||
+ ngx_err_t err;
|
+ ngx_err_t err;
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ index 97a91aee2..2d07d71e6 100644
|
||||||
etag->next = NULL;
|
etag->next = NULL;
|
||||||
ngx_str_set(&etag->key, "ETag");
|
ngx_str_set(&etag->key, "ETag");
|
||||||
|
|
||||||
(((1)))
|
{[(1)]}
|
||||||
- etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
|
- etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
|
||||||
- if (etag->value.data == NULL) {
|
- if (etag->value.data == NULL) {
|
||||||
- etag->hash = 0;
|
- etag->hash = 0;
|
||||||
|
@ -131,14 +131,14 @@ index 97a91aee2..2d07d71e6 100644
|
||||||
+ // gzip-compressed) should have different Etags. Thus, we also append
|
+ // gzip-compressed) should have different Etags. Thus, we also append
|
||||||
+ // content-length, which should be different when the response is compressed
|
+ // content-length, which should be different when the response is compressed
|
||||||
+
|
+
|
||||||
+ err = ngx_errno; (((3)))
|
+ err = ngx_errno; {[(3)]}
|
||||||
+ real = ngx_realpath(clcf->root.data, NULL); (((4)))
|
+ real = ngx_realpath(clcf->root.data, NULL); {[(4)]}
|
||||||
+ ngx_set_errno(err); (((5)))
|
+ ngx_set_errno(err); {[(5)]}
|
||||||
+
|
+
|
||||||
+ #define NIX_STORE_DIR "@nixStoreDir@" (((6)))
|
+ #define NIX_STORE_DIR "@nixStoreDir@" {[(6)]}
|
||||||
+ #define NIX_STORE_LEN @nixStoreDirLen@
|
+ #define NIX_STORE_LEN @nixStoreDirLen@
|
||||||
+
|
+
|
||||||
+ if (r->headers_out.last_modified_time == 1 (((7)))
|
+ if (r->headers_out.last_modified_time == 1 {[(7)]}
|
||||||
+ && real != NULL
|
+ && real != NULL
|
||||||
+ && !ngx_strncmp(real, NIX_STORE_DIR, NIX_STORE_LEN)
|
+ && !ngx_strncmp(real, NIX_STORE_DIR, NIX_STORE_LEN)
|
||||||
+ && real[NIX_STORE_LEN] == '/'
|
+ && real[NIX_STORE_LEN] == '/'
|
||||||
|
@ -147,7 +147,7 @@ index 97a91aee2..2d07d71e6 100644
|
||||||
+ // extract the hash from a path formatted like
|
+ // extract the hash from a path formatted like
|
||||||
+ // /nix/store/hashhere1234-pname-1.0.0
|
+ // /nix/store/hashhere1234-pname-1.0.0
|
||||||
+ // +1 to skip the leading /
|
+ // +1 to skip the leading /
|
||||||
+ ptr1 = real + NIX_STORE_LEN + 1; (((8)))
|
+ ptr1 = real + NIX_STORE_LEN + 1; {[(8)]}
|
||||||
+
|
+
|
||||||
+ ptr2 = (u_char *) ngx_strchr(ptr1, '-');
|
+ ptr2 = (u_char *) ngx_strchr(ptr1, '-');
|
||||||
+
|
+
|
||||||
|
@ -157,7 +157,7 @@ index 97a91aee2..2d07d71e6 100644
|
||||||
+ return NGX_ERROR;
|
+ return NGX_ERROR;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ *ptr2 = '\0'; (((9)))
|
+ *ptr2 = '\0'; {[(9)]}
|
||||||
+
|
+
|
||||||
+ // hash + content-length + quotes and hyphen. Note that the
|
+ // hash + content-length + quotes and hyphen. Note that the
|
||||||
+ // content-length part of the string can vary in length.
|
+ // content-length part of the string can vary in length.
|
||||||
|
@ -178,7 +178,7 @@ index 97a91aee2..2d07d71e6 100644
|
||||||
+ - etag->value.data;
|
+ - etag->value.data;
|
||||||
+
|
+
|
||||||
+ ngx_http_clear_last_modified(r);
|
+ ngx_http_clear_last_modified(r);
|
||||||
+ } else { (((10)))
|
+ } else { {[(10)]}
|
||||||
+ // outside of Nix store, use the upstream Nginx logic for etags
|
+ // outside of Nix store, use the upstream Nginx logic for etags
|
||||||
+
|
+
|
||||||
+ etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
|
+ etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue