Dotclear

Changeset 3882:254f3929b2c4


Ignore:
Timestamp:
09/19/18 10:11:05 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Actually the minifier did not like the template strings, so one step back (see rev [3881]) and fix the minifier

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/js/common.js

    r3881 r3882  
    525525    if (!opt.remove && opt.value !== null) { 
    526526      // Compose badge classes 
    527       const cls = `badge badge-${opt.id} ${opt.inline ? 'badge-inline' : 'badge-block'}${opt.icon ? ' badge-icon' : ''}${opt.type !== '' ? ` badge-${opt.type}` : ''}${opt.left ? ' badge-left' : ''}${opt.noborder ? ' badge-noborder' : ''}${opt.small ? ' badge-small' : ''}${opt.classes !== '' ? ` ${opt.classes}` : ''}`; 
     527      const cls = `badge badge-${opt.id} \ 
     528${opt.inline ? 'badge-inline' : 'badge-block'}\ 
     529${opt.icon ? ' badge-icon' : ''}\ 
     530${opt.type !== '' ? ` badge-${opt.type}` : ''}\ 
     531${opt.left ? ' badge-left' : ''}\ 
     532${opt.noborder ? ' badge-noborder' : ''}\ 
     533${opt.small ? ' badge-small' : ''}\ 
     534${opt.classes !== '' ? ` ${opt.classes}` : ''}`; 
    528535      // Compose badge 
    529536      const xml = `<span class="${cls}" aria-hidden="true">${opt.value}</span>`; 
  • build-tools/Minifier.php

    r3877 r3882  
    107107 
    108108            $jshrink = new Minifier(); 
    109             $js = $jshrink->lock($js); 
     109            $js      = $jshrink->lock($js); 
    110110            $jshrink->minifyDirectToOutput($js, $options); 
    111111 
     
    155155    { 
    156156        $this->options = array_merge(static::$defaultOptions, $options); 
    157         $js = str_replace("\r\n", "\n", $js); 
    158         $js = str_replace('/**/', '', $js); 
    159         $this->input = str_replace("\r", "\n", $js); 
     157        $js            = str_replace("\r\n", "\n", $js); 
     158        $js            = str_replace('/**/', '', $js); 
     159        $this->input   = str_replace("\r", "\n", $js); 
    160160 
    161161        // We add a newline to the end of the script to make it easier to deal 
     
    190190                    // if B is a space we skip the rest of the switch block and go down to the 
    191191                    // string/regex check below, resetting $this->b with getReal 
    192                     if($this->b === ' ') 
     192                    if ($this->b === ' ') { 
    193193                        break; 
     194                    } 
    194195 
    195196                // otherwise we treat the newline like a space 
    196197 
    197198                case ' ': 
    198                     if(static::isAlphaNumeric($this->b)) 
     199                    if (static::isAlphaNumeric($this->b)) { 
    199200                        echo $this->a; 
     201                    } 
    200202 
    201203                    $this->saveString(); 
     
    205207                    switch ($this->b) { 
    206208                        case "\n": 
    207                             if (strpos('}])+-"\'', $this->a) !== false) { 
     209                            if (strpos('}])+-"\'`', $this->a) !== false) { 
    208210                                echo $this->a; 
    209211                                $this->saveString(); 
     
    218220 
    219221                        case ' ': 
    220                             if(!static::isAlphaNumeric($this->a)) 
     222                            if (!static::isAlphaNumeric($this->a)) { 
    221223                                break; 
     224                            } 
    222225 
    223226                        default: 
    224227                            // check for some regex that breaks stuff 
    225                             if ($this->a === '/' && ($this->b === '\'' || $this->b === '"')) { 
     228                            if ($this->a === '/' && ($this->b === '\'' || $this->b === '"' || $this->b === '`')) { 
    226229                                $this->saveRegex(); 
    227230                                continue; 
     
    237240            $this->b = $this->getReal(); 
    238241 
    239             if(($this->b == '/' && strpos('(,=:[!&|?', $this->a) !== false)) 
     242            if (($this->b == '/' && strpos('(,=:[!&|?', $this->a) !== false)) { 
    240243                $this->saveRegex(); 
     244            } 
     245 
    241246        } 
    242247    } 
     
    251256        unset($this->input); 
    252257        $this->index = 0; 
    253         $this->a = $this->b = ''; 
     258        $this->a     = $this->b    = ''; 
    254259        unset($this->c); 
    255260        unset($this->options); 
     
    268273            unset($this->c); 
    269274 
    270         // Otherwise we start pulling from the input. 
     275            // Otherwise we start pulling from the input. 
    271276        } else { 
    272277            $char = substr($this->input, $this->index, 1); 
     
    283288        // Normalize all whitespace except for the newline character into a 
    284289        // standard space. 
    285         if($char !== "\n" && ord($char) < 32) 
    286  
     290        if ($char !== "\n" && ord($char) < 32) { 
    287291            return ' '; 
     292        } 
    288293 
    289294        return $char; 
     
    303308    { 
    304309        $startIndex = $this->index; 
    305         $char = $this->getChar(); 
     310        $char       = $this->getChar(); 
    306311 
    307312        // Check to see if we're potentially in a comment 
     
    365370        if ($this->getNext('*/')) { 
    366371 
    367             $this->getChar(); // get * 
    368             $this->getChar(); // get / 
     372            $this->getChar();         // get * 
     373            $this->getChar();         // get / 
    369374            $char = $this->getChar(); // get next real character 
    370375 
    371376            // Now we reinsert conditional comments and YUI-style licensing comments 
    372377            if (($this->options['flaggedComments'] && $thirdCommentString === '!') 
    373                 || ($thirdCommentString === '@') ) { 
     378                || ($thirdCommentString === '@')) { 
    374379 
    375380                // If conditional comments or flagged comments are not the first thing in the script 
     
    395400        } 
    396401 
    397         if($char === false) 
     402        if ($char === false) { 
    398403            throw new \RuntimeException('Unclosed multiline comment at position: ' . ($this->index - 2)); 
     404        } 
    399405 
    400406        // if we're here c is part of the comment and therefore tossed 
    401         if(isset($this->c)) 
     407        if (isset($this->c)) { 
    402408            unset($this->c); 
     409        } 
    403410 
    404411        return $char; 
     
    419426 
    420427        // If it's not there return false. 
    421         if($pos === false) 
    422  
     428        if ($pos === false) { 
    423429            return false; 
     430        } 
    424431 
    425432        // Adjust position of index to jump ahead to the asked for string 
     
    445452 
    446453        // If this isn't a string we don't need to do anything. 
    447         if ($this->a !== "'" && $this->a !== '"') { 
     454        if ($this->a !== "'" && $this->a !== '"' && $this->a !== '`') { 
    448455            return; 
    449456        } 
    450457 
    451         // String type is the quote used, " or ' 
     458        // String type is the quote used, " or ' or ` 
    452459        $stringType = $this->a; 
    453460 
     
    474481                // block below. 
    475482                case "\n": 
    476                     throw new \RuntimeException('Unclosed string at position: ' . $startpos ); 
     483                    throw new \RuntimeException('Unclosed string at position: ' . $startpos); 
    477484                    break; 
    478485 
     
    494501                    break; 
    495502 
    496  
    497503                // Since we're not dealing with any special cases we simply 
    498504                // output the character and continue our loop. 
     
    514520 
    515521        while (($this->a = $this->getChar()) !== false) { 
    516             if($this->a === '/') 
     522            if ($this->a === '/') { 
    517523                break; 
     524            } 
    518525 
    519526            if ($this->a === '\\') { 
     
    522529            } 
    523530 
    524             if($this->a === "\n") 
     531            if ($this->a === "\n") { 
    525532                throw new \RuntimeException('Unclosed regex pattern at position: ' . $this->index); 
     533            } 
    526534 
    527535            echo $this->a; 
Note: See TracChangeset for help on using the changeset viewer.

Sites map