Compare commits
No commits in common. "ba276290368dc1b3e6298d7a9f8c8ae86d7f9904" and "9b7c73a977142e5433aca1ce8923530c8251f66c" have entirely different histories.
ba27629036
...
9b7c73a977
4 changed files with 2 additions and 30 deletions
|
@ -9,4 +9,3 @@ favicon>=0.7.0
|
||||||
markdown>=3.4.4
|
markdown>=3.4.4
|
||||||
Pygments>=2.16.1
|
Pygments>=2.16.1
|
||||||
toml>=0.10
|
toml>=0.10
|
||||||
beautifulsoup4>=4.12.2
|
|
||||||
|
|
|
@ -9,11 +9,6 @@ markdown rendering.
|
||||||
|
|
||||||
[TOC]
|
[TOC]
|
||||||
|
|
||||||
| very | important | table |
|
|
||||||
|--------|-----------|-----------|
|
|
||||||
| v | i | t |
|
|
||||||
| yes | super | important |
|
|
||||||
| really | really | really |
|
|
||||||
|
|
||||||
## Wait, but why?
|
## Wait, but why?
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,6 @@ markdown rendering.
|
||||||
|
|
||||||
[TOC]
|
[TOC]
|
||||||
|
|
||||||
| very | important | table |
|
|
||||||
|--------|-----------|-----------|
|
|
||||||
| v | i | t |
|
|
||||||
| yes | super | important |
|
|
||||||
| really | really | really |
|
|
||||||
|
|
||||||
## Wait, but why?
|
## Wait, but why?
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import re
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import markdown
|
import markdown
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from start.models import Keyword, Searchable
|
from start.models import Keyword, Searchable
|
||||||
|
@ -112,22 +111,6 @@ class BlogPost(Searchable):
|
||||||
# redundand vvvv
|
# redundand vvvv
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def __patch_html(html: str) -> str:
|
|
||||||
soup = BeautifulSoup(html)
|
|
||||||
|
|
||||||
# add bootstrap classes to regular tables
|
|
||||||
tables = soup.select("table")
|
|
||||||
for table in tables:
|
|
||||||
if 'class' in table.attrs and "codehilitetable" in table.attrs['class']:
|
|
||||||
# table has at least one class already AND
|
|
||||||
# this table is a codehighlighting table,
|
|
||||||
# not a regular one
|
|
||||||
continue
|
|
||||||
# set the bootstrap classes for tables
|
|
||||||
table.attrs['class'] = 'table table-striped border'
|
|
||||||
return soup.prettify()
|
|
||||||
|
|
||||||
def sync_file(self):
|
def sync_file(self):
|
||||||
"""
|
"""
|
||||||
generate an article fromm it's original markdown file
|
generate an article fromm it's original markdown file
|
||||||
|
@ -172,12 +155,12 @@ class BlogPost(Searchable):
|
||||||
self.title_en = data['lang'][lang]["title"]
|
self.title_en = data['lang'][lang]["title"]
|
||||||
self.subtitle_en = data['lang'][lang]["subtitle"]
|
self.subtitle_en = data['lang'][lang]["subtitle"]
|
||||||
self.desc_en = data['lang'][lang]["desc"]
|
self.desc_en = data['lang'][lang]["desc"]
|
||||||
self.body_en = BlogPost.__patch_html(MD.convert(body))
|
self.body_en = MD.convert(body)
|
||||||
case "de":
|
case "de":
|
||||||
self.title_de = data['lang'][lang]["title"]
|
self.title_de = data['lang'][lang]["title"]
|
||||||
self.subtitle_de = data['lang'][lang]["subtitle"]
|
self.subtitle_de = data['lang'][lang]["subtitle"]
|
||||||
self.desc_de = data['lang'][lang]["desc"]
|
self.desc_de = data['lang'][lang]["desc"]
|
||||||
self.body_de = BlogPost.__patch_html(MD.convert(body))
|
self.body_de = MD.convert(body)
|
||||||
case _:
|
case _:
|
||||||
logger.error(
|
logger.error(
|
||||||
f"unknown language '{lang}' in meta file for '{self}'")
|
f"unknown language '{lang}' in meta file for '{self}'")
|
||||||
|
|
Loading…
Add table
Reference in a new issue