Skip to content

Commit

Permalink
Update keywords for the brush (#2)
Browse files Browse the repository at this point in the history
* Update keywords for the brush
* Add PCP GitHub Action
* Update "Tested up to" to 6.7
* Add missing license values to plugin header comments
* Update ignored files list
* Add PHPCS test script
  • Loading branch information
2ndkauboy authored Nov 1, 2024
1 parent 2870b97 commit 64377c8
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 35 deletions.
6 changes: 6 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.distignore
.git
.gitattributes
.github
.gitignore
.wordpress-org
36 changes: 36 additions & 0 deletions .github/workflows/wordpress-plugin-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Plugin Check
on:
pull_request:
push:
branches:
- main
release:
types: [ published ]

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Composer install
uses: shivammathur/setup-php@v2
with:
php-version: latest
coverage: none
tools: wp-cli

- name: Install latest version of dist-archive-command
run: wp package install wp-cli/dist-archive-command:@stable

- name: Build plugin
run: |
wp dist-archive . ./${{ github.event.repository.name }}.zip
mkdir tmp-build
unzip ${{ github.event.repository.name }}.zip -d tmp-build
- name: Run plugin check
uses: wordpress/plugin-check-action@v1
with:
build-dir: ./tmp-build/${{ github.event.repository.name }}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
Contributors: Kau-Boy
Donate link: https://github.com/sponsors/2ndkauboy
Tags: code, sass, scss, highlight, syntax
Tested up to: 6.3
Tested up to: 6.7
Stable tag: 1.2.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.txt

Adds support for the SASS language to the SyntaxHighlighter Evolved plugin.

Expand All @@ -27,4 +29,4 @@ Load the script in the footer of the page
Adding names for the Gutenberg block

### 1.0 ###
First stable version
First stable version
87 changes: 87 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards based custom ruleset for your plugin">
<description>Generally-applicable sniffs for WordPress plugins.</description>
<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
#############################################################################
-->

<!-- Pass some flags to PHPCS:
p flag: Show progress of the run.
s flag: Show sniff codes in all reports.
-->
<arg value="ps"/>

<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>

<!-- Check up to 8 files simultanously. -->
<arg name="parallel" value="8"/>

<!-- Only check the PHP. CSS/SCSS/JS files are checked separately with linters. -->
<arg name="extensions" value="php"/>

<!-- Enable colors in the output -->
<arg name="colors"/>

<!-- Check all files in this directory and the directories below it. -->
<file>.</file>

<!--
#############################################################################
EXCLUDE SOME FILES AND FOLDERS
#############################################################################
-->

<!--<exclude-pattern>/build/</exclude-pattern>-->
<!--<exclude-pattern>/vendor/</exclude-pattern>-->
<!--<exclude-pattern>/node_modules/</exclude-pattern>-->

<!--
#############################################################################
USE THE WordPress RULESET
#############################################################################
-->

<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="5.7"/>

<rule ref="WordPress">
<!-- As we use PHP 5.4+ now, we can use the short array syntax -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
<!-- Uncomment if you develop a theme with templates for CPTs having a prefix -->
<exclude name="WordPress.Files.FileName" />
<!-- Uncomment for projects using the metabox toolbox -->
<!--<exclude name="WordPress.CSRF.NonceVerification.NoNonceVerification" />-->
<!-- Uncomment if you want to use some functions that should be replaced with the VIP cached alternatives -->
<!--<exclude name="WordPress.VIP.RestrictedFunctions" />-->
<!--<exclude name="WordPress.VIP.PostsPerPage" />-->
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<!-- Value: replace the function, class, and variable prefixes used. Separate multiple prefixes with a comma. -->
<property name="prefixes" type="array" value="syntaxhighlighter_sass_"/>
</properties>
</rule>
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
<properties>
<property name="blank_line_check" value="true"/>
</properties>
</rule>


<!--
#############################################################################
USE THE PHPCompatibility RULESET
#############################################################################
-->

<!-- https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="5.6-"/>
<!-- https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>

</ruleset>
90 changes: 57 additions & 33 deletions shBrushSass.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,54 +9,78 @@
{
return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
};

function getValuesCSS(str)
{
return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
};

function getKeywordsPrependedBy(keywords, by)
{
return '(?:' + keywords.replace(/^\s+|\s+$/g, '').replace(/\s+/g, '|' + by + '\\b').replace(/^/, by + '\\b') + ')\\b';
}

var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index zoom';

var keywords = 'align-content align-items align-self alignement-adjust all anchor-point animation animation-delay animation-direction ' +
'animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function ' +
'appearance azimuth backface-visibility background background-attachment background-clip background-color background-image ' +
'background-origin background-position background-repeat background-size baseline-shift binding bleed bookmark-label bookmark-level ' +
'bookmark-state bookmark-target border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius ' +
'border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat ' +
'border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width ' +
'border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top ' +
'border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom ' +
'box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side chains clear clip clip-path ' +
'clip-rule color color-interpolation-filters color-profile column-count column-fill column-gap column-rule column-rule-color ' +
'column-rule-style column-rule-width column-span column-width columns contain content counter-increment counter-reset crop ' +
'cue cue-after cue-before cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align ' +
'drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells filter flex ' +
'flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float float-offset flood-color flood-opacity font ' +
'font-family font-feature-settings font-kerning font-language-override font-size font-size-adjust font-stretch font-style ' +
'font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures ' +
'font-variant-numeric font-variant-position font-weight grid grid-area grid-auto-columns grid-auto-flow grid-auto-position ' +
'grid-auto-rows grid-column grid-column-end grid-column-start grid-row grid-row-end grid-row-start grid-template grid-template-areas ' +
'grid-template-columns grid-template-rows hanging-punctuation height hyphens icon image-orientation image-resolution ' +
'ime-mode inline-box-align justify-content left letter-spacing lighting-color line-break line-height line-stacking line-stacking-ruby ' +
'line-stacking-shift line-stacking-strategy list-style list-style-image list-style-position list-style-type margin margin-bottom ' +
'margin-left margin-right margin-top marker-offset marks mask mask-box-image mask-box-image-outset mask-box-image-repeat ' +
'mask-box-image-slice mask-box-image-source mask-box-image-width mask-clip mask-image mask-origin mask-position mask-repeat ' +
'mask-size mask-source-type mask-type max-height max-lines max-width min-height min-width move-to nav-down nav-index nav-left ' +
'nav-right nav-up object-fit object-position opacity order orphans outline outline-color outline-offset outline-style outline-width ' +
'overflow overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page page-break-after ' +
'page-break-before page-break-inside page-policy pause pause-after pause-before perspective perspective-origin pitch pitch-range ' +
'play-during position presentation-level punctuation-trim quotes rendering-intent resize rest rest-after rest-before richness ' +
'right rotation rotation-point ruby-align ruby-overhang ruby-position ruby-span size speak speak-as speak-header speak-numeral ' +
'speak-punctuation speech-rate stress string-set tab-size table-layout target target-name target-new target-position text-align ' +
'text-align-last text-combine-horizontal text-decoration text-decoration-color text-decoration-line text-decoration-skip ' +
'text-decoration-style text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-height text-indent ' +
'text-justify text-orientation text-outline text-overflow text-shadow text-space-collapse text-transform text-underline-position ' +
'text-wrap top transform transform-origin transform-style transition transition-delay transition-durations transition-property ' +
'transition-timing-function unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch ' +
'voice-range voice-rate voice-stress voice-volume volume white-space widows width word-break word-spacing word-wrap ' +
'writing-mode z-index';

var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero digits disc dotted double '+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
'border-box both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
'continuous content-box counter counters cover crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed flex format fuchsia '+
'gray green grid groove handheld hebrew help hidden hide high higher icon infinite inherit inline-block inline-table inline inset inside invert italic '+
'justify landscape large larger left-side left leftwards level lighter lime linear linear-gradient line-through list-item local loud lower-alpha '+
'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb rgba ridge right right-side '+
'rightwards rotate row rtl run-in scale screen scroll semi-condensed semi-expanded separate se-resize show silent silver skewX skewY slower slow '+
'small small-caps small-caption smaller space-around soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
'table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
'text-bottom text-top thick thin top translate translateX translateY transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
'upper-roman url visible wait webkit-box white wider wrap w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';

var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';

var statements = 'important default';
var preprocessor = 'import extend debug warn if else for while mixin function include content media';
var preprocessor = 'import extend debug warn if else for while mixin function include content media use';

var r = SyntaxHighlighter.regexLib;

this.regexList = [
{ regex: r.multiLineCComments, css: 'comments' }, // multiline comments
{ regex: r.singleLineCComments, css: 'comments' }, // singleline comments
Expand Down

0 comments on commit 64377c8

Please sign in to comment.