From babf9c945880e18cfe691449dd056f40adeafbea Mon Sep 17 00:00:00 2001 From: tavo-wasd Date: Sat, 18 Nov 2023 00:35:38 -0600 Subject: [PATCH] major revamp --- public/index.php | 141 ++++++++++++++++++++++++++++------------------- 1 file changed, 85 insertions(+), 56 deletions(-) diff --git a/public/index.php b/public/index.php index 49e2cd7..ba9c4af 100644 --- a/public/index.php +++ b/public/index.php @@ -16,49 +16,63 @@ along with Foobar. If not, see . --> - tmp/$uid.pdf"; - # In case you want to use an external - # script to compile with groff: - #$comp = "sh groff-compiler.sh"; -?> + exec("mkdir -p gen && rm -rf gen/*"); + $uid = bin2hex(random_bytes(5)); + # Configuration + $groff = "/usr/bin/groff"; + $cmd = "$groff -ketpG -mspdf -Tpdf gen/$uid.ms > gen/$uid.pdf"; + # In case you want to use an external script + #$cmd = "sh groff-compiler.sh"; + + if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['codebox'])) { + $code = $_POST['codebox']; + file_put_contents("gen/$uid.ms", $code); + exec("$cmd"); + } +?> + + + Groff Web - - - - -

Groff Web

-

- -
-
-
- - -
- - -

PDF cannot be displayed.

+

+ Groff Web | +

+
+
+
+ +
+ + +
+

+.\" Template
+.\" .ds FAM T       \" H=Helvetica C=Courier
+.\" .nr PS 10p      \" Point size
+.\" .nr VS 12p      \" Line spacing
+.\" .so report.tmac \" Cover page
+.\" .so utils.tmac  \" General utils
+.\" .so toc.tmac    \" Relocate toc
+.\" .so md.tmac     \" Md-like sections
+.\" .so math.tmac   \" Math utils
+.\" .so es.tmac     \" Spanish
+.
+.TL
+title
+.AU
+author
+.AI
+institution
+.
+.AB
+abstract
+.AE
+.
+.NH
+.XN "numbered heading"
+.
+.PP
+indented \f[CW]paragraph\f[] \m[blue]with\m[] \f[B]some\f[] \f[I]formatting\f[]
+.
+.\" .TC
+                
+
- - - +