怎样防止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
- 这个怎么做伪静态?在链接后面加个.htm或者.html
- 代码不行 希望能增加
- 百度统计代码里有弹疮、暗疮?
- 减少使用 JavaScript 的 HTML 和 CSS 技术
- 前端小姐姐只用 HTML+CSS 作油画
Nearby
- 上一篇 › 优化struct 结构,减少内存分配
- 下一篇 › golang 八行代码实现的一致性哈希
写成单行,
示例 https://github.com/ego008/goyoubbs/blob/master/util/contentfmt.go#L74