Commit Graph

171 Commits

Author SHA1 Message Date
tastytea c0a2f7e779
pass c strings to fmt (…)
continuous-integration/drone/push Build was killed Details
2022-08-16 18:15:21 +02:00
tastytea 4b5e6898cd
pass c strings to fmt (and one more)
continuous-integration/drone/push Build was killed Details
2022-08-16 18:10:15 +02:00
tastytea c16265683f
pass c strings to fmt (found some more)
continuous-integration/drone/push Build is failing Details
2022-08-16 17:59:03 +02:00
tastytea d438e2292f
pass c strings to fmt (forgot some)
continuous-integration/drone/push Build is passing Details
2022-08-16 17:42:42 +02:00
tastytea 63a8ab2683
pass c strings to fmt
continuous-integration/drone/push Build is passing Details
boost strings and filesystem paths used to be automatically converted,
but that doesn't happen anymore with fmt 9
2022-08-16 16:26:17 +02:00
tastytea 552df1a49e
Don't crash if language detection fails.
continuous-integration/drone/push Build is passing Details
If there is no container.xml or something unexpected happens, we just return an
empty string.
2021-08-20 17:51:44 +02:00
tastytea 2bede91fb7
Remove some superfluous “std::”.
continuous-integration/drone/push Build is failing Details
2021-08-20 17:07:25 +02:00
tastytea b1dcdea95e
Add language attribute to HTML output.
Bug: #16
2021-08-20 17:05:06 +02:00
tastytea 299063e02c
Add language to books, documents and matches.
Currently only the book's language is actually read and applied down the line.
2021-08-20 16:57:29 +02:00
tastytea fca719634a
Move OPF file path detection into own function. 2021-08-20 15:35:10 +02:00
tastytea d2aff45018
Move spine_filepaths() from zip:: to book::. 2021-08-20 15:29:55 +02:00
tastytea b134bd0301
Add pointer to preferred text version (raw or cleaned) to document. 2021-08-20 15:07:00 +02:00
tastytea d0738891c2
Ensure the correct order of files and the TOC.
continuous-integration/drone/push Build is passing Details
2021-08-17 14:22:28 +02:00
tastytea b53e99306c
Re-add support for raw text searching. 2021-08-17 13:55:53 +02:00
tastytea 84ef5d1bf3
Move book processing into own file.
continuous-integration/drone/push Build is failing Details
2021-08-17 13:05:14 +02:00
tastytea c99c01162d
Silence some clang-tidy warnings.
- Thread-unsafe std::getenv and std::setlocale doesn't matter for us.
- It is unlikely that we can make main() less complex without making it more
  complex elsewhere.
- Thread-unsafe std::strerror stays unsolved for now.
2021-06-29 01:58:53 +02:00
tastytea bdcf153b47
Fix usage quick-help.
continuous-integration/drone/push Build is passing Details
FILE is not optional.
2021-06-26 15:14:57 +02:00
tastytea 691dea092d
typo.
# Previous commits:
#   07ec6f7 Update german translation.
#   979dc93 Re-order --help messages.
#   961deff Add --status and --status-interval.
#   1cf6306 Add linter-exception for EXIT_FATAL.
2021-06-24 18:48:22 +02:00
tastytea 979dc9334c
Re-order --help messages.
Divided them into 3 categories:
  - general
  - search
  - output

Closes: #12
2021-06-24 18:34:07 +02:00
tastytea 961deff41d
Add --status and --status-interval.
--status prints a status message to stderr at regular intervals.
--status-interval sets the interval for status messages.

Closes: #10
2021-06-24 18:13:40 +02:00
tastytea 1cf6306f4b
Add linter-exception for EXIT_FATAL. 2021-06-24 13:16:18 +02:00
tastytea 822bff1955
Don't crash on regex errors.
continuous-integration/drone/push Build is passing Details
The error will be reported once for each initial thread.

Closes: #14
2021-06-24 13:13:49 +02:00
tastytea 18c3d8f58d
Do not show prefix in output if there is no metadata.
Previously epubgrep would output “: match” instead of “match”.

Closes: #15
2021-06-24 12:53:09 +02:00
tastytea f8270369b6
Make whitespace-reduction a bit more efficient.
continuous-integration/drone/push Build is passing Details
We now use 2 passes instead of 3.
2021-06-08 17:30:29 +02:00
tastytea 37c2fe1bb1
Add HTML output.
continuous-integration/drone/push Build is passing Details
Prints a simple HTML document with tables wrapped in articles to stdout.

Closes: #9
2021-06-08 17:11:32 +02:00
tastytea a77b90c8b1
Document output::json_all(). 2021-06-08 04:26:29 +02:00
tastytea 51f8422929
Make HTML entity map static.
continuous-integration/drone/push Build is passing Details
Drastically reduces allocations.
2021-06-07 01:20:29 +02:00
tastytea 8b5c0d289e
print_matches(): Don't check file name for each match.
We only process one file at a time.
2021-06-07 01:09:37 +02:00
tastytea f59c86e20d
Don't search for whitespace beyond the start/end of the text. 2021-06-06 23:48:06 +02:00
tastytea 0470acb00e
Make --raw work again.
continuous-integration/drone/push Build is passing Details
2021-06-06 22:37:09 +02:00
tastytea 1e29608c7e
Fix positioning of matches in search::search(). 2021-06-06 22:34:52 +02:00
tastytea 9708bb69c8
Don't attempt to access a pointer to nowhere. 2021-06-06 21:34:48 +02:00
tastytea b8431019b7
Don't inject page numbers and headline-markers into the text.
continuous-integration/drone/push Build is failing Details
The metadata is recorded in position → data pairs.

Closes: #13
2021-06-06 21:26:09 +02:00
tastytea a49c500d0f
Fix <style> and <script> erasure.
I didn't take into account that <script […]/> is possible.
2021-06-06 16:06:14 +02:00
tastytea 262aab6671
Add debug log for replacements. 2021-06-06 15:52:09 +02:00
tastytea 9067b387ef
Fix pagebreak-iterators.
Oopsie! 😄
2021-06-06 15:50:13 +02:00
tastytea 99e1cd8e98
Re-enabled address sanitizer.
continuous-integration/drone/push Build is passing Details
Found out what was wrong: I fed boost::regex_search() the pointer to a substring
that was created in-place. match[2] was a pointer to a substring inside that.

The problem was, that match was declared outside of the if-block. So after the
if-block match[2] would point to a now freed memory address. It didn't have any
effects because I didn't use match afterwards.

I rewrote the whole thing with iterators. Slightly less readable, slightly
better performance (probably).
2021-06-05 17:45:07 +02:00
tastytea bdf9a86651
Fix pagebreak-regex and range in which pagebreaks are searched. 2021-06-05 17:18:35 +02:00
tastytea f1a0015f28
Disable address sanitizer.
It complains about boost/regex/v5/sub_match.hpp:57:30 and I can't figure out
what's wrong or how to ignore it.
2021-06-05 14:24:53 +02:00
tastytea 12e1c64fc0
Make text formatting more readable. 2021-06-05 13:34:48 +02:00
tastytea 4026937f08
Don't return pointer to freed memory address. 2021-06-04 23:14:36 +02:00
tastytea de2001a442
Fix nlohmann_json error with old versions.
continuous-integration/drone/push Build is passing Details
Old versions of nlohmann_json do not have support for std::string_view,
std::filesystem::::path(?) and std::pair(?).
2021-06-01 22:35:52 +02:00
tastytea 6a4511099f
Do not add empty matches to matches_all. 2021-06-01 20:15:05 +02:00
tastytea 21989aabfe
Fix JSON output.
Bug: #3
2021-06-01 20:14:36 +02:00
tastytea f1cb16f6d0
Add JSON output.
Closes: #3
2021-06-01 19:17:44 +02:00
tastytea 7b4b9edfe5
Rename file names in search::matches to make it more clear. 2021-06-01 19:15:00 +02:00
tastytea 88e4e78db8
Add nlohmann_json dependency. 2021-06-01 18:47:12 +02:00
tastytea b0b6c00a90
Log application exit.
continuous-integration/drone/push Build is passing Details
2021-06-01 18:22:15 +02:00
tastytea a7fae314b3
Log some progress info to log file.
continuous-integration/drone/push Build is passing Details
2021-06-01 17:17:00 +02:00
tastytea 6278779029
Don't mask previous failures. 2021-06-01 17:06:25 +02:00