From: Scott Worley Date: Sat, 25 Nov 2023 09:47:31 +0000 (-0800) Subject: --pandoc flag X-Git-Url: http://git.scottworley.com/paperdoorknob/commitdiff_plain/1e51262909ed85fcf1016973e6baff2487d889e1?ds=sidebyside --pandoc flag --- diff --git a/README.md b/README.md index e236b64..5b6336b 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ A polite glowfic → printable book scraper. * Retrieves glowfic * Minimizes server load with local caching +* Uses [pandoc](https://pandoc.org/) to convert HTML to LaTeX ### Alternatives diff --git a/default.nix b/default.nix index bf96eb8..6bbed22 100644 --- a/default.nix +++ b/default.nix @@ -1,21 +1,27 @@ { pkgs ? import { }, lint ? false }: -pkgs.python3Packages.callPackage ({ lib, buildPythonPackage, autopep8, mypy - , pylint, beautifulsoup4, requests, requests-cache, types-beautifulsoup4 - , types-requests, xdg-base-dirs }: +pkgs.python3Packages.callPackage ({ lib, buildPythonPackage, makeWrapper + , autopep8, mypy, pylint, beautifulsoup4, requests, requests-cache + , types-beautifulsoup4, types-requests, xdg-base-dirs, pandoc-cli }: buildPythonPackage rec { pname = "paperdoorknob"; version = "0.0.1"; src = lib.cleanSource ./.; + nativeBuildInputs = [ makeWrapper ]; propagatedBuildInputs = [ beautifulsoup4 requests requests-cache xdg-base-dirs ]; nativeCheckInputs = [ mypy types-beautifulsoup4 types-requests ] ++ lib.optionals lint [ autopep8 pylint ]; doCheck = true; checkPhase = "./test.sh"; + postInstall = '' + wrapProgram "$out/bin/paperdoorknob" \ + --add-flags "--pandoc=${pandoc-cli}/bin/pandoc" \ + + ''; meta = { description = "A polite glowfic → printable book scraper."; homepage = "https://git.scottworley.com/paperdoorknob"; license = pkgs.lib.licenses.gpl3; maintainers = with pkgs.lib.maintainers; [ chkno ]; }; - }) { } + }) { inherit (pkgs.haskellPackages) pandoc-cli; } diff --git a/paperdoorknob.py b/paperdoorknob.py index 91909a3..a31b659 100644 --- a/paperdoorknob.py +++ b/paperdoorknob.py @@ -30,6 +30,7 @@ def command_line_parser() -> ArgumentParser: help='The filename stem at which to write output ' + '(eg: "%(default)s" produces %(default)s.text, %(default)s.pdf, etc.)', default='book') + parser.add_argument('--pandoc', help='Location of the pandoc executable') parser.add_argument( '--timeout', help='How long to wait for HTTP requests, in seconds',