Be nice with strict Content-Security-Policy

This commit is contained in:
Julien Palard 2023-01-24 15:12:11 +01:00
parent 47ab1d32db
commit e8ed7384de
Signed by: mdk
GPG Key ID: 0EFC1AC1006886F8
4 changed files with 60 additions and 46 deletions

View File

@ -8,19 +8,7 @@ import argparse
import jinja2
import requests
TPL = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Prez</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ revealjs_url }}/dist/reset.css">
<link rel="stylesheet" href="{{ revealjs_url }}/dist/reveal.css">
<link rel="stylesheet" href="{{ revealjs_url }}/dist/theme/simple.css" id="theme">
MDTOREVEAL_CSS = """
<style>
a.sourceLine { display: inline-block; line-height: 1.25; }
a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
@ -188,6 +176,21 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
.reveal { font-family: sans-serif; }
</style>
"""
TPL = """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Prez</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="{{ revealjs_url }}/dist/reset.css">
<link rel="stylesheet" href="{{ revealjs_url }}/dist/reveal.css">
<link rel="stylesheet" href="{{ revealjs_url }}/dist/theme/simple.css" id="theme">
<link rel="stylesheet" href="mdtoreveal.css">
</head>
<body>
<div class="reveal">
@ -254,6 +257,7 @@ def main():
tpl = jinja2.Template(TPL)
root = Path(args.html).resolve().parent
(root / "mdtoreveal.css").write_text(MDTOREVEAL_CSS)
reveal_dir = f"reveal.js-{REVEAL_JS_VERSION}"
reveal_path = root / reveal_dir
if not reveal_path.exists():

43
pyproject.toml Normal file
View File

@ -0,0 +1,43 @@
[build-system]
requires = ["setuptools>=61.2"]
build-backend = "setuptools.build_meta"
[project]
name = "mdtoreveal"
version = "0.3.2"
description = "Transform a flat markdown to a reveal.js presentation."
authors = [
{ name = "Julien Palard", email = "julien@palard.fr" },
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
]
requires-python = ">= 3.6"
dependencies = [
"jinja2",
"requests",
"markdown",
]
[project.readme]
file = "README.md"
content-type = "text/markdown; charset=UTF-8"
[project.license]
text = "MIT License"
[project.urls]
Homepage = "https://github.com/JulienPalard/mdtoreveal"
[project.scripts]
mdtoreveal = "mdtoreveal:main"
[tool.setuptools]
py-modules = [
"mdtoreveal",
]
include-package-data = false

View File

@ -1,30 +0,0 @@
[metadata]
name = mdtoreveal
version = 0.3.1
description = Transform a flat markdown to a reveal.js presentation.
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8
author = Julien Palard
author_email = julien@palard.fr
url = https://github.com/JulienPalard/mdtoreveal
license = MIT License
classifiers =
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
[options]
py_modules = mdtoreveal
python_requires = >= 3.6
install_requires =
jinja2
requests
markdown
[options.entry_points]
console_scripts = mdtoreveal=mdtoreveal:main

View File

@ -1,3 +0,0 @@
import setuptools
setuptools.setup()