]> git.scottworley.com Git - paperdoorknob/commitdiff
--pandoc flag
authorScott Worley <scottworley@scottworley.com>
Sat, 25 Nov 2023 09:47:31 +0000 (01:47 -0800)
committerScott Worley <scottworley@scottworley.com>
Wed, 20 Dec 2023 01:37:10 +0000 (17:37 -0800)
README.md
default.nix
paperdoorknob.py

index e236b649fddbeb5a71569a09f320664d3cbb2d56..5b6336b24cb780774114f063ad1f40bc89174e83 100644 (file)
--- 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
index bf96eb8c437f74b47d65a4b9a09ed4d9d258e55d..6bbed2273e21a61fed51aeda480968a10b06840a 100644 (file)
@@ -1,21 +1,27 @@
 { pkgs ? import <nixpkgs> { }, 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; }
index 91909a332552e285d6b5175fee5559b6557da096..a31b659d2d403c67e0a44d4e32ebfd218168cc1d 100644 (file)
@@ -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',