diff --git a/2026/10/12_hispanidad.jpg b/2026/10/12_hispanidad.jpg new file mode 100644 index 0000000..d668614 Binary files /dev/null and b/2026/10/12_hispanidad.jpg differ diff --git a/2026/10/14_votoenblanco_1.png b/2026/10/14_votoenblanco_1.png new file mode 100644 index 0000000..25ad1e6 Binary files /dev/null and b/2026/10/14_votoenblanco_1.png differ diff --git a/2026/10/14_votoenblanco_2.png b/2026/10/14_votoenblanco_2.png new file mode 100644 index 0000000..274c2c3 Binary files /dev/null and b/2026/10/14_votoenblanco_2.png differ diff --git a/2026/10/14_votoenblanco_3.png b/2026/10/14_votoenblanco_3.png new file mode 100644 index 0000000..86c8903 Binary files /dev/null and b/2026/10/14_votoenblanco_3.png differ diff --git a/2026/10/14_votoenblanco_4.png b/2026/10/14_votoenblanco_4.png new file mode 100644 index 0000000..da8fc6a Binary files /dev/null and b/2026/10/14_votoenblanco_4.png differ diff --git a/2026/10/14_votoenblanco_5.png b/2026/10/14_votoenblanco_5.png new file mode 100644 index 0000000..7e69087 Binary files /dev/null and b/2026/10/14_votoenblanco_5.png differ diff --git a/2026/10/14_votoenblanco_6.png b/2026/10/14_votoenblanco_6.png new file mode 100644 index 0000000..5516dc4 Binary files /dev/null and b/2026/10/14_votoenblanco_6.png differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..3247508 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# pnh-rrss + +Imágenes publicadas en redes del Partido Nacional Hispanista y kit para generarlas. + +- `AAAA/MM/DD_tema[_n].png` – imágenes servidas a Metricool por enlace raw: + `https://git.alejandrogs.es/PNHispanista/pnh-rrss/raw/branch/main/` +- `kit/` – generador de carteles 1080×1080 con el marco oficial. + +## Kit + +``` +cd kit && npm i && node render.mjs ejemplos/ejemplo.json +``` + +`render.mjs` recibe un JSON con `slides[].html` y dibuja fondo granate, aspa de Borgoña, doble marco dorado, +cabecera «PARTIDO NACIONAL [caballo] HISPANISTA», pie y numeración. `{{LOGO}}` y `{{HORSE}}` se sustituyen por los +recursos de `assets/`. Clases: `.txt .center .kick .date .big h1 p .motto .quote .bigquote .rows .row`. +`referencia/` guarda los scripts originales de cada cartel (mapa del 12-O, carrusel 29N, Trafalgar). + +## Estilo + +- Paleta: granate #4B0000/#6a0a14, rojo hispánico #A10F2B, oro #F2C64B/#D9A63A, crema #FBF3E4. Azules nunca. +- Tipografía: Cinzel (titulares, 700/900) + EB Garamond (texto, cursiva para lemas y citas). +- Lo que funciona: composición tipográfica, mapas en oro, emblemas sencillos. Lo que no: ilustraciones dibujadas a mano (barcos, figuras). +- Carruseles: portada potente + láminas de texto; la descripción de Instagram corta. diff --git a/kit/.gitignore b/kit/.gitignore new file mode 100644 index 0000000..c2658d7 --- /dev/null +++ b/kit/.gitignore @@ -0,0 +1 @@ +node_modules/ diff --git a/kit/assets/horse.png b/kit/assets/horse.png new file mode 100644 index 0000000..e7f6908 Binary files /dev/null and b/kit/assets/horse.png differ diff --git a/kit/assets/logo_full_hd.png b/kit/assets/logo_full_hd.png new file mode 100644 index 0000000..672e9ff Binary files /dev/null and b/kit/assets/logo_full_hd.png differ diff --git a/kit/ejemplos/ejemplo.json b/kit/ejemplos/ejemplo.json new file mode 100644 index 0000000..0569c34 --- /dev/null +++ b/kit/ejemplos/ejemplo.json @@ -0,0 +1,12 @@ +{ + "out": "../../_preview", + "prefix": "ejemplo", + "footerLeft": "29N · VOTO EN BLANCO", + "numbered": true, + "slides": [ + { "cross": 0.22, "halo": [540, 640, 300], + "html": "
ELECCIONES GENERALES · 29N
VOTO EN
BLANCO
Ninguno nos representa. Todavía.
" }, + { "html": "
LA POSTURA DEL PNH

¿Por qué no pedimos el voto para nadie?

Ningún partido defiende la Hispanidad como proyecto.

Hasta entonces, en blanco. Y después, con nosotros.
" }, + { "footer": true, "html": "
— 21 DE OCTUBRE DE 1805 —
TRAFALGAR
«Si llegas a saber que mi navío ha sido hecho prisionero, dame por muerto.»
" } + ] +} diff --git a/kit/package-lock.json b/kit/package-lock.json new file mode 100644 index 0000000..d4e2a10 --- /dev/null +++ b/kit/package-lock.json @@ -0,0 +1,45 @@ +{ + "name": "pnh-kit", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "pnh-kit", + "dependencies": { + "@fontsource/cinzel": "5.3.0", + "@fontsource/eb-garamond": "5.3.0", + "playwright-core": "1.64.0" + } + }, + "node_modules/@fontsource/cinzel": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/cinzel/-/cinzel-5.3.0.tgz", + "integrity": "sha512-KEOYTsrRppW0uRIPWBDPrQgunCS6f8u4nzZxYRBfo9SCknKojLYjK7B0ZoVmJhyVLefz271ZQRF9EOpHZlfhRw==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/@fontsource/eb-garamond": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/eb-garamond/-/eb-garamond-5.3.0.tgz", + "integrity": "sha512-VplwHpB8FLuzl+4G5LDci1b3Z4SghiuXH8XEgaxjnOb5aue5mEt1njmDKeO6iyLeGa73LffU7PC7hzncLRx0ZA==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, + "node_modules/playwright-core": { + "version": "1.64.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.0.tgz", + "integrity": "sha512-T9r+MZkTECl2+oUcZ26YgZzTrYidTsIhYYkJix+6iDOymOb1FB2RLLSOxRGnZGv5DStt+aduIVbt+E8WygXYpg==", + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + } + } +} diff --git a/kit/package.json b/kit/package.json new file mode 100644 index 0000000..2506834 --- /dev/null +++ b/kit/package.json @@ -0,0 +1,2 @@ +{ "name": "pnh-kit", "private": true, "type": "module", + "dependencies": { "@fontsource/cinzel": "5.3.0", "@fontsource/eb-garamond": "5.3.0", "playwright-core": "1.64.0" } } diff --git a/kit/referencia/12octubre_mapa.mjs b/kit/referencia/12octubre_mapa.mjs new file mode 100644 index 0000000..640477a --- /dev/null +++ b/kit/referencia/12octubre_mapa.mjs @@ -0,0 +1,161 @@ +import fs from 'fs'; +import { geoMercator, geoPath } from 'd3-geo'; +import { feature } from 'topojson-client'; +import { chromium } from 'playwright-core'; + +const D = process.cwd(); +const topo = JSON.parse(fs.readFileSync(D + '/node_modules/world-atlas/countries-50m.json')); +const countries = feature(topo, topo.objects.countries).features; +const b64 = f => fs.readFileSync(D + '/' + f).toString('base64'); +const font = f => fs.readFileSync(D + '/node_modules/@fontsource/' + f).toString('base64'); + +const HISP = new Set([724, 620, 484, 320, 340, 222, 558, 188, 591, 192, 214, 630, 170, 862, 218, 604, 68, 152, 32, 858, 600, 76, 226].map(String).map(s => s.padStart(3, '0'))); +const PHI = '608'; + +// main map: Americas +const W = 1080; +const proj = geoMercator().fitExtent([[80, 470], [640, 975]], { + type: 'MultiPoint', coordinates: [[-117, 32.5], [-60, 23], [-74, -55.5], [-34.8, -10]] +}); +const path = geoPath(proj); +const iproj = geoMercator().fitExtent([[760, 455], [990, 645]], { type: 'MultiPoint', coordinates: [[-9.5, 36], [4.3, 43.8]] }); +const ipath = geoPath(iproj); +const IBE = new Set(['724', '620']); +let canar = ''; +const cproj = geoMercator().scale(iproj.scale()).center([-15.6, 28.3]).translate([742, 668]); +let hisp = '', iber = ''; +for (const c of countries) { + if (c.id === PHI) continue; + if (IBE.has(c.id)) { + if (c.id === '724') { + const polys = c.geometry.coordinates; + const main = polys.filter(p => p[0].every(([x]) => x > -12)); + const can = polys.filter(p => p[0].some(([x]) => x <= -12) && p[0].every(([, y]) => y > 26.5)); + iber += ipath({ type: 'MultiPolygon', coordinates: main }); + canar = geoPath(cproj)({ type: 'MultiPolygon', coordinates: can }); + } else iber += ipath(c); + continue; + } + if (!HISP.has(c.id)) continue; + const d = path(c); if (!d) continue; + const [[x0, y0], [x1, y1]] = path.bounds(c); + if (x1 < 0 || x0 > W || y1 < 0 || y0 > W) continue; + hisp += d; +} +hisp += iber + canar; +const phi = countries.find(c => c.id === PHI); +const pproj = geoMercator().fitExtent([[905, 700], [1000, 880]], phi); +const phiPath = geoPath(pproj)(phi); +const P = iproj([-6.9, 37.2]), G = cproj([-17.2, 28.1]), S = proj([-74.5, 24.1]); +const route = `M${P[0]},${P[1]} Q${(P[0] + G[0]) / 2 + 10},${(P[1] + G[1]) / 2 + 5} ${G[0]},${G[1]} Q${(G[0] + S[0]) / 2},${Math.min(G[1], S[1]) - 70} ${S[0]},${S[1]}`; +const mid = [(G[0] + S[0]) / 2 + 10, (G[1] + S[1]) / 2 - 50]; +// sun centre in mid-Atlantic +const sun = [645, 650]; +let rays = ''; +for (let i = 0; i < 36; i++) { + const a = i * Math.PI * 2 / 36, r0 = 70, r1 = i % 2 ? 190 : 270; + rays += ``; +} + +// ragged Cross of Burgundy (background, faint) +function raggedBar(x0, y0, x1, y1, w) { + const dx = x1 - x0, dy = y1 - y0, L = Math.hypot(dx, dy), ux = dx / L, uy = dy / L, nx = -uy, ny = ux; + const pts = [], n = 9; + for (let s = 0; s <= 1; s++) { + const side = s ? -1 : 1, seq = []; + for (let k = 0; k <= n; k++) { + const t = k / n * L, knot = (k > 0 && k < n && k % 2 === 1) ? 26 : 0; + seq.push([x0 + ux * t + nx * side * (w / 2 + knot), y0 + uy * t + ny * side * (w / 2 + knot)]); + if (knot) seq.push([x0 + ux * (t + 18) + nx * side * w / 2, y0 + uy * (t + 18) + ny * side * w / 2]); + } + pts.push(...(s ? seq.reverse() : seq)); + } + return 'M' + pts.map(p => p.map(v => v.toFixed(1)).join(',')).join('L') + 'Z'; +} +const cross = raggedBar(-60, -60, 1140, 1140, 110) + raggedBar(1140, -60, -60, 1140, 110); + +const caravel = ` + + + + + + + + + + +`; + +const html = ` + + + + + + + + + + + + + + + ${rays} + + + + + + 1492 + ${caravel} + + + + + +N.ª S.ª del Pilar + + + + + + + + + + + PARTIDO NACIONAL + HISPANISTA + + + + + + +— 12 DE OCTUBRE — +HISPANIDAD + + Unidad, Fe y Destino + + + + + +¡ARRIBA LA HISPANIDAD! · 2026 +`; + +fs.writeFileSync(D + '/poster.html', html); +const browser = await chromium.launch({ executablePath: '/opt/pw-browsers/chromium' + (fs.existsSync('/opt/pw-browsers/chromium') && fs.statSync('/opt/pw-browsers/chromium').isDirectory() ? '/chrome' : '') }); +const pg = await browser.newPage({ viewport: { width: 1080, height: 1080 }, deviceScaleFactor: 2 }); +await pg.setContent(html); await pg.evaluate(() => document.fonts.ready); await pg.waitForTimeout(300); +await pg.screenshot({ path: D + '/out.png', clip: { x: 0, y: 0, width: 1080, height: 1080 } }); +await browser.close(); +console.log('ok', P, G, S, sun); diff --git a/kit/referencia/trafalgar_cita.mjs b/kit/referencia/trafalgar_cita.mjs new file mode 100644 index 0000000..ac0bf7f --- /dev/null +++ b/kit/referencia/trafalgar_cita.mjs @@ -0,0 +1,111 @@ +import fs from 'fs'; +import { chromium } from 'playwright-core'; +const D = process.cwd(); +const b64 = f => fs.readFileSync(D + '/' + f).toString('base64'); +const font = f => fs.readFileSync(D + '/node_modules/@fontsource/' + f).toString('base64'); + +function raggedBar(x0, y0, x1, y1, w) { + const dx = x1 - x0, dy = y1 - y0, L = Math.hypot(dx, dy), ux = dx / L, uy = dy / L, nx = -uy, ny = ux; + const pts = [], n = 9; + for (let s = 0; s <= 1; s++) { + const side = s ? -1 : 1, seq = []; + for (let k = 0; k <= n; k++) { + const t = k / n * L, knot = (k > 0 && k < n && k % 2 === 1) ? 26 : 0; + seq.push([x0 + ux * t + nx * side * (w / 2 + knot), y0 + uy * t + ny * side * (w / 2 + knot)]); + if (knot) seq.push([x0 + ux * (t + 18) + nx * side * w / 2, y0 + uy * (t + 18) + ny * side * w / 2]); + } + pts.push(...(s ? seq.reverse() : seq)); + } + return 'M' + pts.map(p => p.map(v => v.toFixed(1)).join(',')).join('L') + 'Z'; +} +const cross = raggedBar(-60, -60, 1140, 1140, 110) + raggedBar(1140, -60, -60, 1140, 110); + +// anchor + laurel, centred at (cx, cy) +function emblem(cx, cy) { + const g = '#F2C64B'; + let leaves = ''; + for (const side of [-1, 1]) { + // branch: arc from bottom centre outwards and up + const pts = []; + for (let i = 0; i <= 10; i++) { + const t = i / 10, a = Math.PI * (0.62 + 0.62 * t); + pts.push([cx + side * -Math.cos(a) * 92 * -1, cy + 18 - Math.sin(a) * 82]); + } + leaves += ``; + for (let i = 1; i < 10; i++) { + const [x, y] = pts[i], [x2, y2] = pts[i + 1]; + const ang = Math.atan2(y2 - y, x2 - x) * 180 / Math.PI; + leaves += ``; + leaves += ``; + } + } + const anchor = ` + + + + + + + `; + return `${leaves}${anchor}`; +} + +const ships = ['SANTÍSIMA TRINIDAD', 'PRÍNCIPE DE ASTURIAS', 'SANTA ANA', 'RAYO', 'NEPTUNO', 'ARGONAUTA', 'SAN ILDEFONSO', 'BAHAMA', + 'SAN JUAN NEPOMUCENO', 'SAN AGUSTÍN', 'MONARCA', 'MONTAÑÉS', 'SAN FRANCISCO DE ASÍS', 'SAN JUSTO', 'SAN LEANDRO']; + +const svg = ` + + + + + + + + + + + +${emblem(540, 470)} + + + + PARTIDO NACIONAL + HISPANISTA + + + + +— 21 DE OCTUBRE DE 1805 — +TRAFALGAR + +HONOR Y GLORIA A LOS MARINOS DE ESPAÑA +`; + +const html = `
${svg} +
«Si llegas a saber que mi navío ha sido hecho prisionero, dame por muerto.»
+
COSME DAMIÁN CHURRUCA
Brigadier de la Real Armada · Comandante del San Juan Nepomuceno
Cayó en combate en Trafalgar
+
`; +const browser = await chromium.launch({ executablePath: '/opt/pw-browsers/chromium' }); +const pg = await browser.newPage({ viewport: { width: 1080, height: 1080 } }); +await pg.setContent(html); await pg.evaluate(() => document.fonts.ready); await pg.waitForTimeout(200); +await pg.screenshot({ path: D + '/churruca.png', clip: { x: 0, y: 0, width: 1080, height: 1080 } }); +await browser.close(); console.log('ok'); diff --git a/kit/referencia/trafalgar_lapida.mjs b/kit/referencia/trafalgar_lapida.mjs new file mode 100644 index 0000000..ec50c4c --- /dev/null +++ b/kit/referencia/trafalgar_lapida.mjs @@ -0,0 +1,109 @@ +import fs from 'fs'; +import { chromium } from 'playwright-core'; +const D = process.cwd(); +const b64 = f => fs.readFileSync(D + '/' + f).toString('base64'); +const font = f => fs.readFileSync(D + '/node_modules/@fontsource/' + f).toString('base64'); + +function raggedBar(x0, y0, x1, y1, w) { + const dx = x1 - x0, dy = y1 - y0, L = Math.hypot(dx, dy), ux = dx / L, uy = dy / L, nx = -uy, ny = ux; + const pts = [], n = 9; + for (let s = 0; s <= 1; s++) { + const side = s ? -1 : 1, seq = []; + for (let k = 0; k <= n; k++) { + const t = k / n * L, knot = (k > 0 && k < n && k % 2 === 1) ? 26 : 0; + seq.push([x0 + ux * t + nx * side * (w / 2 + knot), y0 + uy * t + ny * side * (w / 2 + knot)]); + if (knot) seq.push([x0 + ux * (t + 18) + nx * side * w / 2, y0 + uy * (t + 18) + ny * side * w / 2]); + } + pts.push(...(s ? seq.reverse() : seq)); + } + return 'M' + pts.map(p => p.map(v => v.toFixed(1)).join(',')).join('L') + 'Z'; +} +const cross = raggedBar(-60, -60, 1140, 1140, 110) + raggedBar(1140, -60, -60, 1140, 110); + +// anchor + laurel, centred at (cx, cy) +function emblem(cx, cy) { + const g = '#F2C64B'; + let leaves = ''; + for (const side of [-1, 1]) { + // branch: arc from bottom centre outwards and up + const pts = []; + for (let i = 0; i <= 10; i++) { + const t = i / 10, a = Math.PI * (0.62 + 0.62 * t); + pts.push([cx + side * -Math.cos(a) * 92 * -1, cy + 18 - Math.sin(a) * 82]); + } + leaves += ``; + for (let i = 1; i < 10; i++) { + const [x, y] = pts[i], [x2, y2] = pts[i + 1]; + const ang = Math.atan2(y2 - y, x2 - x) * 180 / Math.PI; + leaves += ``; + leaves += ``; + } + } + const anchor = ` + + + + + + + `; + return `${leaves}${anchor}`; +} + +const ships = ['SANTÍSIMA TRINIDAD', 'PRÍNCIPE DE ASTURIAS', 'SANTA ANA', 'RAYO', 'NEPTUNO', 'ARGONAUTA', 'SAN ILDEFONSO', 'BAHAMA', + 'SAN JUAN NEPOMUCENO', 'SAN AGUSTÍN', 'MONARCA', 'MONTAÑÉS', 'SAN FRANCISCO DE ASÍS', 'SAN JUSTO', 'SAN LEANDRO']; + +const svg = ` + + + + + + + + + + + +${emblem(540, 470)} + + + +${[[124, 564], [956, 564], [124, 936], [956, 936]].map(([x, y]) => ``).join('')} + + + + PARTIDO NACIONAL + HISPANISTA + + + + +— 21 DE OCTUBRE DE 1805 — +TRAFALGAR +A los marinos de España + +GRAVINA · CHURRUCA · ALCALÁ GALIANO +`; + +const html = `
${svg} +
NAVÍOS DE LA REAL ARMADA
✦ ✦ ✦
+
${ships.map((n, i) => `${n}
`).join('')}
+`; +const browser = await chromium.launch({ executablePath: '/opt/pw-browsers/chromium' }); +const pg = await browser.newPage({ viewport: { width: 1080, height: 1080 } }); +await pg.setContent(html); await pg.evaluate(() => document.fonts.ready); await pg.waitForTimeout(200); +await pg.screenshot({ path: D + '/lapida.png', clip: { x: 0, y: 0, width: 1080, height: 1080 } }); +await browser.close(); console.log('ok'); diff --git a/kit/referencia/votoenblanco_carrusel.mjs b/kit/referencia/votoenblanco_carrusel.mjs new file mode 100644 index 0000000..5b10728 --- /dev/null +++ b/kit/referencia/votoenblanco_carrusel.mjs @@ -0,0 +1,166 @@ +import fs from 'fs'; +import { chromium } from 'playwright-core'; + +const D = process.cwd(); +const b64 = f => fs.readFileSync(D + '/' + f).toString('base64'); +const font = f => fs.readFileSync(D + '/node_modules/@fontsource/' + f).toString('base64'); +const OUT = process.argv[2] || D + '/carrusel'; +fs.mkdirSync(OUT, { recursive: true }); + +function raggedBar(x0, y0, x1, y1, w) { + const dx = x1 - x0, dy = y1 - y0, L = Math.hypot(dx, dy), ux = dx / L, uy = dy / L, nx = -uy, ny = ux; + const pts = [], n = 9; + for (let s = 0; s <= 1; s++) { + const side = s ? -1 : 1, seq = []; + for (let k = 0; k <= n; k++) { + const t = k / n * L, knot = (k > 0 && k < n && k % 2 === 1) ? 26 : 0; + seq.push([x0 + ux * t + nx * side * (w / 2 + knot), y0 + uy * t + ny * side * (w / 2 + knot)]); + if (knot) seq.push([x0 + ux * (t + 18) + nx * side * w / 2, y0 + uy * (t + 18) + ny * side * w / 2]); + } + pts.push(...(s ? seq.reverse() : seq)); + } + return 'M' + pts.map(p => p.map(v => v.toFixed(1)).join(',')).join('L') + 'Z'; +} +const cross = raggedBar(-60, -60, 1140, 1140, 110) + raggedBar(1140, -60, -60, 1140, 110); +const horse = b64('horse.png'), logo = b64('logo_full_hd.png'); +const TOTAL = 6; + +const css = ` +@font-face{font-family:Cinzel;font-weight:700;src:url(data:font/woff2;base64,${font('cinzel/files/cinzel-latin-700-normal.woff2')})} +@font-face{font-family:Cinzel;font-weight:900;src:url(data:font/woff2;base64,${font('cinzel/files/cinzel-latin-900-normal.woff2')})} +@font-face{font-family:Garamond;font-weight:500;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-500-normal.woff2')})} +@font-face{font-family:Garamond;font-weight:600;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-600-normal.woff2')})} +@font-face{font-family:Garamond;font-style:italic;font-weight:500;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-500-italic.woff2')})} +html,body{margin:0;background:#2a0508} +.s{position:relative;width:1080px;height:1080px;overflow:hidden;color:#FBF3E4} +.s>svg{position:absolute;inset:0} +.txt{position:absolute;left:96px;right:96px;top:215px;bottom:150px;display:flex;flex-direction:column;justify-content:center;gap:34px} +.kick{font-family:Cinzel;font-weight:700;font-size:24px;letter-spacing:6px;color:#D9A63A} +h1{margin:0;font-family:Cinzel;font-weight:900;font-size:68px;line-height:1.05;color:#F2C64B;text-wrap:balance} +p{margin:0;font-family:Garamond;font-weight:500;font-size:37px;line-height:1.32;color:#FBF3E4} +p b{font-weight:600;color:#F2C64B} +.rows{display:flex;flex-direction:column;gap:22px} +.row{display:grid;grid-template-columns:270px 1fr;gap:28px;align-items:baseline;border-top:1.5px solid rgba(217,166,58,.55);padding-top:20px} +.row .k{font-family:Cinzel;font-weight:900;font-size:34px;color:#F2C64B;letter-spacing:1px} +.row .v{font-family:Garamond;font-weight:500;font-size:33px;line-height:1.28} +.row.hl .k{color:#FBF3E4;background:#A10F2B;padding:2px 12px;justify-self:start;white-space:nowrap;font-size:30px} +.quote{font-family:Garamond;font-style:italic;font-size:44px;line-height:1.25;color:#F2C64B;border-left:4px solid #D9A63A;padding-left:28px} +`; + +function frame(n) { + return ` + + + + + + + + + + + PARTIDO NACIONAL + HISPANISTA + + + + + +29N · VOTO EN BLANCO +${n} / ${TOTAL}${n < TOTAL ? ' →' : ''} +`; +} + +// ballot box + blank envelope illustration for the cover +const urna = ` + + + + + + + + + + ${Array.from({ length: 28 }, (_, i) => { const a = i * Math.PI * 2 / 28, r0 = 210, r1 = i % 2 ? 300 : 360; return ``; }).join('')} + + + + + + + + + + + + + + + + + + + + +`; + +const slides = [ + // 1 portada + `${frame(1)}${urna} +
+
ELECCIONES GENERALES · 29N
+
VOTO EN
BLANCO
+
+
Ninguno nos representa.
Todavía.
`, + // 2 + `${frame(2)}
+
LA POSTURA DEL PNH
+

¿Por qué no pedimos el voto para nadie?

+

Ningún partido de los que se presentan el 29N defiende la Hispanidad como proyecto. Ninguno pone en el centro la unidad de nuestros pueblos, la fe que los formó y un destino común para España y América.

+

No vamos a elegir el mal menor. Vamos a decirlo con claridad en las urnas.

+
`, + // 3 + `${frame(3)}
+
CÓMO SE VOTA EN BLANCO
+

Blanco no es nulo.
Nulo no es blanco.

+
+
EN BLANCO
Congreso: sobre vacío, sin papeleta. Senado: papeleta sin ninguna cruz. Es un voto válido y sale en los resultados oficiales.
+
NULO
Papeleta tachada, rota, con dibujos o dos papeletas distintas. No cuenta como voto válido.
+
ABSTENCIÓN
Quedarse en casa. No cuenta para nada.
+
+
`, + // 4 + `${frame(4)}
+
¿Y POR QUÉ NO QUEDARSE EN CASA?
+

Quien se abstiene, calla. Quien vota en blanco, habla.

+

La abstención se lee como desinterés. Se mezcla con quien olvidó votar, con quien estaba de viaje y con quien no le importa nada.

+
El voto en blanco dice otra cosa: he venido, creo en mi Patria y ninguno de vosotros la merece.
+
`, + // 5 + `${frame(5)}
+
HASTA QUE PODAMOS PRESENTARNOS
+

La próxima vez, el PNH estará en la papeleta.

+

El Partido Nacional Hispanista está en formación. Todavía no podemos concurrir a estas elecciones, pero estamos construyendo la alternativa.

+

Hasta entonces, en blanco. Y después, con nosotros.

+
`, + // 6 cierre + `${frame(6)} +
+
DOMINGO 29 DE NOVIEMBRE
+
VOTA EN
BLANCO
+
+ +
Unidad, Fe y Destino
+
¡ARRIBA LA HISPANIDAD!
`, +]; + +const browser = await chromium.launch({ executablePath: '/opt/pw-browsers/chromium' }); +const pg = await browser.newPage({ viewport: { width: 1080, height: 1080 }, deviceScaleFactor: 1 }); +for (let i = 0; i < slides.length; i++) { + await pg.setContent(`
${slides[i]}
`); + await pg.evaluate(() => document.fonts.ready); await pg.waitForTimeout(150); + await pg.screenshot({ path: `${OUT}/votoenblanco_${i + 1}.png`, clip: { x: 0, y: 0, width: 1080, height: 1080 } }); +} +await browser.close(); +console.log('ok'); diff --git a/kit/render.mjs b/kit/render.mjs new file mode 100644 index 0000000..de05187 --- /dev/null +++ b/kit/render.mjs @@ -0,0 +1,108 @@ +// PNH · generador de carteles 1080x1080 con el marco oficial. +// Uso: node render.mjs spec.json +// spec = { out: "dir", prefix: "nombre", footerLeft: "29N · VOTO EN BLANCO", numbered: true, +// slides: [ { html: "
...
", cross: 0.13, halo: false, footer: true } ] } +// En el html se pueden usar {{LOGO}} y {{HORSE}} (data URIs) y las clases CSS de abajo. +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; +import { chromium } from 'playwright-core'; + +const K = path.dirname(fileURLToPath(import.meta.url)); +const spec = JSON.parse(fs.readFileSync(process.argv[2], 'utf8')); +const asset = f => fs.readFileSync(path.join(K, 'assets', f)).toString('base64'); +const font = f => fs.readFileSync(path.join(K, 'node_modules/@fontsource', f)).toString('base64'); +const HORSE = 'data:image/png;base64,' + asset('horse.png'); +const LOGO = 'data:image/png;base64,' + asset('logo_full_hd.png'); + +function raggedBar(x0, y0, x1, y1, w) { + const dx = x1 - x0, dy = y1 - y0, L = Math.hypot(dx, dy), ux = dx / L, uy = dy / L, nx = -uy, ny = ux; + const pts = [], n = 9; + for (let s = 0; s <= 1; s++) { + const side = s ? -1 : 1, seq = []; + for (let k = 0; k <= n; k++) { + const t = k / n * L, knot = (k > 0 && k < n && k % 2 === 1) ? 26 : 0; + seq.push([x0 + ux * t + nx * side * (w / 2 + knot), y0 + uy * t + ny * side * (w / 2 + knot)]); + if (knot) seq.push([x0 + ux * (t + 18) + nx * side * w / 2, y0 + uy * (t + 18) + ny * side * w / 2]); + } + pts.push(...(s ? seq.reverse() : seq)); + } + return 'M' + pts.map(p => p.map(v => v.toFixed(1)).join(',')).join('L') + 'Z'; +} +const CROSS = raggedBar(-60, -60, 1140, 1140, 110) + raggedBar(1140, -60, -60, 1140, 110); + +const css = ` +@font-face{font-family:Cinzel;font-weight:700;src:url(data:font/woff2;base64,${font('cinzel/files/cinzel-latin-700-normal.woff2')})} +@font-face{font-family:Cinzel;font-weight:900;src:url(data:font/woff2;base64,${font('cinzel/files/cinzel-latin-900-normal.woff2')})} +@font-face{font-family:Garamond;font-weight:500;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-500-normal.woff2')})} +@font-face{font-family:Garamond;font-weight:600;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-600-normal.woff2')})} +@font-face{font-family:Garamond;font-style:italic;font-weight:500;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-500-italic.woff2')})} +@font-face{font-family:Garamond;font-style:italic;font-weight:600;src:url(data:font/woff2;base64,${font('eb-garamond/files/eb-garamond-latin-600-italic.woff2')})} +html,body{margin:0;background:#2a0508} +.s{position:relative;width:1080px;height:1080px;overflow:hidden;color:#FBF3E4} +.s>svg{position:absolute;inset:0} +/* bloque de texto estándar (zona útil 96..984 x 215..930) */ +.txt{position:absolute;left:96px;right:96px;top:215px;bottom:150px;display:flex;flex-direction:column;justify-content:center;gap:34px} +.center{position:absolute;left:0;right:0;text-align:center} +.kick{font-family:Cinzel;font-weight:700;font-size:24px;letter-spacing:6px;color:#D9A63A} +.date{font-family:Cinzel;font-weight:700;font-size:32px;letter-spacing:8px;color:#F2C64B} +.big{font-family:Cinzel;font-weight:900;font-size:120px;line-height:1.02;color:#FBF3E4;text-shadow:0 4px 12px rgba(0,0,0,.5)} +h1{margin:0;font-family:Cinzel;font-weight:900;font-size:68px;line-height:1.05;color:#F2C64B;text-wrap:balance} +p{margin:0;font-family:Garamond;font-weight:500;font-size:37px;line-height:1.32;color:#FBF3E4} +p b,.gold{font-weight:600;color:#F2C64B} +.motto{font-family:Garamond;font-style:italic;font-size:40px;color:#F2C64B} +.quote{font-family:Garamond;font-style:italic;font-size:44px;line-height:1.25;color:#F2C64B;border-left:4px solid #D9A63A;padding-left:28px} +.bigquote{font-family:Garamond;font-style:italic;font-weight:500;font-size:56px;line-height:1.18;color:#FBF3E4;text-wrap:balance;text-shadow:0 3px 10px rgba(0,0,0,.45)} +.bigquote b{font-weight:600;color:#F2C64B} +.rows{display:flex;flex-direction:column;gap:22px} +.row{display:grid;grid-template-columns:270px 1fr;gap:28px;align-items:baseline;border-top:1.5px solid rgba(217,166,58,.55);padding-top:20px} +.row .k{font-family:Cinzel;font-weight:900;font-size:34px;color:#F2C64B;letter-spacing:1px} +.row .v{font-family:Garamond;font-weight:500;font-size:33px;line-height:1.28} +.row.hl .k{color:#FBF3E4;background:#A10F2B;padding:2px 12px;justify-self:start;white-space:nowrap;font-size:30px} +`; + +function frame(i, n, sl) { + const footer = sl.footer === false ? '' : ` + +${sl.footerText || spec.footerLeft || ''} +${spec.numbered && n > 1 ? `${i} / ${n}${i < n ? ' →' : ''}` : ''}`; + return ` + + + + + + + + +${sl.halo ? `` : ''} +${sl.svg || ''} + + + + PARTIDO NACIONAL + HISPANISTA + + + + +${footer} +`; +} + +const out = path.resolve(path.dirname(process.argv[2]), spec.out || '.'); +fs.mkdirSync(out, { recursive: true }); +const browser = await chromium.launch({ executablePath: process.env.CHROMIUM || '/opt/pw-browsers/chromium' }); +const pg = await browser.newPage({ viewport: { width: 1080, height: 1080 }, deviceScaleFactor: spec.scale || 1 }); +const n = spec.slides.length, files = []; +for (let i = 0; i < n; i++) { + const sl = spec.slides[i]; + const html = (sl.html || '').replaceAll('{{LOGO}}', LOGO).replaceAll('{{HORSE}}', HORSE); + await pg.setContent(`
${frame(i + 1, n, sl)}${html}
`); + await pg.evaluate(() => document.fonts.ready); await pg.waitForTimeout(150); + const f = path.join(out, `${spec.prefix || 'pnh'}${n > 1 ? '_' + (i + 1) : ''}.png`); + await pg.screenshot({ path: f, clip: { x: 0, y: 0, width: 1080, height: 1080 } }); + files.push(f); +} +await browser.close(); +console.log(files.join('\n'));