html-calendar
Project description
This module has the simple purpose of building html calendar tables with links and formatting. It is totally framework agnostic.
The module provides the htmlcalendar Python function that takes an starting date and a number of months for rendering the HTML Tables containing the specified months with formated cells and HTML links on day’s numbers.
Formatting is provided by passing a callback function as the classes parameters that takes the date and returns a list of CSS classes that are applied to the date’s cell.
Linking dates to URLs is also provided by a callback function passed as the links parameter that takes the date and returns a fully qualified HTML link if required or None if not.
You can also format the days that are not in the month but appear in the table with the option no_month_class. And the classes for formatting the headers and the table using the options th_classes and table_classes.
It also supports North American calendar with the option caltype putting its value to 1.
from flask import Flask
from datetime import date
from htmlcalendar import htmlcalendar
app = Flask("party")
def links(date):
if date.weekday() == 5:
return "https://github.com/llou/html-calendar"
def css_class(date):
if date.weekday() == 5:
return ["party"]
@app.route("/")
def party_calendar():
return htmlcalendar(date.today(), months=1, links=links, classes=css_class)
You can read the documentation at https://html-calendar.readthedocs.io/en/latest/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file html_calendar-0.0.10.tar.gz
.
File metadata
- Download URL: html_calendar-0.0.10.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d9f293fe8522d95a2e57fc560148246c962dc59757cf24d964259febd99115b |
|
MD5 | 950b313b3d751b5a338cc9ee2c84becb |
|
BLAKE2b-256 | c902001d690deb2b381ccc26f3a1775f5e8786b0268d51e8a3f1f83100b1aaa2 |