Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 For example 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?

question from:https://stackoverflow.com/questions/65879938/ruby-replace-html-fragments-with-specified-links

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
620 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...