diff --git a/manual.pdf b/manual.pdf index 5750a47..06521eb 100644 Binary files a/manual.pdf and b/manual.pdf differ diff --git a/manual.typ b/manual.typ index 99ea598..08a5137 100644 --- a/manual.typ +++ b/manual.typ @@ -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) \ No newline at end of file +#tidy.show-module(element-docs, sort-functions: false) + +#(tidy.utilities.get-style-functions(tidy.styles.default).show-reference)(label("wirewire()"), "test") \ No newline at end of file diff --git a/src/elements/alu.typ b/src/elements/alu.typ index d15b9d6..1c09ce9 100644 --- a/src/elements/alu.typ +++ b/src/elements/alu.typ @@ -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, diff --git a/src/elements/block.typ b/src/elements/block.typ index bb41fc0..31bda9e 100644 --- a/src/elements/block.typ +++ b/src/elements/block.typ @@ -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, diff --git a/src/elements/extender.typ b/src/elements/extender.typ index bb789c5..86a86c9 100644 --- a/src/elements/extender.typ +++ b/src/elements/extender.typ @@ -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, diff --git a/src/elements/multiplexer.typ b/src/elements/multiplexer.typ index 49dad5c..c0da305 100644 --- a/src/elements/multiplexer.typ +++ b/src/elements/multiplexer.typ @@ -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, diff --git a/src/wire.typ b/src/wire.typ index 809fc46..4b12679 100644 --- a/src/wire.typ +++ b/src/wire.typ @@ -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")