Skip to content

Enjoy Kaizen

Tag: Open Source

Dads’ Breakfast: Commit c6ac2d562b

From the Making of Dads’ Breakfast

HTTPS://CJWILLCOCK.CA/DADS-BREAKFAST-MAKING-OF/

I added microformats to Dads’ Breakfast, my active WordPress theme and ongoing bit of coding in the open.

Dads’ Breakfast: Commit c6ac2d562b,

It is early days in D. B. but my Psymantic theme is longer in the tooth (practice) and in it I wrote some code to mute WordPress’ microformatting with h-entry and hentry wherever post_class() is used. WordPress applies the h-entry context to all of my owned content, sans-theme. A dirty press is, the working press. I think I may have leveled-up on the distraction-free writing mode with this one.

With that out of the way and on adding the h-entry back I was left with a divot to fix when the post_class('h-entry') no longer worked as the WordPress documentation of this library function describes it to do and thus I discovered the platform is left compromised by my D. B. theme architecture. First, I had this planned and second, they-all started it.

Using the conventional post_class() template tag, to now allow a theme author to use discretion on the location of an h-entry via post_class() is a must-do in order to obviate the shoe-horning I need to accomplish to make this theme. h-entry is therefore written wp-entry in the post_class() library function call using a Psymantic-based theme in WordPress.

This is the simplest I can figure to satisfy the requirements of semantic interoperability given modern definitions of both WordPress & Microformats. There is much more done in the Psymantic theme to mute microformatting. Aside: I should write about that maybe.

Trial balloon now steady on a string, adding the h-entry back via wp-entry is done:

/**
 * Filter the post_class tag to convert wp encoded microformats.
 *
 * @since 0.1.0
 *
 * @param  array $classes The list of classes.
 * @param  array $class   The class provided to the function at call-time.
 * @param  int   $post_id The ID of the post for which the classes are given.
 * @return array The filtered classes.
 */
function dadsbreakfast_post_class_convert_wp_microformats( $classes, $class, $post_id ) {
	return str_replace(
		array(
			'wp-entry'
		),
		array(
			'h-entry'
		),
		$classes
	);
}
add_filter( 'post_class', 'dadsbreakfast_post_class_convert_wp_microformats', 10, 3 );

The rest of the commit is there for those with additional time and interest.

Dads’ Breakfast: Commit 998df0135f

From the Making of Dads’ Breakfast

HTTPS://CJWILLCOCK.CA/DADS-BREAKFAST-MAKING-OF/

You are welcome to view this commit via github, sourcehut, or author’s original.

I use two (2) flatscreen LCD monitors at my writing desk. Both monitors are 1080p and leave me some room around the default block widths in the Gutenberg editor. These have a maximum width of 31.77% of my viewing area. I’m looking for nearer to half as a minimum return on my monitor-dollar.

I preserve some negative space around the tableau but impose a little bit more room for tables and various things, by applying the following CSS to the editor:

@media (min-width: 1280px){
	.wp-block{
		max-width: 800px;
	}
}

@media (min-width: 1600px){
	.wp-block{
		max-width: 960px;
	}
}

With this change, on any screen with two-thirds (2/3) the horizontal resolution of a monitor like one of mine the block widths increase from 47.66% to five-eights (5/8) of the viewport width. At screens five-sixths (5/6) mine the block widths increase from the 41.69% of the viewport width imposed by the previous media query -up from 38.125% at default WP size- to three-fifths (3/5) of the viewport width.

The ratio of viewport width to block width changes as the viewport width increases. I’m keeping the tableau on desktop to a comfortable one-half (1/2) of a 1920 pixels wide viewport. YMMV.

Signing My Git Commits w/ GPG

UPDATE: I elaborated on this in my follow-up post Why Sign Git Commits?

I have my master, secret GPG key stored offline in an encrypted USB drive, but keep a signing subkey on my local machine for day-to-day use. I ensured that my GPG signing subkey was available to the git client on the host where my development work was taking place, and configured that git client to use my signing subkey.

On commit, I answer the challenge with my GPG passphrase to apply my signature to my work using my private signing subkey. Such signed commits are indicated as verified by both my-own installation of Gitea at code.cjwillcock.ca and third-parties Github, et al.

I found the article Create GnuPG key with sub-keys to sign, encrypt, authenticate by Gerhard, via Tinned Software, helpful in getting started with GPG.

I found the article Using an offline GnuPG master key by Damien Goutte-Gattat helpful in learning to remove the secret from my master key, so that I could have this offline master key while keeping the convenience of signing keys on my workstation.