docs: Move align-with example out of ports parameter box

This commit is contained in:
David Stadelmann committed 2026-10-01 10:29:40 +02:00
1 parent 2e6bfab744
commit 2823565dd9
3 files changed
+8223 -8198

No files matched your search

+8194 -8186
View File
File diff suppressed because it is too large. Load diff
+28 -11
View File
@@ -166,8 +166,24 @@ If you have installed Circuiteria directly in your project, import #link("src/li
#pagebreak()
#let element-scope = (
element: element,
circuit: circuit,
draw: draw,
wire: wire,
tidy: tidy,
examples: examples,
doc-ref: doc-ref
)
#let elmt-docs = tidy.parse-module(
read("src/elements/element.typ"),
name: "element",
old-syntax: true,
scope: element-scope
)
#let element-docs = tidy.parse-module(
read("src/elements/element.typ") + "\n" +
read("src/elements/alu.typ") + "\n" +
read("src/elements/block.typ") + "\n" +
read("src/elements/extender.typ") + "\n" +
@@ -175,18 +191,19 @@ If you have installed Circuiteria directly in your project, import #link("src/li
read("src/elements/group.typ"),
name: "element",
old-syntax: true,
scope: (
element: element,
circuit: circuit,
draw: draw,
wire: wire,
tidy: tidy,
examples: examples,
doc-ref: doc-ref
)
scope: element-scope
)
#tidy.show-module(element-docs, sort-functions: false)
#tidy.show-module(elmt-docs, sort-functions: false, show-module-name: true)
#figure(
examples.align-with-ports,
caption: [Example of the `align-with` port field (see #doc-ref("element.elmt")).],
kind: "example",
supplement: [Example],
) <elmt-align-with-example>
#tidy.show-module(element-docs, sort-functions: false, show-module-name: false)
#pagebreak()
+1 -1
View File
@@ -38,7 +38,7 @@
/// - `name` (`str`): Optional name displayed *in* the block
/// - `clock` (`bool`): Whether it is a clock port (triangle symbol)
/// - `vertical` (`bool`): Whether the name should be drawn vertically
/// - `align-with` (`str`, `dictionary`): Optional. Reuse another port's placement coordinate (east/west: y, north/south: x). Accepted forms: `"<local-id>"` (same-element port; axis must match, transitively resolved, cycles panic), `(element: "<id>", port: "<id>")` (cross-element; axis not validated; target element must be drawn first), or `"<raw-anchor>"` (any unrecognised string is used as a CeTZ anchor name). See #examples.align-with-ports
/// - `align-with` (`str`, `dictionary`): Optional. Reuse another port's placement coordinate (east/west: y, north/south: x). Accepted forms: `"<local-id>"` (same-element port; axis must match, transitively resolved, cycles panic), `(element: "<id>", port: "<id>")` (cross-element; axis not validated; target element must be drawn first), or `"<raw-anchor>"` (any unrecognised string is used as a CeTZ anchor name). See @elmt-align-with-example.
/// - `x` (length, ratio, function): Optional. North/south ports only. Explicit x-offset override measured from the left corner of the side. A `ratio` is used as a percentage along the side; a length/number is used as an absolute offset; a function is called with the element width and must return a length/number. Panics if used together with `align-with` or on an east/west port.
/// - `y` (length, ratio, function): Optional. East/west ports only. Analogous to `x`, measured from the top corner of the side and called with the element height when a function is passed.
/// - `shape` (`none`, `str`): Optional. Per-port override of the element-level `port-shape` (e.g. `"pentagon"`). Lets a single port on a block or group opt into (or out of) a shape independently of the element default. See the `port-shape` parameter below.