Skip to content
  1. Dec 08, 2017
    • Antonio Ospite's avatar
      Fix setting up the autoloader script at install time · 4ddbf946
      Antonio Ospite authored
      When 'use_autoloader' is set to true in an installation profile the
      autoloader script is not created automatically and this can result in an
      error when the module actually tries to load it.
      
      Fix this by setting up the autoloader script at install time.
      4ddbf946
  2. Nov 21, 2017
  3. Nov 17, 2017
  4. Nov 15, 2017
  5. Jun 26, 2017
  6. Jun 14, 2017
    • Antonio Ospite's avatar
      Issue #2881173: enable verifying requirements also at install time · c3f4be1f
      Antonio Ospite authored
      Note that the first check is performed by just using
      libraries_get_path() because during the install phase the library has
      not been registered yet as the module does that in the
      syntaxhighlighter_libraries_info() hook, and so libraries_detect() would
      not work.
      
      During the runtime phase it's OK to use libraries_detect() to retrieve
      the library version.
      8.x-1.0-alpha1
      c3f4be1f
  7. Jun 13, 2017
    • Antonio Ospite's avatar
      Fix creating the syntaxhighlighter.autoloader.js file · 8f8ef6f8
      Antonio Ospite authored
      The _syntaxhighlighter_setup_autoloader_script() function was called as
      a custom form submit handler, but these handlers are being called
      _before_ the submitForm() method.
      
      This was a problem because _syntaxhighlighter_setup_autoloader_script()
      relies on the module config, but the config was updated in submitForm(),
      only _after_ the execution.
      
      That resulted in _syntaxhighlighter_setup_autoloader_script() ignoring
      changes to the 'use_autoloader' setting, failing to create or remove the
      syntaxhighlighter.autoloader.js file when the setting value changed.
      
      So don't call _syntaxhighlighter_setup_autoloader_script() as a custom
      submit handler, call it in submitForm() after the config has been
      updated.
      8f8ef6f8
    • Antonio Ospite's avatar
      Issue #2881252: Make the libraries module a hard dependency · 0b5df625
      Antonio Ospite authored
      By making the libraries module a hard dependency the code can be
      simplified: _syntaxhighlighter_get_lib_location() and
      _syntaxhighlighter_scan_lib_location() can be removed as they were
      merely duplicating the libraries module functionality.
      
      Remove also the custom caching of the library path, the libraries module
      already caches this and some other info; if the library location changes
      the cache has to be flushed in some way (drush, drupal-console, etc.).
      0b5df625
    • Antonio Ospite's avatar
      Armonize naming conventions across the code · f616c6b0
      Antonio Ospite authored
      In the code these conventions are used:
      
        - SyntaxHighlighter with no space refers to the Javascript library.
        - Syntax Highlighter with a space refers to the Drupal module.
      f616c6b0
    • Antonio Ospite's avatar
  8. Jun 12, 2017
  9. May 23, 2017
    • Antonio Ospite's avatar
      Misc indentation fixes to harmonize the code style · 018175ab
      Antonio Ospite authored
      Continuation lines do not need to be indented so much, so indent the
      minimum necessary still following the coding standard, as done in other
      places in the code.
      
      This is just cosmetics, no functional changes made.
      018175ab
    • Antonio Ospite's avatar
      TODO: remove the entry about following the Drupal coding standard · ec932a2b
      Antonio Ospite authored
      The code now follows the Drupal coding standard.
      ec932a2b
    • Antonio Ospite's avatar
      Fix lines which exceed 80 characters · 67518835
      Antonio Ospite authored
      This fixes the last warnings from phpcs, the code is now following the
      Drupal coding standard.
      67518835
    • Antonio Ospite's avatar
      Make some code more explicit in FilterSyntaxHighlighter::prepare() · 9e53a5d3
      Antonio Ospite authored
      It's more semantically correct to have a proper boolean expression in if
      conditions instead of the implicit handling of an arithmetic expression.
      
      And it's more readable to have the increment in the for loop condition
      written explicitly when possible.
      9e53a5d3
    • Antonio Ospite's avatar
      Fix misc spaces issues · a63d0392
      Antonio Ospite authored
      Fix these phpcs errors:
      
        Expected one space after the comma, 0 found
        Space found before first semicolon of FOR loop
        Space found before second semicolon of FOR loop
        Space found before semicolon; expected "0;" but found "0 ;"
        Space found before semicolon; expected "$n;" but found "$n ;"
        There should be no white space before a closing ")"
        Use "elseif" in place of "else if"
      
      Fixed automatically with:
      
         $ phpcbf --sniffs=Drupal.WhiteSpace.Comma,Squiz.ControlStructures.ForLoopDeclaration,Squiz.WhiteSpace.SemicolonSpacing,Drupal.WhiteSpace.CloseBracketSpacing,Drupal.ControlStructures.ElseIf --standard=Drupal .
      a63d0392
    • Antonio Ospite's avatar
      Fix array formatting · 586caf94
      Antonio Ospite authored
      Fix these phpcs errors:
      
        A comma should follow the last multiline array item
        Array indentation error
        Closing parenthesis of array declaration must be on a new line
        The first index in a multi-value array must be on a new line
      
      Fixed automatically with:
      
        $ phpcbf --sniffs=Drupal.Array.Array,Squiz.Arrays.ArrayDeclaration --standard=Drupal .
      
      Plus some manual tweaks.
      586caf94
    • Antonio Ospite's avatar
      Fix documentation comments · 52234592
      Antonio Ospite authored
      Fix these phpcs errors:
      
        Data types in @param tags need to be fully namespaced
        Description for the @return value must be on the next line
        Doc comment is empty
        Doc comment long description must end with a full stop
        Doc comment short description must be on a single line, further text should be a separate paragraph
        Doc comment short description must end with a full stop
        Missing function doc comment
        Parameter comment must start with a capital letter
        There must be exactly one blank line before the tags in a doc comment
      
      Some are fixed automatically by running:
      
        $  phpcbf --sniffs=Drupal.Commenting.FunctionComment,Drupal.Commenting.DocComment,Drupal.Commenting.DataTypeNamespace --standard=Drupal .
      
      Some fixes required manual intervention.
      
      While at it also improve the grammar here and there.
      52234592
    • Antonio Ospite's avatar
      Fix inline comments · dcce1384
      Antonio Ospite authored
      Fix these phpcs errors:
      
        Inline comments must start with a capital letter
        Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
      
      Fixed automatically with:
      
        $ phpcbf --sniffs=Drupal.Commenting.InlineComment --standard=Drupal .
      dcce1384
    • Antonio Ospite's avatar
      Don't use parentheses for "require_once" · f2eb834f
      Antonio Ospite authored
      Fix phpcs error:
      
        "require_once" is a statement not a function; no parentheses are required
      
      Fixed automatically with:
      
        $ phpcbf --sniffs=PEAR.Files.IncludingFile --standard=Drupal .
      f2eb834f
    • Antonio Ospite's avatar
      Use only one blank line between functions · 5675ffba
      Antonio Ospite authored
      Fix these phpcs errors:
      
        Expected 1 blank line after function; 2 found
        Expected 1 newline at end of file; 2 found
      
      Fixed automatically by running:
      
        $ phpcbf --sniffs=Squiz.WhiteSpace.FunctionSpacing,Drupal.Files.EndFileNewline --standard=Drupal .
      5675ffba
    • Antonio Ospite's avatar
      Short array syntax must be used to define arrays · 53c2cdb0
      Antonio Ospite authored
      This fixes the very same errors reported by phpcs.
      
      Fixed automaticaly by running:
      
        $ phpcbf --sniffs=Drupal.Array.DisallowLongArraySyntax --standard=Drupal .
      
      Also remove the correspondent entry from the TODO file.
      53c2cdb0
    • Antonio Ospite's avatar
      Strip trailing spaces · 26591239
      Antonio Ospite authored
      This fixes the "Whitespace found at end of line" errors from phpcs.
      26591239
    • Antonio Ospite's avatar
      Make _syntaxhighlighter_validate_input() more accurate · d5ee9351
      Antonio Ospite authored
      In _syntaxhighlighter_validate_input() the checks and the corresponding
      error messages are not very accurate, a case like the following:
      
        <pre>
        </pre>
        <pre>
      
      will report both unbalanced and nested elements, even if there is no
      nesting.
      
      A case like this:
      
        <pre>
        </pre>
        </pre>
        <pre>
      
      will tell that there are nested elements, which is not technically
      correct either, the tags are not nested but unbalanced.
      
      So check for the order of elements only if the number of opening and
      closing tags is equal, and make the error message about nesting more
      generic to apply to the case when the opening and closing tags are in
      equal number but still unbalanced.
      
      While at it also set the error message right after the check, as the
      errors do not accumulate anymore.
      
      Remove the TODO entry about the issue.
      d5ee9351
    • Antonio Ospite's avatar
      Use 'const' instead of 'define()' to declare constants · 5a3b5213
      Antonio Ospite authored
      There is no need to use 'define()' because the constants are declared
      unconditionally and their names are literals.
      
      Remove the correspondent TODO entry.
      5a3b5213
    • Antonio Ospite's avatar
      Fix a typo in the name of the constant SYNTAXHIGHLGHTER_TAG_STRING · 97924e01
      Antonio Ospite authored
      The constant is supposed to use the module name as a prefix but the
      current prefix lacks an 'I', fix it.
      
      This also fixes an actual warning message from phpcs, although the fix
      proposed by phpcs is not correct:
      
        38 | WARNING | [ ] All constants defined by a module must be
           |         |     prefixed with the module's name, expected
           |         |     "SYNTAXHIGHLIGHTER_SYNTAXHIGHLGHTER_TAG_STRING"
           |         |     but found "SYNTAXHIGHLGHTER_TAG_STRING"
      97924e01
    • Antonio Ospite's avatar
      Open code _syntaxhighlighter_file_directory_path(), as it only has one user · 749115d4
      Antonio Ospite authored
      And remove the correspondent TODO entry.
      749115d4
  10. May 22, 2017
    • Antonio Ospite's avatar
      Verify the compatibility with the 'php' module · 6a919d23
      Antonio Ospite authored
      The module is still compatible with the 'PHP Filter' plugin.
      
      The latter is now a contrib module, installable with:
      
        composer require drupal/php
      
      So remove the corresponding entry in the TODO file and also mention that
      the PHP mechanism for matching pages could go away if the Javascript
      library is attached only when the input filter gets applied.
      6a919d23
    • Antonio Ospite's avatar
      Verify the compatibility with the 'libraries' module · d21dc7a5
      Antonio Ospite authored
      The module is still compatible with the development version of the
      libraries, but it may not be with a future stable release, add a note
      about that in the code.
      
      Also fix the 'download url' field in syntaxhighlighter_libraries_info()
      because the previous value is not valid anymore, and remove the
      'download' field which is not documented anywhere for
      hook_libraries_info().
      
      Now that the compatibility status has been verified, drop the TODO
      entries about it.
      d21dc7a5
  11. May 19, 2017
    • Antonio Ospite's avatar
    • Antonio Ospite's avatar
      Fix comment validation and add back node body validation · 6e370f2e
      Antonio Ospite authored
      List of changes:
        - add syntaxhighlighter_form_node_form_alter() to re-enable validation
          for nodes, since hook_node_validate() is not available anymore in
          Drupal 8;
        - update _syntaxhighlighter_comment_validate() and
          _syntaxhighlighter_node_validate() to use $form_state; the latter is
          now a callback local to the module, before it was a global hook;
        - update _syntaxhighlighter_format_has_syntaxhighlighter_filter() to
          use a Drupal 8 API, namely FilterFormat, because
          filter_list_format() is not available anymore;
        - pass the $form_state object to _syntaxhighlighter_validate_input()
          so it can use $form_state->setErrorByName() to set the error
          messages.
      6e370f2e
    • Antonio Ospite's avatar
      Remove the last string placeholders using exclamation marks · 7a693727
      Antonio Ospite authored
      Placeholders using exclamation marks do not exist anymore in Drupal 8,
      replace them and user Markup to show the HTML entities unescaped.
      7a693727
  12. May 18, 2017