Skip to content

Commit

Permalink
Add stylesheet for tagcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverRainZ committed Jan 6, 2024
1 parent 6b867ad commit 8600e78
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ablog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ def config_inited(app, config):
)
app.config.matched_blog_posts = matched_patterns

# Add ablog stylesheets to static_path.
static_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "stylesheets"))
app.config.html_static_path.append(static_path)


def builder_inited(app):
if not isinstance(app.builder, StandaloneHTMLBuilder) or app.config.skip_injecting_base_ablog_templates:
Expand Down
36 changes: 36 additions & 0 deletions src/ablog/stylesheets/ablog/tagcloud.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ul.ablog-cloud {
list-style: none;
overflow: auto;
}

ul.ablog-cloud li {
float: left;
height: 20pt;
line-height: 18pt;
margin-right: 5px;
}

ul.ablog-cloud a {
text-decoration: none;
vertical-align: middle;
}

li.ablog-cloud-1 {
font-size: 80%;
}

li.ablog-cloud-2 {
font-size: 95%;
}

li.ablog-cloud-3 {
font-size: 110%;
}

li.ablog-cloud-4 {
font-size: 125%;
}

li.ablog-cloud-5 {
font-size: 140%;
}
1 change: 1 addition & 0 deletions src/ablog/templates/ablog/tagcloud.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% if ablog.tags %}
<div class="ablog-sidebar-item ablog__tags">
<link rel="stylesheet" href="/_static/ablog/tagcloud.css" type="text/css" />
<h3><a href="{{ pathto(ablog.tags.path) }}">{{ gettext('Tags') }}</a></h3>
<ul class="ablog-cloud">
{% for coll in ablog.tags %}
Expand Down
1 change: 1 addition & 0 deletions src/ablog/templates/tagcloud.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{{ warning("tagcloud.html is an old template path, that is no longer used by ablog. Please use ablog/tagcloud.html instead.") }}
{% if ablog.tags %}
<div class="ablog-sidebar-item ablog__tags">
<link rel="stylesheet" href="/_static/ablog/tagcloud.css" type="text/css" />
<h3><a href="{{ pathto(ablog.tags.path) }}">{{ gettext('Tags') }}</a></h3>
<ul class="ablog-cloud">
{% for coll in ablog.tags %}
Expand Down

0 comments on commit 8600e78

Please sign in to comment.