Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46256

count_words returns too few words when dealing with html tags

    XMLWordPrintable

    Details

      Description

      The problem is strip_tags will join words together:

      <p>Some text</p>
      <p><br/><p>
      <p>Some more text</p>

      How many words ? Moodle thinks it's 4.

      Also count_letters includes the letters in HTML entities - eg &nbsp; is 6 letters.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              damyon Damyon Wiese
              Peer reviewer:
              Jason Platts Jason Platts
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              CiBoT CiBoT
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Mar/21

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 45 minutes
                  45m