R
R
romanovskiyV2021-03-18 12:26:03
css
romanovskiyV, 2021-03-18 12:26:03

How to set attributes in notepad++ automatically?

There is an example in the photo of how the attributes should be affixed.
60531c7d665aa149623137.jpeg
There are many employee cards of the same type that need to be put down attributes where there are none
The question is how to do it quickly
60531c9cd620d263967007.jpeg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
WbICHA, 2021-03-18
@romanovskiyV

Type in the console in the browser or through the node:

const props = ['prop1', 'prop2', ... , 'prop5'];
let i = 0;
const n = props.length;
console.log(
  `твой хтмл в виде текста`.replace(/td itemprop=""/g, () => {
    const newProp = `td itemprop="${props[i]}"`;
    i = (i + 1) % n;
    return newProp;
  })
);

A
acwartz, 2021-03-18
@acwartz

In the settings, turn on multi-editing, hold down Ctrl and poke the cursors where necessary, then type in the values.
From more complicated:
In the case of XML, there is an XMLTools plugin, which can be used to execute expressions using XPath, thus modifying the document where necessary, again, you need to know XPAth / XSLT queries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question