Skip to content

Commit

Permalink
lowdown: patch to fix macOS and UTF-8 bugs
Browse files Browse the repository at this point in the history
- Improve UTF-8 handling by not treating bytes >=0x80, which tend to be
  UTF-8 continuation bytes, as control characters.

  This leaves control characters U+0080 through U+009F in the output
  (incorrectly) but doesn't mangle other UTF-8 characters, so it's a net
  win.

  See: kristapsdz/lowdown#140

- Don't output a newline between a `.SH` and a heading.

  This fixes `makewhatis` output on macOS and (as a result) `man`
  completions for `fish` on macOS.

  See: kristapsdz/lowdown#138

(cherry picked from commit 7784c97)
  • Loading branch information
9999years authored and github-actions[bot] committed Sep 19, 2024
1 parent 377b500 commit 426f7bd
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions pkgs/tools/typesetting/lowdown/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ lib, stdenv, fetchurl, fixDarwinDylibNames, which, dieHook
, fetchpatch
, enableShared ? !stdenv.hostPlatform.isStatic
, enableStatic ? stdenv.hostPlatform.isStatic
# for passthru.tests
Expand All @@ -16,6 +17,40 @@ stdenv.mkDerivation rec {
hash = "sha512-EpAWTz7Zy+2qqJGgzLrt0tK7WEZ+hHbdyqzAmMiaqc6uNXscR88git6/UbTjvB9Yanvetvw9huSuyhcORCEIug==";
};

patches = [
# Improve UTF-8 handling on macOS by not treating bytes >=0x80, which tend to be
# UTF-8 continuation bytes, as control characters.
#
# This leaves control characters U+0080 through U+009F in the output
# (incorrectly) but doesn't mangle other UTF-8 characters, so it's a net
# win.
#
# See: https://github.com/kristapsdz/lowdown/pull/140
(fetchpatch {
url = "https://github.com/kristapsdz/lowdown/commit/5a02866dd682363a8e4f6b344c223cfe8b597da9.diff";
hash = "sha256-7tGhZJQQySeBv4h6A4r69BBbQkPRX/3JTw/80A8YXjQ=";
})
(fetchpatch {
url = "https://github.com/kristapsdz/lowdown/commit/c033a6886e4d6efb948782fbc389fe5f673acf36.diff";
hash = "sha256-7DvKFerAMoPifuTn7rOX4ru888HfBkpspH1opIbzj08=";
})

# Don't output a newline after .SH
#
# This fixes `makewhatis` output on macOS and (as a result) `man`
# completions for `fish` on macOS.
#
# See: https://github.com/kristapsdz/lowdown/pull/138
(fetchpatch {
url = "https://github.com/kristapsdz/lowdown/commit/e05929a09a697de3d2eb14d0f0a087a6fae22e11.diff";
hash = "sha256-P03W+hFeBKwfJB+DhGCPq0DtiOiLLc+0ZvWrWqXFvVU=";
})
(fetchpatch {
url = "https://github.com/kristapsdz/lowdown/commit/9906f8ceac586c54eb39ae78105fd84653a89c33.diff";
hash = "sha256-nBnAgTb8RDe/QpUhow3lyeR7UIVJX2o4lmP78e2fw/E=";
})
];

nativeBuildInputs = [ which dieHook ]
++ lib.optionals stdenv.isDarwin [ fixDarwinDylibNames ];

Expand Down

0 comments on commit 426f7bd

Please sign in to comment.