forked from github.com/blag
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8656780e5b | ||
|
|
ff1099de60 | ||
|
|
a0374a777e | ||
|
|
55eb9d7482 | ||
|
|
55e2f41b88 | ||
|
|
8c61614295 | ||
|
|
c364087eab | ||
|
|
a06947d762 | ||
|
|
12a7fb9568 | ||
|
|
caf6217221 | ||
|
|
744dadb1a5 | ||
|
|
7defacd3f6 | ||
|
|
c1d741a56c | ||
|
|
056ddbdbcb | ||
|
|
9b0bd2814a | ||
|
|
8f287c5b8d |
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [2.2.1] -- 2023-11-11
|
||||||
|
|
||||||
|
* fixed `suggests` to blag-doc
|
||||||
|
|
||||||
## [2.2.0] -- 2023-11-05
|
## [2.2.0] -- 2023-11-05
|
||||||
|
|
||||||
* switched from flake8 to ruff
|
* switched from flake8 to ruff
|
||||||
|
|||||||
46
blag/blag.py
46
blag/blag.py
@@ -10,6 +10,7 @@ import configparser
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sqlite3
|
||||||
import sys
|
import sys
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
@@ -284,6 +285,8 @@ def build(args: argparse.Namespace) -> None:
|
|||||||
generate_index(articles, index_template, args.output_dir)
|
generate_index(articles, index_template, args.output_dir)
|
||||||
generate_archive(articles, archive_template, args.output_dir)
|
generate_archive(articles, archive_template, args.output_dir)
|
||||||
generate_tags(articles, tags_template, tag_template, args.output_dir)
|
generate_tags(articles, tags_template, tag_template, args.output_dir)
|
||||||
|
generate_search(articles, pages, 'corpus.db')
|
||||||
|
logger.info("Done.")
|
||||||
|
|
||||||
|
|
||||||
def process_markdown(
|
def process_markdown(
|
||||||
@@ -511,5 +514,48 @@ def generate_tags(
|
|||||||
fh.write(result)
|
fh.write(result)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_search(
|
||||||
|
articles: list[tuple[str, dict[str, Any]]],
|
||||||
|
pages: list[tuple[str, dict[str, Any]]],
|
||||||
|
db: str,
|
||||||
|
) -> None:
|
||||||
|
"""Generate Search.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
articles, pages
|
||||||
|
db
|
||||||
|
path to sqlite file
|
||||||
|
|
||||||
|
"""
|
||||||
|
logger.info("Generating full text search.")
|
||||||
|
conn = sqlite3.connect(db)
|
||||||
|
with conn:
|
||||||
|
conn.executescript("""
|
||||||
|
drop table if exists corpus;
|
||||||
|
|
||||||
|
create virtual table corpus using fts5(
|
||||||
|
link,
|
||||||
|
text,
|
||||||
|
tokenize = porter
|
||||||
|
);
|
||||||
|
""")
|
||||||
|
|
||||||
|
with conn:
|
||||||
|
for dst, context in articles:
|
||||||
|
text = context['content']
|
||||||
|
conn.execute("""
|
||||||
|
insert into corpus(link, text)
|
||||||
|
values(:link, :text)
|
||||||
|
""", dict(link=dst, text=text))
|
||||||
|
|
||||||
|
for dst, context in pages:
|
||||||
|
text = context['content']
|
||||||
|
conn.execute("""
|
||||||
|
insert into corpus(link, text)
|
||||||
|
values(:link, :text)
|
||||||
|
""", dict(link=dst, text=text))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""Version information for the blag package."""
|
"""Version information for the blag package."""
|
||||||
|
|
||||||
__VERSION__ = "2.2.0"
|
__VERSION__ = "2.2.1"
|
||||||
|
|||||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
|||||||
|
blag (2.2.1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* fixed suggests field to blag-doc (Closes: #1055769)
|
||||||
|
|
||||||
|
-- Bastian Venthur <venthur@debian.org> Sat, 11 Nov 2023 10:57:06 +0100
|
||||||
|
|
||||||
blag (2.2.0) unstable; urgency=medium
|
blag (2.2.0) unstable; urgency=medium
|
||||||
|
|
||||||
* switched from flake8 to ruff
|
* switched from flake8 to ruff
|
||||||
|
|||||||
2
debian/control
vendored
2
debian/control
vendored
@@ -31,7 +31,7 @@ Depends:
|
|||||||
${python3:Depends},
|
${python3:Depends},
|
||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
Suggests:
|
Suggests:
|
||||||
python-blag-doc,
|
blag-doc,
|
||||||
Description: Blog-aware, static site generator
|
Description: Blog-aware, static site generator
|
||||||
Blag is a blog-aware, static site generator, written in Python. It supports
|
Blag is a blog-aware, static site generator, written in Python. It supports
|
||||||
the following features:
|
the following features:
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
build==1.0.3
|
build==1.0.3
|
||||||
mkdocs==1.5.3
|
mkdocs==1.5.3
|
||||||
mkdocs-material==9.4.6
|
mkdocs-material==9.4.8
|
||||||
mkdocstrings[python]==0.23.0
|
mkdocstrings[python]==0.23.0
|
||||||
twine==4.0.2
|
twine==4.0.2
|
||||||
wheel==0.41.2
|
wheel==0.41.3
|
||||||
pytest==7.4.3
|
pytest==7.4.3
|
||||||
pytest-cov==4.1.0
|
pytest-cov==4.1.0
|
||||||
ruff==0.1.3
|
ruff==0.1.5
|
||||||
mypy==1.6.1
|
mypy==1.6.1
|
||||||
types-markdown==3.5.0.0
|
types-markdown==3.5.0.1
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
markdown==3.5
|
markdown==3.5.1
|
||||||
feedgenerator==2.1.0
|
feedgenerator==2.1.0
|
||||||
jinja2==3.1.2
|
jinja2==3.1.2
|
||||||
pygments==2.16.1
|
pygments==2.16.1
|
||||||
|
|||||||
Reference in New Issue
Block a user