Compare commits

..

4 commits

14 changed files with 720 additions and 13 deletions

67
.cargo/cliff.toml Normal file
View file

@ -0,0 +1,67 @@
# cliff.toml
[changelog]
header = """
# CHANGELOG
Este archivo documenta los cambios más relevantes realizados en cada versión. El formato está basado
en [Keep a Changelog](https://keepachangelog.com/es-ES/1.0.0/), y las versiones se numeran siguiendo
las reglas del [Versionado Semántico](https://semver.org/lang/es/).
Resume la evolución del proyecto para usuarios y colaboradores, destacando nuevas funcionalidades,
correcciones, mejoras durante el desarrollo o cambios en la documentación. Cambios menores o
internos pueden omitirse si no afectan al uso del proyecto.
"""
trim = true
render_always = true
body = """
{% if version %}
## {{ version | trim_start_matches(pat="v") }} ({{ timestamp | date(format="%Y-%m-%d") }})
{% else %}
## Pendiente de publicación
{% endif %}\
{% set base = "https://git.cillero.es/manuelcillero/pagetop" %}\
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
{%- set msg = commit.message
| split(pat="\n")
| first
| replace(from="✨ ", to="")
| replace(from="🐛 ", to="")
| replace(from="⬆️ ", to="")
| replace(from="🚧 ", to="")
| replace(from="♻️ ", to="")
| replace(from="✏️ ", to="")
| replace(from="🏷️ ", to="")
| replace(from="🧑‍💻 ", to="")
| replace(from="🍱 ", to="")
| replace(from="📝 ", to="")
| replace(from="💡 ", to="")
-%}
{% set sha7 = commit.id | truncate(length=7, end="") %}
- {{ msg | trim }} ([{{ sha7 }}]({{ base }}/commit/{{ commit.id }}){% if commit.author.name != "Manuel Cillero" %} - {{ commit.author.name }}{% endif %})
{% endfor %}{% endfor %}
"""
[git]
conventional_commits = false
filter_unconventional = false
topo_order_commits = true
sort_commits = "oldest"
commit_parsers = [
{ message = "^✨", group = "Añadido" },
{ message = "^🐛", group = "Corregido" },
{ message = "^🚧", group = "Cambiado" },
{ message = "^♻️", group = "Cambiado" },
{ message = "^✏️", group = "Cambiado" },
{ message = "^🏷️", group = "Cambiado" },
{ message = "^🧑‍💻", group = "Cambiado" },
{ message = "^🍱", group = "Cambiado" },
{ message = "^⬆️", group = "Dependencias" },
{ message = "^📝", group = "Documentado" },
{ message = "^💡", group = "Documentado" },
{ message = "^.*", group = "Otros cambios" },
]

45
.cargo/release.toml Normal file
View file

@ -0,0 +1,45 @@
# release.toml
# Etiqueta por crate: `pagetop-macros-v0.2.0`
tag-prefix = "{{crate_name}}-v"
# Confirmaciones firmadas (no requeridas)
sign-commit = false
sign-tag = false
# Empuja etiquetas y commits
push = true
# Publica en crates.io (puedes desactivarlo para pruebas)
publish = true
# Actualiza todos los dependientes internos
update-dependencies = true
# Solo permite publicar estos crates (los que forman parte del workspace)
allow-branch = ["main"]
consolidate-commits = false
consolidate-pushes = true
# Mensaje personalizado para el commit de versión
pre-release-commit-message = "🔖 Prepara publicación de {{crate_name}} {{version}}"
[workspace]
# Lista de crates que se pueden publicar dentro del workspace
# Puedes añadir extensiones más adelante
allow-publish = [
"pagetop",
"pagetop-build",
"pagetop-macros"
]
# Opcional: ordena la publicación de dependencias internas
publish-order = [
"pagetop-build",
"pagetop-macros",
"pagetop"
]
pre-release-hook = [
"./tools/changelog.sh", "{{crate_name}}", "{{version}}", "--stage"
]

View file

@ -10,7 +10,7 @@ como son:
de la aplicación.
* [Fluent templates](https://github.com/XAMPPRocky/fluent-templates), que integra
[Fluent](https://projectfluent.org/) para internacionalizar las aplicaciones.
* Además de otros crates adicionales que se pueden explorar en los archivos `Cargo.toml` de
* Además de otros *crates* adicionales que se pueden explorar en los archivos `Cargo.toml` de
`PageTop` y sus extensiones.

View file

@ -41,8 +41,8 @@ async fn main() -> std::io::Result<()> {
}
```
Este código arranca el servidor de `PageTop` que, con la configuración por defecto, muestra una
página de bienvenida accesible desde un navegador local en `http://localhost:8080`.
Este código arranca el servidor de `PageTop`. Con la configuración por defecto, muestra una página
de bienvenida accesible desde un navegador local en la dirección `http://localhost:8080`.
Para personalizar el servicio, se puede crear una extensión de `PageTop` de la siguiente manera:

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2022 Manuel Cillero
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Manuel Cillero
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2022 Manuel Cillero
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Manuel Cillero
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -177,10 +177,9 @@ pub fn builder_fn(_: TokenStream, item: TokenStream) -> TokenStream {
let fn_with_attrs = &fn_with.attrs;
// Genera el método alter_...() con el código del método with_...().
let fn_alter_doc = format!(
"Igual que [`Self::{0}()`](Self::{0}), pero sin usar el patrón *builder*.",
fn_with_name_str,
);
let fn_alter_doc =
format!("Igual que [`Self::{fn_with_name_str}()`], pero sin usar el patrón *builder*.");
let fn_alter = quote! {
#[doc = #fn_alter_doc]
pub fn #fn_alter_name #fn_generics(&mut self, #(#args),*) -> &mut Self #where_clause {

View file

@ -44,6 +44,7 @@ impl<E: ToTokens> ToTokens for Markups<E> {
}
#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum Markup<E> {
Block(Block<E>),
Lit(HtmlLit),
@ -429,6 +430,7 @@ impl ToTokens for Attribute {
}
#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum HtmlNameOrMarkup {
HtmlName(HtmlName),
Markup(Markup<NoElement>),
@ -472,6 +474,7 @@ impl Display for HtmlNameOrMarkup {
}
#[derive(Debug, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum AttributeType {
Normal {
eq_token: Eq,

View file

@ -19,7 +19,7 @@ pub fn impl_my_derive(input: &DeriveInput) -> Result<TokenStream, Error> {
quote! {
#name #body_assignment
},
format!("Returns a `{}` default.", name),
format!("Returns a `{name}` default."),
)
}
syn::Data::Enum(ref body) => {
@ -44,7 +44,7 @@ pub fn impl_my_derive(input: &DeriveInput) -> Result<TokenStream, Error> {
quote! {
#name :: #default_variant_name #body_assignment
},
format!("Returns a `{}::{}` default.", name, default_variant_name),
format!("Returns a `{name}::{default_variant_name}` default."),
)
}
syn::Data::Union(_) => {
@ -109,7 +109,7 @@ fn default_body_tt(body: &syn::Fields) -> Result<(TokenStream, String), Error> {
.iter()
.map(|field| {
let (default_value, default_doc) = field_default_expr_and_doc(field)?;
write!(&mut doc, "{}, ", default_doc).unwrap();
write!(&mut doc, "{default_doc}, ").unwrap();
Ok(default_value)
})
.collect::<Result<Vec<TokenStream>, Error>>()?;
@ -145,7 +145,7 @@ fn field_default_expr_and_doc(field: &syn::Field) -> Result<(TokenStream, String
ConversionStrategy::Into => quote!((#field_value).into()),
};
let field_doc = format!("{}", field_value);
let field_doc = format!("{field_value}");
Ok((field_value, field_doc))
} else {
Ok((

View file

@ -41,9 +41,9 @@
//! }
//! ```
//!
//! Este código arranca el servidor de `PageTop` que, con la
//! Este código arranca el servidor de `PageTop`. Con la
//! [configuración por defecto](crate::global::SETTINGS), muestra una página de bienvenida accesible
//! desde un navegador local en `http://localhost:8080`.
//! desde un navegador local en la dirección `http://localhost:8080`.
//!
//! Para personalizar el servicio, se puede crear una extensión de `PageTop` de la siguiente manera:
//!

101
tools/changelog.sh Executable file
View file

@ -0,0 +1,101 @@
#!/bin/bash
set -euo pipefail
# ------------------------------------------------------------------------------
# Script para generar el archivo de cambios del crate indicado.
# Uso:
# ./tools/changelog.sh <crate> <version> [--stage]
# Ejemplo:
# ./tools/changelog.sh pagetop-macros 0.1.0 # Sólo genera archivo
# ./tools/changelog.sh pagetop 0.1.0 --stage # Prepara archivo para commit
# ------------------------------------------------------------------------------
# Configuración
CRATE="${1:-}"
VERSION="${2:-}"
STAGE="${3:-}"
CLIFF_CONFIG=".cargo/cliff.toml"
# Comprobaciones
if [[ -z "$CRATE" || -z "$VERSION" ]]; then
echo "Usage: $0 <crate> <version> [--stage]" >&2
exit 1
fi
# Dependencias
command -v git-cliff >/dev/null || {
echo "Error: git-cliff is not installed. Use: cargo install git-cliff"
exit 1
}
# Cambia al directorio del espacio
cd "$(dirname "$0")/.." || exit 1
# ------------------------------------------------------------------------------
# Determina ruta del archivo y ámbito de los archivos afectados para el crate
# ------------------------------------------------------------------------------
case "$CRATE" in
pagetop)
CHANGELOG_FILE="CHANGELOG.md"
PATH_FLAGS=(
--exclude-path "helpers/pagetop-macros/**/*"
--exclude-path "helpers/pagetop-build/**/*"
)
;;
pagetop-macros)
CHANGELOG_FILE="helpers/pagetop-macros/CHANGELOG.md"
PATH_FLAGS=(--include-path "helpers/pagetop-macros/**/*")
;;
pagetop-build)
CHANGELOG_FILE="helpers/pagetop-build/CHANGELOG.md"
PATH_FLAGS=(--include-path "helpers/pagetop-build/**/*")
;;
*)
echo "Error: unsupported crate '$CRATE'" >&2
exit 1
;;
esac
# ------------------------------------------------------------------------------
# Obtiene la última etiqueta del crate
# ------------------------------------------------------------------------------
LAST_TAG="$(git tag --list "${CRATE}-v*" --sort=-v:refname | head -n 1)"
if [[ -n "$LAST_TAG" ]]; then
echo "Generating CHANGELOG for '$CRATE' from last tag '$LAST_TAG'"
CLIFF_ARGS=(--unreleased --tag "$VERSION")
else
echo "Generating initial CHANGELOG for '$CRATE'"
CLIFF_ARGS=(--tag "$VERSION")
fi
# ------------------------------------------------------------------------------
# Genera el CHANGELOG para el crate correspondiente
# ------------------------------------------------------------------------------
git-cliff --config "$CLIFF_CONFIG" "${PATH_FLAGS[@]}" "${CLIFF_ARGS[@]}" -o "$CHANGELOG_FILE" -u
echo "CHANGELOG generated at '$CHANGELOG_FILE'"
# Pregunta por la revisión del archivo de cambios generado
read -p "Do you want to review the changelog before continuing? (y/n) " -n 1 -r || exit 1
echo
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
${EDITOR:-nano} "$CHANGELOG_FILE"
fi
read -p "Do you want to proceed with the release of $CRATE? (y/n) " -n 1 -r || exit 1
echo
if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
echo "Aborting release process." >&2
exit 1
fi
# Si hay cambios y procede, añade al stage (cargo-release hará el commit)
if ! git diff --quiet -- "$CHANGELOG_FILE"; then
if [[ "$STAGE" == "--stage" ]]; then
git add "$CHANGELOG_FILE"
echo "Staged $CHANGELOG_FILE for commit"
else
echo "Changes detected in '$CHANGELOG_FILE', but not staged (no --stage flag)"
fi
else
echo "No changes in '$CHANGELOG_FILE', skipping staging"
fi

48
tools/release.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash
set -euo pipefail
# ------------------------------------------------------------------------------
# Script para publicar un crate individual del workspace con cargo-release.
# Uso:
# ./tools/release.sh <crate> [patch|minor|major] [--execute]
# Ejemplos:
# ./tools/release.sh pagetop-macros patch # Dry run (por defecto)
# ./tools/release.sh pagetop minor --execute # Publicación real
# ------------------------------------------------------------------------------
# Configuración
CRATE="${1:-}"
LEVEL="${2:-patch}"
EXECUTE="${3:-}"
CONFIG=".cargo/release.toml"
# Comprobaciones
if [[ -z "$CRATE" ]]; then
echo "Usage: $0 <crate> [patch|minor|major] [--execute]"
exit 1
fi
if [[ ! "$LEVEL" =~ ^(patch|minor|major)$ ]]; then
echo "Error: invalid level '$LEVEL'. Use: patch, minor, or major"
exit 1
fi
# Dependencias
command -v cargo-release >/dev/null || {
echo "Error: cargo-release is not installed. Use: cargo install cargo-release"
exit 1
}
# Cambia al directorio del espacio
cd "$(dirname "$0")/.." || exit 1
# ------------------------------------------------------------------------------
# DRY-RUN (por defecto) o ejecución real con --execute
# ------------------------------------------------------------------------------
if [[ "$EXECUTE" != "--execute" ]]; then
echo "Running dry-run (default mode). Add --execute to publish"
CARGO_RELEASE_CONFIG="$CONFIG" cargo release --package "$CRATE" "$LEVEL" --dry-run
else
echo "Releasing $CRATE ($LEVEL)…"
CARGO_RELEASE_CONFIG="$CONFIG" cargo release --package "$CRATE" "$LEVEL" --execute
echo "Release completed."
fi