better docs

This commit is contained in:
2021-01-19 13:03:03 +01:00
parent 5c3368f953
commit b91b26f586
3 changed files with 21 additions and 42 deletions

View File

@@ -4,13 +4,13 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="../style.css">
</head> </head>
<body> <body>
<div class="content"> <div class="content">
<div class="logo"> <div class="logo">
<a href="http://github.com/carp-lang/Carp"> <a href="">
<img src="logo.png"> <img src="">
</a> </a>
<div class="title"> <div class="title">
zlib zlib
@@ -56,25 +56,6 @@ levels are defined in <a href="#ZLevel"><code>ZLib.ZLevel</code></a>, and are <c
default.</p> default.</p>
</div> </div>
<div class="binder">
<a class="anchor" href="#ZBytes">
<h3 id="ZBytes">
ZBytes
</h3>
</a>
<div class="description">
module
</div>
<p class="sig">
Module
</p>
<span>
</span>
<p class="doc">
</p>
</div>
<div class="binder"> <div class="binder">
<a class="anchor" href="#ZLevel"> <a class="anchor" href="#ZLevel">
<h3 id="ZLevel"> <h3 id="ZLevel">
@@ -108,7 +89,7 @@ default.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String] (Result ZBytes String)) (Fn [(Ref String a)] (Result ZBytes String))
</p> </p>
<pre class="args"> <pre class="args">
(deflate s) (deflate s)
@@ -132,7 +113,7 @@ well, and an <code>Error</code> returning an error message otherwise.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [&amp;String, ZLevel] (Result ZBytes String)) (Fn [(Ref String a), ZLib.ZLevel] (Result ZBytes String))
</p> </p>
<pre class="args"> <pre class="args">
(deflate-with s level) (deflate-with s level)
@@ -155,7 +136,7 @@ well, and an <code>Error</code> returning an error message otherwise.</p>
defn defn
</div> </div>
<p class="sig"> <p class="sig">
(λ [ZBytes] (Result String String)) (Fn [ZBytes] (Result String String))
</p> </p>
<pre class="args"> <pre class="args">
(inflate s) (inflate s)

View File

@@ -1,13 +1,10 @@
(load "zlib.carp") (load "zlib.carp")
(defndynamic gendocs []
(do
(Project.config "title" "zlib") (Project.config "title" "zlib")
(Project.config "docs-directory" "./docs/") (Project.config "docs-directory" "./docs/")
(Project.config "docs-logo" "") (Project.config "docs-logo" "")
(Project.config "docs-styling" "style.css") (Project.config "docs-styling" "../style.css")
(Project.config "docs-generate-index" false) (Project.config "docs-generate-index" false)
(save-docs ZLib))) (save-docs ZLib)
(gendocs)
(quit) (quit)

View File

@@ -41,14 +41,13 @@ default.")
; i tried doing this in carp, but its a bit of a pain to wrap the API ; i tried doing this in carp, but its a bit of a pain to wrap the API
; idiomatically, so for now youll only get regular inflation and deflation ; idiomatically, so for now youll only get regular inflation and deflation
(defmodule ZLib (defmodule ZLib
(doc ZBytes "is an opaque bytes type with an associated length.")
(register-type ZBytes [ (register-type ZBytes [
len Int len Int
bytes String bytes String
]) ])
(private ZBytes)
(hidden ZBytes)
(private ZRes)
(hidden ZRes)
(register-type ZRes) (register-type ZRes)
(defmodule ZRes (defmodule ZRes
(register ok? (Fn [&ZRes] Bool) "ZRes_is_ok") (register ok? (Fn [&ZRes] Bool) "ZRes_is_ok")
@@ -56,12 +55,9 @@ default.")
(register str (Fn [ZRes] String) "ZRes_str") (register str (Fn [ZRes] String) "ZRes_str")
(register err (Fn [ZRes] String) "ZRes_err") (register err (Fn [ZRes] String) "ZRes_err")
) )
(private ZRes)
(hidden ZRes)
(doc ZLevel "is a type used in conjunction with
[`deflate-with`](#deflate-with). It controls the compression level.
The constructors are `NoCompression`, `BestSpeed`, `BestCompression`, and
`DefaultCompression`, which is, well, the default.")
(deftype ZLevel (deftype ZLevel
(NoCompression []) (NoCompression [])
(BestSpeed []) (BestSpeed [])
@@ -76,6 +72,11 @@ The constructors are `NoCompression`, `BestSpeed`, `BestCompression`, and
(BestSpeed) 1 (BestSpeed) 1
(BestCompression) 9 (BestCompression) 9
(DefaultCompression) -1))) (DefaultCompression) -1)))
(doc ZLevel "is a type used in conjunction with
[`deflate-with`](#deflate-with). It controls the compression level.
The constructors are `NoCompression`, `BestSpeed`, `BestCompression`, and
`DefaultCompression`, which is, well, the default.")
(private inflate-) (private inflate-)
(hidden inflate-) (hidden inflate-)