Genesis - 如何将其他类传递给genesis_markup?

I have a function that created a div named "content-wrapper". In special occasions I need additional classes within this div and I tried it with this function:

function content_wrapper($function, $title = '', $first = false ) {
    if ('open' != $function && 'close' != $function)
        return;

if ('open' == $function) {
    if ($first == true) {
        genesis_markup( array(
            'html5'   => '<div %s>',
            'xhtml'   => '<div class="content-wrapper content-wrapper-first">',
            'context' => 'content-wrapper content-wrapper-first',
        ) );

But the output is

<div class="content-wrappercontent-wrapper-first">

Does anybody know why the whitespace is removed and how I can add it? I even extended the function to

function content_wrapper($function, $title = '', $args = '' ) {

$args would be an array where I can pass additional classes to, but this is not working properly. Even genesis_attr-content-wrapper does not work properly, as it adds the additional class to every content-wrapper on the page.

Does somebody has an idea?

Thanks.

It looks like the space is removed in the function genesis_parse_attr() in the genesis theme's markup.php file when it runs the sanitize_html_class($context). You have the right idea of using the genesis_attr-context-wrapper filter, but this context is used in other places so it will be called many times. For your case to only have it add the class when you want it, change the context to be only 'content-wrapper-first' and which creates a filter called genesis_attr-context-wrapper-first. Hook to this filter and add the context-wrapper class (and any other you want).

So call genesis_markup like this:

genesis_markup( array(
  'html5'   => '<div %s>',
  'xhtml'   => '<div class="content-wrapper content-wrapper-first">',
  'context' => 'content-wrapper-first',
 ) );

Then hook to the filter which will only be called when genesis_markup has the context 'content-wrapper-first'

add_filter('genesis_attr_content-wrapper-first','myFilterFunction');

function myFilterFunction($attributes) {
  $attributes['class'] = $attributes['class'] . ' ' . 'content-wrapper';
  return $attributes;
}

Since the context is content-wrapper-first, it will already be in the $attributes['class'] variable.