#xml

macro mox

Mockery Of X(ML): a JSX-alike syntax for the builder pattern

5 releases (breaking)

0.12.0 Feb 2, 2021
0.11.0 Jan 10, 2021
0.10.0 Jul 7, 2020
0.2.0 Nov 20, 2019
0.1.0 Nov 10, 2018

#301 in #xml


Used in 2 crates (via slack-blocks)

MIT/Apache

16KB
261 lines

mox

mox implements the mox! macro: "a Mockery Of X(ML)". A JSX-like Rust DSL for calling builders.

[0.12.0] - 2021-02-01

Changed

  • mox-impl is no longer being published and its contents are included directly in this crate.

Removed

  • Dependency on topo.

[0.11.0] - 2021-01-10

Added

  • "Attribute init shorthand" allows pulling an attribute from an identically-named binding in the local scope:

    let onclick = |_| { ... };
    mox!(<button onclick>"click me?"</button>)
    
  • Module-nested tag names: mox!(<krate::module::tag>"foo"</krate::module::tag>).

  • Attributes support single-expression values without braces: <button disabled=true/>.

  • XML comments: mox!(<div> <!-- COMMENT HERE --> </div>).

Changed

  • mox! invocations are now lexed by the syn-rsx crate.
  • Non-tag children have .into_child() appended to them.

[0.10.0] - 2020-07-06

Removed

  • Support for _=(...) style function invocation in tags.

Added

  • Implementation is now in mox-impl crate to allow publication separately from moxie.

Changed

  • Handles collisions with Rust keywords when used as attributes.
  • Expands directly to builder methods rather than emulating them with macro calls.
  • Expanded builder syntax is compatible with owned builders & typed parent/child bindings.
  • Each tag is wrapped in its own topo::call(...).

[0.2.0] - 2019-11-19

This version was a complete rewrite in tandem with moxie v0.2.0.

[0.1.0] - 2018-11-09

Initial release.

Dependencies

~1.5MB
~38K SLoC