2013-06-23 47 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}」',並且不要忘記增加所有其他數字。 –