Wrapping Arbitrary HTML to Assign a common Universal Attribute

A few days ago I checked the HTML validity of my own blog. I have to admit that I didn’t do that after I wrote the jugglingPostLang plugin (wrote about that in my blog post Simple Language-Defined Posts in WordPress) for WordPress. I realized that my plugin produced invalid html in many cases, so that was an issue:

The issue is, that <span> elements forbid block level content, while <div> elements are not allowed as a child of any element that only accepts phrasing content (which is roughly running text and what’s inside).

To solve that I read through the html specifications to find a solution but unfortunately there isn’t a simple solution on the horizon.

In the following I’m going to summarize the html specification details on the topic and give a rough sketch on the algorithm to determine what’s a valid wrapping node. Wrapping Arbitrary HTML to Assign a common Universal Attribute weiterlesen

Simple Language-Defined posts in WordPress

For different audiences I write blog posts in different languages. Developers usually understand English and often even talk in English, it’s their lingua franca of the programming domain.
On the other hand other articles are about more local topics, so their target audience is mainly Germans. Here I prefer writing in my mother tongue. Unfortunately there seems to be no easy and simple solution to define the language per article in WordPress, so I considered to write one myself.

The plugin is available for download on github now.

Read further for more details on What it does, How it is done, Why I did it and What could be added. Simple Language-Defined posts in WordPress weiterlesen