Commit graph

18 commits

Author SHA1 Message Date
72ddaaf1bc
refactor: Extract exporters to separate module 2024-01-25 21:42:33 +01:00
f4a26292a0
fix: Remove debug print statement 2024-01-24 11:13:35 +01:00
c53cd563b7
feat: Add pocketbook extraction 2024-01-24 08:56:21 +01:00
9169e1c98a
chore: Improve stdout newline handling
Always strip all newlines of the end of all entries, and then add
a single newline back between entries.
2024-01-23 09:49:31 +01:00
765de505bb
refactor: Remove AnnotatedDocument class
The AnnotatedDocument class was, essentially, a simple tuple of a document
and a list of annotations. While not bad in a vacuum, it is unwieldy and
passing this around instead of a document, annotations, or both where
necessary is more restrictive and frankly unnecessary.

This commit removes the data class and any instances of its use. Instead,
we now pass the individual components around to anything that needs them.
This also frees us up to pass only annotations around for example.

We also do not iterate through the selected papis documents to work on
in each exporter anymore (since we only pass a single document), but
in the main function itself. This leads to less duplication and makes
the overall run function the overall single source of iteration through
selected documents. Everything else only knows about a single document -
the one it is operating on - which seems much neater.

For now, it does not change much, but should make later work on extra
exporters or extractors easier.
2024-01-20 16:36:24 +01:00
5cd5a05062
chore: Fix black fmt
Some checks failed
ci/woodpecker/push/test unknown status
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/static_analysis Pipeline was successful
2023-10-17 22:07:09 +02:00
aeb18ae358
feat: Add option to force-add annotations
Will turn off looking for duplicate annotations and simply add all.
2023-10-17 22:05:11 +02:00
7ee8d4911e
refactor: Make formatters functions
Formatters have been classes so far which contained some data (the
tamplate to use for formatting and the annotations and documents to
format) and the actual formatting logic (an execute function).

However, we can inject the annotations to be formatted and the templates
so far are static only, so they can be simple variables (we can think
about how to inject them at another point should it come up, no
bikeshedding now).

This way, we can simply pass around one function per formatter, which
should make the code much lighter, easier to add to and especially less
stateful which means less areas of broken interactions to worry about.
2023-09-21 21:54:24 +02:00
e511ffa48d
feat: Add CSV formatter
Added formatter for csv-compatible syntax. The formatting is quite basic
with no escaping happening should that be necessary. However, for an
initial csv output it suffices for me.
2023-09-20 09:15:00 +02:00
5a6d672c76
refactor: Move formatting logic to formatters
Formatters (previously templates) were pure data containers before,
continating the 'template' for how things should be formatted using
mustache. The formatting would be done a) in the exporters and b) in the
annotations.

This spread of formatting has now been consolidated into the Formatter,
which fixes the overall spread of formatting code and now can coherently
format a whole output instead of just individual annotations.

A formatter contains references to all documents and contained
annotations and will format everything at once by default, but the
formatting function can be invoked with reference to a specific
annotated document to only format that.

This commit should put more separation into the concerns of exporter and
formatter and made formatting a concern purely of the formatters and
annotation objects.
2023-09-20 09:14:58 +02:00
07d4de9a46
docs: Add docstrings 2023-09-20 09:13:04 +02:00
4eb983d9e3
refactor: Move templating to separate file 2023-09-20 09:12:59 +02:00
5450776eb2
refactor: Extract templating to model module 2023-09-20 09:12:45 +02:00
e56f014136
Add formatting style Markdown 2023-08-31 21:40:17 +02:00
c6b95a4742
Fix spacing in print output 2023-08-28 18:05:52 +02:00
2109c6535d
Add decoration to pretty printed author 2023-08-28 17:04:15 +02:00
1bb1b80620
Add debug logging for extractor 2023-08-28 12:53:17 +02:00
a22cc635b2
initial commit 2023-08-28 10:28:06 +02:00