0

所以我最近拿起了 Sublime,它是我用过的最好的编辑器,毫无疑问。也就是说,我正在尝试为 HTML 页面框架编写一个自定义片段,但似乎无法让它在 Sublime 中正确插入。它没有回退任何错误,Sublime 承认它存在,但是当我尝试插入它时,它什么也没做......我在这里的代码片段中遗漏了什么吗?

我在编写文档时使用了此处的文档。

<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: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_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>
4

1 回答 1

2

第 22 和 23 部分没有正确结束,第 2 部分丢失,第 7 部分很奇怪:

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

应该是:

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>
于 2013-06-23T22:50:19.840 回答