Compare commits

..

20 Commits

Author SHA1 Message Date
inma bbae0571ae fixtures: .doc originales de Fray Marcos (#209)
Los 30 .doc tal cual llegan por correo, de la carta 713 a la 740, para poder
reproducir el borrado silencioso por <w:smartTag> y diffear contra lo publicado.
Pedidos por Rafa en el #209, donde el barrido quedó bloqueado sin ellos.
2026-08-19 09:06:08 +00:00
inma a806cf9cae doc_convert.py: conversor .doc->.docx de Fray Marcos, con el arreglo de los smartTag (#209) 2026-08-18 09:24:55 +00:00
rafa 696934016f Merge pull request 'Backfill evangelio: modo apply explícito vía variable de entorno' (#208) from fix/backfill-apply-mode into main 2026-08-12 13:57:12 +00:00
rafa 06d7057e76 fix: support explicit backfill apply mode
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:56:10 -04:00
rafa ef2978fc21 Merge pull request 'Mostrar el evangelio también en Comentario editorial (no solo Comentarios al evangelio)' (#207) from feat/evangelio-editorial into main 2026-08-12 13:53:41 +00:00
rafa 587b10c2b3 Merge pull request 'Modo oscuro: toggle duplicado, evangelio, navegación, visited, colaboradores' (#206) from fix/theme-button-duplicate into main 2026-08-12 13:53:37 +00:00
rafa 6b966a3b5f fix: style contributor cards in dark mode
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:33:58 -04:00
rafa 754915b91f feat: show gospel in editorial comments
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:30:43 -04:00
rafa 75c0f07eab fix: keep visited links readable in dark mode
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:20:34 -04:00
rafa f0946be1fc fix: cover navigation and gallery dark states
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:16:43 -04:00
rafa d836297c89 fix: cover editorial components in dark mode
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:15:47 -04:00
rafa d9ff5e891c fix: prevent duplicate theme toggle
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 09:04:15 -04:00
rafa 5cf588ffe3 Merge pull request 'Accesibilidad: Atkinson Hyperlegible + modo oscuro (#196)' (#205) from fix/dark-article-menu into main 2026-08-12 12:47:23 +00:00
rafa a734ffc933 Merge pull request 'Comentarios al evangelio: cita + pasaje plegable (#199)' (#201) from feat/issue-199-evangelio into main 2026-08-12 12:47:09 +00:00
rafa b3a2ae682b fix: style author archives in dark mode
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 07:05:57 -04:00
rafa 825434a0b7 fix: preserve dark menu background in articles
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-12 06:11:06 -04:00
rafa 68b95aae89 fix: extend accessible typography
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-09 10:50:56 -04:00
rafa 82c352aa15 fix: refine dark search states
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-09 01:01:26 -04:00
rafa 51ae723c5a fix: correct dark mode search and slider
Co-authored-by: rafa <rcalvotorrejon@gmail.com>
Signed-off-by: rafa <rcalvotorrejon@gmail.com>
2026-08-09 00:39:32 -04:00
rafa 7a623e8bb9 accesibilidad: Atkinson Hyperlegible + toggle claro/oscuro (#196)
Mu-plugin fea-accesibilidad.php:
- Atkinson Hyperlegible (OFL) self-hosted, subset latin regular+bold,
  sustituye la tipografia global del cuerpo sin selector.
- Toggle claro/oscuro persistente (localStorage), anti-flash en wp_head,
  boton inyectado junto al selector de idioma en el header.
- color-scheme: dark para controles nativos (audio, inputs) + overrides
  puntuales donde el sitio fija colores claros a mano (hero, tarjetas,
  selector de idioma, buscador movil, beta feedback, cookie consent).
- Acento mas claro (#e8899e) solo en modo oscuro: el carmesi de marca
  (#8b1a2e) no llega a 2:1 de contraste sobre el fondo casi negro.

QA local (docker wordpress-web, capturas Playwright en tools/e2e/out/):
portada, tarjetas y single verificados en claro y oscuro.
2026-08-09 00:15:45 -04:00
38 changed files with 575 additions and 3 deletions
+1
View File
@@ -17,6 +17,7 @@ scripts/ — scripts Python/PHP de migración, traducción, TTS y mantenimi
| `fea-homepage.php` | Tarjetas de portada | | `fea-homepage.php` | Tarjetas de portada |
| `fea-share.php` | Sección "Comparte FeAdulta" (Facebook, Instagram, Imprimir) | | `fea-share.php` | Sección "Comparte FeAdulta" (Facebook, Instagram, Imprimir) |
| `fea-ui.php` | Estilos globales, menú, fondo cálido en artículos | | `fea-ui.php` | Estilos globales, menú, fondo cálido en artículos |
| `fea-accesibilidad.php` | Tipografía Atkinson Hyperlegible (self-hosted) + toggle claro/oscuro persistente |
| `fea-beta-feedback.php` | Barra de feedback beta + endpoint `/fea/v1/lang/{id}` | | `fea-beta-feedback.php` | Barra de feedback beta + endpoint `/fea/v1/lang/{id}` |
| `fea-search.php` | Buscador móvil nativo | | `fea-search.php` | Buscador móvil nativo |
| `fea-pensamientos.php` | Widget de pensamientos | | `fea-pensamientos.php` | Widget de pensamientos |
+415
View File
@@ -0,0 +1,415 @@
<?php
/**
* Plugin Name: Fe Adulta — Accesibilidad (tipografía + contraste)
* Description: Tipografía Atkinson Hyperlegible global (self-hosted) + toggle
* claro/oscuro persistente, pensado para el público mayor de
* Fe Adulta (issue rafa/feadulta#196, evidencia en comment #609).
* Version: 1.0
*
* Alcance decidido en el issue (2026-08-08): SOLO dos cosas, sin más superficie
* de UI que la necesaria —
* 1. Atkinson Hyperlegible sustituye la tipografía del cuerpo, sin selector.
* 2. Un único toggle claro/oscuro persistente (claro por defecto).
* Nada de panel de accesibilidad, A+/Aa ni cambio de tamaño de letra.
*/
if (!defined('ABSPATH')) exit;
if (!defined('FEA_A11Y_ACCENT_DARK')) {
// Variante clara del carmesí de marca (#8b1a2e) para que enlaces/foco
// cumplan contraste AA sobre fondo casi negro (el carmesí original da
// ~1.8:1 sobre #0d0d0d, muy por debajo del 4.5:1 que exige texto).
define('FEA_A11Y_ACCENT_DARK', '#e8899e');
}
/* ── 1) Anti-flash: fija el tema ANTES de que el navegador pinte nada ─────
* Se engancha con prioridad muy baja para salir de los primeros bytes de
* <head>, igual que el resto del sitio guarda preferencias en localStorage
* (ver fea-beta-feedback.php). Sin esto habría un parpadeo claro→oscuro. */
add_action('wp_head', function () {
if (is_admin()) return;
?>
<script>(function(){try{
var t = localStorage.getItem('fea_theme');
if (t === 'dark') document.documentElement.setAttribute('data-fea-theme', 'dark');
}catch(e){}})();</script>
<?php
}, 1);
/* ── 2) Fuente self-hosted + estilos de tema oscuro ───────────────────── */
add_action('wp_head', function () {
if (is_admin()) return;
$base = plugins_url('fea-accesibilidad/fonts', __FILE__);
$accent_dark = FEA_A11Y_ACCENT_DARK;
?>
<style id="fea-a11y">
/* ── Atkinson Hyperlegible (Braille Institute, OFL), subset latin ──── */
@font-face {
font-family: 'Atkinson Hyperlegible';
font-style: normal;
font-weight: 100 500;
font-display: swap;
src: url('<?php echo esc_url($base); ?>/atkinson-hyperlegible-regular.woff2') format('woff2');
}
@font-face {
font-family: 'Atkinson Hyperlegible';
font-style: normal;
font-weight: 501 900;
font-display: swap;
src: url('<?php echo esc_url($base); ?>/atkinson-hyperlegible-bold.woff2') format('woff2');
}
/* Sustitución global del cuerpo de texto (no opcional, issue #196).
Especificidad baja a propósito: el menú (fea-ui.php, issue #95) usa
una sans de UI más específica y debe seguir ganando. */
body {
font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3, h4, h5, h6,
.fea-hero-title,
.fea-section-title {
font-family: 'Atkinson Hyperlegible', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
input, textarea, select, button {
font-family: inherit;
}
/* ── Toggle claro/oscuro: botón inyectado junto al selector de idioma ── */
#fea-theme-btn {
display: inline-flex; align-items: center; justify-content: center;
width: 30px; height: 30px; border-radius: 50%;
border: 1px solid rgba(0,0,0,0.25); background: none; color: inherit;
cursor: pointer; font-size: 0.95rem; line-height: 1; padding: 0;
}
#fea-theme-btn:hover { background: rgba(0,0,0,0.06); }
/* ══════════════════════════════════════════════════════════════════
MODO OSCURO — activado por [data-fea-theme="dark"] en <html>
══════════════════════════════════════════════════════════════════ */
html[data-fea-theme="dark"] {
/* Deja que el navegador oscurezca controles nativos gratis:
audio/video, scrollbars, checkboxes, selects sin estilo propio. */
color-scheme: dark;
--wp--preset--color--base: #0d0d0d;
--wp--preset--color--contrast: #ececec;
}
html[data-fea-theme="dark"] body {
background-color: #0d0d0d !important;
color: #ececec !important;
}
/* En artículos, fea-ui.php fija --wp--preset--color--base en el body
para el modo claro. El contenedor desplegable del menú hereda esa
variable, así que hay que restaurarla aquí en oscuro. */
html[data-fea-theme="dark"] body.single-post {
--wp--preset--color--base: #0d0d0d;
--wp--preset--color--contrast: #ececec;
}
html[data-fea-theme="dark"] a,
html[data-fea-theme="dark"] a:visited { color: <?php echo esc_html($accent_dark); ?>; }
html[data-fea-theme="dark"] a:focus-visible,
html[data-fea-theme="dark"] button:focus-visible {
outline-color: <?php echo esc_html($accent_dark); ?> !important;
}
/* Cabecera/pie y bloques de grupo sin fondo explícito heredan el body;
solo hay que corregir los pocos sitios con color fijo en claro. */
html[data-fea-theme="dark"] input,
html[data-fea-theme="dark"] textarea,
html[data-fea-theme="dark"] select {
background-color: #1c1c1c;
color: #ececec;
border-color: #3a3a3a;
}
/* Search block uses more-specific own color rules. */
html[data-fea-theme="dark"] .wp-block-search__inside-wrapper,
html[data-fea-theme="dark"] .wp-block-search__input {
background-color: #1c1c1c;
color: #ececec;
border-color: #3a3a3a;
}
html[data-fea-theme="dark"] .wp-block-search__button {
background-color: #ececec;
color: #0d0d0d;
border-color: #ececec;
}
html[data-fea-theme="dark"] .fea-adv-link-wrap { background: #161311; border-bottom-color: #2a2320; }
html[data-fea-theme="dark"] .fea-adv-link { color: <?php echo esc_html($accent_dark); ?>; }
/* Crop the white edge embedded in slide images in dark mode only. */
html[data-fea-theme="dark"] .fea-hero-slider .n2-ss-slide-background-image {
overflow: hidden;
}
html[data-fea-theme="dark"] .fea-hero-slider .n2-ss-slide-background-image img {
transform: scale(1.015);
}
/* Portada — franja hero (fea-homepage.php) */
html[data-fea-theme="dark"] .fea-hero-band {
background: linear-gradient(180deg, #1a1512, #0d0d0d);
border-bottom-color: #2a2320;
}
html[data-fea-theme="dark"] .fea-hero-title,
html[data-fea-theme="dark"] .fea-section-title {
color: #ececec;
}
html[data-fea-theme="dark"] .fea-section-label,
html[data-fea-theme="dark"] .fea-section-more,
html[data-fea-theme="dark"] .fea-card-author {
color: <?php echo esc_html($accent_dark); ?>;
}
html[data-fea-theme="dark"] .fea-hero-meta { color: #b8afa8; }
/* Tarjetas de autor/artículo (fea-homepage.php) */
html[data-fea-theme="dark"] .fea-card {
background: #161311;
border-color: #2a2320;
}
html[data-fea-theme="dark"] .fea-card-title a { color: #ececec; }
/* Archivos (categoría, búsqueda y autor) — fea-homepage.php fija aquí
fondos y texto claros que no heredan del tema. */
html[data-fea-theme="dark"] .wp-block-query-title {
color: #ececec !important;
}
html[data-fea-theme="dark"] .fea-archive-card {
background: #161311;
border-color: #2a2320;
}
html[data-fea-theme="dark"] .fea-archive-title a {
color: #ececec;
}
html[data-fea-theme="dark"] .fea-archive-excerpt {
color: #b8afa8;
}
/* Comentarios al evangelio: el panel usa colores editoriales claros fijos. */
html[data-fea-theme="dark"] .fea-com-evangelio {
background: #1a1711;
border-left-color: #c9973e;
color: #ececec;
}
html[data-fea-theme="dark"] .fea-com-evangelio-details summary {
color: #f0c674;
}
/* Elementos editoriales presentes en artículos y resultados. */
html[data-fea-theme="dark"] .fea-audio {
background: #161311;
border-color: #3a302b;
border-left-color: <?php echo esc_html($accent_dark); ?>;
}
html[data-fea-theme="dark"] .fea-byline-name { color: #ececec; }
html[data-fea-theme="dark"] .fea-byline-cat,
html[data-fea-theme="dark"] .fea-eed-link .fecha { color: #b8afa8; }
html[data-fea-theme="dark"] .fea-share-rule { border-top-color: #3a302b; }
html[data-fea-theme="dark"] .fea-share-row { color: #d5cbc3; }
html[data-fea-theme="dark"] .fea-share-label,
html[data-fea-theme="dark"] .fea-share-sep { color: #b8afa8; }
/* Formulario y filtros de búsqueda avanzada. */
html[data-fea-theme="dark"] .fea-adv-details {
background: #161311; border-color: #3a302b;
}
html[data-fea-theme="dark"] .fea-adv-summary {
background: #24181c; border-bottom-color: #3a302b;
color: <?php echo esc_html($accent_dark); ?>;
}
html[data-fea-theme="dark"] .fea-adv-label,
html[data-fea-theme="dark"] .fea-adv-chips-label,
html[data-fea-theme="dark"] .fea-adv-meta,
html[data-fea-theme="dark"] .fea-archive-card .fea-adv-byline { color: #b8afa8; }
html[data-fea-theme="dark"] .fea-adv-chip {
background: #2a1b20; border-color: #56343d; color: #ececec;
}
html[data-fea-theme="dark"] .fea-adv-input,
html[data-fea-theme="dark"] .fea-adv-select {
background: #1c1c1c; border-color: #3a3a3a; color: #ececec;
}
html[data-fea-theme="dark"] .fea-adv-count { color: #b8afa8; }
/* Recopilatorios y galería multimedia. */
html[data-fea-theme="dark"] .fea-recop-year { border-bottom-color: #3a302b; }
html[data-fea-theme="dark"] .fea-recop-list li { border-bottom-color: #2a2320; }
html[data-fea-theme="dark"] .fea-recop-list a,
html[data-fea-theme="dark"] .fea-mm-title { color: #ececec; }
html[data-fea-theme="dark"] .fea-recop-date,
html[data-fea-theme="dark"] .fea-mm-date,
html[data-fea-theme="dark"] .fea-mm-excerpt { color: #b8afa8; }
html[data-fea-theme="dark"] .fea-mm-card { background: #161311; border-color: #2a2320; }
html[data-fea-theme="dark"] .fea-mm-thumb { background: #241f1c; }
/* Galerías de pensamientos y navegación del tema base. */
html[data-fea-theme="dark"] .fea-gallery-item {
background: #161311; border-color: #3a302b;
}
html[data-fea-theme="dark"] .fea-lightbox-frame img { background: #161311; }
html[data-fea-theme="dark"] .fea-lightbox button { background: #2a2320; color: #ececec; }
html[data-fea-theme="dark"] .wp-block-navigation .wp-block-navigation-item__content {
color: #ececec;
}
html[data-fea-theme="dark"] .wp-block-navigation__submenu-container {
background: #161311; border-color: #3a302b;
}
/* Página de apoyo: plantilla propia con colores claros explícitos. */
html[data-fea-theme="dark"] .fea-support-page {
--fea-support-ink: #ececec;
--fea-support-warm: #161311;
--fea-support-line: #3a302b;
--fea-support-card: #161311;
}
html[data-fea-theme="dark"] .fea-support-hero,
html[data-fea-theme="dark"] .fea-support-banner {
background: #1a1711 !important;
border-color: #3a302b !important;
}
html[data-fea-theme="dark"] .fea-support-card,
html[data-fea-theme="dark"] .fea-support-button.is-secondary {
background: #161311 !important;
border-color: #3a302b !important;
color: #ececec !important;
}
html[data-fea-theme="dark"] .fea-support-card__title,
html[data-fea-theme="dark"] .fea-support-progress__numbers span,
html[data-fea-theme="dark"] .fea-support-progress__note,
html[data-fea-theme="dark"] .fea-support-sidebar__small { color: #b8afa8; }
html[data-fea-theme="dark"] .fea-support-progress__track { background: #3a302b; }
/* Colaboradores: stylesheet propio del tema con tarjetas claras y !important. */
html[data-fea-theme="dark"] .entry-content .wrapper {
background: #161311 !important;
border-color: #3a302b !important;
color: #ececec !important;
box-shadow: 0 2px 4px rgba(0,0,0,.45) !important;
}
html[data-fea-theme="dark"] .entry-content .wrapper strong {
color: #ececec !important;
}
html[data-fea-theme="dark"] .entry-content .wrapper a,
html[data-fea-theme="dark"] .entry-content .wrapper a:visited {
color: #ececec !important;
}
html[data-fea-theme="dark"] .entry-content .wrapper a:hover {
color: <?php echo esc_html($accent_dark); ?> !important;
}
/* Selector de idioma (fea-homepage.php) */
html[data-fea-theme="dark"] #fea-lang-btn { border-color: rgba(255,255,255,0.3); }
html[data-fea-theme="dark"] #fea-lang-btn:hover,
html[data-fea-theme="dark"] #fea-theme-btn:hover { background: rgba(255,255,255,0.08); }
html[data-fea-theme="dark"] #fea-theme-btn { border-color: rgba(255,255,255,0.3); }
html[data-fea-theme="dark"] #fea-lang-dropdown {
background: #161311; border-color: #3a3a3a;
box-shadow: 0 6px 16px rgba(0,0,0,.5);
}
html[data-fea-theme="dark"] #fea-lang-dropdown a { color: #ececec; }
html[data-fea-theme="dark"] #fea-lang-dropdown a:hover { background: #241f1c; }
html[data-fea-theme="dark"] #fea-lang-dropdown a[aria-current] { background: #2a2320; color: #fff; }
/* Buscador móvil (fea-search.php) */
html[data-fea-theme="dark"] .fea-search-bar { background: #0d0d0d; border-bottom-color: #2a2320; }
html[data-fea-theme="dark"] .fea-search { background: #1c1c1c; border-color: #3a3a3a; }
html[data-fea-theme="dark"] .fea-search input[type=search] { color: #ececec; }
/* Reproductor de audio (fea-audio-player.php) — el <audio> nativo ya
cambia solo vía color-scheme; solo hace falta la etiqueta de texto. */
html[data-fea-theme="dark"] .fea-audio-label { color: #b8afa8; }
/* Barra y tarjeta de Beta Feedback (fea-beta-feedback.php) */
html[data-fea-theme="dark"] #fea-beta-bar {
background: #161311; border-top-color: #2a2320; color: #ececec;
}
html[data-fea-theme="dark"] #fea-beta-bar .fea-beta-dismiss { color: #b8afa8; }
html[data-fea-theme="dark"] #fea-fb .fea-fb-card {
background: #161311; border-color: #3a3a3a; color: #ececec;
}
html[data-fea-theme="dark"] #fea-fb button.fea-fb-vote {
background: #1c1c1c; border-color: #3a3a3a; color: #ececec;
}
html[data-fea-theme="dark"] #fea-fb button.fea-fb-vote.sel {
border-color: <?php echo esc_html($accent_dark); ?>; background: #2a1418;
}
html[data-fea-theme="dark"] #fea-fb textarea { background: #1c1c1c; border-color: #3a3a3a; color: #ececec; }
/* Barra de consentimiento de cookies (fea-cookie-consent.php) */
html[data-fea-theme="dark"] #fea-cc {
background: #161311 !important; color: #ececec !important; border-top-color: #2a2320 !important;
}
html[data-fea-theme="dark"] #fea-cc a { color: #b8afa8 !important; }
html[data-fea-theme="dark"] #fea-cc .fea-cc-reject { color: #ececec !important; border-color: #3a3a3a !important; }
</style>
<?php
}, 30);
/* ── 3) Botón de toggle, inyectado en el header junto al selector de idioma ──
* Mismo patrón que el selector de idioma (fea-homepage.php): se crea por JS
* y se inserta en el nav del header, para no tocar el template FSE. */
add_action('wp_footer', function () {
if (is_admin()) return;
?>
<script>
(function() {
// El footer puede renderizarse más de una vez en algunos templates FSE.
// Evitamos crear un segundo toggle en ese caso.
if (document.getElementById('fea-theme-btn')) return;
var btn = document.createElement('button');
btn.id = 'fea-theme-btn';
btn.type = 'button';
btn.setAttribute('aria-pressed', document.documentElement.getAttribute('data-fea-theme') === 'dark' ? 'true' : 'false');
btn.setAttribute('aria-label', 'Cambiar a modo oscuro');
btn.textContent = document.documentElement.getAttribute('data-fea-theme') === 'dark' ? '☀️' : '🌙';
function setLabel(isDark) {
btn.setAttribute('aria-pressed', isDark ? 'true' : 'false');
btn.setAttribute('aria-label', isDark ? 'Cambiar a modo claro' : 'Cambiar a modo oscuro');
btn.textContent = isDark ? '☀️' : '🌙';
}
btn.addEventListener('click', function() {
var isDark = document.documentElement.getAttribute('data-fea-theme') === 'dark';
if (isDark) {
document.documentElement.removeAttribute('data-fea-theme');
} else {
document.documentElement.setAttribute('data-fea-theme', 'dark');
}
setLabel(!isDark);
try { localStorage.setItem('fea_theme', !isDark ? 'dark' : 'light'); } catch (e) {}
});
function inject() {
var header = document.querySelector('header.wp-block-template-part') || document.querySelector('header');
if (!header) return;
var navGroup = header.querySelector('.wp-block-navigation__container') || header.querySelector('nav');
var li = document.createElement('li');
li.className = 'wp-block-navigation-item';
li.style.cssText = 'display:flex;align-items:center;margin-left:0.5rem;';
li.appendChild(btn);
if (!navGroup) {
header.style.position = 'relative';
li.style.cssText = 'position:absolute;top:50%;right:1.5rem;transform:translateY(-50%);';
header.appendChild(li);
return;
}
// Insertar después del selector de idioma si ya se inyectó, si no, al final del nav.
var langSwitcher = navGroup.querySelector('#fea-lang-switcher');
if (langSwitcher) {
var anchor = langSwitcher;
while (anchor.parentNode && anchor.parentNode !== navGroup) anchor = anchor.parentNode;
anchor.parentNode.insertBefore(li, anchor.nextSibling);
} else {
navGroup.appendChild(li);
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', inject);
} else {
inject();
}
})();
</script>
<?php
}, 21);
+5 -1
View File
@@ -9,8 +9,12 @@ function fea_evangelio_category($es_id) {
return function_exists('fea_cat') ? (int) fea_cat($es_id) : (int) $es_id; return function_exists('fea_cat') ? (int) fea_cat($es_id) : (int) $es_id;
} }
function fea_evangelio_comment_categories() {
return array_map('fea_evangelio_category', [1647, 1646]);
}
function fea_evangelio_is_comment($post_id) { function fea_evangelio_is_comment($post_id) {
return has_category(fea_evangelio_category(1647), $post_id); return has_category(fea_evangelio_comment_categories(), $post_id);
} }
/** Lee el meta del comentario; las traducciones heredan el dato editorial del original ES. */ /** Lee el meta del comentario; las traducciones heredan el dato editorial del original ES. */
+6 -2
View File
@@ -2,10 +2,14 @@
/** Propuesta/aplicación segura del backfill de _cita_evangelio. */ /** Propuesta/aplicación segura del backfill de _cita_evangelio. */
/** Uso: wp eval-file scripts/backfill_evangelio_meta.php [--apply] --path=/var/www/html */ /** Uso: wp eval-file scripts/backfill_evangelio_meta.php [--apply] --path=/var/www/html */
$apply = in_array('--apply', $_SERVER['argv'] ?? [], true); // WP-CLI no reenvía de forma consistente argumentos desconocidos a eval-file.
// El modo escritura exige por tanto una intención explícita y auditable:
// FEA_EVANGELIO_APPLY=1 wp eval-file scripts/backfill_evangelio_meta.php
$apply = getenv('FEA_EVANGELIO_APPLY') === '1'
|| in_array('--apply', $_SERVER['argv'] ?? [], true);
$posts = get_posts([ $posts = get_posts([
'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1, 'post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => -1,
'category__in' => [fea_evangelio_category(1647)], 'category__in' => fea_evangelio_comment_categories(),
'meta_query' => [['key' => '_cita_evangelio', 'compare' => 'NOT EXISTS']], 'meta_query' => [['key' => '_cita_evangelio', 'compare' => 'NOT EXISTS']],
'orderby' => 'date', 'order' => 'ASC', 'orderby' => 'date', 'order' => 'ASC',
]); ]);
+79
View File
@@ -0,0 +1,79 @@
"""doc_convert.py — convierte un .doc viejo a .docx usando Microsoft Word (COM).
Necesario para Marcos (marroro@telefonica.net), que envía .doc (Word antiguo) y
python-docx no sabe leer .doc. El contenido ya viene en EML (lo etiqueta Inma al
revisar); aquí solo cambiamos el FORMATO de archivo.
Requiere Microsoft Word instalado + pywin32 (igual que marcos_review).
API: doc_to_docx(path, force=False) -> Path | None
"""
from __future__ import annotations
from pathlib import Path
WD_FORMAT_DOCX = 16 # wdFormatDocumentDefault (.docx)
def doc_to_docx(path, force: bool = False):
"""Convierte un .doc a .docx con Word COM. Idempotente: si el .docx ya existe y
no force, lo devuelve sin reconvertir. Devuelve la ruta .docx, o None si falla."""
path = Path(path)
if path.suffix.lower() != ".doc":
return None
out = path.with_suffix(".docx")
if out.exists() and not force:
return out
try:
import win32com.client # type: ignore
except ImportError:
return None
word = win32com.client.Dispatch("Word.Application")
word.Visible = False
try:
d = word.Documents.Open(str(path))
d.SaveAs(str(out), FileFormat=WD_FORMAT_DOCX)
d.Close(SaveChanges=False)
finally:
word.Quit()
if out.exists():
quitar_smarttags(out)
return out if out.exists() else None
def quitar_smarttags(docx_path) -> int:
"""Desenvuelve los <w:smartTag> del .docx. Devuelve cuántos ha quitado.
⚠️ CRÍTICO, no es cosmético. Los .doc de Fray Marcos traen `smartTag` (el viejo
reconocimiento de nombres de Word) envolviendo expresiones como "la Iglesia" o
"la Cananea". **python-docx solo lee los <w:r> que cuelgan directamente del párrafo,
así que el texto de dentro del smartTag DESAPARECE sin dar error**: se publicaron
frases mutiladas en las cartas 736, 737 y 739 ("...no va dirigida a los apóstoles,
sino a dureza de la respuesta..."). Detectado el 12-ago-2026.
"""
import re, shutil, zipfile
from pathlib import Path
docx_path = Path(docx_path)
with zipfile.ZipFile(docx_path) as z:
piezas = {n: z.read(n) for n in z.namelist()}
xml = piezas.get("word/document.xml", b"").decode("utf-8", "replace")
nuevo, n = re.subn(r"</?w:smartTag(?:Pr)?\b[^>]*>|<w:attr\b[^>]*/>", "", xml)
if not n:
return 0
piezas["word/document.xml"] = nuevo.encode("utf-8")
tmp = docx_path.with_suffix(".docx.tmp")
with zipfile.ZipFile(tmp, "w", zipfile.ZIP_DEFLATED) as z:
for nombre, datos in piezas.items():
z.writestr(nombre, datos)
shutil.move(str(tmp), str(docx_path))
return n
if __name__ == "__main__":
import sys
if len(sys.argv) < 2:
print("uso: python doc_convert.py path/al/archivo.doc", file=sys.stderr)
sys.exit(2)
res = doc_to_docx(Path(sys.argv[1]), force="--force" in sys.argv)
print(f"OK: {res}" if res else "FALLO (¿Word/pywin32?)")
sys.exit(0 if res else 1)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+69
View File
@@ -0,0 +1,69 @@
# `.doc` originales de Fray Marcos
Los 30 ficheros `.doc` (Word binario antiguo) tal y como los envía Fray Marcos por correo a
`ediciones@feadulta.com`, sin tocar. Subidos a petición de Rafa en el **issue #209**, para poder
reproducir y diffear desde este lado el problema de los `<w:smartTag>`.
## Por qué están aquí
`python-docx` **no lee el texto que va dentro de un `<w:smartTag>`**: lo salta sin dar error. Los `.doc`
de Fray Marcos arrastran esas etiquetas heredadas de versiones viejas de Word envolviendo expresiones
como «la Iglesia» o «la Cananea», así que al convertirlos se publicaban frases con palabras borradas en
silencio. Está corregido en `scripts/doc_convert.py` con `quitar_smarttags()`.
Ojo: la cadena `smartTag` **no aparece en el binario `.doc`**; surge al convertirlo a `.docx`, que es
formato OOXML. Para verlas hay que convertir primero.
## Cómo reproducir
```bash
python scripts/doc_convert.py "tests/fixtures/fray-marcos/739_8r_Marcos_d 20 la Cananea.doc"
```
Requiere Word instalado (la conversión va por COM). `doc_convert.py` desenvuelve los smartTag y hace el
reemplazo con reintentos, porque Dropbox bloquea el fichero unos segundos justo después de que Word lo
cree (WinError 1224).
## Alcance del problema (barrido cerrado en el #209)
De los 30 `.doc` revisados, 20 traían smartTag y sumaban 46 fragmentos envueltos, pero solo **3
artículos publicados quedaron dañados** (posts `53981`, `55078` y `55659`), ya reparados en producción.
Los comentarios de febrero a junio están intactos porque se publicaron por la vía de la migración de
Joomla, no desde el `.docx`; solo quedó expuesto lo publicado por Mixbot desde julio.
## Inventario
El prefijo numérico es el número de carta; el resto es el nombre original del fichero.
| carta | semana | fichero original |
|---:|---|---|
| 713 | semana_VI_TO | `713_8r_Marcos_d 06 plenitud de ley.doc` |
| 714 | semana_I_Cuaresma | `714_8r_Marcos_Cuar 1 tentaciones.doc` |
| 715 | semana_II_Cuaresma | `715_8r_Marcos_Cuar 2 Transfigurac.doc` |
| 716 | semana_III_Cuaresma | `716_8r_Marcos_Cuar 3 Samaritana.doc` |
| 717 | semana_IV_Cuaresma | `717_8r_Marcos_Cuar 4 ciego de naci.doc` |
| 718 | semana_V_Cuaresma | `718_8r_Marcos_Cuar 5 Lázaro.doc` |
| 719 | semana_Domingo_Ramos | `719_8r_Marcos_Cuar 6 Ramos.doc` |
| 720 | semana_Santa | `720_8r_Marcos_JUEVES SANTO.doc` |
| 720 | semana_Santa | `720_8r_Marcos_Pasc 1 resucitó.doc` |
| 720 | semana_Santa | `720_8r_Marcos_VIERNES SANTO.doc` |
| 721 | semana_II_Pascua | `721_8r_Marcos_Pasc 2 Tomás.doc` |
| 722 | semana_III_Pascua | `722_8r_Marcos_Pasc 3 Emaús.doc` |
| 723 | semana_IV_Pascua | `723_8r_Marcos_Pasc 4 pastor modelo.doc` |
| 724 | semana_V_Pascua | `724_8r_Marcos_Pasc 5 camino,verdad,vida.doc` |
| 725 | semana_VI_Pascua | `725_8r_Marcos_Pasc 6 El Paráclito.doc` |
| 726 | semana_VII_Pascua | `726_8r_Marcos_Pasc 7 ascensión.doc` |
| 727 | semana_Pentecostes | `727_8r_Marcos_PENTECOSTÉS.doc` |
| 728 | semana_Trinidad | `728_8r_Marcos_TRINIDAD.doc` |
| 729 | semana_Corpus | `729_8r_Marcos_CORPUS.doc` |
| 730 | semana_11_TO | `730_8r_Marcos_d 11 misión de los 12.doc` |
| 731 | semana_12_TO | `731_8r_Marcos_d 12 no tengas miedo.doc` |
| 732 | semana_13_TO | `732_8r_Marcos_d 13 amor a Dios o família.doc` |
| 733 | semana_14_TO | `733_8r_Marcos_d 14 sencillez.doc` |
| 734 | semana_15_TO | `734_8r_Marcos_d 15 sembrador.doc` |
| 735 | semana_16_TO | `735_8r_Marcos_d 16 cizaña.doc` |
| 736 | semana_17_TO | `736_8r_Marcos_d 17 tesoro y perla.doc` |
| 737 | semana_18_TO | `737_8r_Marcos_d 18 panes y peces.doc` |
| 738 | semana_19_TO | `738_8r_Marcos_d 19 Qué poca fe.doc` |
| 739 | semana_20_TO | `739_8r_Marcos_d 20 la Cananea.doc` |
| 740 | semana_21_TO | `740_8r_Marcos_d 21 quién es Jesús.doc` |