added doc cross-reference links

This commit is contained in:
Louis Heredero 2024-05-17 18:12:25 +02:00
parent c01e33cab4
commit a9014e03e9
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7
7 changed files with 65 additions and 47 deletions

Binary file not shown.

View File

@ -44,6 +44,20 @@
]
}
#let doc-ref(target, full: false, var: false) = {
let (module, func) = target.split(".")
let label-name = module + func
let display-name = func
if full {
display-name = target
}
if not var {
label-name += "()"
display-name += "()"
}
link(label(label-name))[#display-name]
}
= Introduction
This package provides a way to make beautiful block circuit diagrams using the CeTZ package.
@ -92,7 +106,8 @@ Simply import #link("src/lib.typ") and call the `circuit` function:
wire: wire,
circuit: circuit,
draw: draw,
examples: examples
examples: examples,
doc-ref: doc-ref
)
)
#tidy.show-module(wire-docs)
@ -113,8 +128,11 @@ Simply import #link("src/lib.typ") and call the `circuit` function:
draw: draw,
wire: wire,
tidy: tidy,
examples: examples
examples: examples,
doc-ref: doc-ref
)
)
#tidy.show-module(element-docs, sort-functions: false)
#tidy.show-module(element-docs, sort-functions: false)
#(tidy.utilities.get-style-functions(tidy.styles.default).show-reference)(label("wirewire()"), "test")

View File

@ -40,16 +40,16 @@
/// Draws an ALU with two inputs
///
/// #examples.alu
/// - x (number, dictionary): see `elmt()`
/// - y (number, dictionary): see `elmt()`
/// - w (number): see `elmt()`
/// - h (number): see `elmt()`
/// - name (none, str): see `elmt()`
/// - name-anchor (str): see `elmt()`
/// - fill (none, color): see `elmt()`
/// - stroke (stroke): see `elmt()`
/// - id (str): see `elmt()`
/// - debug (dictionary): see `elmt()`
/// - 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")
#let alu(
x: none,
y: none,

View File

@ -16,18 +16,18 @@
/// Draws a block element
///
/// #examples.block
/// - x (number, dictionary): see `elmt()`
/// - y (number, dictionary): see `elmt()`
/// - w (number): see `elmt()`
/// - h (number): see `elmt()`
/// - name (none, str): see `elmt()`
/// - name-anchor (str): see `elmt()`
/// - ports (dictionary): see `elmt()`
/// - ports-margins (dictionary): see `elmt()`
/// - fill (none, color): see `elmt()`
/// - stroke (stroke): see `elmt()`
/// - id (str): see `elmt()`
/// - debug (dictionary): see `elmt()`
/// - 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")
#let block(
x: none,
y: none,

View File

@ -28,16 +28,16 @@
/// Draws a bit extender
///
/// #examples.extender
/// - x (number, dictionary): see `elmt()`
/// - y (number, dictionary): see `elmt()`
/// - w (number): see `elmt()`
/// - h (number): see `elmt()`
/// - name (none, str): see `elmt()`
/// - name-anchor (str): see `elmt()`
/// - fill (none, color): see `elmt()`
/// - stroke (stroke): see `elmt()`
/// - id (str): see `elmt()`
/// - debug (dictionary): see `elmt()`
/// - 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")
#let extender(
x: none,
y: none,

View File

@ -24,17 +24,17 @@
/// Draws a multiplexer
///
/// #examples.multiplexer
/// - x (number, dictionary): see `elmt()`
/// - y (number, dictionary): see `elmt()`
/// - w (number): see `elmt()`
/// - h (number): see `elmt()`
/// - name (none, str): see `elmt()`
/// - name-anchor (str): see `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 string, it defines the name of each input.
/// - fill (none, color): see `elmt()`
/// - stroke (stroke): see `elmt()`
/// - id (str): see `elmt()`
/// - debug (dictionary): see `elmt()`
/// - 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")
/// - 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,

View File

@ -100,7 +100,7 @@
/// - slice (none, array): Optional bits slice (start and end bit indices). If set, it will be displayed at the start of the wire
/// - color (color): The stroke color
/// - dashed (bool): Whether the stroke is dashed or not
/// - style (str): The wire's style (see `wire-styles` for possible values)
/// - style (str): The wire's style (see #doc-ref("wire.wire-styles", var: true) for possible values)
/// - reverse (bool): If true, the start and end points will be swapped (useful in cases where the start point depends on the end point, for example with perpendiculars)
/// - zigzag-ratio (ratio): Position of the zigzag vertical relative to the horizontal span (only with style "zigzag")
/// - dodge-y (number): Y position to dodge the wire to (only with style "dodge")