怎样防止html代码格式化?

By root at 2018-03-26 18:32 • 286次点击
root

@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变量的值呢?


html, 代码


登录 后发表评论