1
0
mirror of https://github.com/venthur/blag.git synced 2025-11-25 20:52:43 +00:00

Compare commits

...

147 Commits
0.0.2 ... 1.3.2

Author SHA1 Message Date
Bastian Venthur
595356e915 bumped version 2022-06-29 21:27:55 +02:00
Bastian Venthur
6005369108 Added some test cases for the MarkdownLinktreeProcessor 2022-06-28 21:38:47 +02:00
Bastian Venthur
db4e03afde Merge pull request #52 from venthur/improve_quickstart
improved quickstart:
2022-06-28 21:06:13 +02:00
Bastian Venthur
877c47c391 improved quickstart:
* respective default answers will be written to config if user provided
   no answer
 * added tests for quickstart
2022-06-28 21:02:51 +02:00
Bastian Venthur
3bd7125873 Merge pull request #49 from venthur/version
added version option
2022-06-28 19:51:29 +02:00
Bastian Venthur
35f6ef05b6 added version option 2022-06-20 12:30:27 +02:00
Bastian Venthur
7e8f2a5b9a prepare new version 2022-06-10 07:27:24 +02:00
Bastian Venthur
d942bf150c install man page 2022-06-09 22:23:12 +02:00
Bastian Venthur
48cfb49acb generate man page in debian package 2022-06-09 22:22:03 +02:00
Bastian Venthur
c3edbeb511 cleanup generated doc files in makefile 2022-06-09 21:52:34 +02:00
Bastian Venthur
a60887e0d6 small yaml fix m( 2022-06-09 21:44:27 +02:00
Bastian Venthur
bfbedcc3df prepared 1.3.0 2022-06-09 21:26:47 +02:00
Bastian Venthur
dff60d7399 updated changelog and readme 2022-06-09 21:22:13 +02:00
Bastian Venthur
f9b6afa80a made docs working 2022-06-09 21:13:41 +02:00
Bastian Venthur
c469b9b591 WIP 2022-06-05 21:15:30 +02:00
Bastian Venthur
d76a0834e3 Merge remote-tracking branch 'origin/dependabot/pip/pytest-7.1.2' 2022-06-05 10:30:59 +02:00
Bastian Venthur
20b1e281a1 Merge remote-tracking branch 'origin/dependabot/pip/pygments-2.12.0' 2022-06-05 10:29:54 +02:00
Bastian Venthur
58e74f8d55 Merge remote-tracking branch 'origin/dependabot/pip/jinja2-3.1.2' 2022-06-05 10:27:22 +02:00
Bastian Venthur
aad5f288af updated changelog 2022-06-05 10:26:54 +02:00
Bastian Venthur
dc76295203 Merge remote-tracking branch 'origin/dependabot/pip/markdown-3.3.7' 2022-06-05 10:26:44 +02:00
Bastian Venthur
8a9a8cd2eb updated changelog 2022-06-05 10:25:22 +02:00
dependabot[bot]
55e82393b6 Bump sphinx from 4.5.0 to 5.0.0
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 4.5.0 to 5.0.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/5.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v4.5.0...v5.0.0)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-30 14:12:27 +00:00
dependabot[bot]
b74cea8296 Bump markdown from 3.3.6 to 3.3.7
Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.3.6 to 3.3.7.
- [Release notes](https://github.com/Python-Markdown/markdown/releases)
- [Commits](https://github.com/Python-Markdown/markdown/compare/3.3.6...3.3.7)

---
updated-dependencies:
- dependency-name: markdown
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-09 14:11:54 +00:00
dependabot[bot]
58a164899c Bump jinja2 from 3.1.1 to 3.1.2
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.1...3.1.2)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-05-02 14:08:42 +00:00
Bastian Venthur
769dcca83a change dependabot check to weekly 2022-04-26 20:11:00 +02:00
dependabot[bot]
f8bcaafc30 Bump pytest from 7.1.1 to 7.1.2
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.1.1 to 7.1.2.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.1.1...7.1.2)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 14:20:24 +00:00
dependabot[bot]
f1fe211ac6 Bump pygments from 2.11.2 to 2.12.0
Bumps [pygments](https://github.com/pygments/pygments) from 2.11.2 to 2.12.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.11.2...2.12.0)

---
updated-dependencies:
- dependency-name: pygments
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-04-25 14:20:20 +00:00
Bastian Venthur
c88628350f updated changelog 2022-04-10 12:26:42 +02:00
Bastian Venthur
60e8b98232 Merge remote-tracking branch 'origin/dependabot/pip/jinja2-3.1.1' 2022-04-10 12:20:43 +02:00
Bastian Venthur
b74c34839f Merge remote-tracking branch 'origin/dependabot/pip/pygments-2.11.2' 2022-04-10 12:18:46 +02:00
Bastian Venthur
2a8f93147f Merge remote-tracking branch 'origin/dependabot/pip/pytest-7.1.1' 2022-04-10 12:18:34 +02:00
Bastian Venthur
4c12ef738c Merge remote-tracking branch 'origin/dependabot/pip/sphinx-4.5.0' 2022-04-10 12:18:14 +02:00
dependabot[bot]
bc71f51443 Bump twine from 3.7.1 to 4.0.0
Bumps [twine](https://github.com/pypa/twine) from 3.7.1 to 4.0.0.
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/twine/compare/3.7.1...4.0.0)

---
updated-dependencies:
- dependency-name: twine
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-31 14:18:30 +00:00
dependabot[bot]
4cfbdd5108 Bump sphinx from 4.3.2 to 4.5.0
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 4.3.2 to 4.5.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/4.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v4.3.2...v4.5.0)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 14:24:35 +00:00
dependabot[bot]
6a07b19eda Bump jinja2 from 3.0.3 to 3.1.1
Bumps [jinja2](https://github.com/pallets/jinja) from 3.0.3 to 3.1.1.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.0.3...3.1.1)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 14:24:32 +00:00
dependabot[bot]
d486b7a90b Bump pytest from 6.2.5 to 7.1.1
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.5 to 7.1.1.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.5...7.1.1)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-18 14:35:17 +00:00
dependabot[bot]
2355799aaa Bump pygments from 2.11.1 to 2.11.2
Bumps [pygments](https://github.com/pygments/pygments) from 2.11.1 to 2.11.2.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.11.1...2.11.2)

---
updated-dependencies:
- dependency-name: pygments
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-06 14:19:55 +00:00
Bastian Venthur
788c07446d Fixed typo 2022-01-06 11:34:33 +01:00
Bastian Venthur
c1375a1478 updated readme 2022-01-05 15:26:51 +01:00
Bastian Venthur
67d9a31256 updated changelog 2022-01-05 15:25:28 +01:00
Bastian Venthur
25c6a4c089 Merge pull request #28 from venthur/dependabot/pip/pygments-2.11.1
Bump pygments from 2.10.0 to 2.11.1
2022-01-05 15:22:18 +01:00
dependabot[bot]
e75fd4eacb Bump pygments from 2.10.0 to 2.11.1
Bumps [pygments](https://github.com/pygments/pygments) from 2.10.0 to 2.11.1.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.10.0...2.11.1)

---
updated-dependencies:
- dependency-name: pygments
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-05 14:22:05 +00:00
Bastian Venthur
88905db579 Merge pull request #26 from venthur/dependabot/pip/sphinx-4.3.2
Bump sphinx from 4.2.0 to 4.3.2
2022-01-05 15:21:33 +01:00
dependabot[bot]
702bc2e986 Bump sphinx from 4.2.0 to 4.3.2
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 4.2.0 to 4.3.2.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/4.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v4.2.0...v4.3.2)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-05 14:21:24 +00:00
Bastian Venthur
7cc4d8be45 Merge pull request #25 from venthur/dependabot/pip/twine-3.7.1
Bump twine from 3.5.0 to 3.7.1
2022-01-05 15:20:50 +01:00
Bastian Venthur
764317aa24 Merge pull request #18 from venthur/dependabot/pip/jinja2-3.0.3
Bump jinja2 from 3.0.2 to 3.0.3
2022-01-05 15:20:38 +01:00
dependabot[bot]
a8a976403f Bump twine from 3.5.0 to 3.7.1
Bumps [twine](https://github.com/pypa/twine) from 3.5.0 to 3.7.1.
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/twine/compare/3.5.0...3.7.1)

---
updated-dependencies:
- dependency-name: twine
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-01-05 14:20:36 +00:00
Bastian Venthur
fd9a6e6fa2 Merge pull request #22 from venthur/dependabot/pip/markdown-3.3.6
Bump markdown from 3.3.4 to 3.3.6
2022-01-05 15:20:26 +01:00
Bastian Venthur
8f02c107e2 Merge pull request #27 from venthur/dependabot/pip/wheel-0.37.1
Bump wheel from 0.37.0 to 0.37.1
2022-01-05 15:19:44 +01:00
Bastian Venthur
489e546173 added missing phony target 2022-01-05 15:16:58 +01:00
dependabot[bot]
9143a4dc7f Bump wheel from 0.37.0 to 0.37.1
Bumps [wheel](https://github.com/pypa/wheel) from 0.37.0 to 0.37.1.
- [Release notes](https://github.com/pypa/wheel/releases)
- [Changelog](https://github.com/pypa/wheel/blob/main/docs/news.rst)
- [Commits](https://github.com/pypa/wheel/compare/0.37.0...0.37.1)

---
updated-dependencies:
- dependency-name: wheel
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-12-22 14:17:49 +00:00
dependabot[bot]
512c12eaae Bump markdown from 3.3.4 to 3.3.6
Bumps [markdown](https://github.com/Python-Markdown/markdown) from 3.3.4 to 3.3.6.
- [Release notes](https://github.com/Python-Markdown/markdown/releases)
- [Commits](https://github.com/Python-Markdown/markdown/compare/3.3.4...3.3.6)

---
updated-dependencies:
- dependency-name: markdown
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-18 14:14:46 +00:00
dependabot[bot]
ab3eaf934d Bump jinja2 from 3.0.2 to 3.0.3
Bumps [jinja2](https://github.com/pallets/jinja) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-10 14:16:48 +00:00
Bastian Venthur
db30fe1d06 bumped version 2021-11-06 15:01:11 +01:00
Bastian Venthur
27a760d834 Merge pull request #17 from venthur/fix_autoreload
Fix autoreload
2021-11-06 15:00:08 +01:00
Bastian Venthur
a9abcd753a updated changelog 2021-11-06 14:59:53 +01:00
Bastian Venthur
3deb62ed88 Merge pull request #16 from venthur/dependabot/pip/twine-3.5.0
Bump twine from 3.4.2 to 3.5.0
2021-11-06 14:58:38 +01:00
Bastian Venthur
2366a2ae86 print the devserver URL to output 2021-11-06 14:57:37 +01:00
Bastian Venthur
0fb01e3249 updated changelog 2021-11-06 14:53:56 +01:00
Bastian Venthur
78316725cf remove warning in test due to threading race condition we don´t care
about
2021-11-06 14:51:46 +01:00
Bastian Venthur
4f1632e3cd Immediately rebuild once when entering autoreload 2021-11-06 14:12:57 +01:00
dependabot[bot]
d23f3666dc Bump twine from 3.4.2 to 3.5.0
Bumps [twine](https://github.com/pypa/twine) from 3.4.2 to 3.5.0.
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/twine/compare/3.4.2...3.5.0)

---
updated-dependencies:
- dependency-name: twine
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-04 14:17:19 +00:00
Bastian Venthur
60cfd0290a updated changelog 2021-10-23 12:21:05 +02:00
Bastian Venthur
10ea8df1ac Merge pull request #12 from venthur/dependabot/pip/jinja2-3.0.2
Bump jinja2 from 3.0.1 to 3.0.2
2021-10-23 12:18:37 +02:00
Bastian Venthur
edc89581af Merge pull request #14 from venthur/dependabot/pip/pytest-cov-3.0.0
Bump pytest-cov from 2.12.1 to 3.0.0
2021-10-23 12:17:35 +02:00
dependabot[bot]
6d75891ace Bump pytest-cov from 2.12.1 to 3.0.0
Bumps [pytest-cov](https://github.com/pytest-dev/pytest-cov) from 2.12.1 to 3.0.0.
- [Release notes](https://github.com/pytest-dev/pytest-cov/releases)
- [Changelog](https://github.com/pytest-dev/pytest-cov/blob/master/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest-cov/compare/v2.12.1...v3.0.0)

---
updated-dependencies:
- dependency-name: pytest-cov
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-23 10:16:33 +00:00
Bastian Venthur
6367f5a55a Merge branch 'master' of github.com:venthur/blag 2021-10-23 12:16:06 +02:00
dependabot[bot]
3cd316a537 Bump jinja2 from 3.0.1 to 3.0.2
Bumps [jinja2](https://github.com/pallets/jinja) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.0.1...3.0.2)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-23 10:15:27 +00:00
Bastian Venthur
3b8d2fe9d6 Merge pull request #15 from venthur/dependabot/pip/flake8-4.0.1
Bump flake8 from 3.9.2 to 4.0.1
2021-10-23 12:15:06 +02:00
Bastian Venthur
1fe576a771 Merge pull request #13 from venthur/dependabot/pip/feedgenerator-2.0.0
Bump feedgenerator from 1.9.2 to 2.0.0
2021-10-23 12:14:39 +02:00
Bastian Venthur
2f4d2267a0 fixed typo in changelog 2021-10-23 12:08:13 +02:00
dependabot[bot]
7bb51ff060 Bump flake8 from 3.9.2 to 4.0.1
Bumps [flake8](https://github.com/pycqa/flake8) from 3.9.2 to 4.0.1.
- [Release notes](https://github.com/pycqa/flake8/releases)
- [Commits](https://github.com/pycqa/flake8/compare/3.9.2...4.0.1)

---
updated-dependencies:
- dependency-name: flake8
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-11 14:17:10 +00:00
dependabot[bot]
5a8012d62b Bump feedgenerator from 1.9.2 to 2.0.0
Bumps [feedgenerator](https://github.com/getpelican/feedgenerator) from 1.9.2 to 2.0.0.
- [Release notes](https://github.com/getpelican/feedgenerator/releases)
- [Changelog](https://github.com/getpelican/feedgenerator/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getpelican/feedgenerator/compare/1.9.2...2.0.0)

---
updated-dependencies:
- dependency-name: feedgenerator
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-06 14:23:13 +00:00
Bastian Venthur
713b53d0d9 bumped version 2021-10-06 13:34:03 +02:00
Bastian Venthur
2d1d0ab302 Merge pull request #9 from venthur/0130dependabot/pip/twine-3.4.2
Bump twine from 3.4.1 to 3.4.2
2021-10-06 13:30:29 +02:00
dependabot[bot]
572710fab1 Bump twine from 3.4.1 to 3.4.2
Bumps [twine](https://github.com/pypa/twine) from 3.4.1 to 3.4.2.
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/twine/compare/3.4.1...3.4.2)

---
updated-dependencies:
- dependency-name: twine
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-06 11:30:11 +00:00
Bastian Venthur
0b66c5fbf4 Merge pull request #7 from venthur/902edependabot/pip/wheel-0.37.0
Bump wheel from 0.36.2 to 0.37.0
2021-10-06 13:29:28 +02:00
dependabot[bot]
18ecd82c5a Bump wheel from 0.36.2 to 0.37.0
Bumps [wheel](https://github.com/pypa/wheel) from 0.36.2 to 0.37.0.
- [Release notes](https://github.com/pypa/wheel/releases)
- [Changelog](https://github.com/pypa/wheel/blob/master/docs/news.rst)
- [Commits](https://github.com/pypa/wheel/compare/0.36.2...0.37.0)

---
updated-dependencies:
- dependency-name: wheel
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-10-06 11:27:47 +00:00
Bastian Venthur
a74f36be8a Merge pull request #6 from venthur/ae1edependabot/pip/pygments-2.10.0
Bump pygments from 2.9.0 to 2.10.0
2021-10-06 13:27:30 +02:00
Bastian Venthur
dd7d6cdae2 Merge pull request #10 from venthur/5121dependabot/pip/pytest-6.2.5
Bump pytest from 6.2.4 to 6.2.5
2021-10-06 13:27:09 +02:00
Bastian Venthur
39e6aa2676 Merge pull request #11 from venthur/12a6dependabot/pip/sphinx-4.2.0
Bump sphinx from 4.0.1 to 4.2.0
2021-10-06 13:26:56 +02:00
Bastian Venthur
93f6840168 Merge pull request #5 from venthur/py310
added python 3.10 to ci pipeline
2021-10-06 13:23:19 +02:00
Bastian Venthur
e27d82ac2a Merge branch 'master' into py310 2021-10-06 13:23:02 +02:00
Bastian Venthur
88b4fc8233 minor fix 2021-10-06 13:18:37 +02:00
dependabot[bot]
8923b0bb6e Bump sphinx from 4.0.1 to 4.2.0
Bumps [sphinx](https://github.com/sphinx-doc/sphinx) from 4.0.1 to 4.2.0.
- [Release notes](https://github.com/sphinx-doc/sphinx/releases)
- [Changelog](https://github.com/sphinx-doc/sphinx/blob/4.x/CHANGES)
- [Commits](https://github.com/sphinx-doc/sphinx/compare/v4.0.1...v4.2.0)

---
updated-dependencies:
- dependency-name: sphinx
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-13 14:30:08 +00:00
dependabot[bot]
2671239ac1 Bump pytest from 6.2.4 to 6.2.5
Bumps [pytest](https://github.com/pytest-dev/pytest) from 6.2.4 to 6.2.5.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/6.2.4...6.2.5)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-31 14:16:34 +00:00
dependabot[bot]
7aa6cebb63 Bump pygments from 2.9.0 to 2.10.0
Bumps [pygments](https://github.com/pygments/pygments) from 2.9.0 to 2.10.0.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.9.0...2.10.0)

---
updated-dependencies:
- dependency-name: pygments
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-18 18:41:36 +00:00
Bastian Venthur
4869ea0fd2 Merge pull request #4 from venthur/dependabot
Create dependabot.yml
2021-08-18 20:41:11 +02:00
Bastian Venthur
aeedd9b73a added changelog entry 2021-08-18 20:40:15 +02:00
Bastian Venthur
52412b8926 fix string for python 3.10 m( 2021-08-18 20:30:45 +02:00
Bastian Venthur
c0dae31b60 added python 3.10 to ci pipeline 2021-08-18 20:29:45 +02:00
Bastian Venthur
2366ee2def Create dependabot.yml 2021-08-18 20:26:34 +02:00
Bastian Venthur
67f24642e5 bumped dependency to feedgenerator to version that uses description as a
subtitle for the feed.

bumped version.
2021-08-18 20:14:40 +02:00
Bastian Venthur
f1020637e6 bumped version, added changelog url 2021-06-22 22:13:04 +02:00
Bastian Venthur
a4d596b79d updated dependencies 2021-06-22 22:12:29 +02:00
Bastian Venthur
79edd04ee8 added smartypants support 2021-04-18 13:03:05 +02:00
Bastian Venthur
9cdecdccf7 replaced args with cleandir where possible, removed tempdir 2021-03-29 13:22:04 +02:00
Bastian Venthur
499b0dfe11 added cleandir to change cwd 2021-03-29 13:02:12 +02:00
Bastian Venthur
72971408b2 added tests for build and main 2021-03-29 12:40:13 +02:00
Bastian Venthur
6445f31204 fixed bug so empty tags don't throw an error 2021-03-29 12:39:52 +02:00
Bastian Venthur
98b97fbbbd fixed bug in blag where context was not provided to pages 2021-03-29 12:06:08 +02:00
Bastian Venthur
df65dee488 added conftest 2021-03-29 12:01:09 +02:00
Bastian Venthur
d227392c79 put fixtures into conftest 2021-03-29 11:59:43 +02:00
Bastian Venthur
03663a855d added project urls 2021-03-28 11:16:41 +02:00
Bastian Venthur
0d2c54071e bumped version 2021-03-23 11:35:13 +01:00
Bastian Venthur
cffb4cf49d added devserver doc 2021-03-23 11:34:29 +01:00
Bastian Venthur
0d4052dbb5 Merge pull request #3 from venthur/docs
Docs
2021-03-23 11:22:23 +01:00
Bastian Venthur
eada12097d finalized docs 2021-03-23 11:21:24 +01:00
Bastian Venthur
4c14cac499 added templating part 2021-03-23 10:48:58 +01:00
Bastian Venthur
637d57eb85 added metadata stuff 2021-03-23 10:08:32 +01:00
Bastian Venthur
746841f05c Merge pull request #2 from venthur/docs
Docs
2021-03-22 10:54:58 +01:00
Bastian Venthur
a78d4238b6 updated docs 2021-03-22 10:53:54 +01:00
Bastian Venthur
a8e14e86d0 added doc for blag.py 2021-03-22 10:32:51 +01:00
Bastian Venthur
cdc6639447 added markdown docs 2021-03-22 10:16:56 +01:00
Bastian Venthur
9c228165e9 updated docs for devserver 2021-03-22 10:09:30 +01:00
Bastian Venthur
2b3651e7d5 fixed typo 2021-03-22 09:40:40 +01:00
Bastian Venthur
7240b0a28b included docs into makefile 2021-03-22 09:30:14 +01:00
Bastian Venthur
3c264966c0 reformatted the readme 2021-03-21 15:19:42 +01:00
Bastian Venthur
b24241544b added link to docs 2021-03-21 15:14:53 +01:00
Bastian Venthur
9a96fe5e81 use py38 2021-03-21 15:10:58 +01:00
Bastian Venthur
c60c98c37c added python version 2021-03-21 15:10:25 +01:00
Bastian Venthur
179100005c try adding path 2021-03-21 15:08:27 +01:00
Bastian Venthur
b2f32e84e4 added readthedocs config 2021-03-21 14:56:23 +01:00
Bastian Venthur
14ebc2769c api docs 2021-03-21 14:47:02 +01:00
Bastian Venthur
e2ebd950ae initial sphinx setup 2021-03-21 14:45:41 +01:00
Bastian Venthur
576121afac added link to my blog as an example 2021-03-20 17:23:11 +01:00
Bastian Venthur
2d3bb0c0f3 bumped version 2021-03-19 11:37:06 +01:00
Bastian Venthur
01b203ff5c updated requirements 2021-03-19 11:36:34 +01:00
Bastian Venthur
6f70f7ca93 Merge pull request #1 from venthur/devserver
Devserver
2021-03-19 11:30:55 +01:00
Bastian Venthur
7f832a1445 added missing devserver.py m( 2021-03-19 11:24:58 +01:00
Bastian Venthur
aac2d70fed updated readme 2021-03-19 11:22:56 +01:00
Bastian Venthur
dc6547290b added devserver 2021-03-19 11:22:11 +01:00
Bastian Venthur
b077e22984 WIP 2021-03-19 09:20:34 +01:00
Bastian Venthur
af5825b412 added info messages and set loglevel to info 2021-03-17 10:41:49 +01:00
Bastian Venthur
7d69c37032 Use description tag for Atom feed if provided 2021-03-17 10:39:26 +01:00
Bastian Venthur
dbd1679038 remove dist directory before building next version 2021-03-12 21:11:19 +01:00
Bastian Venthur
7eafaba49a updated readme 2021-03-12 21:06:54 +01:00
Bastian Venthur
a98b2071fd updated readme 2021-03-12 20:42:15 +01:00
Bastian Venthur
98e124dfc1 rely on makefile again 2021-03-12 20:15:24 +01:00
Bastian Venthur
3fe9a1ae16 simplify venv commands 2021-03-12 19:44:21 +01:00
Bastian Venthur
12c3315808 docyment PY variable 2021-03-12 19:44:12 +01:00
Bastian Venthur
7decb8fddd Try python for windows 2021-03-12 19:28:45 +01:00
Bastian Venthur
7cb373af94 try python 2021-03-12 16:58:12 +01:00
Bastian Venthur
65fdb3405a another attempt 2021-03-12 16:54:25 +01:00
Bastian Venthur
6a57641ec2 fixed usage of PY 2021-03-12 16:44:32 +01:00
Bastian Venthur
96e2eb76d4 bleh 2021-03-12 16:43:23 +01:00
Bastian Venthur
59d7d2bb71 test makefile again 2021-03-12 16:28:48 +01:00
35 changed files with 1505 additions and 127 deletions

6
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -17,8 +17,9 @@ jobs:
- macos-latest
- windows-latest
python-version:
- 3.8
- 3.9
- "3.8"
- "3.9"
- "3.10"
steps:
- uses: actions/checkout@v2
@@ -28,15 +29,10 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests
run: |
pytest
make test
- name: Run linter
run: |
flake8
make lint

3
.gitignore vendored
View File

@@ -5,6 +5,9 @@ build/
dist/
*.egg-info/
docs/_build/
docs/api/
htmlcov/
.coverage

8
.readthedocs.yaml Normal file
View File

@@ -0,0 +1,8 @@
version: 2
python:
version: 3.8
install:
- requirements: requirements.txt
- requirements: requirements-dev.txt
- path: .

View File

@@ -1,6 +1,61 @@
# Changelog
## [0.0.0] - YYYY-MM-DD
## [1.3.2] - 2022-06-29
*
* Added --version option
* Improved quickstart:
* respective default answers will be written to config if user provided no
answer
* added tests for quickstart
* Added some test cases for the MarkdownLinktreeProcessor
## [1.3.1] - 2022-06-10
* fixed man page
## [1.3.0] - 2022-06-09
* debianized package
* Small fix in makefile
* updated dependencies:
* pytest 7.1.2
* sphinx 5.0.0
* twine 3.7.1
* wheel 0.37.1
* markdown 3.3.7
* jinja 3.1.2
* pygments 2.12.0
## [1.2.0] - 2021-11-06
* `make serve` now rebuilds immediately once after called to avoid serving
stale files
* updated dependencies:
* feedgenerator 2.0.0
* jinja2 3.0.1
* pytest-cov 3.0.0
* flake8 4.0.1
* twine 3.5.0
## [1.1.0] - 2021-10-06
* added Python 3.10 to list of supported versions to test against
* added dependabot to github workflows
* updated various dependencies:
* pygments 2.10.0
* sphinx 4.2.0
* twine 3.4.2
* wheel 0.37.0
* pytest 6.2.5
## [1.0.0] - 2021-08-18
* first 1.0 release!
* bump requirements of feedgenerator to 1.9.2. this version uses the
description to provide a subtitle for the feed
## [0.0.9] - 2021-06-22
* updated to jinja 3.0
* updated to sphinx 4.0
* added link to changelog

View File

@@ -1,39 +1,53 @@
# system python interpreter. used only to create virtual environment
PY = python3
VENV = venv
BIN=$(VENV)/bin
DOCS_SRC = docs
DOCS_OUT = $(DOCS_SRC)/_build
ifeq ($(OS), Windows_NT)
BIN=$(VENV)/Scripts
else
BIN=$(VENV)/bin
PY=python
endif
.PHONY: all
all: lint test
$(VENV): requirements.txt requirements-dev.txt setup.py
python3 -m venv $(VENV)
$(BIN)/python3 -m pip install --upgrade -r requirements.txt
$(BIN)/python3 -m pip install --upgrade -r requirements-dev.txt
$(BIN)/python3 -m pip install -e .
$(PY) -m venv $(VENV)
$(BIN)/pip install --upgrade -r requirements.txt
$(BIN)/pip install --upgrade -r requirements-dev.txt
$(BIN)/pip install -e .
touch $(VENV)
test: $(VENV)
$(BIN)/python3 -m pytest
.PHONY: test
test: $(VENV)
$(BIN)/pytest
lint: $(VENV)
$(BIN)/python3 -m flake8
.PHONY: lint
lint: $(VENV)
$(BIN)/flake8
release: $(VENV)
$(BIN)/python3 setup.py sdist bdist_wheel
$(BIN)/twine upload dist/*
.PHONY: release
release: $(VENV)
rm -rf dist
$(BIN)/python setup.py sdist bdist_wheel
$(BIN)/twine upload dist/*
.PHONY: docs
docs: $(VENV)
$(BIN)/sphinx-build $(DOCS_SRC) $(DOCS_OUT)
.PHONY: clean
clean:
rm -rf build dist *.egg-info
rm -rf $(VENV)
rm -rf $(DOCS_OUT)
rm -rf $(DOCS_SRC)/api
find . -type f -name *.pyc -delete
find . -type d -name __pycache__ -delete
# coverage
rm -rf htmlcov .coverage
.PHONY: clean

View File

@@ -1,11 +1,55 @@
# blag -- a simple, blog-aware static site generator
# blag
## Installation
blag is a blog-aware, static site generator, written in [Python][].
* an example "deployment" can be found [here][venthur.de]
* online [documentation][] is available on https://readthedocs.org.
blag is named after [the blag of the webcomic xkcd][blagxkcd].
[python]: https://python.org
[blagxkcd]: https://blog.xkcd.com
[venthur.de]: https://venthur.de
[documentation]: https://blag.readthedocs.io/en/latest/
## Features
* Write content in [Markdown][]
* Theming support using [Jinja2][] templates
* Generation of Atom feeds for blog content
* Fenced code blocks and syntax highlighting using [Pygments][]
* Integrated devserver
* Available on [PyPI][]
blag runs on Linux, Mac and Windows and requires Python >= 3.8
[markdown]: https://daringfireball.net/projects/markdown/
[jinja2]: https://palletsprojects.com/p/jinja/
[pygments]: https://pygments.org/
[pypi]: https://pypi.org/project/blag/
## Install
blag is available on [PyPI][], you can install it via:
```bash
$ pip install blag
```
## Usage
On Debian or Ubuntu, you can also just install the Debian package:
TBD
```bash
$ sudo aptitude install blag
```
## Quickstart
```bash
$ pip install blag # 1. install blag
$ blag quickstart # 2. create a new site
$ vim content/hello-world.md # 3. create some content
$ blag build # 4. build the website
```

View File

@@ -1,13 +1,9 @@
#!/usr/bin/env python3
"""Small static site generator.
"""blag's core methods.
"""
__author__ = "Bastian Venthur <venthur@debian.org>"
import argparse
import os
import shutil
@@ -19,15 +15,29 @@ from jinja2 import Environment, ChoiceLoader, FileSystemLoader, PackageLoader
import feedgenerator
from blag.markdown import markdown_factory, convert_markdown
from blag.devserver import serve
from blag.version import __VERSION__
from blag.quickstart import quickstart
logger = logging.getLogger(__name__)
logging.basicConfig(
level=logging.DEBUG,
level=logging.INFO,
format='%(asctime)s %(levelname)s %(name)s %(message)s',
)
def main(args=None):
"""Main entrypoint for the CLI.
This method parses the CLI arguments and executes the respective
commands.
Parameters
----------
args : list[str]
optional parameters, used for testing
"""
args = parse_args(args)
args.func(args)
@@ -35,22 +45,30 @@ def main(args=None):
def parse_args(args=None):
"""Parse command line arguments.
Paramters
---------
Parameters
----------
args : List[str]
optional parameters, used for testing
Returns
-------
args
arparse.Namespace
"""
parser = argparse.ArgumentParser()
parser.add_argument(
'--version',
action='version',
version='%(prog)s '+__VERSION__,
)
commands = parser.add_subparsers(dest='command')
commands.required = True
build_parser = commands.add_parser('build')
build_parser = commands.add_parser(
'build',
help='Build website.',
)
build_parser.set_defaults(func=build)
build_parser.add_argument(
'-i', '--input-dir',
@@ -73,13 +91,55 @@ def parse_args(args=None):
help='Static directory (default: static)',
)
quickstart_parser = commands.add_parser('quickstart')
quickstart_parser = commands.add_parser(
'quickstart',
help="Quickstart blag, creating necessary configuration.",
)
quickstart_parser.set_defaults(func=quickstart)
serve_parser = commands.add_parser(
'serve',
help="Start development server.",
)
serve_parser.set_defaults(func=serve)
serve_parser.add_argument(
'-i', '--input-dir',
default='content',
help='Input directory (default: content)',
)
serve_parser.add_argument(
'-o', '--output-dir',
default='build',
help='Ouptut directory (default: build)',
)
serve_parser.add_argument(
'-t', '--template-dir',
default='templates',
help='Template directory (default: templates)',
)
serve_parser.add_argument(
'-s', '--static-dir',
default='static',
help='Static directory (default: static)',
)
return parser.parse_args(args)
def get_config(configfile):
"""Load site configuration from configfile.
Parameters
----------
configfile : str
path to configuration file
Returns
-------
dict
"""
config = configparser.ConfigParser()
config.read(configfile)
# check for the mandatory options
@@ -128,6 +188,16 @@ def environment_factory(template_dir=None, globals_=None):
def build(args):
"""Build the site.
This is blag's main method that builds the site, generates the feed
etc.
Parameters
----------
args : argparse.Namespace
"""
os.makedirs(f'{args.output_dir}', exist_ok=True)
convertibles = []
for root, dirnames, filenames in os.walk(args.input_dir):
@@ -205,12 +275,13 @@ def process_markdown(convertibles, input_dir, output_dir,
articles, pages : List[Tuple[str, Dict]]
"""
logger.info("Converting Markdown files...")
md = markdown_factory()
articles = []
pages = []
for src, dst in convertibles:
logger.debug(f'Processing {src}')
logger.info(f'Processing {src}')
with open(f'{input_dir}/{src}', 'r') as fh:
body = fh.read()
@@ -225,7 +296,7 @@ def process_markdown(convertibles, input_dir, output_dir,
articles.append((dst, context))
result = article_template.render(context)
else:
pages.append((dst, content))
pages.append((dst, context))
result = page_template.render(context)
with open(f'{output_dir}/{dst}', 'w') as fh_dest:
fh_dest.write(result)
@@ -243,6 +314,25 @@ def generate_feed(
blog_description,
blog_author,
):
"""Generate Atom feed.
Parameters
----------
articles : list[list[str, dict]]
list of relative output path and article dictionary
output_dir : str
where the feed is stored
base_url : str
base url
blog_title : str
blog title
blog_description : str
blog description
blog_author : str
blog author
"""
logger.info('Generating Atom feed.')
feed = feedgenerator.Atom1Feed(
link=base_url,
title=blog_title,
@@ -251,11 +341,15 @@ def generate_feed(
)
for dst, context in articles:
# if article has a description, use that. otherwise fall back to
# the title
description = context.get('description', context['title'])
feed.add_item(
title=context['title'],
author_name=blog_author,
link=base_url + dst,
description=context['title'],
description=description,
content=context['content'],
pubdate=context['date'],
)
@@ -265,6 +359,17 @@ def generate_feed(
def generate_archive(articles, template, output_dir):
"""Generate the archive page.
Parameters
----------
articles : list[list[str, dict]]
List of articles. Each article has the destination path and a
dictionary with the content.
template : jinja2.Template instance
output_dir : str
"""
archive = []
for dst, context in articles:
entry = context.copy()
@@ -277,12 +382,24 @@ def generate_archive(articles, template, output_dir):
def generate_tags(articles, tags_template, tag_template, output_dir):
"""Generate the tags page.
Parameters
----------
articles : list[list[str, dict]]
List of articles. Each article has the destination path and a
dictionary with the content.
tags_template, tag_template : jinja2.Template instance
output_dir : str
"""
logger.info("Generating Tag-pages.")
os.makedirs(f'{output_dir}/tags', exist_ok=True)
# get tags number of occurrences
all_tags = {}
for _, context in articles:
tags = context.get('tags', None)
tags = context.get('tags', [])
for tag in tags:
all_tags[tag] = all_tags.get(tag, 0) + 1
# sort by occurrence
@@ -295,7 +412,7 @@ def generate_tags(articles, tags_template, tag_template, output_dir):
# get tags and archive per tag
all_tags = {}
for dst, context in articles:
tags = context.get('tags', None)
tags = context.get('tags', [])
for tag in tags:
archive = all_tags.get(tag, [])
entry = context.copy()
@@ -309,23 +426,5 @@ def generate_tags(articles, tags_template, tag_template, output_dir):
fh.write(result)
def quickstart(args):
base_url = input("Hostname (and path) to the root? "
"[https://example.com/]: ")
title = input("Title of your website? ")
description = input("Description of your website [John Does's Blog]? ")
author = input("Author of your website [John Doe]? ")
config = configparser.ConfigParser()
config['main'] = {
'base_url': base_url,
'title': title,
'description': description,
'author': author,
}
with open('config.ini', 'w') as fh:
config.write(fh)
if __name__ == '__main__':
main()

93
blag/devserver.py Normal file
View File

@@ -0,0 +1,93 @@
"""Development Server.
This module provides functionality for blag's development server. It
automatically detects changes in certain directories and rebuilds the
site if necessary.
"""
import os
import logging
import time
import multiprocessing
from http.server import SimpleHTTPRequestHandler, HTTPServer
from functools import partial
from blag import blag
logger = logging.getLogger(__name__)
def get_last_modified(dirs):
"""Get the last modified time.
This method recursively goes through `dirs` and returns the most
recent modification time time found.
Parameters
----------
dirs : list[str]
list of directories to search
Returns
-------
int
most recent modification time found in `dirs`
"""
last_mtime = 0
for dir in dirs:
for root, dirs, files in os.walk(dir):
for f in files:
mtime = os.stat(os.path.join(root, f)).st_mtime
if mtime > last_mtime:
last_mtime = mtime
return last_mtime
def autoreload(args):
"""Start the autoreloader.
This method monitors the given directories for changes (i.e. the
last modified time). If the last modified time has changed, a
rebuild is triggered.
A rebuild is also performed immediately when this method is called
to avoid serving stale contents.
Parameters
----------
args : argparse.Namespace
"""
dirs = [args.input_dir, args.template_dir, args.static_dir]
logger.info(f'Monitoring {dirs} for changes...')
# make sure we trigger the rebuild immediately when we enter the
# loop to avoid serving stale contents
last_mtime = 0
while True:
mtime = get_last_modified(dirs)
if mtime > last_mtime:
last_mtime = mtime
logger.info('Change detected, rebuilding...')
blag.build(args)
time.sleep(1)
def serve(args):
"""Start the webserver and the autoreloader.
Parameters
----------
args : arparse.Namespace
"""
httpd = HTTPServer(('', 8000), partial(SimpleHTTPRequestHandler,
directory=args.output_dir))
proc = multiprocessing.Process(target=autoreload, args=(args,))
proc.start()
logger.info("\n\n Devserver Started -- visit http://localhost:8000\n")
httpd.serve_forever()

View File

@@ -1,3 +1,10 @@
"""Markdown Processing.
This module contains the methods responsible for blag's markdown
processing.
"""
from datetime import datetime
import logging
from urllib.parse import urlsplit, urlunsplit
@@ -23,7 +30,7 @@ def markdown_factory():
"""
md = Markdown(
extensions=[
'meta', 'fenced_code', 'codehilite',
'meta', 'fenced_code', 'codehilite', 'smarty',
MarkdownLinkExtension()
],
output_format='html5',
@@ -34,6 +41,11 @@ def markdown_factory():
def convert_markdown(md, markdown):
"""Convert markdown into html and extract meta data.
Some meta data is treated special:
* `date` is converted into datetime with local timezone
* `tags` is interpreted as a comma-separeted list of strings.
All strings are stripped and converted to lower case.
Parameters
----------
md : markdown.Markdown instance
@@ -98,6 +110,9 @@ class MarkdownLinkTreeprocessor(Treeprocessor):
class MarkdownLinkExtension(Extension):
"""markdown.extension that converts relative .md- to .html-links.
"""
def extendMarkdown(self, md):
md.treeprocessors.register(
MarkdownLinkTreeprocessor(md), 'mdlink', 0,

68
blag/quickstart.py Normal file
View File

@@ -0,0 +1,68 @@
"""Helper methods for blag's quickstart command.
"""
import configparser
def get_input(question, default):
"""Prompt for user input.
This is a wrapper around the input-builtin. It will show the default answer
in the prompt and -- if no answer was given -- use the default.
Parameters
----------
question : str
the question the user is presented
default : str
the default value that will be used if no answer was given
Returns
-------
str
"""
reply = input(f"{question} [{default}]: ")
if not reply:
reply = default
return reply
def quickstart(args):
"""Quickstart.
This method asks the user some questions and generates a
configuration file that is needed in order to run blag.
Parameters
----------
args : argparse.Namespace
"""
base_url = get_input(
"Hostname (and path) to the root?",
"https://example.com/",
)
title = get_input(
"Title of your website?",
"My little blog",
)
description = get_input(
"Description of your website?",
"John Doe's Blog",
)
author = get_input(
"Author of your website",
"John Doe",
)
config = configparser.ConfigParser()
config['main'] = {
'base_url': base_url,
'title': title,
'description': description,
'author': author,
}
with open('config.ini', 'w') as fh:
config.write(fh)

View File

@@ -1 +1 @@
__VERSION__ = '0.0.2'
__VERSION__ = '1.3.2'

1
debian/blag-doc.docs vendored Normal file
View File

@@ -0,0 +1 @@
build/html/

1
debian/blag.install vendored Normal file
View File

@@ -0,0 +1 @@
build/man/blag.1 /usr/share/man/man1

22
debian/changelog vendored Normal file
View File

@@ -0,0 +1,22 @@
blag (1.3.2) unstable; urgency=medium
* Added --version option
* Improved quickstart:
* respective default answers will be written to config if user provided no
answer
* added tests for quickstart
* Added some test cases for the MarkdownLinktreeProcessor
-- Bastian Venthur <venthur@debian.org> Wed, 29 Jun 2022 21:27:15 +0200
blag (1.3.1) unstable; urgency=medium
* re-upload with man pages
-- Bastian Venthur <venthur@debian.org> Fri, 10 Jun 2022 07:26:19 +0200
blag (1.3.0) unstable; urgency=medium
* Initial release. Closes: #1012584
-- Bastian Venthur <venthur@debian.org> Sun, 05 Jun 2022 15:20:48 +0200

59
debian/control vendored Normal file
View File

@@ -0,0 +1,59 @@
Source: blag
Section: python
Priority: optional
Maintainer: Bastian Venthur <venthur@debian.org>
Rules-Requires-Root: no
Build-Depends:
debhelper-compat (= 13),
dh-sequence-sphinxdoc,
dh-sequence-python3,
dh-python,
python3-setuptools,
python3-all,
python3-markdown,
python3-feedgenerator,
python3-jinja2,
python3-pygments,
python3-pytest,
python3-pytest-cov,
python3-sphinx,
#Testsuite: autopkgtest-pkg-python
Standards-Version: 4.6.0.1
Homepage: https://github.com/venthur/blag
Vcs-Browser: https://github.com/venthur/blag
Vcs-Git: https://github.com/venthur/blag.git
Package: blag
Architecture: all
Depends:
${python3:Depends},
${misc:Depends},
Suggests:
python-blag-doc,
Description: Blog-aware, static site generator
Blag is a blog-aware, static site generator, written in Python. It supports
the following features:
* Write content in Markdown
* Theming support using Jinja2 templates
* Generation of Atom feeds for blog content
* Fenced code blocks and syntax highlighting using Pygments
* Integrated devserver
* Available on PyPI
Package: blag-doc
Section: doc
Architecture: all
Depends:
${sphinxdoc:Depends},
${misc:Depends},
Description: Blog-aware, static site generator (documentation)
Blag is a blog-aware, static site generator, written in Python. It supports
the following features:
* Write content in Markdown
* Theming support using Jinja2 templates
* Generation of Atom feeds for blog content
* Fenced code blocks and syntax highlighting using Pygments
* Integrated devserver
* Available on PyPI
.
This is the common documentation package.

35
debian/copyright vendored Normal file
View File

@@ -0,0 +1,35 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/venthur/blag
Upstream-Name: blag
Upstream-Contact: Bastian Venthur venthur@debian.org
Files:
*
Copyright:
2022 Bastian Venthur venthur@debian.org
License: MIT
Files:
debian/*
Copyright:
2022 Bastian Venthur <venthur@debian.org>
License: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

25
debian/rules vendored Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
#export DH_VERBOSE = 1
export PYBUILD_DESTDIR=debian/blag
export PYBUILD_TEST_ARGS=--no-cov
export PYBUILD_NAME=blag
%:
dh $@ --with python3,sphinxdoc --buildsystem=pybuild
# If you need to rebuild the Sphinx documentation:
# Add sphinxdoc to the dh --with line.
#
# And uncomment the following lines.
execute_after_dh_auto_build-indep: export http_proxy=127.0.0.1:9
execute_after_dh_auto_build-indep: export https_proxy=127.0.0.1:9
execute_after_dh_auto_build-indep:
PYTHONPATH=. python3 -m sphinx -N -bhtml \
docs/ build/html # HTML generator
PYTHONPATH=. python3 -m sphinx -N -bman \
docs/ build/man # Manpage generator

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (native)

20
docs/Makefile Normal file
View File

@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

12
docs/api.rst Normal file
View File

@@ -0,0 +1,12 @@
API
===
.. autosummary::
:toctree: api
blag.__init__
blag.version
blag.blag
blag.markdown
blag.devserver
blag.quickstart

283
docs/blag.rst Normal file
View File

@@ -0,0 +1,283 @@
Manual
======
Quickstart
----------
Install blag from PyPI_
.. code-block:: sh
$ pip install blag
.. _pypi: https://pypi.org/project/blag/
Run blag's quickstart command to create the configuration needed
.. code-block:: sh
$ blag quickstart
Create some content
.. code-block:: sh
$ mkdir content
$ edit content/hello-world.md
Generate the website
.. code-block:: sh
$ blag build
By default, blag will search for content in ``content`` and the output will be
generated in ``build``. All markdown files in ``content`` will be converted to
html, all other files (i.e. static files) will be copied over).
If you want more separation between the static files and the markdown content,
you can put all static files into the ``static`` directory. Blag will copy
them over to the ``build`` directory.
If you want to customize the looks of the generated site, create a
``template`` directory and put your jinja2 templates here.
Those directories can be changed via command line arguments. See
.. code-block:: sh
$ blag --help
Manual
------
Pages and Articles
^^^^^^^^^^^^^^^^^^
Internally, blag differentiates between **pages** and **articles**.
Intuitively, pages are simple pages and articles are blog posts. The decision
whether a document is a page or an article is made depending on the presence
of the ``date`` metadata element: Any document that contains the ``date``
metadata element is an article, everything else a page.
This differentiation has consequences:
* blag uses different templates: ``page.html`` and ``article.html``
* only articles are collected in the Atom feed
* only articles are aggregated in the tag pages
blag does **not** enforce a certain directory structure for pages and
articles. You can mix and match them freely or structure them in different
directories. blag will mirror the structure found in the ``content`` directory
::
content/
article1.md
article2.md
page1.md
results in:
::
build/
article1.html
article2.html
page1.html
Arbitrary complex structures are possible too:
::
content/
posts/
2020/
2020-01-01-foo.md
2020-02-01-foo.md
pages/
foo.md
bar.md
results in:
::
build/
posts/
2020/
2020-01-01-foo.html
2020-02-01-foo.html
pages/
foo.html
bar.html
Static Files
^^^^^^^^^^^^
Static files can be put into the ``content`` directory and will be copied over
to the ``build`` directory as well. If you want better separation between
content and static files, you can create a ``static`` directory and put the
files there. All files and directories found in the ``static`` directory will
be copied over to ``build``.
::
content/
foo.md
bar.md
kitty.jpg
results in:
::
build/
foo.html
bar.html
kitty.jpg
Alternatively:
::
content/
foo.md
bar.md
static/
kitty.jpg
results in:
::
build/
foo.html
bar.html
kitty.jpg
Internal Links
--------------
In contrast to most other static blog generators, blag will automatically
convert **relative** markdown links. That means you can link you content using
relative markdown links and blag will convert them to html automatically. The
advantage is that your content tree in markdown is consistent and
self-contained even if you don't generate html from it.
.. code-block:: markdown
[...]
this is a [link](foo.md) to an internal page foo.
becomes
.. code-block:: html
<p>this is a <a href="foo.html">link</a> to an internal page foo.</p>
Templating
----------
Custom templates are **optional** and stored by default in the ``templates``
directory. blag will search the ``templates`` directory first, and fall back
to blag's default built-in templates.
============ ====================================== ===================
Template Used For Variables
============ ====================================== ===================
page.html pages (i.e. non-articles) site, content, meta
article.html articles (i.e. blog posts) site, content, meta
archive.html archive- and landing page of the blog site, archive
tags.html list of tags site, tags
tag.html archive of Articles with a certain tag site, archive, tag
============ ====================================== ===================
If you make use of Jinja2's template inheritance, you can of course have more
template files in the ``templates`` directory.
``site``
This dictionary contains the site configuration, namely: ``base_url``,
``title``, ``description`` and ``author``. Don't confuse the site-title
and -description with the title and description of individual pages or
articles.
``content``
HTML, converted from markdown.
``meta``
``meta`` stands for all metadata elements available in the article or
page. Please be aware that those are not wrapped in a dictionary, but
**directly** available as variables.
``archive``
A list of ``[destination path, context]`` tuples, where the context are
the respective variables that would be provided to the individual page or
article.
``tags``
List of tags.
``tag``
A tag.
Metadata
---------
blag supports metadata elements in the markdown files. They must come before
the content and should be separated from the content with a blank line:
.. code-block:: markdown
title: foo
date: 2020-02-02
tags: this, is, a, test
description: some subtitle
this is my content.
[...]
blag supports *arbitrary* metadata in your documents, and you can use them
freely in you templates. However, some metadata elements are treated special:
``date``
If a document contains the ``date`` element, it is treated as an
**article**, otherwise as a **page**. Additionally, ``date`` elements are
expected to be in ISO format (e.g. ``1980-05-05 21:58``). They are
automatically converted into ``datetime`` objects with the local timezone
attached.
``tags``
Tags are interpreted as a comma separated list. All elements are stripped
and converted to lower-case: ``tags: foo, Foo Bar, BAZ`` becomes: ``[foo,
foo bar, baz]``.
Tags in **articles** are also used to generate the tag-pages, that
aggregate all articles per tag.
``title`` and ``description``
The title and description are used in the html header and in the atom
feed.
Devserver
---------
blag provides a devserver which you can use for local web-development. The
devserver provides a simple web server, serving your site in
http://localhost:8000 and will automatically rebuild the project when it
detects modifications in one of the ``content``, ``static`` and ``templates``
directories.
.. code-block:: sh
$ blag serve

69
docs/conf.py Normal file
View File

@@ -0,0 +1,69 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
import blag
# -- Project information -----------------------------------------------------
project = 'blag'
copyright = '2021, Bastian Venthur'
author = 'Bastian Venthur'
# The full version, including alpha/beta/rc tags
release = blag.__VERSION__
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autosummary',
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
]
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
autodoc_default_options = {
'members': True,
'undoc-members': True,
'private-members': True,
'special-members': True,
}
autosummary_generate = True

53
docs/index.rst Normal file
View File

@@ -0,0 +1,53 @@
.. blag documentation master file, created by
sphinx-quickstart on Sun Mar 21 13:39:00 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to blag!
================
blag is a blog-aware, static site generator, written in Python_. An example
"deployment" can be found here_.
blag is named after the blag of the webcomic xkcd_.
.. _python: https://python.org
.. _xkcd: https://blog.xkcd.com
.. _here: https://venthur.de
Features
--------
* Write content in Markdown_
* Theming support using Jinja2_ templates
* Generation of Atom feeds for blog content
* Fenced code blocks and syntax highlighting using Pygments_
* Integrated devserver
* Available on PyPI_
blag runs on Linux, Mac and Windows and requires Python >= 3.8
.. _markdown: https://daringfireball.net/projects/markdown/
.. _jinja2: https://palletsprojects.com/p/jinja/
.. _pygments: https://pygments.org/
.. _pypi: https://pypi.org/project/blag/
Documentation
=============
.. toctree::
:maxdepth: 2
:caption: Contents:
blag.rst
api.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

35
docs/make.bat Normal file
View File

@@ -0,0 +1,35 @@
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
:end
popd

View File

@@ -1,5 +1,6 @@
twine==3.3.0
wheel==0.36.2
pytest==6.2.1
pytest-cov==2.10.1
flake8==3.8.4
sphinx==5.0.0
twine==4.0.0
wheel==0.37.1
pytest==7.1.2
pytest-cov==3.0.0
flake8==4.0.1

View File

@@ -1,4 +1,4 @@
markdown==3.3.3
feedgenerator==1.9.1
jinja2==2.11.2
pygments==2.7.3
markdown==3.3.7
feedgenerator==2.0.0
jinja2==3.1.2
pygments==2.12.0

View File

@@ -6,4 +6,4 @@ addopts =
--cov-report=term-missing:skip-covered
[flake8]
exclude = venv,build
exclude = venv,build,docs

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env python
from setuptools import setup
meta = {}
@@ -10,13 +9,19 @@ meta['long_description'] = open('./README.md').read()
setup(
name='blag',
version=meta['__VERSION__'],
description='simple blog-aware static site generator',
description='blog-aware, static site generator',
long_description=meta['long_description'],
long_description_content_type='text/markdown',
keywords='markdown blag blog static site generator cli',
author='Bastian Venthur',
author_email='mail@venthur.de',
url='https://github.com/venthur/blag',
project_urls={
'Documentation': 'https://blag.readthedocs.io/',
'Source': 'https://github.com/venthur/blag',
'Changelog':
'https://github.com/venthur/blag/blob/master/CHANGELOG.md',
},
python_requires='>=3.8',
package_data={
'blag': ['templates/*'],

86
tests/conftest.py Normal file
View File

@@ -0,0 +1,86 @@
from tempfile import TemporaryDirectory
import os
import pytest
from blag import blag
@pytest.fixture
def environment():
site = {
'base_url': 'site base_url',
'title': 'site title',
'description': 'site description',
'author': 'site author',
}
env = blag.environment_factory(globals_=dict(site=site))
yield env
@pytest.fixture
def page_template(environment):
yield environment.get_template('page.html')
@pytest.fixture
def article_template(environment):
yield environment.get_template('article.html')
@pytest.fixture
def archive_template(environment):
yield environment.get_template('archive.html')
@pytest.fixture
def tags_template(environment):
yield environment.get_template('tags.html')
@pytest.fixture
def tag_template(environment):
yield environment.get_template('tag.html')
@pytest.fixture
def cleandir():
"""Create a temporary workind directory and cwd.
"""
config = """
[main]
base_url = https://example.com/
title = title
description = description
author = a. u. thor
"""
with TemporaryDirectory() as dir:
for d in 'content', 'build', 'static', 'templates':
os.mkdir(f'{dir}/{d}')
with open(f'{dir}/config.ini', 'w') as fh:
fh.write(config)
# change directory
old_cwd = os.getcwd()
os.chdir(dir)
yield dir
# and change back afterwards
os.chdir(old_cwd)
@pytest.fixture
def args(cleandir):
class NameSpace:
def __init__(self, **kwargs):
for name in kwargs:
setattr(self, name, kwargs[name])
args = NameSpace(
input_dir='content',
output_dir='build',
static_dir='static',
template_dir='templates',
)
yield args

View File

@@ -1,21 +1,86 @@
from tempfile import TemporaryDirectory
import os
from datetime import datetime
import pytest
from blag import blag
@pytest.fixture
def outdir():
with TemporaryDirectory() as dir:
yield dir
def test_generate_feed(outdir):
def test_generate_feed(cleandir):
articles = []
blag.generate_feed(articles, outdir, ' ', ' ', ' ', ' ')
assert os.path.exists(f'{outdir}/atom.xml')
blag.generate_feed(articles, 'build', ' ', ' ', ' ', ' ')
assert os.path.exists('build/atom.xml')
def test_feed(cleandir):
articles = [
[
'dest1.html',
{
'title': 'title1',
'date': datetime(2019, 6, 6),
'content': 'content1',
}
],
[
'dest2.html',
{
'title': 'title2',
'date': datetime(1980, 5, 9),
'content': 'content2',
}
],
]
blag.generate_feed(articles, 'build', 'https://example.com/',
'blog title', 'blog description', 'blog author')
with open('build/atom.xml') as fh:
feed = fh.read()
assert '<title>blog title</title>' in feed
# enable when https://github.com/getpelican/feedgenerator/issues/22
# is fixed
# assert '<subtitle>blog description</subtitle>' in feed
assert '<author><name>blog author</name></author>' in feed
# article 1
assert '<title>title1</title>' in feed
assert '<summary type="html">title1' in feed
assert '<published>2019-06-06' in feed
assert '<content type="html">content1' in feed
assert '<link href="https://example.com/dest1.html"' in feed
# article 2
assert '<title>title2</title>' in feed
assert '<summary type="html">title2' in feed
assert '<published>1980-05-09' in feed
assert '<content type="html">content2' in feed
assert '<link href="https://example.com/dest2.html"' in feed
def test_generate_feed_with_description(cleandir):
# if a description is provided, it will be used as the summary in
# the feed, otherwise we simply use the title of the article
articles = [[
'dest.html',
{
'title': 'title',
'description': 'description',
'date': datetime(2019, 6, 6),
'content': 'content',
}
]]
blag.generate_feed(articles, 'build', ' ', ' ', ' ', ' ')
with open('build/atom.xml') as fh:
feed = fh.read()
assert '<title>title</title>' in feed
assert '<summary type="html">description' in feed
assert '<published>2019-06-06' in feed
assert '<content type="html">content' in feed
def test_parse_args_build():
@@ -109,3 +174,116 @@ def test_environment_factory():
env = blag.environment_factory(globals_=globals_)
assert env.globals['foo'] == 'bar'
assert env.globals['test'] == 'me'
def test_process_markdown(cleandir, page_template, article_template):
page1 = """\
title: some page
some text
foo bar
"""
article1 = """\
title: some article1
date: 2020-01-01
some text
foo bar
"""
article2 = """\
title: some article2
date: 2021-01-01
some text
foo bar
"""
convertibles = []
for i, txt in enumerate((page1, article1, article2)):
i = str(i)
with open(f'content/{i}', 'w') as fh:
fh.write(txt)
convertibles.append([i, i])
articles, pages = blag.process_markdown(
convertibles,
'content',
'build',
page_template,
article_template
)
assert isinstance(articles, list)
assert len(articles) == 2
for dst, context in articles:
assert isinstance(dst, str)
assert isinstance(context, dict)
assert 'content' in context
assert isinstance(pages, list)
assert len(pages) == 1
for dst, context in pages:
assert isinstance(dst, str)
assert isinstance(context, dict)
assert 'content' in context
def test_build(args):
page1 = """\
title: some page
some text
foo bar
"""
article1 = """\
title: some article1
date: 2020-01-01
tags: foo, bar
some text
foo bar
"""
article2 = """\
title: some article2
date: 2021-01-01
tags: baz
some text
foo bar
"""
# write some convertibles
convertibles = []
for i, txt in enumerate((page1, article1, article2)):
i = str(i)
with open(f'{args.input_dir}/{i}.md', 'w') as fh:
fh.write(txt)
convertibles.append([i, i])
# some static files
with open(f'{args.static_dir}/test', 'w') as fh:
fh.write('hello')
os.mkdir(f'{args.input_dir}/testdir')
with open(f'{args.input_dir}/testdir/test', 'w') as fh:
fh.write('hello')
blag.build(args)
def test_main(cleandir):
blag.main(['build'])
def test_cli_version(capsys):
with pytest.raises(SystemExit) as ex:
blag.main(['--version'])
# normal system exit
assert ex.value.code == 0
# proper version reported
out, _ = capsys.readouterr()
assert blag.__VERSION__ in out

66
tests/test_devserver.py Normal file
View File

@@ -0,0 +1,66 @@
import time
import threading
import pytest
from blag import devserver
def test_get_last_modified(cleandir):
# take initial time
t1 = devserver.get_last_modified(['content'])
# wait a bit, create a file and measure again
time.sleep(0.1)
with open('content/test', 'w') as fh:
fh.write('boo')
t2 = devserver.get_last_modified(['content'])
# wait a bit and take time again
time.sleep(0.1)
t3 = devserver.get_last_modified(['content'])
assert t2 > t1
assert t2 == t3
def test_autoreload_builds_immediately(args):
# create a dummy file that can be build
with open('content/test.md', 'w') as fh:
fh.write('boo')
t = threading.Thread(target=devserver.autoreload,
args=(args, ),
daemon=True,)
t0 = devserver.get_last_modified(['build'])
t.start()
# try for 5 seconds...
for i in range(5):
time.sleep(1)
t1 = devserver.get_last_modified(['build'])
print(t1)
if t1 > t0:
break
assert t1 > t0
@pytest.mark.filterwarnings("ignore::pytest.PytestUnhandledThreadExceptionWarning") # noqa
def test_autoreload(args):
t = threading.Thread(target=devserver.autoreload,
args=(args, ),
daemon=True,)
t.start()
t0 = devserver.get_last_modified(['build'])
# create a dummy file that can be build
with open('content/test.md', 'w') as fh:
fh.write('boo')
# try for 5 seconds to see if we rebuild once...
for i in range(5):
time.sleep(1)
t1 = devserver.get_last_modified(['build'])
if t1 > t0:
break
assert t1 > t0

View File

@@ -32,6 +32,20 @@ def test_convert_markdown_links(input_, expected):
assert expected in html
@pytest.mark.parametrize("input_, expected", [
# scheme
('[test](https://)', 'https://'),
# netloc
('[test](//test.md)', '//test.md'),
# no path
('[test]()', ''),
])
def test_dont_convert_normal_links(input_, expected):
md = markdown_factory()
html, _ = convert_markdown(md, input_)
assert expected in html
@pytest.mark.parametrize("input_, expected", [
('foo: bar', {'foo': 'bar'}),
('foo: those are several words', {'foo': 'those are several words'}),
@@ -49,3 +63,31 @@ def test_convert_metadata(input_, expected):
def test_markdown_factory():
md = markdown_factory()
assert isinstance(md, markdown.Markdown)
def test_smarty():
md = markdown_factory()
md1 = """
this --- is -- a test ...
"""
html, meta = convert_markdown(md, md1)
assert 'mdash' in html
assert 'ndash' in html
assert 'hellip' in html
def test_smarty_code():
md = markdown_factory()
md1 = """
```
this --- is -- a test ...
```
"""
html, meta = convert_markdown(md, md1)
assert 'mdash' not in html
assert 'ndash' not in html
assert 'hellip' not in html

24
tests/test_quickstart.py Normal file
View File

@@ -0,0 +1,24 @@
from blag.quickstart import get_input, quickstart
def test_get_input_default_answer(monkeypatch):
monkeypatch.setattr('builtins.input', lambda x: '')
answer = get_input("foo", "bar")
assert answer == 'bar'
def test_get_input(monkeypatch):
monkeypatch.setattr('builtins.input', lambda x: 'baz')
answer = get_input("foo", "bar")
assert answer == 'baz'
def test_quickstart(cleandir, monkeypatch):
monkeypatch.setattr('builtins.input', lambda x: 'foo')
quickstart(None)
with open('config.ini', 'r') as fh:
data = fh.read()
assert 'base_url = foo' in data
assert 'title = foo' in data
assert 'description = foo' in data
assert 'author = foo' in data

View File

@@ -1,46 +1,5 @@
import datetime
import pytest
from blag import blag
@pytest.fixture
def environment():
site = {
'base_url': 'site base_url',
'title': 'site title',
'description': 'site description',
'author': 'site author',
}
env = blag.environment_factory(globals_=dict(site=site))
yield env
@pytest.fixture
def page_template(environment):
yield environment.get_template('page.html')
@pytest.fixture
def article_template(environment):
yield environment.get_template('article.html')
@pytest.fixture
def archive_template(environment):
yield environment.get_template('archive.html')
@pytest.fixture
def tags_template(environment):
yield environment.get_template('tags.html')
@pytest.fixture
def tag_template(environment):
yield environment.get_template('tag.html')
def test_page(page_template):
ctx = {