From 69a2f27aa7555745ac260578b4b7a428995baa59 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Thu, 8 Jul 1999 23:57:23 +0200
Subject: [PATCH] First version.

Rev: bin/pikedoc2.pike:1.1
---
 .gitattributes    |  1 +
 bin/pikedoc2.pike | 53 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100755 bin/pikedoc2.pike

diff --git a/.gitattributes b/.gitattributes
index 38369dbb39..11ef302f35 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -25,6 +25,7 @@ testfont binary
 /bin/mkpeep.pike foreign_ident
 /bin/mkwmml.pike foreign_ident
 /bin/pikedoc.pike foreign_ident
+/bin/pikedoc2.pike foreign_ident
 /bin/test_pike.pike foreign_ident
 /lib/master.pike.in foreign_ident
 /lib/modules/ADT.pmod/Table.pmod foreign_ident
diff --git a/bin/pikedoc2.pike b/bin/pikedoc2.pike
new file mode 100755
index 0000000000..03a2559ed7
--- /dev/null
+++ b/bin/pikedoc2.pike
@@ -0,0 +1,53 @@
+#!/usr/local/bin/pike
+/*
+ * $Id: pikedoc2.pike,v 1.1 1999/07/08 21:57:23 grubba Exp $
+ *
+ * Pike-doc extractor mk II
+ *
+ * Henrik Grubbström 1999-07-08
+ */
+
+/* Load spider. */
+#if constant(spider)
+#endif /* constant(spider) */
+
+string _extract_pikedoc(string tag, mapping attrs, string contents,
+			mapping res)
+{
+  /* NOTE: Drop the first line. */
+  array(string) s = (contents/"\n")[1..];
+  int i;
+
+  for(i=0; i < sizeof(s); i++) {
+    int j = search(s[i], "*:");
+
+    if (j >= 0) {
+      s[i] = s[i][j+2..];
+      if (sizeof(s[i]) && (s[i][0] == ' ')) {
+	s[i] = s[i][1..];
+      }
+    }
+  }
+
+  res->res += s*"\n" + "\n";
+
+  return("");
+}
+
+string extract_pikedoc(string input)
+{
+  mapping res = (["res":""]);
+
+  parse_html(input, ([]), (["pikedoc":_extract_pikedoc]), res);
+
+  return(res->res);
+}
+
+int main(int argc, array(string) argv)
+{
+  string raw = Stdio.stdin->read();
+
+  write(extract_pikedoc(raw));
+
+  return(0);
+}
-- 
GitLab