2013-06-23 29 views
0

所以我最近拿起崇高,这是我有过的最好的编辑,双手放下。也就是说,我正在尝试为HTML页面框架编写自定义代码片段,但似乎无法使其在Sublime中正确插入。它不会踢出任何错误,并且Sublime认识到它存在,但是当我尝试插入它时,它不会执行任何操作....我在代码段代码中丢失了什么吗?自定义代码片段不工作 - 崇高文本

我在写文档时使用了文档here

<snippet> 
<content><![CDATA[ 
<!DOCTYPE html> 
<html lang="en-us"> 
<head> 
<title>${1:WebsiteName}</title> 
<meta charset="utf-8" > 
<meta http-equiv="default-style" content="pref" > 
<!--disables caching of the site--> 
<meta http-equiv="pragma" content="no-cache" > 
<!--other sites cannot display this page in a frame--> 
<meta http-equiv="window-target" content="_top" > 
<!--must be completed for SEO--> 
<meta name="keywords" content="${3:keywords...}" > 
<!--must be completed for SEO--> 
<meta name="description" content="${4:description...}" > 
<meta name="author" content="${5:your_name}" > 
<!--allows bots to index website--> 
<meta name="robots" content="index, follow" > 
<meta name="copyright" content="${6:copyright}" > 
<!--sets the revisit frequency for search bots--> 
<meta name="revisit-after" content="14 days"> 
<!--prevents dup entries in open directory project DMOZ--> 
<meta name="googlebot" content="noodp"> 
<!--used for age appropriateness, values: {general} {mature} {restricted} {14 years} {safe for kids}--> 
<meta name="rating" content="general"> 
<meta name="reply-to" content="${7:[email protected]}"> 
<!--use the content of this to indicate the developer who created the page--> 
<meta name="web_author" content="${8:your_name}"> 
<!--controls caching permissions, values: {Public} {Private} {no-cache} {no-Store}--> 
<meta name="Cache-control" content="Public"> 
<!--cookie data should be dynamically handled by PHP if needed--> 
<!-- <meta name="Set-Cookie" content="" --> 
<meta name="host" content="Internet Connection Inc"> 
<meta name="host-admin" content="${9:webmaster_name}"> 
<meta name="contactName" content="${10:customer_name}"> 
<meta name="contactOrganization" content="${11:business_name}"> 
<meta name="contactStreetAddress1" content="${12:business_address}"> 
<meta name="contactZipcode" content="${13:business_zipcode}"> 
<meta name="contactCity" content="${14:business_city}"> 
<meta name="contactCountry" content="${15:business_country}"> 
<meta name="contactPhoneNumber" content="${16:business_phone}"> 
<meta name="contactFaxNumber" content="${17:business_fax}"> 
<meta name="contactNetworkAddress" content="${18:business_email}"> 
<meta name="linkage" content="${19:website_url_absolute}"> 
<link id="pref" rel="stylesheet" type="text/css" href="${20:CSS_Location}" > 
<!--[if lte IE 6]> 
    <link rel="stylesheet" href="${21:CSS_Location}"> 
<!--[endif]--> 
<!--[if lt IE 9]> 
    <script src="http://html5shiv.googlecode.com/svn/trunk/html15.js"></script> 
<!--[endif]--> 
</head> 
<body> 
<?php include("${22:Header_location"); ?> 
<!--main HTML content goes here--> 

<?php include("${23:Footer_location"); ?> 
</body> 
</html> 

]]></content> 
<tabTrigger>htf</tabTrigger> 
<scope>text.html</scope> 
<description></description> 
</snippet> 

回答

2

部分22和23不正确结束,2号失踪,7号是奇怪:

content="${7:[email protected]}" 

这应该是:

content="${7:webmasteremail}@yoursite.com" 

这应该为你工作(请注意,我更改了一些名称并将它们全部大写,但功能相同):

<snippet> 
<content><![CDATA[ 
<!DOCTYPE html> 
<html lang="en-us"> 
<head> 
<title>${1:WEBSITENAME}</title> 
<meta charset="utf-8" > 
<meta http-equiv="default-style" content="pref" > 
<!--disables caching of the site--> 
<meta http-equiv="pragma" content="no-cache" > 
<!--other sites cannot display this page in a frame--> 
<meta http-equiv="window-target" content="${2:WINDOW_NAME}" > 
<!--must be completed for SEO--> 
<meta name="keywords" content="${3:KEYWORDS}" > 
<!--must be completed for SEO--> 
<meta name="description" content="${4:DESCRIPTION}" > 
<meta name="author" content="${5:YOUR_NAME}" > 
<!--allows bots to index website--> 
<meta name="robots" content="index, follow" > 
<meta name="copyright" content="${6:COPYRIGHT}" > 
<!--sets the revisit frequency for search bots--> 
<meta name="revisit-after" content="14 days"> 
<!--prevents dup entries in open directory project DMOZ--> 
<meta name="googlebot" content="noodp"> 
<!--used for age appropriateness, values: {general} {mature} {restricted} {14 years} {safe for kids}--> 
<meta name="rating" content="general"> 
<meta name="reply-to" content="${7:WEBMASTEREMAIL}@yoursite.com"> 
<!--use the content of this to indicate the developer who created the page--> 
<meta name="web_author" content="${8:YOUR_NAME}"> 
<!--controls caching permissions, values: {Public} {Private} {no-cache} {no-Store}--> 
<meta name="Cache-control" content="Public"> 
<!--cookie data should be dynamically handled by PHP if needed--> 
<!-- <meta name="Set-Cookie" content="" --> 
<meta name="host" content="Internet Connection Inc"> 
<meta name="host-admin" content="${9:WEBMASTER_NAME}"> 
<meta name="contactName" content="${10:CUSTOMER_NAME}"> 
<meta name="contactOrganization" content="${11:BUSINESS_NAME}"> 
<meta name="contactStreetAddress1" content="${12:BUSINESS_ADDRESS}"> 
<meta name="contactZipcode" content="${13:BUSINESS_ZIPCODE}"> 
<meta name="contactCity" content="${14:BUSINESS_CITY}"> 
<meta name="contactCountry" content="${15:BUSINESS_COUNTRY}"> 
<meta name="contactPhoneNumber" content="${16:BUSINESS_PHONE}"> 
<meta name="contactFaxNumber" content="${17:BUSINESS_FAX}"> 
<meta name="contactNetworkAddress" content="${18:BUSINESS_EMAIL}"> 
<meta name="linkage" content="${19:WEBSITE_URL_ABSOLUTE}"> 
<link id="pref" rel="stylesheet" type="text/css" href="${20:CSS_LOCATION}" > 
<!--[if lte IE 6]> 
    <link rel="stylesheet" href="${21:CSS_LOCATION2}"> 
<!--[endif]--> 
<!--[if lt IE 9]> 
    <script src="http://html5shiv.googlecode.com/svn/trunk/html15.js"></script> 
<!--[endif]--> 
</head> 
<body> 
<?php include("${22:HEADER_LOCATION}"); ?> 
<!--main HTML content goes here--> 

<?php include("${23:FOOTER_LOCATION}"); ?> 
</body> 
</html> 

]]></content> 
<tabTrigger>htf</tabTrigger> 
<scope>text.html</scope> 
<description></description> 
</snippet> 
+0

我讨厌这种情况发生...... btw我在括号内保留了完整的邮件地址,因为它会被不同网站上的几个不同开发者使用,而且我们确实有客户偶尔处理他们自己的网站。 – mikedugan

+0

#22和#23修好了,谢谢一堆! – mikedugan

+0

在这种情况下,它应该是'content =“$ {7:webmasteremail} @ $ {8:yoursite}”',并且不要忘记增加所有其他数字。 –