aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--README.md17
-rwxr-xr-xopenrussian.lua9
3 files changed, 26 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 8fe3880..8d51ea3 100644
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ install : openrussian openrussian-sqlite3.db \
cp openrussian-completion.bash $(DESTDIR)$(COMPLETIONSDIR)/openrussian
mkdir -p $(DESTDIR)$(PREFIX)/man/man1
cp openrussian.1 $(DESTDIR)$(PREFIX)/man/man1
- mandb
+ mandb || true
clean:
$(RM) openrussian openrussian-sqlite3.db
diff --git a/README.md b/README.md
index 31b49b5..89fd84d 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,8 @@ Possible future features:
* Be tolerant to typing mistakes.
* Accented characters are still broken in nroff tables
(see https://lists.gnu.org/archive/html/groff/2018-08/msg00000.html).
+ We could and probably should of translate most vowel-accent combinations to single precomposed codepoints,
+ but that might cause problems when copying text from the terminal.
## Installation
@@ -72,6 +74,21 @@ If it returns lots of errors, you should probably stay with the original databas
Otherwise, the error messages might help in fixing/upgrading the script.
You are of course welcome to contribute patches. :-)
+### FreeBSD
+
+Build-time dependencies:
+
+ pkg install gmake pkgconf groff lua52 lua52-luasql-sqlite3 lua52-luarocks wget sqlite3
+
+Installing [luautf8](https://github.com/starwing/luautf8) using LuaRocks:
+
+ luarocks52 install luautf8
+
+Building is straight forward:
+
+ gmake LUA=lua52 LUAC=luac52
+ gmake install
+
### NixOS
`openrussian-cli` is part of the `nixos-unstable` (and soon `nixos-21.05`) channels.
diff --git a/openrussian.lua b/openrussian.lua
index 961efdc..6ee5628 100755
--- a/openrussian.lua
+++ b/openrussian.lua
@@ -600,7 +600,14 @@ end
-- Open stream only now, after no more messages have to be written to
-- stdout/stderr.
-out_stream = assert(use_stdout and io.stdout or io.popen("man /dev/stdin", "w"))
+if use_stdout then
+ out_stream = io.stdout
+else
+ local size_stream = io.popen("stty size")
+ local columns = size_stream and size_stream:read("*a"):match("%d+ (%d+)") or 80
+ out_stream = io.popen("nroff -Kutf8 -Tutf8 -t -man -rLL="..columns.."n -rLT="..columns.."n | less -r", "w")
+end
+assert(out_stream)
-- NOTE: The headers and footers shouldn't contain critical information
-- since they might not be printed at all.