Skip to content

Commit

Permalink
Fix docs on mobile.
Browse files Browse the repository at this point in the history
  • Loading branch information
fubark committed Jan 6, 2024
1 parent 3d0d00c commit 2f26e63
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 14 deletions.
11 changes: 7 additions & 4 deletions docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1742,8 +1742,8 @@ Once the object is released by ARC, the TCCState is also released which removes
When using `cfunc` or `cbind` declarations, [symbols](#symbols-1) are used to represent default type mappings from Cyber to C and back:
> _Incomplete: This is not the final API for dynamically loading and interfacing with C libraries. The plan is to parse a subset of C headers to bind to Cyber types and functions._
| Binding | Cyber | C | Details |
| -- | -- | -- | -- |
| Binding | Cyber | C |
| --- | --- | --- |
| .bool | bool | bool |
| .char | int | int8_t, signed char |
| .uchar | int | uint8_t, unsigned char |
Expand All @@ -1756,9 +1756,12 @@ When using `cfunc` or `cbind` declarations, [symbols](#symbols-1) are used to re
| .usize | int | size_t, uintptr_t |
| .float | float | float |
| .double | float | double |
| .charPtr | pointer | char* | Use `os.cstr()` and `pointer.fromCstr()` to convert between a Cyber string and a null terminated C string.
| (1) .charPtr | pointer | char* |
| .voidPtr | pointer | void* |
| type {S} object | type {S} object | struct | The mapping from a Cyber object type `S` and the C-struct can be declared with `cbind`. |
| (2) type {S} object | type {S} object | struct |
1. Use `os.cstr()` and `pointer.fromCstr()` to convert between a Cyber string and a null terminated C string.
2. The mapping from a Cyber object type `S` and the C-struct can be declared with `cbind`.
[parent](#ffi)
Expand Down
15 changes: 13 additions & 2 deletions docs/gen-docs.cy
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import md '../src/tools/md4c.cy'

var args = os.parseArgs([
[ name: 'version', type: string, default: 'dev' ],
[ name: 'import-style', type: bool, default: false ],
])

genDocsModules()
Expand Down Expand Up @@ -50,7 +51,11 @@ for tocLinks -> link:
var simpleCSS = os.readFile('$(curDir)/simple.css')
var hljsCSS = os.readFile('$(curDir)/hljs.min.css')
var hljsJS = os.readFile('$(curDir)/highlight.min.js')
var styleCSS = os.readFile('$(curDir)/style.css')

var stylePart = '<link rel="stylesheet" href="./style.css">'
if !args['import-style']:
var styleCSS = os.readFile('$(curDir)/style.css')
stylePart = '<style>$(styleCSS)</style>'

var html = '''<html lang="en">
<head>
Expand All @@ -59,7 +64,7 @@ var html = '''<html lang="en">
<title>Cyber Docs</title>
<style>$(simpleCSS)</style>
<style>$(hljsCSS)</style>
<style>$(styleCSS)</style>
$(stylePart)
</head>
<body id="table-of-contents">
<header>
Expand Down Expand Up @@ -203,6 +208,9 @@ func enterBlock(block_t md.BLOCKTYPE, detail_p pointer, userdata pointer) int:
case md.BLOCK_UL:
out += '<ul>\n'
return 0
case md.BLOCK_OL:
out += '<ol>\n'
return 0
case md.BLOCK_LI:
out += '<li>'
return 0
Expand Down Expand Up @@ -275,6 +283,9 @@ func leaveBlock(block_t md.BLOCKTYPE, detail_p pointer, userdata pointer) int:
case md.BLOCK_UL:
out += '</ul>\n'
return 0
case md.BLOCK_OL:
out += '</ol>\n'
return 0
case md.BLOCK_LI:
out += '</li>\n'
return 0
Expand Down
28 changes: 20 additions & 8 deletions docs/style.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
:root {
--bg: #0c0c0c;
--accent-bg: #111;
--accent-bg: #0d0707;
--border: #614721;
/* --text: #d2d2d2;*/
--text: #fff;
Expand Down Expand Up @@ -61,14 +61,9 @@ h1:hover a, h2:hover a, h3:hover a, h4:hover a, h5:hover a, h6:hover a {

h1.title {
color: var(--accent);
padding-left: 40px;
margin-bottom: 10px;
}

div.sub-title {
padding-left: 40px;
}

html, body {
font-size: 18px;

Expand All @@ -82,12 +77,17 @@ html, body {

header ul {
list-style-type: none;
padding-left: 0px;
}

header a {
white-space: nowrap;
}

body > header {
height: 100%;
width: var(--nav-width);
padding-left: 0px;
padding-left: 40px;
text-align: left;
position: fixed;
top: 0;
Expand Down Expand Up @@ -121,8 +121,20 @@ em {
display: grid;
}

/* Make 2 column navs fit */
table ul {
padding-left: 20px;
}
table ul ul {
padding-left: 0px;
}
table td {
padding: 0.5rem 0 0.5rem 0;
}

body > header {
position: static;
padding-left: 0px;
height: initial;
width: initial;
top: initial;
Expand Down Expand Up @@ -342,5 +354,5 @@ table td {
}

table tbody tr:nth-child(even) {
background-color: var(--accent-bg);
background-color: #111;
}

0 comments on commit 2f26e63

Please sign in to comment.