Merge branch 'feature/projects-as-entities'

Projects become their own editorial taxonomy, modelled on releases and shows:
term meta for repository, package, site, status and cover; a list block and an
archive header block; archive templates for projects and podcast shows; a
landing pattern; and the retirement of the featured-project picker.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
chrnxandClaude Opus 5 committed 2026-08-15 16:25:09 -05:00
commit 5c5f385bc0
62 files changed
+1882 -459

No files matched your search

+1 -1
View File
@@ -83,7 +83,7 @@ responsive_output=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-responsive.XXXXXX")
The rebuild rejects symlinks, nested paths, nonexistent paths, and destinations
outside the canonical system temporary directory. The automated smoke test
byte-compares all 76 generated files: 62 binary derivatives and 14 manifests.
byte-compares all 81 generated files: 66 binary derivatives and 15 manifests.
The inventory has eleven portrait families at 384 px and 768 px, plus three
landscape background families (Podcast, About, and Projects) at 384 px, 768 px,
and 1536 px. Every 384/768 derivative is
+49 -53
View File
@@ -267,7 +267,8 @@ footer a {
.chrnx-journal-card,
.chrnx-podcast-card,
.chrnx-related-card,
.chrnx-release-card {
.chrnx-release-card,
.chrnx-project-card {
position: relative;
overflow: hidden;
border: 1px solid var(--chrnx-line);
@@ -342,7 +343,9 @@ footer a {
.chrnx-podcast-card__link > .chrnx-responsive-portrait,
.chrnx-related-card__link > .chrnx-responsive-portrait,
.chrnx-release-card__art > .chrnx-responsive-portrait,
.chrnx-release-detail__art > .chrnx-responsive-portrait {
.chrnx-release-detail__art > .chrnx-responsive-portrait,
.chrnx-project-card__art > .chrnx-responsive-portrait,
.chrnx-project-detail__art > .chrnx-responsive-portrait {
display: block;
width: 100%;
height: 100%;
@@ -538,40 +541,6 @@ footer a {
position: relative;
}
.chrnx-selected-work__list {
display: grid;
gap: 0;
grid-template-columns: 1fr;
margin: 0;
padding: 0;
border-top: 1px solid var(--chrnx-line);
list-style: none;
}
.chrnx-selected-work__item {
padding-block: 1.25rem;
border-bottom: 1px solid var(--chrnx-line);
}
.chrnx-selected-work__title {
margin: 0;
overflow-wrap: anywhere;
}
.chrnx-selected-work__title a {
color: inherit;
text-decoration: none;
}
.chrnx-selected-work__title a:hover {
text-decoration: underline;
}
.chrnx-selected-work__empty {
margin: 0;
color: var(--chrnx-muted);
}
.chrnx-responsive-portrait {
display: block;
}
@@ -876,14 +845,16 @@ html[data-theme="light"] .chrnx-home-music p {
pointer-events: none;
}
.chrnx-release-list {
.chrnx-release-list,
.chrnx-project-list {
display: grid;
gap: 1rem;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
/* Grunge release cards: torn light, heavy rule, dirt in the corners. */
.chrnx-release-card {
.chrnx-release-card,
.chrnx-project-card {
position: relative;
isolation: isolate;
overflow: hidden;
@@ -899,7 +870,8 @@ html[data-theme="light"] .chrnx-home-music p {
transition: transform 160ms ease, border-color 160ms ease;
}
.chrnx-release-card::after {
.chrnx-release-card::after,
.chrnx-project-card::after {
position: absolute;
z-index: -1;
inset: 0;
@@ -909,18 +881,21 @@ html[data-theme="light"] .chrnx-home-music p {
pointer-events: none;
}
.chrnx-release-card:hover {
.chrnx-release-card:hover,
.chrnx-project-card:hover {
border-top-color: var(--chrnx-green);
transform: translateY(-3px);
}
.chrnx-release-card__link {
.chrnx-release-card__link,
.chrnx-project-card__link {
display: block;
color: inherit;
text-decoration: none;
}
.chrnx-release-card__art {
.chrnx-release-card__art,
.chrnx-project-card__art {
display: block;
overflow: hidden;
margin-bottom: 1rem;
@@ -930,7 +905,9 @@ html[data-theme="light"] .chrnx-home-music p {
}
.chrnx-release-card__cover,
.chrnx-release-card__fallback {
.chrnx-release-card__fallback,
.chrnx-project-card__cover,
.chrnx-project-card__fallback {
display: block;
width: 100%;
height: 100%;
@@ -938,7 +915,9 @@ html[data-theme="light"] .chrnx-home-music p {
}
.chrnx-release-card__fallback,
.chrnx-release-detail__fallback {
.chrnx-release-detail__fallback,
.chrnx-project-card__fallback,
.chrnx-project-detail__fallback {
background-color: var(--chrnx-surface);
background-image:
linear-gradient(132deg, transparent 0 46%, color-mix(in srgb, var(--chrnx-accent) 42%, transparent) 47% 50%, transparent 51%),
@@ -946,17 +925,21 @@ html[data-theme="light"] .chrnx-home-music p {
radial-gradient(circle at 70% 28%, color-mix(in srgb, var(--chrnx-accent) 34%, transparent), transparent 52%);
}
.chrnx-release-card__title {
.chrnx-release-card__title,
.chrnx-project-card__title {
margin: 0 0 0.4rem;
text-wrap: balance;
}
.chrnx-release-card__link:hover .chrnx-release-card__title {
.chrnx-release-card__link:hover .chrnx-release-card__title,
.chrnx-project-card__link:hover .chrnx-project-card__title {
color: var(--chrnx-green);
}
.chrnx-release-card__status,
.chrnx-release-detail__status {
.chrnx-release-detail__status,
.chrnx-project-card__status,
.chrnx-project-detail__status {
margin: 0;
color: var(--chrnx-muted);
font-family: var(--wp--preset--font-family--metadata);
@@ -992,7 +975,8 @@ html[data-theme="light"] .chrnx-home-music p {
}
/* Album page. */
.chrnx-release-detail__head {
.chrnx-release-detail__head,
.chrnx-project-detail__head {
display: grid;
gap: clamp(1.5rem, 4vw, 3rem);
grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
@@ -1000,11 +984,13 @@ html[data-theme="light"] .chrnx-home-music p {
margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.chrnx-release-detail__head.is-bare {
.chrnx-release-detail__head.is-bare,
.chrnx-project-detail__head.is-bare {
grid-template-columns: minmax(0, 22rem);
}
.chrnx-release-detail__art {
.chrnx-release-detail__art,
.chrnx-project-detail__art {
position: relative;
overflow: hidden;
border: 1px solid color-mix(in srgb, var(--chrnx-accent) 34%, var(--chrnx-line));
@@ -1014,14 +1000,22 @@ html[data-theme="light"] .chrnx-home-music p {
}
.chrnx-release-detail__cover,
.chrnx-release-detail__fallback {
.chrnx-release-detail__fallback,
.chrnx-project-detail__cover,
.chrnx-project-detail__fallback {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.chrnx-release-detail__description {
.chrnx-release-detail__intro,
.chrnx-project-detail__intro {
min-width: 0;
}
.chrnx-release-detail__description,
.chrnx-project-detail__description {
margin: 0.75rem 0 0;
color: var(--chrnx-text);
}
@@ -1134,6 +1128,7 @@ html[data-theme="light"] .chrnx-home-music p {
@media (max-width: 720px) {
.chrnx-release-detail__head,
.chrnx-project-detail__head,
.chrnx-track-meta {
grid-template-columns: minmax(0, 1fr);
}
@@ -1215,7 +1210,8 @@ html[data-theme="light"] .chrnx-home-music p {
@media (max-width: 900px) {
.chrnx-journal-stream__list,
.chrnx-release-list {
.chrnx-release-list,
.chrnx-project-list {
grid-template-columns: 1fr;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

@@ -0,0 +1,5 @@
{
"source": "placeholder-project.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

-111
View File
@@ -1,111 +0,0 @@
( function ( factory ) {
if ( typeof module === 'object' && module.exports ) {
module.exports = factory();
} else {
factory().initialize( window.wp );
}
} )( function () {
'use strict';
function getTranslator( wp ) {
return wp.i18n && typeof wp.i18n.__ === 'function'
? wp.i18n.__
: function ( text ) {
return text;
};
}
function updateMeta( editPost, currentMeta, key, value ) {
if ( typeof editPost !== 'function' ) {
return;
}
editPost( { meta: { ...( currentMeta || {} ), [ key ]: value } } );
}
function hasRequiredGlobals( wp ) {
return Boolean(
wp &&
wp.components &&
wp.components.ToggleControl &&
wp.data &&
typeof wp.data.useDispatch === 'function' &&
typeof wp.data.useSelect === 'function' &&
wp.editPost &&
wp.editPost.PluginDocumentSettingPanel &&
wp.element &&
typeof wp.element.createElement === 'function' &&
wp.plugins &&
typeof wp.plugins.registerPlugin === 'function',
);
}
function initialize( wp ) {
if ( ! hasRequiredGlobals( wp ) ) {
return false;
}
const __ = getTranslator( wp );
function ProjectPanel() {
const editorState = wp.data.useSelect( function ( select ) {
if ( typeof select !== 'function' ) {
return null;
}
const currentEditor = select( 'core/editor' );
const core = select( 'core' );
if (
! currentEditor ||
typeof currentEditor.getCurrentPostType !== 'function' ||
typeof currentEditor.getEditedPostAttribute !== 'function' ||
! core ||
typeof core.getEntityRecord !== 'function'
) {
return null;
}
const topicIds = currentEditor.getEditedPostAttribute( 'topic' );
return {
meta: currentEditor.getEditedPostAttribute( 'meta' ) || {},
postType: currentEditor.getCurrentPostType(),
topic:
Array.isArray( topicIds ) && topicIds.length === 1
? core.getEntityRecord( 'taxonomy', 'chrnx_topic', topicIds[ 0 ] )
: null,
};
}, [] );
const editorDispatch = wp.data.useDispatch( 'core/editor' );
if ( ! editorState || editorState.postType !== 'post' || ! editorDispatch?.editPost ) {
return null;
}
if ( ! editorState.topic || editorState.topic.slug !== 'projects' ) {
return null;
}
const meta = editorState.meta;
return wp.element.createElement(
wp.editPost.PluginDocumentSettingPanel,
{ name: 'chrnx-project', title: __( 'Project', 'chrnx' ) },
wp.element.createElement( wp.components.ToggleControl, {
label: __( 'Show in Selected work', 'chrnx' ),
help: __(
'Selected work lists these first, then fills the rest with the most recent projects.',
'chrnx',
),
checked: Boolean( meta.chrnx_project_featured ),
onChange( value ) {
updateMeta( editorDispatch.editPost, meta, 'chrnx_project_featured', Boolean( value ) );
},
} ),
);
}
wp.plugins.registerPlugin( 'chrnx-project-meta', { render: ProjectPanel } );
return true;
}
return { initialize, updateMeta };
} );
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/featured-stories",
"version": "0.4.4",
"version": "0.4.5",
"title": "Featured Stories",
"category": "theme",
"description": "A sticky-led selection of topic-diverse stories.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/footer-content",
"version": "0.4.4",
"version": "0.4.5",
"title": "CHRNX Footer Content",
"category": "theme",
"description": "Display translated internal footer navigation and site credit.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/header-tools",
"version": "0.4.4",
"version": "0.4.5",
"title": "CHRNX Header Tools",
"category": "theme",
"description": "Display translated primary navigation and progressive site search.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-link",
"version": "0.4.4",
"version": "0.4.5",
"title": "Journal Link",
"category": "theme",
"description": "Display a translated portable link to the full Journal.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/journal-stream",
"version": "0.4.4",
"version": "0.4.5",
"title": "Journal Stream",
"category": "theme",
"description": "The filterable chronological journal.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/latest-podcast",
"version": "0.4.4",
"version": "0.4.5",
"title": "Latest Podcast",
"category": "theme",
"description": "A linked card for the latest podcast episode.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/mobile-menu-toggle",
"version": "0.4.4",
"version": "0.4.5",
"title": "CHRNX Mobile Menu Toggle",
"category": "theme",
"description": "Progressively reveal the primary navigation on small screens.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/podcast-meta",
"version": "0.4.4",
"version": "0.4.5",
"title": "Podcast Metadata",
"category": "theme",
"description": "Safe episode details for the current post.",
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/project-detail",
"version": "0.4.5",
"title": "Project Detail",
"category": "theme",
"description": "Cover, status, description and links for the queried project.",
"textdomain": "chrnx",
"attributes": {},
"supports": { "html": false },
"render": "file:./render.php"
}
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* Project Detail block render.
*
* @package CHRNX
*/
$chrnx_term = get_queried_object();
if ( ! $chrnx_term instanceof WP_Term || 'chrnx_project' !== $chrnx_term->taxonomy ) {
return;
}
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_project_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_project_cover', true ) );
$chrnx_links = chrnx_get_project_links( $chrnx_term->term_id );
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-project-detail__cover' ) ) : '';
// Without status, description or links there is no second column to fill.
$chrnx_has_intro = '' !== $chrnx_status || '' !== $chrnx_term->description || ! empty( $chrnx_links );
$chrnx_head_class = 'chrnx-project-detail__head' . ( $chrnx_has_intro ? '' : ' is-bare' );
?>
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-project-detail' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $chrnx_head_class ); ?>">
<div class="chrnx-project-detail__art">
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-project', '', 'chrnx-project-detail__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</div>
<div class="chrnx-project-detail__intro">
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-project-detail__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php if ( '' !== $chrnx_term->description ) : ?>
<p class="chrnx-project-detail__description"><?php echo esc_html( $chrnx_term->description ); ?></p>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links', chrnx_get_project_link_slots() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
</section>
+15
View File
@@ -0,0 +1,15 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/project-list",
"version": "0.4.5",
"title": "Project List",
"category": "theme",
"description": "Every project, each linking to its own page.",
"textdomain": "chrnx",
"attributes": {
"headingLevel": { "type": "integer", "default": 4, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false },
"render": "file:./render.php"
}
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* Project List block render.
*
* @package CHRNX
*/
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 4, 4 );
$chrnx_terms = get_terms(
array(
'taxonomy' => 'chrnx_project',
'hide_empty' => false,
)
);
if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
return;
}
?>
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-project-list' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php
foreach ( $chrnx_terms as $chrnx_term ) :
$chrnx_link = get_term_link( $chrnx_term );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_project_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_project_cover', true ) );
$chrnx_links = chrnx_get_project_links( $chrnx_term->term_id );
?>
<article class="chrnx-project-card">
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
<a class="chrnx-project-card__link" href="<?php echo esc_url( $chrnx_link ); ?>">
<?php endif; ?>
<span class="chrnx-project-card__art">
<?php
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-project-card__cover' ) ) : '';
?>
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-project', '', 'chrnx-project-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
</span>
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-project-card__title"><?php echo esc_html( $chrnx_term->name ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
<?php if ( '' !== $chrnx_status ) : ?>
<p class="chrnx-project-card__status"><?php echo esc_html( $chrnx_status ); ?></p>
<?php endif; ?>
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
</a>
<?php endif; ?>
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links', chrnx_get_project_link_slots() ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</article>
<?php endforeach; ?>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/reading-time",
"version": "0.4.4",
"version": "0.4.5",
"title": "Reading Time",
"category": "theme",
"description": "Display a localized estimate based on the current post content.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/related-posts",
"version": "0.4.4",
"version": "0.4.5",
"title": "Related Posts",
"category": "theme",
"description": "Related stories selected by topic, tags, and recency.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/release-detail",
"version": "0.4.4",
"version": "0.4.5",
"title": "Release Detail",
"category": "theme",
"description": "Album cover, listening links, and the ordered tracklist.",
+9 -8
View File
@@ -10,12 +10,13 @@ if ( ! $chrnx_term instanceof WP_Term || 'chrnx_release' !== $chrnx_term->taxono
return;
}
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
$chrnx_tracks = chrnx_get_release_track_ids( $chrnx_term->slug );
$chrnx_track_h = min( 6, $chrnx_heading + 1 );
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-release-detail__cover' ) ) : '';
$chrnx_tracks = chrnx_get_release_track_ids( $chrnx_term->slug );
$chrnx_track_h = min( 6, $chrnx_heading + 1 );
// Without status, description or links there is no second column to fill.
$chrnx_has_intro = '' !== $chrnx_status || '' !== $chrnx_term->description || ! empty( $chrnx_links );
$chrnx_head_class = 'chrnx-release-detail__head' . ( $chrnx_has_intro ? '' : ' is-bare' );
@@ -23,8 +24,8 @@ $chrnx_head_class = 'chrnx-release-detail__head' . ( $chrnx_has_intro ? '' : ' i
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-release-detail' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<div class="<?php echo esc_attr( $chrnx_head_class ); ?>">
<div class="chrnx-release-detail__art">
<?php if ( $chrnx_cover > 0 ) : ?>
<?php echo wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-release-detail__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-detail__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/release-list",
"version": "0.4.4",
"version": "0.4.5",
"title": "Release List",
"category": "theme",
"description": "The No Names releases, each linking to its album page.",
+5 -2
View File
@@ -29,8 +29,11 @@ if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
<a class="chrnx-release-card__link" href="<?php echo esc_url( $chrnx_link ); ?>">
<?php endif; ?>
<span class="chrnx-release-card__art">
<?php if ( $chrnx_cover > 0 ) : ?>
<?php echo wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-release-card__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php
$chrnx_cover_markup = $chrnx_cover > 0 ? wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-release-card__cover' ) ) : '';
?>
<?php if ( '' !== $chrnx_cover_markup ) : ?>
<?php echo $chrnx_cover_markup; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php else : ?>
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php endif; ?>
-16
View File
@@ -1,16 +0,0 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/selected-work",
"version": "0.4.4",
"title": "Selected Work",
"category": "theme",
"description": "Hand-picked projects first, then the most recent ones.",
"textdomain": "chrnx",
"attributes": {
"limit": { "type": "integer", "default": 3, "minimum": 1, "maximum": 12 },
"headingLevel": { "type": "integer", "default": 3, "enum": [2, 3, 4, 5, 6] }
},
"supports": { "html": false },
"render": "file:./render.php"
}
-26
View File
@@ -1,26 +0,0 @@
<?php
/**
* Selected Work block render.
*
* @package CHRNX
*/
$chrnx_limit = isset( $attributes['limit'] ) ? min( 12, max( 1, absint( $attributes['limit'] ) ) ) : 3;
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 3, 3 );
$chrnx_ids = chrnx_get_selected_project_ids( $chrnx_limit );
?>
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-selected-work' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
<?php if ( empty( $chrnx_ids ) ) : ?>
<p class="chrnx-selected-work__empty"><?php echo esc_html__( 'No projects published yet.', 'chrnx' ); ?></p>
<?php else : ?>
<ul class="chrnx-selected-work__list">
<?php foreach ( $chrnx_ids as $chrnx_project_id ) : ?>
<li class="chrnx-selected-work__item">
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-selected-work__title">
<a href="<?php echo esc_url( get_permalink( $chrnx_project_id ) ); ?>"><?php echo esc_html( get_the_title( $chrnx_project_id ) ); ?></a>
</h<?php echo esc_attr( $chrnx_heading ); ?>>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/show-links",
"version": "0.4.4",
"version": "0.4.5",
"title": "Show Links",
"category": "theme",
"description": "Where a podcast show can be listened to, rendered only when a URL exists.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/site-brand",
"version": "0.4.4",
"version": "0.4.5",
"title": "CHRNX Site Brand",
"category": "theme",
"description": "Display the local CHRNX wordmark linked to the site home.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/subscribe-cta",
"version": "0.4.4",
"version": "0.4.5",
"title": "Subscribe CTA",
"category": "theme",
"description": "A call to action linked to the configured subscribe page.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/subscribe-form",
"version": "0.4.4",
"version": "0.4.5",
"title": "Subscribe Form",
"category": "theme",
"description": "The email subscription form, rendered only when a provider endpoint is configured.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/theme-toggle",
"version": "0.4.4",
"version": "0.4.5",
"title": "Theme Toggle",
"category": "theme",
"description": "Choose a light, dark, or system color theme.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/topic-hero",
"version": "0.4.4",
"version": "0.4.5",
"title": "Topic Hero",
"category": "theme",
"description": "A fixed-art hero for an editorial topic.",
+1 -1
View File
@@ -2,7 +2,7 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "chrnx/track-meta",
"version": "0.4.4",
"version": "0.4.5",
"title": "Track Meta",
"category": "theme",
"description": "Player, listening links, and album for one song.",
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,119 @@
# CHRNX Projects as First-Class Entities — Design
<!-- markdownlint-disable MD013 -->
**Status:** Approved 2026-08-15
**Supersedes:** the `projects` topic term as a grouping mechanism
## Problem
`projects` is a topic term, so it cannot separate the thing from the writing about it.
Green Tea is a project with a repository, a published package, and a release status.
The posts about Green Tea are a different kind of object. Today both collapse into one
term, and the term cannot hold a repository URL or a cover.
That collapse already produced an inconsistency. Announcement posts landed in
`projects` while deep dives on the same product landed in `code`:
| Product | Announcement | Deep dive |
|---|---|---|
| Expressive Tea | 692 (`projects`) | 695 (`code`) |
| Ailed | 678 (`projects`) | 716 (`code`) |
| Green Tea | 838 (`projects`) | 730 (`code`) |
A reader browsing Green Tea finds half its material. The split exists only because one
term was doing two jobs.
Music and podcasts already solved this. `chrnx_release` is the album, `chrnx_show` is the
programme, and posts reference them. Projects never got the same treatment.
## Solution
Promote projects to an entity taxonomy modelled on `chrnx_release`, and return `code`
to being a general topic about writing code.
### Content model
New taxonomy `chrnx_project`, registered through the existing
`chrnx_register_editorial_taxonomy` contract with `rest_base` `project`.
Seeded terms: `green-tea` (Green Tea), `ailed` (Ailed).
Term meta, mirroring `chrnx_release`:
| Meta key | Type | Sanitizer | Purpose |
|---|---|---|---|
| `chrnx_project_cover` | integer | `absint` | Attachment ID for the project cover |
| `chrnx_project_status` | string | `sanitize_text_field` | Free text, e.g. `Beta`, `Activo`, `Archivado` |
| `chrnx_project_repo` | string | `chrnx_sanitize_https_url` | Source repository |
| `chrnx_project_site` | string | `chrnx_sanitize_https_url` | Documentation or product site |
| `chrnx_project_package` | string | `chrnx_sanitize_https_url` | Where the package lives |
`chrnx_project_package` is deliberately one generic URL rather than an npm-specific
field. Green Tea publishes to npm, a Rust project would publish to crates.io, a Python
one to PyPI. One URL covers all three; a per-registry field list would need editing
every time a new language shows up.
Cover falls back to shared placeholder art when unset, exactly as
`chrnx_release_cover` falls back to `placeholder-release`.
### Retired
`chrnx_project_featured` (post meta), `chrnx_get_selected_project_ids()`, and the
`chrnx/selected-work` block are removed.
Music proves they are unnecessary. `music-landing` lists every release through
`chrnx/release-list` with no notion of a featured release, and `home-music` carries no
list at all. With two or three projects, picking a favourite is ceremony, not curation.
The `projects` topic term is retired. Posts that carried it move to `code`, and grouping
moves to their project term.
### Surfaces
| Surface | Today | After |
|---|---|---|
| `/projects/` page (740) | `chrnx/home-projects` pattern + `journal-stream {"topic":"projects"}` | `chrnx/projects-landing` pattern |
| Project archive | none | `templates/taxonomy-chrnx_project.html` |
| Home section | `chrnx/selected-work` inside `home-projects` | banner copy only, mirroring `home-music` |
The landing gets a character-stage banner in the established three-layer shape
(atmosphere, content, art), followed by `chrnx/project-list`.
Landing copy, in the author's voice:
> **Proyectos**
> Aquí va lo que mi cerebro tira en formato de código.
> Una noche me agarra la loquera y sale código. A veces sirve, a veces nomás me deja
> dormir. Lo que sobrevive lo dejo aquí, con su repo y su estado real, sin adornos.
### Debt repaid alongside
`chrnx_show` has no `taxonomy-chrnx_show.html` and falls through to the generic archive,
so a podcast programme page never renders its own detail block. Adding
`templates/taxonomy-chrnx_show.html` alongside the project template closes that gap
while the same shape is fresh.
## Migration
Pages store pattern references rather than expanded markup, so theme changes propagate
without touching stored content. Verified on production:
```text
740 /projects/ <!-- wp:pattern {"slug":"chrnx/home-projects"} /-->
<!-- wp:chrnx/journal-stream {"topic":"projects"} /-->
743 /music/ <!-- wp:pattern {"slug":"chrnx/music-landing"} /-->
```
One stored block breaks: `journal-stream {"topic":"projects"}` on page 740, because its
topic disappears. Page 740 becomes a single `chrnx/projects-landing` pattern reference.
Six published posts need project terms assigned and their topic corrected. The exact
post-to-project mapping is supplied by the author, not inferred.
## Non-goals
- No custom post type. Projects are terms, like releases and shows.
- No per-registry package fields.
- No project-level prose page beyond the term description.
- No changes to `chrnx_release`, `chrnx_show`, Related Stories, or theme preference.
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
define( 'CHRNX_VERSION', '0.4.4' );
define( 'CHRNX_VERSION', '0.4.5' );
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'project-meta', 'release-meta', 'show-meta', 'track-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) {
+2 -2
View File
@@ -29,7 +29,7 @@ function chrnx_get_current_navigation_destination() {
return '';
}
if ( is_home() || is_search() || is_singular( 'post' ) || is_tax( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) ) ) {
if ( is_home() || is_search() || is_singular( 'post' ) || is_tax( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ) ) ) {
return $journal_url;
}
@@ -232,7 +232,7 @@ function chrnx_get_editorial_card_markup( $post_id, $heading_level = 3, $class_n
/** Register all block metadata directories that exist. */
function chrnx_register_editorial_blocks() {
$blocks = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand', 'mobile-menu-toggle', 'footer-content', 'header-tools', 'reading-time', 'journal-link', 'selected-work', 'release-list', 'release-detail', 'track-meta', 'subscribe-form', 'show-links' );
$blocks = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand', 'mobile-menu-toggle', 'footer-content', 'header-tools', 'reading-time', 'journal-link', 'release-list', 'release-detail', 'track-meta', 'subscribe-form', 'show-links', 'project-list', 'project-detail' );
foreach ( $blocks as $block ) {
$name = 'chrnx/' . $block;
if ( WP_Block_Type_Registry::get_instance()->is_registered( $name ) ) {
-9
View File
@@ -45,14 +45,6 @@ function chrnx_enqueue_editor_assets() {
true
);
wp_enqueue_script(
'chrnx-editor-project',
get_theme_file_uri( 'assets/js/editor-project.js' ),
array( 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
CHRNX_VERSION,
true
);
wp_enqueue_script(
'chrnx-editor-track',
get_theme_file_uri( 'assets/js/editor-track.js' ),
@@ -63,7 +55,6 @@ function chrnx_enqueue_editor_assets() {
wp_set_script_translations( 'chrnx-editor-taxonomies', 'chrnx', get_theme_file_path( 'languages' ) );
wp_set_script_translations( 'chrnx-editor-podcast', 'chrnx', get_theme_file_path( 'languages' ) );
wp_set_script_translations( 'chrnx-editor-project', 'chrnx', get_theme_file_path( 'languages' ) );
wp_set_script_translations( 'chrnx-editor-track', 'chrnx', get_theme_file_path( 'languages' ) );
}
add_action( 'enqueue_block_editor_assets', 'chrnx_enqueue_editor_assets' );
+133 -21
View File
@@ -1,37 +1,149 @@
<?php
/**
* Project post metadata.
* Project term metadata.
*
* @package CHRNX
*/
/**
* Require permission to edit the post owning project metadata.
* Return the outbound link slots a project can carry.
*
* @param bool $allowed Previously calculated permission.
* @param string $meta_key Metadata key.
* @param int $post_id Post ID.
* @return bool Whether the current user can edit the post.
* One generic package slot rather than one field per registry: Green Tea ships
* to npm, a Rust project would ship to crates.io, a Python one to PyPI. A
* per-registry list would need editing every time a new language shows up.
*
* @return array<string,array<string,string>> Slot key to label and icon.
*/
function chrnx_auth_project_meta( $allowed, $meta_key, $post_id ) {
return current_user_can( 'edit_post', $post_id );
function chrnx_get_project_link_slots() {
return array(
'repo' => array(
'label' => __( 'Repository', 'chrnx' ),
'icon' => '<path d="M9 19c-5 1.5-5-2.5-7-3"/><path d="M15 22v-4a3.4 3.4 0 0 0-1-2.6c3-.3 6-1.5 6-6.6a5 5 0 0 0-1.4-3.5 4.6 4.6 0 0 0-.1-3.5s-1.1-.3-3.5 1.3a12 12 0 0 0-6 0C6.6 1.5 5.5 1.8 5.5 1.8a4.6 4.6 0 0 0-.1 3.5A5 5 0 0 0 4 8.8c0 5.1 3 6.3 6 6.6a3.4 3.4 0 0 0-1 2.6v4"/>',
),
'package' => array(
'label' => __( 'Package', 'chrnx' ),
'icon' => '<path d="m7.5 4.3 9 5.2"/><path d="M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16"/><path d="M3.3 7 12 12l8.7-5"/><path d="M12 22V12"/>',
),
'site' => array(
'label' => __( 'Website', 'chrnx' ),
'icon' => '<circle cx="12" cy="12" r="10"/><path d="M12 2a15 15 0 0 1 0 20"/><path d="M12 2a15 15 0 0 0 0 20"/><path d="M2 12h20"/>',
),
);
}
/**
* Register project metadata for posts.
* Return the project term meta keys and their sanitizers.
*
* @return array<string,string> Meta key to sanitize callback.
*/
function chrnx_get_project_meta_definitions() {
$definitions = array(
'chrnx_project_cover' => 'absint',
'chrnx_project_status' => 'sanitize_text_field',
);
foreach ( array_keys( chrnx_get_project_link_slots() ) as $slot ) {
$definitions[ 'chrnx_project_' . $slot ] = 'chrnx_sanitize_https_url';
}
return $definitions;
}
/**
* Register project term metadata.
*/
function chrnx_register_project_meta() {
register_post_meta(
'post',
'chrnx_project_featured',
array(
'type' => 'boolean',
'single' => true,
'default' => false,
'show_in_rest' => array( 'schema' => array( 'type' => 'boolean' ) ),
'sanitize_callback' => 'rest_sanitize_boolean',
'auth_callback' => 'chrnx_auth_project_meta',
)
);
foreach ( chrnx_get_project_meta_definitions() as $meta_key => $sanitize ) {
register_term_meta(
'chrnx_project',
$meta_key,
array(
'type' => 'chrnx_project_cover' === $meta_key ? 'integer' : 'string',
'single' => true,
'show_in_rest' => true,
'sanitize_callback' => $sanitize,
'auth_callback' => 'chrnx_auth_release_meta',
)
);
}
}
add_action( 'init', 'chrnx_register_project_meta' );
/**
* Return the stored outbound links for one project.
*
* @param int $term_id Project term ID.
* @return array<string,string> Slot key to URL, omitting empty ones.
*/
function chrnx_get_project_links( $term_id ) {
$links = array();
foreach ( array_keys( chrnx_get_project_link_slots() ) as $slot ) {
$url = chrnx_sanitize_https_url( get_term_meta( $term_id, 'chrnx_project_' . $slot, true ) );
if ( '' !== $url ) {
$links[ $slot ] = $url;
}
}
return $links;
}
/**
* Render the project metadata fields on the term edit screen.
*
* @param WP_Term $term Project term.
*/
function chrnx_render_project_edit_fields( $term ) {
chrnx_print_release_field(
'chrnx_project_status',
__( 'Status', 'chrnx' ),
(string) get_term_meta( $term->term_id, 'chrnx_project_status', true ),
'text',
__( 'Short and honest, for example Beta, Activo or Archivado.', 'chrnx' )
);
foreach ( chrnx_get_project_link_slots() as $slot => $definition ) {
chrnx_print_release_field(
'chrnx_project_' . $slot,
$definition['label'],
(string) get_term_meta( $term->term_id, 'chrnx_project_' . $slot, true ),
'url',
__( 'HTTPS only. Leave empty to hide this icon.', 'chrnx' )
);
}
chrnx_print_release_field(
'chrnx_project_cover',
__( 'Cover attachment ID', 'chrnx' ),
(string) absint( get_term_meta( $term->term_id, 'chrnx_project_cover', true ) ),
'text',
__( 'Leave empty to use the shared placeholder art.', 'chrnx' )
);
}
add_action( 'chrnx_project_edit_form_fields', 'chrnx_render_project_edit_fields' );
/**
* Persist project term metadata from the term edit screen.
*
* @param int $term_id Project term ID.
*/
function chrnx_save_project_meta( $term_id ) {
if ( ! chrnx_auth_release_meta() ) {
return;
}
// Core supplies and verifies the add/update term nonce on these screens.
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
if ( ! wp_verify_nonce( $nonce, 'update-tag_' . $term_id ) && ! wp_verify_nonce( $nonce, 'add-tag' ) ) {
return;
}
foreach ( chrnx_get_project_meta_definitions() as $meta_key => $sanitize ) {
if ( ! isset( $_POST[ $meta_key ] ) ) {
continue;
}
$value = call_user_func( $sanitize, wp_unslash( $_POST[ $meta_key ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by the mapped callback.
if ( '' === $value || 0 === $value ) {
delete_term_meta( $term_id, $meta_key );
continue;
}
update_term_meta( $term_id, $meta_key, $value );
}
}
add_action( 'edited_chrnx_project', 'chrnx_save_project_meta' );
add_action( 'created_chrnx_project', 'chrnx_save_project_meta' );
+9 -57
View File
@@ -262,59 +262,6 @@ function chrnx_get_featured_story_ids( int $limit = 3 ): array {
return $selected;
}
/**
* Select projects for the Selected work stage: hand-picked first, then recent.
*
* Sticky already belongs to the home featured stories, so the editorial choice
* lives in its own per-post flag instead of competing for the same signal.
*
* @param int $limit Maximum projects, bounded to 12.
* @return int[] Selected project post IDs.
*/
function chrnx_get_selected_project_ids( int $limit = 3 ): array {
$limit = min( 12, max( 0, $limit ) );
if ( 0 === $limit ) {
return array();
}
$topic_query = array(
array(
'taxonomy' => 'chrnx_topic',
'field' => 'slug',
'terms' => 'projects',
),
);
$selected = chrnx_get_eligible_editorial_post_ids(
array(
'posts_per_page' => $limit,
'tax_query' => $topic_query,
'meta_query' => array(
array(
'key' => 'chrnx_project_featured',
'value' => '1',
),
),
)
);
$remaining = $limit - count( $selected );
if ( $remaining > 0 ) {
$selected = array_merge(
$selected,
chrnx_get_eligible_editorial_post_ids(
array(
'posts_per_page' => $remaining,
'post__not_in' => $selected,
'tax_query' => $topic_query,
)
)
);
}
return $selected;
}
/**
* Validate a request taxonomy slug against an existing editorial term.
*
@@ -374,7 +321,7 @@ function chrnx_sanitize_journal_search( $value ) {
*/
function chrnx_get_journal_archive_filter( $queried_object = null ): array {
$queried_object = null === $queried_object ? get_queried_object() : $queried_object;
if ( ! $queried_object instanceof WP_Term || ! in_array( $queried_object->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ), true ) ) {
if ( ! $queried_object instanceof WP_Term || ! in_array( $queried_object->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ), true ) ) {
return array();
}
@@ -431,7 +378,7 @@ function chrnx_get_journal_base_url() {
$url = get_permalink( $queried );
return is_string( $url ) ? $url : '';
}
if ( $queried instanceof WP_Term && in_array( $queried->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ), true ) ) {
if ( $queried instanceof WP_Term && in_array( $queried->taxonomy, array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ), true ) ) {
$url = get_term_link( $queried );
return is_wp_error( $url ) ? '' : $url;
}
@@ -486,7 +433,7 @@ function chrnx_get_full_journal_url() {
function chrnx_get_journal_page_url( int $page, array $filters ) {
$base_url = chrnx_get_journal_base_url();
$args = array();
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) as $taxonomy ) {
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ) as $taxonomy ) {
$slug = chrnx_validate_editorial_term_slug( $filters[ $taxonomy ] ?? '', $taxonomy );
if ( '' !== $slug ) {
$args[ $taxonomy ] = $slug;
@@ -526,7 +473,7 @@ function chrnx_get_journal_query_args( array $request ): array {
);
$tax_query = array();
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show' ) as $taxonomy ) {
foreach ( array( 'chrnx_topic', 'chrnx_language', 'chrnx_show', 'chrnx_project' ) as $taxonomy ) {
$value = $request[ $taxonomy ] ?? '';
$slug = chrnx_validate_editorial_term_slug( $value, $taxonomy );
if ( '' !== $slug ) {
@@ -687,6 +634,7 @@ function chrnx_get_topic_art_asset( string $topic_slug ): string {
'about-grunge' => 'about-grunge.png',
'placeholder-post' => 'placeholder-post.png',
'placeholder-release' => 'placeholder-release.png',
'placeholder-project' => 'placeholder-project.png',
'projects-grunge' => 'projects-grunge.png',
'podcasts' => 'alter-ego-podcasts.png',
'life' => 'alter-ego-life.png',
@@ -719,5 +667,9 @@ function chrnx_get_topic_art_dimensions( string $topic_slug ): array {
return array( 1536, 1536 );
}
if ( 'placeholder-project' === $topic_slug ) {
return array( 1534, 1025 );
}
return 'gaming' === $topic_slug ? array( 1024, 1536 ) : array( 1122, 1402 );
}
+9
View File
@@ -54,6 +54,15 @@ function chrnx_get_editorial_taxonomies() {
'aqui-se-rompio-una-jerga' => __( 'Aquí se Rompió una Jerga', 'chrnx' ),
),
),
'chrnx_project' => array(
'singular' => __( 'Project', 'chrnx' ),
'plural' => __( 'Projects', 'chrnx' ),
'rest_base' => 'project',
'terms' => array(
'green-tea' => __( 'Green Tea', 'chrnx' ),
'ailed' => __( 'Ailed', 'chrnx' ),
),
),
);
}
+2 -2
View File
@@ -16,8 +16,8 @@
<!-- wp:html --><div class="chrnx-character-stage__atmosphere" aria-hidden="true"><?php echo chrnx_get_atmosphere_markup( 'projects-grunge', 'chrnx-character-stage__backdrop' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><?php echo chrnx_get_topic_portrait_markup( 'research', '', 'chrnx-character-stage__secondary-art' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
<!-- wp:group {"className":"chrnx-character-stage__content","layout":{"type":"constrained"}} -->
<div class="wp-block-group chrnx-character-stage__content">
<!-- wp:heading --><h2 class="wp-block-heading"><?php echo esc_html__( 'Selected work', 'chrnx' ); ?></h2><!-- /wp:heading -->
<!-- wp:chrnx/selected-work /-->
<!-- wp:heading --><h2 class="wp-block-heading"><?php echo esc_html__( 'Proyectos', 'chrnx' ); ?></h2><!-- /wp:heading -->
<!-- wp:paragraph --><p><?php echo esc_html__( 'Lo que sobrevive a la loquera nocturna, con su repo y su estado real.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
</div>
<!-- /wp:group -->
<!-- wp:html --><div class="chrnx-character-stage__art"><?php echo chrnx_get_topic_portrait_markup( 'code', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* Title: Projects landing
* Slug: chrnx/projects-landing
* Categories: chrnx-projects
* Description: Honest introduction to the projects and every one that exists.
* Inserter: yes
*
* @package CHRNX
*/
?>
<!-- wp:group {"tagName":"section","className":"chrnx-projects-landing","layout":{"type":"constrained"}} -->
<section class="wp-block-group chrnx-projects-landing">
<!-- wp:group {"className":"chrnx-character-stage","layout":{"type":"constrained"}} -->
<div class="wp-block-group chrnx-character-stage">
<!-- wp:html --><div class="chrnx-character-stage__atmosphere" aria-hidden="true"><?php echo chrnx_get_atmosphere_markup( 'projects-grunge', 'chrnx-character-stage__backdrop' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
<!-- wp:group {"className":"chrnx-character-stage__content","layout":{"type":"constrained"}} -->
<div class="wp-block-group chrnx-character-stage__content">
<!-- wp:heading {"level":2} --><h2 class="wp-block-heading"><?php echo esc_html__( 'Proyectos', 'chrnx' ); ?></h2><!-- /wp:heading -->
<!-- wp:paragraph --><p><?php echo esc_html__( 'Aquí va lo que mi cerebro tira en formato de código.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
<!-- wp:paragraph --><p><?php echo esc_html__( 'Una noche me agarra la loquera y sale código. A veces sirve, a veces nomás me deja dormir. Lo que sobrevive lo dejo aquí, con su repo y su estado real, sin adornos.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
</div>
<!-- /wp:group -->
<!-- wp:html --><div class="chrnx-character-stage__art"><?php echo chrnx_get_topic_portrait_markup( 'code', '', 'chrnx-projects-landing__portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
</div>
<!-- /wp:group -->
<!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Lo que existe', 'chrnx' ); ?></h3><!-- /wp:heading -->
<!-- wp:chrnx/project-list /-->
</section>
<!-- /wp:group -->
+4 -3
View File
@@ -178,7 +178,7 @@ done
chrnx_build_responsive_image "alter-ego-gaming-half-body" "alter-ego-gaming-half-body.png"
printf '{\n\t"source": "alter-ego-gaming-half-body.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_build_output/alter-ego-gaming-half-body.json"
for chrnx_image_placeholder in placeholder-post placeholder-release; do
for chrnx_image_placeholder in placeholder-post placeholder-release placeholder-project; do
# Placeholders sit at half opacity behind text; they do not need full quality.
chrnx_build_responsive_image "$chrnx_image_placeholder" "$chrnx_image_placeholder.png" 48 40
printf '{\n\t"source": "%s.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' "$chrnx_image_placeholder" > "$chrnx_image_build_output/$chrnx_image_placeholder.json"
@@ -228,14 +228,15 @@ chrnx_validate_staged_family "alter-ego-gaming-half-body" 384 768
chrnx_validate_staged_family "the-no-names-musician-cutout" 384 768
chrnx_validate_staged_family "placeholder-post" 384 768
chrnx_validate_staged_family "placeholder-release" 384 768
chrnx_validate_staged_family "placeholder-project" 384 768
chrnx_validate_staged_family "the-no-names-collage" 384 768
chrnx_validate_staged_family "podcast-frequency-grunge" 384 768 1536
chrnx_validate_staged_family "about-grunge" 384 768 1536
chrnx_validate_staged_family "projects-grunge" 384 768 1536
set -- "$chrnx_image_stage"/*
if [ "$#" -ne 76 ]; then
echo "Responsive image staging expected 76 files, got $#." >&2
if [ "$#" -ne 81 ]; then
echo "Responsive image staging expected 81 files, got $#." >&2
exit 1
fi
for chrnx_image_staged in "$@"; do
+1 -4
View File
@@ -140,12 +140,9 @@ foreach ( $chrnx_seed_posts as $chrnx_seed_index => $chrnx_seed_post ) {
wp_set_object_terms( $chrnx_seed_post_id, array(), 'chrnx_release', false );
}
foreach ( array( 'chrnx_episode_number', 'chrnx_episode_duration', 'canonical_episode_url', 'chrnx_project_featured' ) as $chrnx_seed_meta_key ) {
foreach ( array( 'chrnx_episode_number', 'chrnx_episode_duration', 'canonical_episode_url' ) as $chrnx_seed_meta_key ) {
delete_post_meta( $chrnx_seed_post_id, $chrnx_seed_meta_key );
}
if ( ! empty( $chrnx_seed_post['projectFeatured'] ) ) {
update_post_meta( $chrnx_seed_post_id, 'chrnx_project_featured', true );
}
delete_post_meta( $chrnx_seed_post_id, 'chrnx_track_number' );
if ( isset( $chrnx_seed_post['trackNumber'] ) ) {
update_post_meta( $chrnx_seed_post_id, 'chrnx_track_number', absint( $chrnx_seed_post['trackNumber'] ) );
+1 -1
View File
@@ -3,6 +3,6 @@ Theme Name: CHRNX
Description: A native block theme for chrnx.dev.
Requires at least: 6.9
Requires PHP: 8.1
Version: 0.4.4
Version: 0.4.5
Text Domain: chrnx
*/
+12
View File
@@ -0,0 +1,12 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-archive chrnx-project-archive","layout":{"type":"constrained"}} -->
<main id="chrnx-main" class="wp-block-group chrnx-archive chrnx-project-archive" tabindex="-1">
<!-- wp:query-title {"type":"archive","level":1,"showPrefix":false} /-->
<!-- wp:chrnx/project-detail /-->
<!-- wp:chrnx/journal-stream /-->
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
+12
View File
@@ -0,0 +1,12 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-archive chrnx-show-archive","layout":{"type":"constrained"}} -->
<main id="chrnx-main" class="wp-block-group chrnx-archive chrnx-show-archive" tabindex="-1">
<!-- wp:query-title {"type":"archive","level":1,"showPrefix":false} /-->
<!-- wp:chrnx/show-links /-->
<!-- wp:chrnx/journal-stream /-->
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
-2
View File
@@ -47,6 +47,4 @@ test( 'editorial and podcast controls initialize in the real post editor', async
await openPanel( 'Topic' );
await page.getByRole( 'radio', { name: 'Projects', exact: true } ).check();
await expect( page.getByLabel( 'Episode number', { exact: true } ) ).toBeHidden();
await openPanel( 'Project' );
await expect( page.getByLabel( 'Show in Selected work', { exact: true } ) ).toBeVisible();
} );
+3 -5
View File
@@ -557,11 +557,9 @@ const immutableSurfaces = [
'alter-ego-research-768.webp',
'alter-ego-code-768.webp',
],
// Project names come from chrnx/selected-work: picked projects newest-first,
// then the most recent ones. This is the seeded order, not a frozen string.
headings: [ 'Selected work', 'Ailed', 'Expressive Tea', 'Published research' ],
paragraphs: [],
contentText: 'Selected work Ailed Expressive Tea Published research',
headings: [ 'Proyectos' ],
paragraphs: [ 'Lo que sobrevive a la loquera nocturna, con su repo y su estado real.' ],
contentText: 'Proyectos Lo que sobrevive a la loquera nocturna, con su repo y su estado real.',
},
{
name: 'About',
+3 -2
View File
@@ -193,7 +193,7 @@ test( 'home remains coherent at all approved review viewports', async ( { page }
await expect( page.locator( 'main#chrnx-main' ) ).toBeVisible();
await expect( page.getByRole( 'contentinfo' ) ).toBeVisible();
await expect( page.getByRole( 'heading', { level: 1 } ) ).toHaveCount( 1 );
await expect( page.getByText( 'Selected work', { exact: true } ) ).toBeVisible();
await expect( page.getByText( 'Proyectos', { exact: true } ) ).toBeVisible();
await expect( page.getByText( 'The No Names', { exact: true } ).first() ).toBeVisible();
await expect( page.locator( 'picture source[type="image/avif"]' ).first() ).toHaveAttribute(
'srcset',
@@ -516,7 +516,8 @@ test( 'lower home panels survive missing media and reduced motion', async ( { pa
expect( musicFallback.stageOverflow ).toBeLessThanOrEqual( 1 );
await expect( page.locator( '.chrnx-home-music h2' ) ).toContainText( 'The No Names' );
await expect( page.locator( '.chrnx-home-music p' ) ).toHaveCount( 2 );
await expect( page.locator( '.chrnx-home-projects h3' ) ).toHaveCount( 3 );
await expect( page.locator( '.chrnx-home-projects h2' ) ).toHaveText( 'Proyectos' );
await expect( page.locator( '.chrnx-home-projects p' ) ).toHaveCount( 1 );
await expect( page.locator( '.chrnx-home-about-preview p' ) ).not.toBeEmpty();
await expect( page.locator( '.chrnx-subscribe-cta__link' ) ).toBeVisible();
-102
View File
@@ -1,102 +0,0 @@
const modulePath = '../../assets/js/editor-project.js';
function flatten( node ) {
if ( ! node || typeof node !== 'object' ) {
return [];
}
return [ node ].concat( ( node.children || [] ).flatMap( flatten ) );
}
function createWp( topicSlug = 'projects', meta = { unrelated: 'keep' } ) {
const editPost = jest.fn();
const registerPlugin = jest.fn();
const state = { meta, topic: [ 12 ] };
const wp = {
components: { ToggleControl: 'ToggleControl' },
i18n: { __: jest.fn( ( text ) => text ) },
data: {
select: ( store ) => {
if ( store === 'core/editor' ) {
return {
getCurrentPostType: () => 'post',
getEditedPostAttribute: ( key ) => state[ key ],
};
}
return {
getEntityRecord: () => ( topicSlug ? { id: 12, slug: topicSlug } : undefined ),
};
},
dispatch: () => ( { editPost } ),
useDispatch: ( store ) => wp.data.dispatch( store ),
useSelect: ( mapper ) => mapper( wp.data.select ),
},
editPost: { PluginDocumentSettingPanel: 'PluginDocumentSettingPanel' },
element: {
createElement: ( type, props, ...children ) => ( { type, props: props || {}, children } ),
},
plugins: { registerPlugin },
};
return { wp, editPost, registerPlugin };
}
function renderPanel( context ) {
const { initialize } = require( modulePath );
expect( initialize( context.wp ) ).toBe( true );
const [ , plugin ] = context.registerPlugin.mock.calls[ 0 ];
return plugin.render();
}
describe( 'project editor panel', () => {
beforeEach( () => {
jest.resetModules();
} );
test( 'refuses to initialize without the required editor globals', () => {
const { initialize } = require( modulePath );
expect( initialize( undefined ) ).toBe( false );
expect( initialize( {} ) ).toBe( false );
} );
test( 'renders the Selected work toggle only for the projects topic', () => {
const context = createWp( 'projects' );
const toggles = flatten( renderPanel( context ) ).filter(
( node ) => node.type === 'ToggleControl',
);
expect( toggles ).toHaveLength( 1 );
expect( toggles[ 0 ].props.checked ).toBe( false );
} );
test.each( [ 'podcasts', 'code', null ] )( 'renders nothing for the %s topic', ( slug ) => {
expect( renderPanel( createWp( slug ) ) ).toBeNull();
} );
test( 'reflects an existing flag and preserves unrelated meta when toggling', () => {
const context = createWp( 'projects', { unrelated: 'keep', chrnx_project_featured: true } );
const toggle = flatten( renderPanel( context ) ).find(
( node ) => node.type === 'ToggleControl',
);
expect( toggle.props.checked ).toBe( true );
toggle.props.onChange( false );
expect( context.editPost ).toHaveBeenCalledWith( {
meta: { unrelated: 'keep', chrnx_project_featured: false },
} );
} );
test( 'coerces the toggle value to a boolean', () => {
const context = createWp( 'projects' );
const toggle = flatten( renderPanel( context ) ).find(
( node ) => node.type === 'ToggleControl',
);
toggle.props.onChange( 'yes' );
expect( context.editPost ).toHaveBeenCalledWith( {
meta: { unrelated: 'keep', chrnx_project_featured: true },
} );
} );
test( 'updateMeta ignores a missing dispatcher', () => {
const { updateMeta } = require( modulePath );
expect( () => updateMeta( undefined, {}, 'chrnx_project_featured', true ) ).not.toThrow();
} );
} );
+2 -4
View File
@@ -45,7 +45,7 @@ class EditorAssetsTest extends WP_UnitTestCase {
* Clear only the CHRNX editor script state.
*/
private function reset_editor_scripts() {
foreach ( array( 'chrnx-editor-taxonomies', 'chrnx-editor-podcast', 'chrnx-editor-project', 'chrnx-editor-track' ) as $handle ) {
foreach ( array( 'chrnx-editor-taxonomies', 'chrnx-editor-podcast', 'chrnx-editor-track' ) as $handle ) {
wp_dequeue_script( $handle );
wp_deregister_script( $handle );
}
@@ -83,14 +83,13 @@ class EditorAssetsTest extends WP_UnitTestCase {
)
);
$this->assertSame( array( 'chrnx-editor-taxonomies', 'chrnx-editor-podcast', 'chrnx-editor-project', 'chrnx-editor-track' ), $handles );
$this->assertSame( array( 'chrnx-editor-taxonomies', 'chrnx-editor-podcast', 'chrnx-editor-track' ), $handles );
$expected_dependencies = array( 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' );
foreach (
array(
'chrnx-editor-taxonomies' => 'assets/js/editor-taxonomies.js',
'chrnx-editor-podcast' => 'assets/js/editor-podcast.js',
'chrnx-editor-project' => 'assets/js/editor-project.js',
) as $handle => $asset
) {
$this->assertArrayHasKey( $handle, $scripts->registered );
@@ -123,7 +122,6 @@ class EditorAssetsTest extends WP_UnitTestCase {
do_action( 'enqueue_block_editor_assets' );
$this->assertFalse( wp_script_is( 'chrnx-editor-taxonomies', 'enqueued' ) );
$this->assertFalse( wp_script_is( 'chrnx-editor-podcast', 'enqueued' ) );
$this->assertFalse( wp_script_is( 'chrnx-editor-project', 'enqueued' ) );
$this->assertFalse( wp_script_is( 'chrnx-editor-track', 'enqueued' ) );
}
}
+3 -3
View File
@@ -205,9 +205,9 @@ class PatternsTest extends WP_UnitTestCase {
public function test_character_led_patterns_use_the_exact_shared_stage_api() {
$contracts = array(
'home-projects' => array(
'heading' => 'Selected work',
// The project names come from chrnx/selected-work now, not the pattern.
'order' => array( 'Selected work' ),
'heading' => 'Proyectos',
// The project names come from the project list query now, not the pattern.
'order' => array( 'Proyectos' ),
'art' => 'alter-ego-code-768.webp',
'art_alt' => '',
'atmosphere' => 'chrnx-character-stage__secondary-art',
+180
View File
@@ -0,0 +1,180 @@
<?php
/**
* Tests for the project blocks.
*
* @package CHRNX
*/
/**
* Verify project block rendering.
*/
class ProjectBlocksTest extends WP_UnitTestCase {
/**
* Register blocks and taxonomies before each test.
*/
public function set_up() {
parent::set_up();
do_action( 'init' );
}
/**
* Ensure the list renders one card per project with its status.
*/
public function test_project_list_renders_a_card_per_project() {
$term_id = self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'name' => 'Green Tea',
'slug' => 'green-tea-test',
)
);
update_term_meta( $term_id, 'chrnx_project_status', 'Beta' );
$markup = do_blocks( '<!-- wp:chrnx/project-list /-->' );
$this->assertStringContainsString( 'chrnx-project-card', $markup );
$this->assertStringContainsString( 'Green Tea', $markup );
$this->assertStringContainsString( 'Beta', $markup );
}
/**
* Ensure stored project links render with their platform icons.
*/
public function test_project_list_renders_stored_links() {
$term_id = self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'name' => 'Matcha CLI',
'slug' => 'matcha-cli-test',
)
);
update_term_meta( $term_id, 'chrnx_project_repo', 'https://example.com/repo' );
update_term_meta( $term_id, 'chrnx_project_package', 'https://example.com/package' );
$markup = do_blocks( '<!-- wp:chrnx/project-list /-->' );
$this->assertStringContainsString( 'chrnx-platform-links', $markup );
$this->assertStringContainsString( 'https://example.com/repo', $markup );
$this->assertStringContainsString( 'https://example.com/package', $markup );
}
/**
* Ensure a project without a cover still renders art.
*/
public function test_project_without_cover_uses_placeholder_art() {
self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'slug' => 'coverless-test',
)
);
$markup = do_blocks( '<!-- wp:chrnx/project-list /-->' );
$this->assertStringContainsString( 'chrnx-project-card__fallback', $markup );
}
/**
* Ensure the detail block renders the queried project header.
*/
public function test_project_detail_renders_the_queried_term() {
$term_id = self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'name' => 'Ailed',
'slug' => 'ailed-test',
'description' => 'A chess engine that feels.',
)
);
update_term_meta( $term_id, 'chrnx_project_repo', 'https://github.com/example/ailed' );
update_term_meta( $term_id, 'chrnx_project_status', 'Activo' );
$this->go_to( get_term_link( $term_id ) );
$markup = do_blocks( '<!-- wp:chrnx/project-detail /-->' );
$this->assertStringContainsString( 'A chess engine that feels.', $markup );
$this->assertStringContainsString( 'https://github.com/example/ailed', $markup );
$this->assertStringContainsString( 'Activo', $markup );
}
/**
* Ensure the detail block renders nothing outside a project archive.
*/
public function test_project_detail_is_silent_off_its_archive() {
$this->go_to( home_url( '/' ) );
$this->assertSame( '', trim( do_blocks( '<!-- wp:chrnx/project-detail /-->' ) ) );
}
/**
* Ensure a list card falls back to placeholder art when the stored cover
* attachment no longer exists, instead of rendering a blank art column.
*/
public function test_project_list_with_deleted_cover_uses_placeholder_art() {
$term_id = self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'slug' => 'deleted-cover-list-test',
)
);
update_term_meta( $term_id, 'chrnx_project_cover', 999999 );
$markup = do_blocks( '<!-- wp:chrnx/project-list /-->' );
// Scope the assertion to this term's own card: the taxonomy query is
// unfiltered, so other projects' cards must not mask a broken one.
$needle = 'chrnx_project=deleted-cover-list-test';
$link_offset = strpos( $markup, $needle );
$this->assertNotFalse( $link_offset, 'Expected a card linking to the test project.' );
$card_start = strrpos( substr( $markup, 0, $link_offset ), '<article' );
$card_end = strpos( $markup, '</article>', $link_offset );
$card = substr( $markup, $card_start, $card_end - $card_start );
$this->assertStringContainsString( 'chrnx-project-card__fallback', $card );
$this->assertStringNotContainsString( 'chrnx-project-card__cover', $card );
}
/**
* Ensure the detail block falls back to placeholder art when the stored
* cover attachment no longer exists, instead of rendering a blank art column.
*/
public function test_project_detail_with_deleted_cover_uses_placeholder_art() {
$term_id = self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'slug' => 'deleted-cover-detail-test',
)
);
update_term_meta( $term_id, 'chrnx_project_cover', 999999 );
$this->go_to( get_term_link( $term_id ) );
$markup = do_blocks( '<!-- wp:chrnx/project-detail /-->' );
$this->assertStringContainsString( 'chrnx-project-detail__fallback', $markup );
$this->assertStringNotContainsString( 'chrnx-project-detail__cover', $markup );
}
/**
* Ensure a project archive filters the journal to that project.
*/
public function test_project_archive_filters_the_journal() {
$term_id = self::factory()->term->create(
array(
'taxonomy' => 'chrnx_project',
'slug' => 'filter-test',
)
);
$mine = self::factory()->post->create( array( 'post_title' => 'Belongs to the project' ) );
self::factory()->post->create( array( 'post_title' => 'Unrelated post' ) );
wp_set_object_terms( $mine, array( $term_id ), 'chrnx_project' );
$this->go_to( get_term_link( $term_id ) );
$markup = do_blocks( '<!-- wp:chrnx/journal-stream /-->' );
$this->assertStringContainsString( 'Belongs to the project', $markup );
$this->assertStringNotContainsString( 'Unrelated post', $markup );
}
}
+55
View File
@@ -0,0 +1,55 @@
<?php
/**
* Tests for project term metadata.
*
* @package CHRNX
*/
/**
* Verify the project term meta contract.
*/
class ProjectMetaTest extends WP_UnitTestCase {
/**
* Register taxonomies and meta before each test.
*/
public function set_up() {
parent::set_up();
do_action( 'init' );
}
/**
* Ensure every project meta key is registered for the taxonomy.
*/
public function test_project_meta_keys_are_registered() {
$registered = get_registered_meta_keys( 'term', 'chrnx_project' );
foreach ( array_keys( chrnx_get_project_meta_definitions() ) as $meta_key ) {
$this->assertArrayHasKey( $meta_key, $registered );
}
}
/**
* Ensure a plain http repository URL is rejected.
*/
public function test_project_links_reject_insecure_urls() {
$term_id = self::factory()->term->create( array( 'taxonomy' => 'chrnx_project' ) );
update_term_meta( $term_id, 'chrnx_project_repo', 'http://example.com/repo' );
$this->assertArrayNotHasKey( 'repo', chrnx_get_project_links( $term_id ) );
}
/**
* Ensure stored https links come back keyed by their slot.
*/
public function test_project_links_return_stored_https_urls() {
$term_id = self::factory()->term->create( array( 'taxonomy' => 'chrnx_project' ) );
update_term_meta( $term_id, 'chrnx_project_repo', 'https://github.com/Expressive-Tea/green-tea' );
update_term_meta( $term_id, 'chrnx_project_package', 'https://www.npmjs.com/package/@green-tea/core' );
$links = chrnx_get_project_links( $term_id );
$this->assertSame( 'https://github.com/Expressive-Tea/green-tea', $links['repo'] );
$this->assertSame( 'https://www.npmjs.com/package/@green-tea/core', $links['package'] );
$this->assertArrayNotHasKey( 'site', $links );
}
}
+7
View File
@@ -50,6 +50,13 @@ class TaxonomiesTest extends WP_UnitTestCase {
'silicon-ranch' => 'Silicon Ranch',
),
),
'chrnx_project' => array(
'rest_base' => 'project',
'terms' => array(
'green-tea' => 'Green Tea',
'ailed' => 'Ailed',
),
),
);
}
+13 -1
View File
@@ -2,7 +2,7 @@ import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
const templates = [ 'home', 'single', 'page', 'archive', 'search', '404' ];
const templates = [ 'home', 'single', 'page', 'archive', 'search', '404', 'taxonomy-chrnx_project', 'taxonomy-chrnx_show', 'taxonomy-chrnx_release' ];
const readTemplate = (name) => readFile(new URL(`../../templates/${name}.html`, import.meta.url), 'utf8');
function assertBalancedBlockMarkup(markup, name) {
@@ -104,3 +104,15 @@ test('404 offers concise recovery with search, Journal, and home links', async (
assert.match(markup, /wp:chrnx\/journal-link/);
assert.doesNotMatch(markup, /"url":"\//);
});
test('taxonomy-chrnx_project surfaces the project detail and its post stream', async () => {
const markup = await readTemplate('taxonomy-chrnx_project');
assert.match(markup, /wp:chrnx\/project-detail/);
assert.match(markup, /wp:chrnx\/journal-stream/);
});
test('taxonomy-chrnx_show surfaces show links and its episode stream', async () => {
const markup = await readTemplate('taxonomy-chrnx_show');
assert.match(markup, /wp:chrnx\/show-links/);
assert.match(markup, /wp:chrnx\/journal-stream/);
});
+4 -4
View File
@@ -140,7 +140,7 @@ test( 'media and review documentation matches the current inventory and cleanup
const readme = read( 'README.md' );
const plan = read( 'docs/superpowers/plans/2026-08-13-music-podcast-grunge-stages.md' );
assert.match( readme, /76 generated files: 62 binary derivatives and 14 manifests/ );
assert.match( readme, /81 generated files: 66 binary derivatives and 15 manifests/ );
assert.match( readme, /eleven portrait families at 384 px and 768 px/ );
assert.match( readme, /three\s+landscape background families \(Podcast, About, and Projects\) at 384 px, 768 px,\s+and 1536 px/ );
for ( const budget of [ '160 KiB', '260 KiB', '400 KiB', '340 KiB', '620 KiB', '3 MiB' ] ) {
@@ -469,7 +469,7 @@ test( 'all approved responsive media rebuild byte-identically within payload bou
assert.deepEqual( readdirSync( external ), [ 'sentinel' ] );
execFileSync( './scripts/build-responsive-images.sh', [ output ], { cwd: new URL( '../..', import.meta.url ) } );
const names = readdirSync( output ).sort();
assert.equal( names.length, 76 );
assert.equal( names.length, 81 );
for ( const name of [
'alter-ego-gaming-half-body-384.avif',
'alter-ego-gaming-half-body-384.webp',
@@ -684,7 +684,7 @@ printf 'partial-build-%s\n' "$count" > "$output"
}
} );
test( 'responsive promotion failure restores all 76 prior files', () => {
test( 'responsive promotion failure restores all 81 prior files', () => {
const output = mkdtempSync( join( tmpdir(), 'chrnx-promotion-output-' ) );
const fakeBin = mkdtempSync( join( tmpdir(), 'chrnx-promotion-bin-' ) );
const external = mkdtempSync( join( tmpdir(), 'chrnx-promotion-external-' ) );
@@ -697,7 +697,7 @@ test( 'responsive promotion failure restores all 76 prior files', () => {
try {
execFileSync( './scripts/build-responsive-images.sh', [ output ], { cwd: projectRoot } );
const published = new Map( readdirSync( output ).map( ( name ) => [ name, sha256( join( output, name ) ) ] ) );
assert.equal( published.size, 76 );
assert.equal( published.size, 81 );
writeFileSync( sentinel, 'external-sentinel' );
const sentinelHash = sha256( sentinel );
const realMv = execFileSync( '/bin/sh', [ '-c', 'command -v mv' ], { encoding: 'utf8' } ).trim();