diff options
Diffstat (limited to 'doc/man3/html_node_add_attr.3')
| -rw-r--r-- | doc/man3/html_node_add_attr.3 | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/doc/man3/html_node_add_attr.3 b/doc/man3/html_node_add_attr.3 new file mode 100644 index 0000000..d6d3bf0 --- /dev/null +++ b/doc/man3/html_node_add_attr.3 @@ -0,0 +1,77 @@ +.TH HTML_NODE_ADD_ATTR 3 2023-09-24 0.1.0 "slweb Library Reference" + +.SH NAME +html_node_add_attr \- add attribute to a HTML node + +.SH SYNOPSIS +.LP +.nf +#include <slweb/html.h> +.P +int html_node_add_attr(struct html_node *\fIn\fP, const char *\fIattr\fP, const char *\fIval\fP); +.fi + +.SH DESCRIPTION +The +.IR html_node_add_attr (3) +function adds an attribute to a +.I struct html_node +object pointed to by +.IR n , +previously returned by +.IR html_node_alloc (3) +or +.IR html_node_add_child (3). +.I attr +is a null-terminated string with the name of the attribute. +.I val +is a null-terminated string with the value for the attribute. + +.I slweb +allocates copies of the null-terminated strings defined by +.I attr +and +.IR val . + +.SH RETURN VALUE +On success, +.IR html_node_add_attr (3) +returns zero. On failure, a negative integer is returned. + +.SH EXAMPLE +A +.I struct html_node +object with +.B example +as tag name, no value and +.B name +as its attribute with value +.B john +would be translated by the HTML +serializer to: + +.PP +.in +4n +.EX +<example name="john"/> +.EE +.in +.PP + +.SH ERRORS +No errors are defined. + +.SH SEE ALSO +.BR html_node_alloc (3), +.BR html_node_free (3), +.BR html_node_set_value (3), +.BR html_node_set_value_unescaped (3), +.BR slweb_http (7). + +.SH COPYRIGHT +Copyright (C) 2023 Xavier Del Campo Romero. +.P +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. |
