2
0
mirror of https://github.com/gradio-app/gradio.git synced 2025-03-19 12:00:39 +08:00

Guides stylistic changes ()

* moved related_spaces positioning

* ordered lists styling
This commit is contained in:
Ali Abdalla 2022-03-09 00:05:29 +02:00 committed by GitHub
parent 59e54cb17d
commit 972080a681
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

@ -73,13 +73,19 @@ for guide in sorted(os.listdir(GRADIO_GUIDES_DIR)):
spaces = None
if "related_spaces: " in guide_content:
spaces = guide_content.split("related_spaces: ")[1].split("\n")[0].split(", ")
title = guide_content.split("\n")[0]
contributor = None
if "Contributed by " in guide_content:
contributor = guide_content.split("Contributed by ")[1].split("\n")[0]
url = f"https://gradio.app/{guide_name}/"
guide_content = "\n".join(
[
line
for line in guide_content.split("\n")
if not (line.startswith("tags: ") or line.startswith("related_spaces: "))
if not (line.startswith("tags: ") or line.startswith("related_spaces: ") or
line.startswith("Contributed by ") or line == title)
]
)
@ -91,6 +97,7 @@ for guide in sorted(os.listdir(GRADIO_GUIDES_DIR)):
"tags": tags,
"spaces": spaces,
"url": url,
"contributor": contributor
}
)
@ -188,6 +195,7 @@ def render_guides():
guide_name=guide["name"],
spaces=guide["spaces"],
tags=guide["tags"],
contributor=guide["contributor"],
**GRADIO_ASSETS,
)
generated_template.write(output_html)

@ -83,6 +83,10 @@
visibility: visible;
}
ol {
list-style: auto;
padding-inline-start: 40px;
}
</style>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156449732-1"></script>
<script>
@ -98,6 +102,13 @@
<body class="bg-white text-gray-900 text-md sm:text-lg">
{{navbar_html|safe}}
<div class="container mx-auto max-w-4xl px-4 mb-12 mt-6" id="guide-template">
<div class="prose mt-6 mb-6">
<h1 id="{{guide_name}}" class="header">{{title}}</h1>
{% if contributor is not none %}
<p>Contributed by {{contributor}}</p>
{% endif %}
</div>
{% if spaces is not none %}
<div id='spaces-holder'>
<a href='https://hf.co/spaces' target='_blank'>
@ -113,7 +124,7 @@
</div>
{% endif %}
<div class="prose mt-6">
<div class="prose mt-6 mb-6">
{{ template_html|safe }}
</div>
</div>