mirror of
https://git.burble.com/burble.dn42/dn42regsrv.git
synced 2024-02-26 20:28:04 +01:00
Fix rendering of attributes that have trailing newlines
This commit is contained in:
parent
12ea3c1d4b
commit
967bea2aa7
@ -57,11 +57,29 @@ Vue.component('reg-attribute', {
|
||||
return reg[2]
|
||||
},
|
||||
decorated: function() {
|
||||
return anchorme(this.content.replace(/\n/g, "<br/>"), {
|
||||
var c = this.content
|
||||
|
||||
// an attribute terminated with \n indicates a blank
|
||||
// trailing line, however a single trailing <br/> will
|
||||
// not be rendered in HTML, this hack doubles up the
|
||||
// trailing newline so it creates a <br/> pair
|
||||
// which renders as the blank line
|
||||
if (c.substr(c.length-1) == "\n") {
|
||||
c = c + "\n"
|
||||
}
|
||||
|
||||
// replace newlines with line breaks
|
||||
c = c.replace(/\n/g, "<br/>")
|
||||
|
||||
// decorate
|
||||
c = anchorme(c, {
|
||||
truncate: 40,
|
||||
ips: false,
|
||||
attributes: [ { name: "target", value: "_blank" } ]
|
||||
})
|
||||
|
||||
// and return the final decorated content
|
||||
return c
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user