Remove export to txt, the .md markdown is really the same
Some checks failed
CI / test (push) Successful in 3m14s
Lint / test (push) Failing after 14s
Trivy / test (push) Successful in 20s

This commit is contained in:
Miguel Jacq 2025-11-15 12:12:18 +11:00
parent 7ef79c495b
commit 97e723ce34
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
6 changed files with 5 additions and 28 deletions

View file

@ -356,21 +356,6 @@ class DBManager:
writer.writerow(["date", "content"]) # header
writer.writerows(entries)
def export_txt(
self,
entries: Sequence[Entry],
file_path: str,
separator: str = "\n\n— — — — —\n\n",
) -> None:
"""
Strip the the latest version of the pages to a text file.
"""
with open(file_path, "w", encoding="utf-8") as f:
for i, (d, c) in enumerate(entries):
f.write(f"{d}\n{c}\n")
if i < len(entries) - 1:
f.write(separator)
def export_html(
self, entries: Sequence[Entry], file_path: str, title: str = "Bouquin export"
) -> None:

View file

@ -1179,7 +1179,6 @@ class MainWindow(QMainWindow):
return False
filters = (
"Text (*.txt);;"
"JSON (*.json);;"
"CSV (*.csv);;"
"HTML (*.html);;"
@ -1195,22 +1194,19 @@ class MainWindow(QMainWindow):
return # user cancelled
default_ext = {
"Text (*.txt)": ".txt",
"JSON (*.json)": ".json",
"CSV (*.csv)": ".csv",
"HTML (*.html)": ".html",
"Markdown (*.md)": ".md",
"SQL (*.sql)": ".sql",
}.get(selected_filter, ".txt")
}.get(selected_filter, ".md")
if not Path(filename).suffix:
filename += default_ext
try:
entries = self.db.get_all_entries()
if selected_filter.startswith("Text"):
self.db.export_txt(entries, filename)
elif selected_filter.startswith("JSON"):
if selected_filter.startswith("JSON"):
self.db.export_json(entries, filename)
elif selected_filter.startswith("CSV"):
self.db.export_csv(entries, filename)