1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
//! [Xacro](https://wiki.ros.org/xacro) processor in Rust.
//!
//! `xacro` is an XML macro processor, that expands properties, macros, and conditionals.
//! The crate provides core extensions by default (cwd, env); ROS-specific extensions
//! are available via the builder when needed.
//!
//! # Quick Start
//!
//! Process a xacro file:
//!
//! ```no_run
//! # fn main() -> Result<(), xacro_rs::XacroError> {
//! let urdf = xacro_rs::process_file("robot.xacro")?;
//! # Ok(())
//! # }
//! ```
//!
//! Use [`process_string`] for string content. For more control (arguments, extensions, compatibility modes):
//!
//! ```no_run
//! # fn main() -> Result<(), xacro_rs::XacroError> {
//! let processor = xacro_rs::XacroProcessor::builder()
//! .with_arg("robot_name", "my_robot")
//! .build();
//! let urdf = processor.run("robot.xacro")?;
//! # Ok(())
//! # }
//! ```
//!
//! # Examples
//!
//! See the [`examples/`](https://github.com/kaidokert/xacro/tree/main/examples)
//! directory for complete examples including:
//! - Basic file processing
//! - Processing from stdin
//! - Using arguments and the builder API
//! - ROS extensions and YAML support
//! - Generic XML macros (non-ROS usage)
//!
//! # Feature Flags
//!
//! - `yaml` (default): Enable YAML loading with `load_yaml()`
//! - `compat` (default): Python Xacro compatibility mode.
//!
//! # Compatibility
//!
//! This crate aims for feature parity with [Python xacro](https://wiki.ros.org/xacro).
//! See the [README](https://github.com/kaidokert/xacro#readme) for status and limitations.
// #![warn(clippy::pedantic)]
pub use XacroError;
pub use PropertyScope;
pub use ;
/// Process a xacro file from the filesystem.
///
/// This is a convenience function that creates a default [`XacroProcessor`]
/// and processes the given file path.
///
/// For more control over processing (arguments, compatibility modes, extensions),
/// use [`XacroProcessor::builder()`] instead.
///
/// # Examples
///
/// ```no_run
/// # fn main() -> Result<(), xacro_rs::XacroError> {
/// let urdf = xacro_rs::process_file("robot.xacro")?;
/// println!("{}", urdf);
/// # Ok(())
/// # }
/// ```
/// Process xacro content from a string.
///
/// This is a convenience function that creates a default [`XacroProcessor`]
/// and processes the given xacro content string.
///
/// For more control over processing (arguments, compatibility modes, extensions),
/// use [`XacroProcessor::builder()`] instead.
///
/// # Examples
///
/// ```
/// # fn main() -> Result<(), xacro_rs::XacroError> {
/// let xacro_content = r#"<?xml version="1.0"?>
/// <robot name="test" xmlns:xacro="http://www.ros.org/wiki/xacro">
/// <xacro:property name="width" value="0.5"/>
/// <link name="base">
/// <visual>
/// <geometry>
/// <box size="${width} 0.5 0.5"/>
/// </geometry>
/// </visual>
/// </link>
/// </robot>"#;
///
/// let urdf = xacro_rs::process_string(xacro_content)?;
/// assert!(urdf.contains("0.5 0.5 0.5"));
/// # Ok(())
/// # }
/// ```