WebRoot/blog/html2xhtml.js
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*==============================================================================
HTML2XHTML Converter 1.0
========================
Copyright (c) 2004 Vyacheslav Smolin
Author:
-------
Vyacheslav Smolin (http://www.richarea.com, http://html2xhtml.richarea.com,
re@richarea.com)
About the script:
-----------------
HTML2XHTML Converter (H2X) generates a well formed XHTML string from a HTML DOM
object.
Requirements:
-------------
H2X works in MS IE 5.0 for Windows or above, in Netscape 7.1, Mozilla 1.3 or
above. It should work in all Mozilla based browsers.
Usage:
------
Please see description of function get_xhtml below.
Demo:
-----
http://html2xhtml.richarea.com/, http://www.richarea.com/demo/
License:
--------
Free for non-commercial using. Please contact author for commercial licenses.
==============================================================================*/
//add \n before opening tag
var need_nl_before = '|div|p|table|tbody|tr|td|th|title|head|body|script|comment|li|meta|h1|h2|h3|h4|h5|h6|hr|ul|ol|option|';
//add \n after opening tag
var need_nl_after = '|html|head|body|p|th|style|';
var re_comment = new RegExp();
re_comment.compile("^<!--(.*)-->$");
var re_hyphen = new RegExp();
re_hyphen.compile("-$");
// Convert inner text of node to xhtml
// Call: get_xhtml(node);
// get_xhtml(node, lang, encoding) -- to convert whole page
// other parameters are for inner usage and should be omitted
// Parameters:
// node - dom node to convert
// lang - document lang (need it if whole page converted)
// encoding - document charset (need it if whole page converted)
// need_nl - if true, add \n before a tag if it is in list need_nl_before
// inside_pre - if true, do not change content, as it is inside a <pre>
后面还有 214 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
