Add vary header
This commit is contained in:
parent
86a414fd58
commit
8ad0a153c5
|
@ -110,7 +110,6 @@ def organize_docobjects(package_name: str) -> dict[str, str]:
|
||||||
docobjects = _extract_docobjects(package_name)
|
docobjects = _extract_docobjects(package_name)
|
||||||
page_registry: defaultdict[str, list[str]] = defaultdict(list)
|
page_registry: defaultdict[str, list[str]] = defaultdict(list)
|
||||||
for module, docobject in docobjects.items():
|
for module, docobject in docobjects.items():
|
||||||
print(f"{module=}")
|
|
||||||
builder = Builder(name="Partial")
|
builder = Builder(name="Partial")
|
||||||
_docobject_to_html(docobject, builder)
|
_docobject_to_html(docobject, builder)
|
||||||
ref = module.rsplit(".", module.count(".") - 1)[0]
|
ref = module.rsplit(".", module.count(".") - 1)[0]
|
||||||
|
|
|
@ -5,7 +5,6 @@ from mistune.markdown import Markdown
|
||||||
DIRECTIVE_PATTERN = r":(?:class|func|meth|attr|exc|mod|data|const|obj|keyword|option|cmdoption|envvar):`(?P<ref>sanic\.[^`]+)`" # noqa: E501
|
DIRECTIVE_PATTERN = r":(?:class|func|meth|attr|exc|mod|data|const|obj|keyword|option|cmdoption|envvar):`(?P<ref>sanic\.[^`]+)`" # noqa: E501
|
||||||
|
|
||||||
def _parse_inline_directive(inline, m: re.Match, state):
|
def _parse_inline_directive(inline, m: re.Match, state):
|
||||||
print("inline_directive.py: _parse_inline_directive", m.group("ref"))
|
|
||||||
state.append_token(
|
state.append_token(
|
||||||
{
|
{
|
||||||
"type": "inline_directive",
|
"type": "inline_directive",
|
||||||
|
@ -16,5 +15,4 @@ def _parse_inline_directive(inline, m: re.Match, state):
|
||||||
return m.end()
|
return m.end()
|
||||||
|
|
||||||
def inline_directive(md: Markdown):
|
def inline_directive(md: Markdown):
|
||||||
print("Registering inline_directive")
|
|
||||||
md.inline.register("inline_directive", DIRECTIVE_PATTERN, _parse_inline_directive, before="escape",)
|
md.inline.register("inline_directive", DIRECTIVE_PATTERN, _parse_inline_directive, before="escape",)
|
||||||
|
|
|
@ -62,7 +62,10 @@ def create_app(root: Path) -> Sanic:
|
||||||
language: str,
|
language: str,
|
||||||
path: str = "",
|
path: str = "",
|
||||||
):
|
):
|
||||||
return html(page_renderer.render(request, language, path))
|
return html(
|
||||||
|
page_renderer.render(request, language, path),
|
||||||
|
headers={"vary": "hx-request"},
|
||||||
|
)
|
||||||
|
|
||||||
@app.on_request
|
@app.on_request
|
||||||
async def set_language(request: Request):
|
async def set_language(request: Request):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user