cgrand/enlive

Removing element cleanly

Closed this issue · 2 comments

Removing an element is simple enough with enlive, just pass a nil (function/value).

One source of frustration however, is that it always leaves the previous element space empty. I recon this has to do with the element structure being along the lines of newline - element - newline leaving newline - newline.

I am looking for the idiomatic way of removing both the element including the next (or previous) newline. I am not sure however, if I can target the newline as well and e.g. select a fragment of element - newline instead to substitute?

Currently, I simply do a string/replace on the final output but that just doesn't feel right. Strangely enough, I have found 0 references to this problem, which makes me think there is a solution I have been overlooking. Or it is just that I make a problem out of something no one else bothers to.

Does newline - newline cause a layout issue or is it just a problem of the HTML source not looking good?

Yeah - point taken. It is pure aesthetic and not at all functional. I guess that answers my question too, thanks!