root
root
2804 1 0

怎样防止html代码格式化?

@ego008 我在contentfmt.go添加蓝下面的代码

input = videoRegexp.ReplaceAllString(input, `
		<div id="video" style="width:600px;height:400px;"></div>
	< script type = "text/javascript" >
var videoObject = {
	container: '#video',
	variable: 'player',
	flashplayer: false,
	video: '$1'
};
var player = new ckplayer(videoObject); < /script>
`)

但是在网页里却变成里下面的代码

<p><div id="video" style="width:600px;height:400px;"></div></p><p>< script type = "text/javascript" ><br>var videoObject = {</p><p>container: '#video',</p><p>variable: 'player',</p><p>flashplayer: false,</p><p>video: 'http://h.ddd.xxx/20171105/WLHDN3G1/index.mp4'<br>};<br>var player = new ckplayer(videoObject); < /script>/<br></p>
        <div id="video" style="width:600px;height:400px;"></div>

想问以下怎样才能实现

input = videoRegexp.ReplaceAllString(input, `
		<div id="video" style="width:600px;height:400px;"></div>
	< script type = "text/javascript" >
var videoObject = {
	container: '#video',
	variable: 'player',
	flashplayer: false,
	video: '$1'
};
var player = new ckplayer(videoObject); < /script>
`)

不被格式化,又能正确获取s1变量的值呢?

0

See Also

Nearby


Discussion (1)

Login Topics