parent
31604a0cd2
commit
39576ac7f3
54 changed files with 1616 additions and 4012 deletions
|
|
@ -6,7 +6,6 @@ import json
|
|||
import os
|
||||
|
||||
from dataclasses import dataclass
|
||||
from markdownify import markdownify as md
|
||||
from pathlib import Path
|
||||
from sqlcipher3 import dbapi2 as sqlite
|
||||
from typing import List, Sequence, Tuple
|
||||
|
|
@ -401,25 +400,13 @@ class DBManager:
|
|||
Export to HTML, similar to export_html, but then convert to Markdown
|
||||
using markdownify, and finally save to file.
|
||||
"""
|
||||
parts = [
|
||||
"<!doctype html>",
|
||||
'<html lang="en">',
|
||||
"<body>",
|
||||
f"<h1>{html.escape(title)}</h1>",
|
||||
]
|
||||
parts = []
|
||||
for d, c in entries:
|
||||
parts.append(
|
||||
f"<article><header><time>{html.escape(d)}</time></header><section>{c}</section></article>"
|
||||
)
|
||||
parts.append("</body></html>")
|
||||
|
||||
# Convert html to markdown
|
||||
md_items = []
|
||||
for item in parts:
|
||||
md_items.append(md(item, heading_style="ATX"))
|
||||
parts.append(f"# {d}")
|
||||
parts.append(c)
|
||||
|
||||
with open(file_path, "w", encoding="utf-8") as f:
|
||||
f.write("\n".join(md_items))
|
||||
f.write("\n".join(parts))
|
||||
|
||||
def export_sql(self, file_path: str) -> None:
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue