I have a Rails Model with field “description” and other Model Person with field “title”.
I want to add ability to replace all Person titles into description field to correct links
John Smith to
<a href='/person/1'>John Smith</a>
Also I want to avoid tag dupliation inside itself.
Of course person name could be an anchor of tag in phrase, for example
<a href='any link'>Meet John Smith</a> – that case of course should stay same.
And I want to make that action as button, which could be pressed any times with correct same result – when all single non A-anchor texts will be replaced with links.
How could I reach it? With xpath or regexp maybe?