Making WordPress.org

Changeset 861


Ignore:
Timestamp:
09/12/2014 10:52:07 PM (12 years ago)
Author:
coffee2code
Message:

Code Reference: improve output formatting and styling for hash style parameters

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r853 r861  
    882882                        return $text;
    883883                }
    884                 $text = trim( substr( $text, 1, -1 ) );
    885                 $text = str_replace( '@type', "<br \>@type", $text );
    886                 return $text;
     884
     885                $new_text = '';
     886                $text     = trim( substr( $text, 1, -1 ) );
     887                $text     = str_replace( '@type', "\n@type", $text );
     888
     889                $in_list = false;
     890                $parts = explode( "\n", $text );
     891                foreach ( $parts as $part ) {
     892                        $part = preg_replace( '/\s+/', ' ', $part );
     893                        list( $wordtype, $type, $name, $description ) = explode( ' ', $part, 4 );
     894
     895                        if ( '@type' != $wordtype ) {
     896                                if ( $in_list ) {
     897                                        $in_list = false;
     898                                        $new_text .= "</li></ul>\n";
     899                                }
     900
     901                                $new_text .= $part;
     902                        } else {
     903                                if ( $in_list ) {
     904                                        $new_text .= '<li>';
     905                                } else {
     906                                        $new_text .= '<ul class="param-hash"><li>';
     907                                        $in_list = true;
     908                                }
     909
     910                                $new_text .= "<b>'" . substr( $name, 1 ) . "'</b><br /><i><span class='type'>({$type})</span></i> {$description}</li>\n";
     911                        }
     912                }
     913
     914                if ( $in_list ) {
     915                        $new_text .= "</li></ul>\n";
     916                }
     917
     918                return $new_text;
    887919        }
    888920
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/scss/main.scss

    r815 r861  
    905905                                }
    906906                        }
     907                        .param-hash {
     908                                margin-left: 1.2em;
     909                                margin-bottom: 0.5em;
     910                        }
    907911                }
    908912                .learn-more {
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/stylesheets/main.css

    r815 r861  
    11111111  font-style: italic;
    11121112}
     1113.devhub-wrap .wp-parser-class .parameters .param-hash, .devhub-wrap .wp-parser-function .parameters .param-hash, .devhub-wrap .wp-parser-hook .parameters .param-hash, .devhub-wrap .wp-parser-method .parameters .param-hash {
     1114  margin-left: 1.2em;
     1115  margin-bottom: 0.5em;
     1116}
    11131117.devhub-wrap .wp-parser-class .learn-more, .devhub-wrap .wp-parser-function .learn-more, .devhub-wrap .wp-parser-hook .learn-more, .devhub-wrap .wp-parser-method .learn-more {
    11141118  background-color: #f1f1f1;
Note: See TracChangeset for help on using the changeset viewer.