Replace text content mode for dom_str_replace

Created on 14 March 2024, 10 months ago

Problem/Motivation

dom_str_replace already provides a way to replace over the element and its attributes.
It would be great to also be able to do that over the node text content.

Steps to reproduce

Proposed resolution

Let us add a new text mode for dom_str_replace plugin.

E.g. We could try to replace a link text content with the following approach in YAML.

-
  plugin: dom_str_replace
  mode: text
  xpath: '//a'
  search: 'Find more information here'
  replace: 'More information'

Remaining tasks

Add patch.
Review.

User interface changes

New text mode for dom_str_replace added.

API changes

N.A.

Data model changes

N.A.

Feature request
Status

Active

Version

6.0

Component

Plugins

Created by

🇵🇪Peru marvil07

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @marvil07
  • Issue was unassigned.
  • Status changed to Needs review 10 months ago
  • 🇵🇪Peru marvil07

    Opened related MR !90 about this new feature with 3427939-dom-str-replace-text-mode branch.

    - 3e417d1 Add text mode to dom_str_replace migrate process plugin

    Marking as NR.

  • Pipeline finished with Failed
    10 months ago
    Total: 224s
    #119392
  • Status changed to Needs work 2 months ago
  • heddn Nicaragua

    Needs a rebase

  • 🇵🇪Peru marvil07

    Merged mainline on the topic branch to solve the merge conflict:

    - fdb0368 Get changes from mainline to solve merge conflict

  • Pipeline finished with Failed
    2 months ago
    Total: 271s
    #345343
  • Pipeline finished with Success
    2 months ago
    Total: 259s
    #345351
  • Pipeline finished with Success
    2 months ago
    Total: 264s
    #345353
  • 🇵🇪Peru marvil07

    Related test needed a message adjustment.
    And given test was being changed, I added minimal test coverage for the new option.

    Tangentially, lint errors were reduced a bit for files related to the changes.

    New changes added to the 3427939-dom-str-replace-text-mode topic branch:

    - 7e422bd Update related error message on the test case
    - efa6cf1 Add minimal test coverage for text mode
    - f725ace Reduce lint errors for DomStrReplaceTest
    - a84e3e8 One less lint error on DomStrReplace

  • Pipeline finished with Success
    2 months ago
    Total: 260s
    #345357
Production build 0.71.5 2024