improved doc + made it fancier
This commit is contained in:
parent
64a6146f32
commit
047c3b8893
BIN
manual.pdf
BIN
manual.pdf
Binary file not shown.
44
manual.typ
44
manual.typ
@ -14,7 +14,7 @@
|
||||
#{
|
||||
outline(indent: true, depth: 3)
|
||||
}
|
||||
#set page(numbering: "1/1", header: align(right)[circuiteria #sym.dash.em v#lib.version])
|
||||
|
||||
#show link: set text(blue)
|
||||
#show heading.where(level: 3): it => context {
|
||||
let cnt = counter(heading)
|
||||
@ -45,6 +45,44 @@
|
||||
]
|
||||
}
|
||||
|
||||
#set page(numbering: "1/1", header: align(right)[circuiteria #sym.dash.em v#lib.version])
|
||||
#set page(
|
||||
header: locate(loc => {
|
||||
let txt = [circuiteria #sym.dash.em v#lib.version]
|
||||
let cnt = counter(heading)
|
||||
let cnt-val = cnt.get()
|
||||
if cnt-val.len() < 2 {
|
||||
align(left, txt)
|
||||
return
|
||||
}
|
||||
let i = cnt-val.at(1) - 1
|
||||
grid(
|
||||
columns: (auto, 1fr),
|
||||
column-gutter: 1em,
|
||||
align: horizon,
|
||||
txt,
|
||||
place(horizon + left)[
|
||||
#rect(width: 100%, height: .5em, radius: .25em, stroke: none, fill: util.colors.values().at(i))
|
||||
]
|
||||
)
|
||||
}),
|
||||
footer: locate(loc => {
|
||||
let cnt = counter(heading)
|
||||
let cnt-val = cnt.get()
|
||||
if cnt-val.len() < 2 { return }
|
||||
let i = cnt-val.at(1) - 1
|
||||
grid(
|
||||
columns: (1fr, auto),
|
||||
column-gutter: 1em,
|
||||
align: horizon,
|
||||
place(horizon + left)[
|
||||
#rect(width: 100%, height: .5em, radius: .25em, stroke: none, fill: util.colors.values().at(i))
|
||||
],
|
||||
counter(page).display("1/1", both: true)
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
#let doc-ref(target, full: false, var: false) = {
|
||||
let (module, func) = target.split(".")
|
||||
let label-name = module + func
|
||||
@ -122,7 +160,6 @@ Simply import #link("src/lib.typ") and call the `circuit` function:
|
||||
read("src/elements/extender.typ") + "\n" +
|
||||
read("src/elements/multiplexer.typ"),
|
||||
name: "element",
|
||||
require-all-parameters: true,
|
||||
scope: (
|
||||
element: element,
|
||||
circuit: circuit,
|
||||
@ -136,6 +173,8 @@ Simply import #link("src/lib.typ") and call the `circuit` function:
|
||||
|
||||
#tidy.show-module(element-docs, sort-functions: false)
|
||||
|
||||
#pagebreak()
|
||||
|
||||
#let gates-docs = tidy.parse-module(
|
||||
read("src/elements/logic/gate.typ") + "\n" +
|
||||
read("src/elements/logic/and.typ") + "\n" +
|
||||
@ -143,7 +182,6 @@ Simply import #link("src/lib.typ") and call the `circuit` function:
|
||||
read("src/elements/logic/or.typ") + "\n" +
|
||||
read("src/elements/logic/xor.typ"),
|
||||
name: "gates",
|
||||
require-all-parameters: false,
|
||||
scope: (
|
||||
element: element,
|
||||
circuit: circuit,
|
||||
|
@ -40,16 +40,7 @@
|
||||
/// Draws an ALU with two inputs
|
||||
///
|
||||
/// #examples.alu
|
||||
/// - x (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - y (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - w (number): see #doc-ref("element.elmt")
|
||||
/// - h (number): see #doc-ref("element.elmt")
|
||||
/// - name (none, str): see #doc-ref("element.elmt")
|
||||
/// - name-anchor (str): see #doc-ref("element.elmt")
|
||||
/// - fill (none, color): see #doc-ref("element.elmt")
|
||||
/// - stroke (stroke): see #doc-ref("element.elmt")
|
||||
/// - id (str): see #doc-ref("element.elmt")
|
||||
/// - debug (dictionary): see #doc-ref("element.elmt")
|
||||
/// For parameters description, see #doc-ref("element.elmt")
|
||||
#let alu(
|
||||
x: none,
|
||||
y: none,
|
||||
|
@ -16,18 +16,7 @@
|
||||
/// Draws a block element
|
||||
///
|
||||
/// #examples.block
|
||||
/// - x (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - y (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - w (number): see #doc-ref("element.elmt")
|
||||
/// - h (number): see #doc-ref("element.elmt")
|
||||
/// - name (none, str): see #doc-ref("element.elmt")
|
||||
/// - name-anchor (str): see #doc-ref("element.elmt")
|
||||
/// - ports (dictionary): see #doc-ref("element.elmt")
|
||||
/// - ports-margins (dictionary): see #doc-ref("element.elmt")
|
||||
/// - fill (none, color): see #doc-ref("element.elmt")
|
||||
/// - stroke (stroke): see #doc-ref("element.elmt")
|
||||
/// - id (str): see #doc-ref("element.elmt")
|
||||
/// - debug (dictionary): see #doc-ref("element.elmt")
|
||||
/// For parameters description, see #doc-ref("element.elmt")
|
||||
#let block(
|
||||
x: none,
|
||||
y: none,
|
||||
|
@ -28,16 +28,7 @@
|
||||
/// Draws a bit extender
|
||||
///
|
||||
/// #examples.extender
|
||||
/// - x (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - y (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - w (number): see #doc-ref("element.elmt")
|
||||
/// - h (number): see #doc-ref("element.elmt")
|
||||
/// - name (none, str): see #doc-ref("element.elmt")
|
||||
/// - name-anchor (str): see #doc-ref("element.elmt")
|
||||
/// - fill (none, color): see #doc-ref("element.elmt")
|
||||
/// - stroke (stroke): see #doc-ref("element.elmt")
|
||||
/// - id (str): see #doc-ref("element.elmt")
|
||||
/// - debug (dictionary): see #doc-ref("element.elmt")
|
||||
/// For parameters description, see #doc-ref("element.elmt")
|
||||
#let extender(
|
||||
x: none,
|
||||
y: none,
|
||||
|
@ -24,17 +24,8 @@
|
||||
/// Draws a multiplexer
|
||||
///
|
||||
/// #examples.multiplexer
|
||||
/// - x (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - y (number, dictionary): see #doc-ref("element.elmt")
|
||||
/// - w (number): see #doc-ref("element.elmt")
|
||||
/// - h (number): see #doc-ref("element.elmt")
|
||||
/// - name (none, str): see #doc-ref("element.elmt")
|
||||
/// - name-anchor (str): see #doc-ref("element.elmt")
|
||||
/// For other parameters description, see #doc-ref("element.elmt")
|
||||
/// - entries (int, array): If it is an integer, it defines the number of input ports (automatically named with their binary index). If it is an array of strings, it defines the name of each input.
|
||||
/// - fill (none, color): see #doc-ref("element.elmt")
|
||||
/// - stroke (stroke): see #doc-ref("element.elmt")
|
||||
/// - id (str): see #doc-ref("element.elmt")
|
||||
/// - debug (dictionary): see #doc-ref("element.elmt")
|
||||
#let multiplexer(
|
||||
x: none,
|
||||
y: none,
|
||||
|
Loading…
Reference in New Issue
Block a user