charlock_holmes 0.6.9.4 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +2 -2
- data/MIT-LICENSE +1 -1
- data/charlock_holmes.gemspec +3 -1
- data/ext/charlock_holmes/encoding_detector.c +66 -20
- data/ext/charlock_holmes/extconf.rb +6 -33
- data/lib/charlock_holmes/encoding_detector.rb +13 -1
- data/lib/charlock_holmes/string.rb +1 -1
- data/lib/charlock_holmes/version.rb +1 -1
- data/test/converter_test.rb +1 -1
- data/test/encoding_detector_test.rb +15 -5
- data/test/fixtures/foo.pdf +0 -0
- data/test/fixtures/octocat.ai +4432 -17
- data/test/fixtures/octocat.gif +0 -0
- data/test/fixtures/octocat.jpg +0 -0
- data/test/fixtures/octocat.png +0 -0
- data/test/fixtures/octocat.psd +0 -0
- data/test/fixtures/utf16be.html +0 -0
- data/test/fixtures/utf32be.html +0 -0
- data/test/fixtures/utf32le.html +0 -0
- data/test/fixtures/utf8.html +240 -0
- data/test/fixtures/vimrc +596 -0
- data/test/helper.rb +7 -0
- data/test/string_methods_test.rb +1 -1
- data/test/transliterator_test.rb +1 -1
- metadata +29 -27
- data/Gemfile.lock +0 -22
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,240 @@
|
|
1
|
+
|
2
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh" dir="ltr">
|
4
|
+
<head>
|
5
|
+
<title>XML - 维基百科,自由的百科全书</title>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<meta http-equiv="Content-Style-Type" content="text/css" />
|
8
|
+
<meta name="generator" content="MediaWiki 1.16wmf4" />
|
9
|
+
<link rel="alternate" type="application/x-wiki" title="编辑本页" href="/w/index.php?title=XML&action=edit" />
|
10
|
+
<link rel="edit" title="编辑本页" href="/w/index.php?title=XML&action=edit" />
|
11
|
+
<link rel="apple-touch-icon" href="http://zh.wikipedia.org/apple-touch-icon.png" />
|
12
|
+
<link rel="shortcut icon" href="/favicon.ico" />
|
13
|
+
<link rel="search" type="application/opensearchdescription+xml" href="/w/opensearch_desc.php" title="Wikipedia (zh)" />
|
14
|
+
<link rel="copyright" href="http://creativecommons.org/licenses/by-sa/3.0/" />
|
15
|
+
<link rel="alternate" type="application/atom+xml" title="Wikipedia的Atom订阅" href="/w/index.php?title=Special:%E6%9C%80%E8%BF%91%E6%9B%B4%E6%94%B9&feed=atom" />
|
16
|
+
<link rel="stylesheet" href="http://bits.wikimedia.org/skins-1.5/vector/main-ltr.css?283-19" type="text/css" media="screen" />
|
17
|
+
<link rel="stylesheet" href="http://bits.wikimedia.org/skins-1.5/common/shared.css?283-19" type="text/css" media="screen" />
|
18
|
+
<link rel="stylesheet" href="http://bits.wikimedia.org/skins-1.5/common/commonPrint.css?283-19" type="text/css" media="print" />
|
19
|
+
<link rel="stylesheet" href="http://bits.wikimedia.org/w/extensions/UsabilityInitiative/css/combined.min.css?117" type="text/css" media="all" />
|
20
|
+
<link rel="stylesheet" href="http://bits.wikimedia.org/w/extensions/UsabilityInitiative/css/vector/jquery-ui-1.7.2.css?1.7.2y" type="text/css" media="all" />
|
21
|
+
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Common.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="all" />
|
22
|
+
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Print.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="print" />
|
23
|
+
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Handheld.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="handheld" />
|
24
|
+
<link rel="stylesheet" href="/w/index.php?title=MediaWiki:Vector.css&usemsgcache=yes&ctype=text%2Fcss&smaxage=2678400&action=raw&maxage=2678400" type="text/css" media="all" />
|
25
|
+
<link rel="stylesheet" href="/w/index.php?title=-&action=raw&maxage=2678400&gen=css" type="text/css" media="all" />
|
26
|
+
<script type="text/javascript">
|
27
|
+
var skin="vector",
|
28
|
+
stylepath="http://bits.wikimedia.org/skins-1.5",
|
29
|
+
wgUrlProtocols="http\\:\\/\\/|https\\:\\/\\/|ftp\\:\\/\\/|irc\\:\\/\\/|gopher\\:\\/\\/|telnet\\:\\/\\/|nntp\\:\\/\\/|worldwind\\:\\/\\/|mailto\\:|news\\:|svn\\:\\/\\/",
|
30
|
+
wgArticlePath="/wiki/$1",
|
31
|
+
wgScriptPath="/w",
|
32
|
+
wgScriptExtension=".php",
|
33
|
+
wgScript="/w/index.php",
|
34
|
+
wgVariantArticlePath="/$2/$1",
|
35
|
+
wgActionPaths={},
|
36
|
+
wgServer="http://zh.wikipedia.org",
|
37
|
+
wgCanonicalNamespace="",
|
38
|
+
wgCanonicalSpecialPageName=false,
|
39
|
+
wgNamespaceNumber=0,
|
40
|
+
wgPageName="XML",
|
41
|
+
wgTitle="XML",
|
42
|
+
wgAction="view",
|
43
|
+
wgArticleId=3632,
|
44
|
+
wgIsArticle=true,
|
45
|
+
wgUserName=null,
|
46
|
+
wgUserGroups=null,
|
47
|
+
wgUserLanguage="zh",
|
48
|
+
wgContentLanguage="zh",
|
49
|
+
wgBreakFrames=false,
|
50
|
+
wgCurRevisionId=15329713,
|
51
|
+
wgVersion="1.16wmf4",
|
52
|
+
wgEnableAPI=true,
|
53
|
+
wgEnableWriteAPI=true,
|
54
|
+
wgSeparatorTransformTable=["", ""],
|
55
|
+
wgDigitTransformTable=["", ""],
|
56
|
+
wgMainPageTitle="Wikipedia:首页",
|
57
|
+
wgFormattedNamespaces={"-2": "Media", "-1": "Special", "0": "", "1": "Talk", "2": "User", "3": "User talk", "4": "Wikipedia", "5": "Wikipedia talk", "6": "File", "7": "File talk", "8": "MediaWiki", "9": "MediaWiki talk", "10": "Template", "11": "Template talk", "12": "Help", "13": "Help talk", "14": "Category", "15": "Category talk", "100": "Portal", "101": "Portal talk"},
|
58
|
+
wgNamespaceIds={"media": -2, "special": -1, "": 0, "talk": 1, "user": 2, "user_talk": 3, "wikipedia": 4, "wikipedia_talk": 5, "file": 6, "file_talk": 7, "mediawiki": 8, "mediawiki_talk": 9, "template": 10, "template_talk": 11, "help": 12, "help_talk": 13, "category": 14, "category_talk": 15, "portal": 100, "portal_talk": 101, "媒体": -2, "媒體": -2, "特殊": -1, "对话": 1, "對話": 1, "讨论": 1, "討論": 1, "用户": 2, "用戶": 2, "用户对话": 3, "用戶對話": 3, "用户讨论": 3, "用戶討論": 3, "图像": 6, "圖像": 6, "档案": 6, "檔案": 6, "文件": 6, "图像对话": 7, "圖像對話": 7, "图像讨论": 7, "圖像討論": 7, "档案对话": 7, "檔案對話": 7, "档案讨论": 7, "檔案討論": 7, "文件对话": 7, "文件對話": 7, "文件讨论": 7, "文件討論": 7, "模板": 10, "样板": 10, "樣板": 10, "模板对话": 11, "模板對話": 11, "模板讨论": 11, "模板討論": 11, "样板对话": 11, "樣板對話": 11, "样板讨论": 11, "樣板討論": 11, "帮助": 12, "幫助": 12, "帮助对话": 13, "幫助對話": 13, "帮助讨论": 13, "幫助討論": 13, "分类": 14, "分類": 14, "分类对话": 15, "分類對話": 15, "分类讨论": 15, "分類討論": 15, "维基百科": 4, "維基百科": 4, "wp": 4, "维基百科讨论": 5, "维基百科对话": 5, "維基百科討論": 5, "維基百科對話": 5, "t": 10, "wt": 5, "cat": 14, "h": 12, "p": 100, "image": 6, "image_talk": 7},
|
59
|
+
wgSiteName="Wikipedia",
|
60
|
+
wgCategories=["含有英語的條目", "網頁技術", "W3C标准", "文件格式", "置标语言", "XML", "数据序列化格式"],
|
61
|
+
wgDBname="zhwiki",
|
62
|
+
wgUserVariant="zh",
|
63
|
+
wgMWSuggestTemplate="http://zh.wikipedia.org/w/api.php?action=opensearch\x26search={searchTerms}\x26namespace={namespaces}\x26suggest",
|
64
|
+
wgSearchNamespaces=[0],
|
65
|
+
wgMWSuggestMessages=["有建议", "无建议"],
|
66
|
+
wgRestrictionEdit=[],
|
67
|
+
wgRestrictionMove=[],
|
68
|
+
wgCollapsibleNavBucketTest=false,
|
69
|
+
wgCollapsibleNavForceNewVersion=false,
|
70
|
+
wgVectorPreferences={"collapsiblenav": {"enable": 1}, "editwarning": {"enable": 1}, "simplesearch": {"enable": 1, "disablesuggest": 0}},
|
71
|
+
wgVectorEnabledModules={"collapsiblenav": true, "collapsibletabs": true, "editwarning": true, "expandablesearch": false, "footercleanup": false, "simplesearch": true},
|
72
|
+
Geo={"city": "", "country": ""},
|
73
|
+
wgNoticeProject="wikipedia";
|
74
|
+
</script><script src="http://bits.wikimedia.org/skins-1.5/common/wikibits.js?283-19" type="text/javascript"></script>
|
75
|
+
<script type="text/javascript" src="http://bits.wikimedia.org/skins-1.5/common/jquery.min.js?283-19"></script>
|
76
|
+
<script src="http://bits.wikimedia.org/skins-1.5/common/ajax.js?283-19" type="text/javascript"></script>
|
77
|
+
<script src="http://bits.wikimedia.org/skins-1.5/common/mwsuggest.js?283-19" type="text/javascript"></script>
|
78
|
+
<script src="http://bits.wikimedia.org/w/extensions/UsabilityInitiative/js/plugins.combined.min.js?283-19" type="text/javascript"></script>
|
79
|
+
<script src="http://bits.wikimedia.org/w/extensions/UsabilityInitiative/Vector/Vector.combined.min.js?283-19" type="text/javascript"></script>
|
80
|
+
<script type="text/javascript">mw.usability.addMessages({'vector-collapsiblenav-more':'更多语言','vector-editwarning-warning':'离开这个页面可能会令您失去之前的所有更改。\n若您已经登入,您可在您参数设置的“编辑”节中关闭此警告。','vector-simplesearch-search':'搜索','vector-simplesearch-containing':'含有...'});</script>
|
81
|
+
<script src="/w/index.php?title=Special:BannerController&cache=/cn.js&283-19" type="text/javascript"></script>
|
82
|
+
<!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/skins-1.5/vector/csshover.htc")}</style><![endif]-->
|
83
|
+
<script src="/w/index.php?title=-&action=raw&gen=js&useskin=vector&283-19" type="text/javascript"></script>
|
84
|
+
|
85
|
+
<style type="text/css">/*<![CDATA[*/
|
86
|
+
.source-xml {line-height: normal;}
|
87
|
+
.source-xml li, .source-xml pre {
|
88
|
+
line-height: normal; border: 0px none white;
|
89
|
+
}
|
90
|
+
/**
|
91
|
+
* GeSHi Dynamically Generated Stylesheet
|
92
|
+
* --------------------------------------
|
93
|
+
* Dynamically generated stylesheet for xml
|
94
|
+
* CSS class: source-xml, CSS id:
|
95
|
+
* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
|
96
|
+
* (http://qbnz.com/highlighter/ and http://geshi.org/)
|
97
|
+
* --------------------------------------
|
98
|
+
*/
|
99
|
+
.xml.source-xml .de1, .xml.source-xml .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
|
100
|
+
.xml.source-xml {font-family:monospace;}
|
101
|
+
.xml.source-xml .imp {font-weight: bold; color: red;}
|
102
|
+
.xml.source-xml li, .xml.source-xml .li1 {font-weight: normal; vertical-align:top;}
|
103
|
+
.xml.source-xml .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
|
104
|
+
.xml.source-xml .li2 {font-weight: bold; vertical-align:top;}
|
105
|
+
.xml.source-xml .es0 {color: #000099; font-weight: bold;}
|
106
|
+
.xml.source-xml .br0 {color: #66cc66;}
|
107
|
+
.xml.source-xml .sy0 {color: #66cc66;}
|
108
|
+
.xml.source-xml .st0 {color: #ff0000;}
|
109
|
+
.xml.source-xml .nu0 {color: #cc66cc;}
|
110
|
+
.xml.source-xml .sc-1 {color: #808080; font-style: italic;}
|
111
|
+
.xml.source-xml .sc0 {color: #00bbdd;}
|
112
|
+
.xml.source-xml .sc1 {color: #ddbb00;}
|
113
|
+
.xml.source-xml .sc2 {color: #339933;}
|
114
|
+
.xml.source-xml .sc3 {color: #009900;}
|
115
|
+
.xml.source-xml .re0 {color: #000066;}
|
116
|
+
.xml.source-xml .re1 {color: #000000; font-weight: bold;}
|
117
|
+
.xml.source-xml .re2 {color: #000000; font-weight: bold;}
|
118
|
+
.xml.source-xml .ln-xtra, .xml.source-xml li.ln-xtra, .xml.source-xml div.ln-xtra {background-color: #ffc;}
|
119
|
+
.xml.source-xml span.xtra { display:block; }
|
120
|
+
|
121
|
+
/*]]>*/
|
122
|
+
</style>
|
123
|
+
<style type="text/css">/*<![CDATA[*/
|
124
|
+
@import "/w/index.php?title=MediaWiki:Geshi.css&usemsgcache=yes&action=raw&ctype=text/css&smaxage=2678400";
|
125
|
+
/*]]>*/
|
126
|
+
</style></head>
|
127
|
+
<body class="mediawiki ltr ns-0 ns-subject page-XML skin-vector">
|
128
|
+
<div id="mw-page-base" class="noprint"></div>
|
129
|
+
<div id="mw-head-base" class="noprint"></div>
|
130
|
+
<!-- content -->
|
131
|
+
<div id="content">
|
132
|
+
<a id="top"></a>
|
133
|
+
<div id="mw-js-message" style="display:none;"></div>
|
134
|
+
<!-- sitenotice -->
|
135
|
+
<div id="siteNotice"><!-- centralNotice loads here --><script type="text/javascript" language="JavaScript">
|
136
|
+
/* <![CDATA[ */
|
137
|
+
document.writeln("\x3cdiv id=\"localNotice\"\x3e\x3c/div\x3e");
|
138
|
+
/* ]]> */
|
139
|
+
</script></div>
|
140
|
+
<!-- /sitenotice -->
|
141
|
+
<!-- firstHeading -->
|
142
|
+
<h1 id="firstHeading" class="firstHeading">XML</h1>
|
143
|
+
<!-- /firstHeading -->
|
144
|
+
<!-- bodyContent -->
|
145
|
+
<div id="bodyContent">
|
146
|
+
<!-- tagline -->
|
147
|
+
<div id="siteSub">维基百科,自由的百科全书</div>
|
148
|
+
<!-- /tagline -->
|
149
|
+
<!-- subtitle -->
|
150
|
+
<div id="contentSub"></div>
|
151
|
+
<!-- /subtitle -->
|
152
|
+
<!-- jumpto -->
|
153
|
+
<div id="jump-to-nav">
|
154
|
+
跳转到: <a href="#mw-head">导航</a>,
|
155
|
+
<a href="#p-search">搜索</a>
|
156
|
+
</div>
|
157
|
+
<!-- /jumpto -->
|
158
|
+
<!-- bodytext -->
|
159
|
+
<p><span style="display: none;"><a href="#_skip_noteTA">跳过字词转换说明</a></span></p>
|
160
|
+
<div class="NavFrame collapsed noprint nohandheld metadata" style="z-index: 1; margin: 0 0.5em 0.5em auto; top: -1.2em; position: relative; background-color: transparent; border: none;">
|
161
|
+
<div class="uncollapse toggleHotspot" style="position: absolute; right:0; background-color: transparent; padding: 0; width: 4em;" title="本頁使用了標題或全文手工轉換,單擊檢視"><span style="font-family:微软雅黑,Arial Unicode MS,黑体;"><span style="padding:1px 3px; background: slategray; color:white;">汉</span><span style="padding:1px 3px; background: sienna; color:white;">漢</span></span><span class="toggleShow" style="color:black;">▼</span><span class="toggleHide" style="color:black;">▲</span></div>
|
162
|
+
<div class="NavContent" style="position: absolute; display: none; right: 0; top: 1.5em; border: 1px gray solid; background-color: lightyellow; padding: 0.3em; z-index: 100; width: 650px; font-size: 90%; background-color: #f0f2f0; color: black;">
|
163
|
+
<div style="background: #FFEA88; background-color: #4d4d4d; color: #ffffff;">为了阅读方便,本文使用<a href="/wiki/Help:%E4%B8%AD%E6%96%87%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91%E7%9A%84%E7%B9%81%E7%AE%80%E5%A4%84%E7%90%86#.E6.8E.A7.E5.88.B6.E8.87.AA.E5.8A.A8.E8.BD.AC.E6.8D.A2.E7.9A.84.E4.BB.A3.E7.A2.BC" title="Help:中文维基百科的繁简处理" class="mw-redirect"><span style="color:#ffffff; font-weight:bold;">全文手工轉換</span></a>。转换内容:</div>
|
164
|
+
<div style="padding: 3px">
|
165
|
+
<p>本文采用<a href="/wiki/Portal:%E7%94%B5%E8%84%91%E5%92%8C%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF" title="Portal:电脑和信息技术" class="mw-redirect"><span style="color: #333333; font-weight: bold;">电脑和信息技术</span></a>组全文转换 <span class="editlink noprint plainlinksneverexpand">[<a href="/wiki/Template:CGroup/IT/temp" title="Template:CGroup/IT/temp">查看</a>] • [<a href="http://zh.wikipedia.org/w/index.php?title=Template:CGroup/IT/temp&action=edit" class="external text" rel="nofollow">编辑</a>] • [<a href="http://philip-bot.appspot.com/autoconvert?group=IT" class="external text" rel="nofollow">强制刷新</a>]</span></p>
|
166
|
+
<p><br /></p>
|
167
|
+
</div>
|
168
|
+
<div class="NavFrame collapsed" style="background-color: transparent; border: none; margin:0; padding:0;">
|
169
|
+
<div class="NavHead" style="background-color: #FFEA88; font-weight: normal; height: 1.5em; text-align: left; background-color: #4d4d4d; color: #ffffff;"><a href="/wiki/Help:%E4%B8%AD%E6%96%87%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91%E7%9A%84%E7%B9%81%E7%AE%80%E3%80%81%E5%9C%B0%E5%8C%BA%E8%AF%8D%E5%A4%84%E7%90%86" title="Help:中文维基百科的繁简、地区词处理"><span style="color: #333333; font-weight: bold;">字詞轉換</span></a>说明<span class="NavToggle"><span class="toggleShow">顯示↓</span><span class="toggleHide">關閉↑</span></span></div>
|
170
|
+
<div class="NavContent">
|
171
|
+
<p>字詞轉換是中文维基的一項自動轉換,目的是通過计算机程序自動消除繁简、地区词等不同<b>用字模式</b>的差異,以達到閱讀方便。字詞轉換包括全局轉換和手動轉換,本說明所使用的标题转换和全文转换技術,都屬於手動轉換。</p>
|
172
|
+
<p>如果您想对我们的字词转换系统提出一些改进建议,或者提交应用面更广的转换(<a href="/wiki/%E4%B8%AD%E6%96%87%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91" title="中文维基百科">中文维基百科</a>全站乃至<a href="/wiki/MediaWiki" title="MediaWiki">MediaWiki</a>软件),或者报告转换系统的错误,请前往<a href="/wiki/Wikipedia:%E5%AD%97%E8%AF%8D%E8%BD%AC%E6%8D%A2%E8%AF%B7%E6%B1%82%E6%88%96%E5%80%99%E9%80%89" title="Wikipedia:字词转换请求或候选">Wikipedia:字词转换请求或候选</a>发表您的意见。</p>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
<p><span id="_skip_noteTA"></span></p>
|
178
|
+
<div class="thumb tright">
|
179
|
+
<div class="thumbinner" style="width:427px;"><a href="/wiki/File:RecipeBook_XML_Example.svg" class="image"><img alt="" src="http://upload.wikimedia.org/wikipedia/commons/thumb/7/73/RecipeBook_XML_Example.svg/425px-RecipeBook_XML_Example.svg.png" width="425" height="234" class="thumbimage" /></a>
|
180
|
+
<div class="thumbcaption">RecipeBook的例子,一種基於XML語法上的烹飪技術書刊。此標籤可轉換為:<a href="/wiki/HTML" title="HTML">HTML</a>, <a href="/wiki/Portable_Document_Format" title="Portable Document Format" class="mw-redirect">PDF</a>以及<a href="/wiki/Rich_Text_Format" title="Rich Text Format" class="mw-redirect">Rich Text Format</a>並使用<a href="/wiki/%E7%A8%8B%E5%BC%8F%E8%AA%9E%E8%A8%80" title="程式語言" class="mw-redirect">程式語言</a>或<a href="/w/index.php?title=%E5%8F%AF%E6%93%B4%E5%85%85%E5%A5%97%E4%BB%B6%E6%A8%A3%E5%BC%8F%E8%AA%9E%E8%A8%80&action=edit&redlink=1" class="new" title="可擴充套件樣式語言">XSL</a>。</div>
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
<p><b>可扩展置标语言</b>(<a href="/wiki/%E8%8B%B1%E8%AF%AD" title="英语">英语</a>:<span lang="en" xml:lang="en">e<b>X</b>tensible <b>M</b>arkup <b>L</b>anguage</span>,简称:<span lang="en" xml:lang="en"><b>XML</b></span>),又称<b>可扩展标记语言</b>,是一种<a href="/wiki/%E7%BD%AE%E6%A0%87%E8%AF%AD%E8%A8%80" title="置标语言">置标语言</a>。置标指<a href="/wiki/%E8%AE%A1%E7%AE%97%E6%9C%BA" title="计算机" class="mw-redirect">计算机</a>所能理解的信息符号,通过此种标记,计算机之间可以处理包含各种信息的文章等。如何定义这些标记,既可以选择国际通用的标记语言,比如<a href="/wiki/HTML" title="HTML">HTML</a>,也可以使用像XML这样由相关人士自由决定的标记语言,这就是语言的可扩展性。XML是从<a href="/wiki/%E6%A0%87%E5%87%86%E9%80%9A%E7%94%A8%E7%BD%AE%E6%A0%87%E8%AF%AD%E8%A8%80" title="标准通用置标语言" class="mw-redirect">标准通用置标语言</a>(SGML)中简化修改出来的。它主要用到的有可扩展置标语言、<a href="/wiki/%E5%8F%AF%E6%89%A9%E5%B1%95%E6%A0%B7%E5%BC%8F%E8%AF%AD%E8%A8%80" title="可扩展样式语言">可扩展样式语言</a>(XSL)、<a href="/wiki/XBRL" title="XBRL">XBRL</a>和<a href="/wiki/XPath" title="XPath">XPath</a>等。</p>
|
184
|
+
<table id="toc" class="toc">
|
185
|
+
<tr>
|
186
|
+
<td>
|
187
|
+
<div id="toctitle">
|
188
|
+
<h2>目录</h2>
|
189
|
+
</div>
|
190
|
+
<ul>
|
191
|
+
<li class="toclevel-1 tocsection-1"><a href="#.E6.AD.B7.E5.8F.B2"><span class="tocnumber">1</span> <span class="toctext">歷史</span></a></li>
|
192
|
+
<li class="toclevel-1 tocsection-2"><a href="#.E7.94.A8.E9.80.94"><span class="tocnumber">2</span> <span class="toctext">用途</span></a></li>
|
193
|
+
<li class="toclevel-1 tocsection-3"><a href="#.E4.BE.8B"><span class="tocnumber">3</span> <span class="toctext">例</span></a></li>
|
194
|
+
<li class="toclevel-1 tocsection-4"><a href="#.E7.BB.93.E6.9E.84"><span class="tocnumber">4</span> <span class="toctext">结构</span></a></li>
|
195
|
+
<li class="toclevel-1 tocsection-5"><a href="#.E5.8F.82.E8.A7.81"><span class="tocnumber">5</span> <span class="toctext">参见</span></a></li>
|
196
|
+
<li class="toclevel-1 tocsection-6"><a href="#.E5.A4.96.E9.83.A8.E9.93.BE.E6.8E.A5"><span class="tocnumber">6</span> <span class="toctext">外部链接</span></a></li>
|
197
|
+
</ul>
|
198
|
+
</td>
|
199
|
+
</tr>
|
200
|
+
</table>
|
201
|
+
<script type="text/javascript">
|
202
|
+
//<![CDATA[
|
203
|
+
if (window.showTocToggle) { var tocShowText = "显示"; var tocHideText = "隐藏"; showTocToggle(); }
|
204
|
+
//]]>
|
205
|
+
</script>
|
206
|
+
<h2><span class="editsection">[<a href="/w/index.php?title=XML&action=edit&section=1" title="编辑段落:歷史">编辑</a>]</span> <span class="mw-headline" id=".E6.AD.B7.E5.8F.B2">歷史</span></h2>
|
207
|
+
<p>XML是從1995年開始有其雛形,並向<a href="/wiki/W3C" title="W3C" class="mw-redirect">W3C</a>(<a href="/wiki/%E4%B8%87%E7%BB%B4%E7%BD%91%E8%81%94%E7%9B%9F" title="万维网联盟">全球資訊網聯盟</a>)提案,而在1998二月發佈為W3C的標準(XML1.0)。XML的前身是<b>SGML</b>(<span lang="en" xml:lang="en">The <b>S</b>tandard <b>G</b>eneralized <b>M</b>arkup <b>L</b>anguage</span>),是自IBM從1960年代就開始發展的<b><a href="/w/index.php?title=%E9%80%9A%E7%94%A8%E7%BD%AE%E6%A0%87%E8%AF%AD%E8%A8%80&action=edit&redlink=1" class="new" title="通用置标语言">GML</a></b>(<span lang="en" xml:lang="en"><b>G</b>eneralized <b>M</b>arkup <b>L</b>anguage</span>)標準化後的名稱。</p>
|
208
|
+
<p>GML的重要概念:</p>
|
209
|
+
<ul>
|
210
|
+
<li>文件中能夠明確的將標示與內容分開</li>
|
211
|
+
<li>所有文件的標示使用方法均一致</li>
|
212
|
+
</ul>
|
213
|
+
<p>1978年,<a href="/wiki/ANSI" title="ANSI" class="mw-redirect">ANSI</a>將GML加以整理規範,發佈成為SGML,1986年起為<a href="/wiki/ISO" title="ISO" class="mw-redirect">ISO</a>所採用(ISO 8879),並且被廣泛地運用在各種大型的文件計劃中,但是SGML是一種非常嚴謹的文件描述法,導致過於龐大複雜(標準手冊就有500多頁),難以理解和學習,進而影響其推廣與應用。</p>
|
214
|
+
<p>同時W3C也發現到HTML的問題:</p>
|
215
|
+
<ul>
|
216
|
+
<li>不能解決所有解釋資料的問題 - 像是影音檔或化學公式、音樂符號等其他形態的內容。</li>
|
217
|
+
<li>效能問題 - 需要下載整份文件,才能開始對文件做搜尋。</li>
|
218
|
+
<li>擴充性、彈性、易讀性均不佳。</li>
|
219
|
+
</ul>
|
220
|
+
<p>為了解決以上問題,專家們使用SGML精簡製作,並依照HTML的發展經驗,產生出一套使用上規則嚴謹,但是簡單的描述資料語言:XML。 XML是在一個這樣的背景下誕生的——为了有一個更中立的方式,讓消費端自行決定要如何消化、呈現從服務端所提供的資訊。</p>
|
221
|
+
<p>XML被廣泛用來作為跨平台之間交互數據的形式,主要針對數據的內容,通過不同的格式化描述手段(XSLT,CSS等)可以完成最終的形式表達(生成對應的HTML,PDF或者其他的文件格式)。</p>
|
222
|
+
<h2><span class="editsection">[<a href="/w/index.php?title=XML&action=edit&section=2" title="编辑段落:用途">编辑</a>]</span> <span class="mw-headline" id=".E7.94.A8.E9.80.94">用途</span></h2>
|
223
|
+
<p>XML设计用来传送及携带数据信息,不用来表现或展示数据,<a href="/wiki/HTML" title="HTML">HTML</a>语言則用来表现数据,所以XML用途的焦点是它说明数据是什么,以及携带数据信息。</p>
|
224
|
+
<ul>
|
225
|
+
<li>丰富文件(Rich Documents)- 自定文件描述并使其更丰富
|
226
|
+
<ul>
|
227
|
+
<li>属于文件为主的XML技术应用</li>
|
228
|
+
<li>标记是用来定义一份资料应该如何呈现</li>
|
229
|
+
</ul>
|
230
|
+
</li>
|
231
|
+
<li>元数据(Metadata)- 描述其它文件或网络资讯
|
232
|
+
<ul>
|
233
|
+
<li>属于资料为主的XML技术应用</li>
|
234
|
+
<li>标记是用来说明一份资料的意义</li>
|
235
|
+
</ul>
|
236
|
+
</li>
|
237
|
+
<li>設定档案(Configuration Files)- 描述软件設定的参数</li>
|
238
|
+
</ul>
|
239
|
+
</body>
|
240
|
+
</html>
|
data/test/fixtures/vimrc
ADDED
@@ -0,0 +1,596 @@
|
|
1
|
+
" vim:foldmethod=marker:foldlevel=0:textwidth=79
|
2
|
+
"
|
3
|
+
" I promise to clean up my vimrc one day !
|
4
|
+
" Kepping up promise made in 9a59c443260aeb6ac64b7766fbe5cc4ad76f860a
|
5
|
+
" vimrc
|
6
|
+
" Author: Pratheek
|
7
|
+
" My Vim settings.
|
8
|
+
" _____________________
|
9
|
+
" Here be my Secrets
|
10
|
+
" ---------------------
|
11
|
+
" o / \ //\
|
12
|
+
" o |\___/| / \// \\
|
13
|
+
" /0 0 \__ / // | \ \
|
14
|
+
" / / \/_/ // | \ \
|
15
|
+
" @_^_@'/ \/_ // | \ \
|
16
|
+
" //_^_/ \/_ // | \ \
|
17
|
+
" ( //) | \/// | \ \
|
18
|
+
" ( / /) _|_ / ) // | \ _\
|
19
|
+
" ( // /) '/,_ _ _/ ( ; -. | _ _\.-~ .-~~~^-.
|
20
|
+
" (( / / )) ,-{ _ `-.|.-~-. .~ `.
|
21
|
+
" (( // / )) '/\ / ~-. _ .-~ .-~^-. \
|
22
|
+
" (( /// )) `. { } / \ \
|
23
|
+
" (( / )) .----~-.\ \-' .~ \ `. \^-.
|
24
|
+
" ///.----..> \ _ -~ `. ^-` ^-_
|
25
|
+
" ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
|
26
|
+
"
|
27
|
+
"
|
28
|
+
" Preamble ---------------------------------------------------------------- {{{
|
29
|
+
|
30
|
+
" No explanation needed
|
31
|
+
set nocompatible
|
32
|
+
|
33
|
+
" Load pathogen, and automatically call pathogen#helptags()
|
34
|
+
execute pathogen#infect()
|
35
|
+
call pathogen#helptags()
|
36
|
+
set shell=/bin/bash
|
37
|
+
"}}}
|
38
|
+
" Basic settings----------------------------------------------------------- {{{
|
39
|
+
"
|
40
|
+
" Better than just /<search term>
|
41
|
+
" Also, `\v` enables use of Perl compatible regexes
|
42
|
+
nmap / /\v
|
43
|
+
syntax on
|
44
|
+
filetype indent on
|
45
|
+
filetype plugin on
|
46
|
+
syntax enable
|
47
|
+
set background=light
|
48
|
+
|
49
|
+
" Have a different colorscheme for GUI and console version of Vim
|
50
|
+
if has('gui_running')
|
51
|
+
colorscheme sol
|
52
|
+
else
|
53
|
+
colorscheme luna-term
|
54
|
+
endif
|
55
|
+
|
56
|
+
" Set stuff (set <whatever>) {{{
|
57
|
+
" I'm going to try to put a comment above most of these `set` stuff,
|
58
|
+
" but if its not present, just do a `:h` for that
|
59
|
+
|
60
|
+
" Always have a status bar
|
61
|
+
set laststatus=2
|
62
|
+
set encoding=utf-8
|
63
|
+
set t_Co=256
|
64
|
+
set relativenumber
|
65
|
+
set autoindent
|
66
|
+
set smartindent
|
67
|
+
set incsearch
|
68
|
+
set listchars=tab:›∙,eol:¬
|
69
|
+
|
70
|
+
" Can *NEVER* settle with one font ! :D
|
71
|
+
" set guifont=Menlo\ for\ Powerline\ 13
|
72
|
+
set guifont=Monaco\ for\ Powerline\ 13
|
73
|
+
|
74
|
+
set hlsearch
|
75
|
+
set wildmenu
|
76
|
+
set colorcolumn=80
|
77
|
+
set cursorline
|
78
|
+
set tabstop=8
|
79
|
+
set expandtab
|
80
|
+
set softtabstop=4
|
81
|
+
set shiftwidth=4
|
82
|
+
set foldlevel=99
|
83
|
+
set foldmethod=indent
|
84
|
+
|
85
|
+
" Remember more previously used stuff
|
86
|
+
set history=1000
|
87
|
+
|
88
|
+
" Better term setting (read :h ttyfast for better understanding)
|
89
|
+
set ttyfast
|
90
|
+
|
91
|
+
" Stops screen from redrawing when macros are being executed
|
92
|
+
set lazyredraw
|
93
|
+
|
94
|
+
" NO WRAP ! EVER !
|
95
|
+
" This is especially usefull for `:vertical h <topic>`
|
96
|
+
set nowrap
|
97
|
+
|
98
|
+
" Amount of time taken to show the matching paren
|
99
|
+
" (This is in tenths of a sec)
|
100
|
+
set matchtime=3
|
101
|
+
|
102
|
+
" Better completion
|
103
|
+
" do a `:h 'complete'`
|
104
|
+
set complete=.,w,b,u,t
|
105
|
+
" do a `:h 'completeopt'`
|
106
|
+
set completeopt=longest,menuone,preview,menu
|
107
|
+
|
108
|
+
" I think all these guioptions should be in gvimrc,
|
109
|
+
" but since vimrc loads faster, I've added them here
|
110
|
+
set guioptions-=T "removes toolbar
|
111
|
+
set guioptions-=r "removes Right-hand scrollbar
|
112
|
+
set guioptions-=R "removes Right-hand scrollbar (Which is present in :vsp)
|
113
|
+
set guioptions-=l "removes Left-hand scrollbar
|
114
|
+
set guioptions-=L "removes Left-hand scrollbar (which is present in :vsp)
|
115
|
+
set guioptions-=m "removes menubar
|
116
|
+
|
117
|
+
" Defualt Status line
|
118
|
+
" Commented out all these, in favour of vim-airline
|
119
|
+
"
|
120
|
+
" set statusline=
|
121
|
+
" set statusline+=(%t)
|
122
|
+
" set statusline+=%m\
|
123
|
+
" set statusline+=%=\
|
124
|
+
" set statusline+=%r\
|
125
|
+
" set statusline+=%{fugitive#statusline()}
|
126
|
+
" set statusline+=%=\
|
127
|
+
" set statusline+=%Y\
|
128
|
+
" set statusline+=(%l/%L)\
|
129
|
+
" set statusline+=(%p%%)\
|
130
|
+
|
131
|
+
" Use the custom fold function
|
132
|
+
set foldtext=MyFoldText()
|
133
|
+
"}}}
|
134
|
+
" Breaking Habit {{{
|
135
|
+
nnoremap <up> <nop>
|
136
|
+
nnoremap <down> <nop>
|
137
|
+
nnoremap <left> <nop>
|
138
|
+
nnoremap <right> <nop>
|
139
|
+
inoremap <up> <nop>
|
140
|
+
inoremap <down> <nop>
|
141
|
+
inoremap <left> <nop>
|
142
|
+
inoremap <right> <nop>
|
143
|
+
vnoremap <up> <nop>
|
144
|
+
vnoremap <down> <nop>
|
145
|
+
vnoremap <left> <nop>
|
146
|
+
vnoremap <right> <nop>
|
147
|
+
"}}}
|
148
|
+
" Mind Hacks {{{
|
149
|
+
" ---------------------------------------------------------------------------
|
150
|
+
" Better <C-^> hack !
|
151
|
+
" :nnoremap <C-^> :buffers<CR>:b<Space>
|
152
|
+
" using tabline (built-in with airline)
|
153
|
+
nnoremap <C-Tab> :tabnext<CR>
|
154
|
+
" ---------------------------------------------------------------------------
|
155
|
+
" with the default `:e` I'll have to remember
|
156
|
+
" the path of the file (which is hard)
|
157
|
+
" So, remap `:e` to run `:CtrlPMRUFiles`
|
158
|
+
" Pros : No need to remember the path, CtrlP will find it for you.
|
159
|
+
" Cons : Requires CtrlP (dependency) and
|
160
|
+
" commands that start with e will be hard to type.
|
161
|
+
" (You'll have to hit `:` and wait about a half a sec or so
|
162
|
+
" to start typing the command, starting with 'e')
|
163
|
+
nnoremap :e :CtrlPMRUFiles<CR>
|
164
|
+
" ---------------------------------------------------------------------------
|
165
|
+
" clear serached stuff
|
166
|
+
nnoremap <C-S-c> :let @/=""<CR>
|
167
|
+
" ---------------------------------------------------------------------------
|
168
|
+
" Show syntax highlighting groups for word under cursor
|
169
|
+
" Thanks to Drew Neil from vimcasts
|
170
|
+
nmap <A-S-P> :call <SID>SynStack()<CR>
|
171
|
+
function! <SID>SynStack()
|
172
|
+
if !exists("*synstack")
|
173
|
+
return
|
174
|
+
endif
|
175
|
+
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
|
176
|
+
endfunc
|
177
|
+
" ---------------------------------------------------------------------------
|
178
|
+
" When using (g)vimdiff (or running `:Gdiff` in fugitive)
|
179
|
+
" Disable relativenumber and use normal numbers
|
180
|
+
if &diff
|
181
|
+
set norelativenumber
|
182
|
+
set number
|
183
|
+
endif
|
184
|
+
" ---------------------------------------------------------------------------
|
185
|
+
" Returns cursor to last position before quitting
|
186
|
+
augroup line_return
|
187
|
+
au!
|
188
|
+
au BufReadPost *
|
189
|
+
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
190
|
+
\ execute 'normal! g`"zvzz' |
|
191
|
+
\ endif
|
192
|
+
augroup END
|
193
|
+
" ---------------------------------------------------------------------------
|
194
|
+
" Key mapping for tab switching
|
195
|
+
nnoremap <C-t> :tabnew<CR>
|
196
|
+
" :map <C-x> :tabclose<CR>
|
197
|
+
" :map <C-h> :tabprevious<CR>
|
198
|
+
nnoremap <C-Tab> :tabnext<CR>
|
199
|
+
" ---------------------------------------------------------------------------
|
200
|
+
" Thanks to Steve Losh
|
201
|
+
" "Uppercase word" mapping.
|
202
|
+
"
|
203
|
+
" This mapping allows you to press <c-u> in insert mode to convert the current
|
204
|
+
" word to uppercase. It's handy when you're writing names of constants and
|
205
|
+
" don't want to use Capslock.
|
206
|
+
"
|
207
|
+
" To use it you type the name of the constant in lowercase. While your
|
208
|
+
" cursor is at the end of the word, press <c-u> to uppercase it, and then
|
209
|
+
" continue happily on your way:
|
210
|
+
"
|
211
|
+
" cursor
|
212
|
+
" v
|
213
|
+
" max_connections_allowed|
|
214
|
+
" <c-u>
|
215
|
+
" MAX_CONNECTIONS_ALLOWED|
|
216
|
+
" ^
|
217
|
+
" cursor
|
218
|
+
"
|
219
|
+
" It works by exiting out of insert mode, recording the current cursor location
|
220
|
+
" in the z mark, using gUiw to uppercase inside the current word, moving
|
221
|
+
" back to the z mark, and entering insert mode again.
|
222
|
+
"
|
223
|
+
" Note that this will overwrite the contents of the z mark. I never use it,
|
224
|
+
" but if you do you'll probably want to use another mark.
|
225
|
+
inoremap <C-u> <esc>mzgUiw`za
|
226
|
+
" ---------------------------------------------------------------------------
|
227
|
+
"}}}
|
228
|
+
" <F5> FileType Runners and Builders {{{
|
229
|
+
" ---------------------------------------------------------------------------
|
230
|
+
" Python {{{
|
231
|
+
augroup ft_python
|
232
|
+
au!
|
233
|
+
" Run the code in `%` (path/to/file) in python
|
234
|
+
" Damn the <leader>r in python-mode for python3
|
235
|
+
au Filetype python nnoremap <F5> :<C-u> ! python %<CR>
|
236
|
+
augroup END
|
237
|
+
"}}}
|
238
|
+
" Lua {{{
|
239
|
+
augroup ft_lua
|
240
|
+
au!
|
241
|
+
" Run the code in `%` (path/to/file) in lua
|
242
|
+
au Filetype lua nnoremap <F5> :<C-u> ! lua %<CR>
|
243
|
+
augroup END
|
244
|
+
" }}}
|
245
|
+
" C {{{
|
246
|
+
augroup ft_c
|
247
|
+
au!
|
248
|
+
" Build the given .c file
|
249
|
+
" by giving `%` as the arg (which is path/to/file)
|
250
|
+
" and store the built binary file in the same path
|
251
|
+
"
|
252
|
+
" Best explained with example:
|
253
|
+
" Let's say file name is foo_bar.c
|
254
|
+
" Then, this makes it `:! gcc -Wall foo_bar.c -o foo_bar.c.o`
|
255
|
+
" (Slightly bad in naming the bin file ! ;) )
|
256
|
+
"
|
257
|
+
" This also works in this case.
|
258
|
+
" $ gvim ~/foo/bar/baz/dumb.c
|
259
|
+
" Then, this runs as:
|
260
|
+
" `:!gcc -Wall ~/foo/bar/baz/dumb.c -o ~/foo/bar/baz/dumb.c.o`
|
261
|
+
"
|
262
|
+
au Filetype c nnoremap <F5> :<C-u> ! gcc -Wall % -o %.o<CR>
|
263
|
+
augroup END
|
264
|
+
" }}}
|
265
|
+
" C++ {{{
|
266
|
+
augroup ft_cpp
|
267
|
+
au!
|
268
|
+
" Build the given .cc file
|
269
|
+
" by giving `%` as the arg (which is path/to/file)
|
270
|
+
" and store the built binary file in the same path
|
271
|
+
"
|
272
|
+
" Best explained with example:
|
273
|
+
" Let's say file name is foo_bar.cc
|
274
|
+
" Then, this makes it `:! g++ -Wall foo_bar.cc -o foo_bar.cc.oo`
|
275
|
+
" Slightly bad in naming the bin file
|
276
|
+
"
|
277
|
+
" This also works in this case.
|
278
|
+
" $ gvim ~/foo/bar/baz/dumb.cc
|
279
|
+
" Then, this runs as:
|
280
|
+
" `:!g++ -Wall ~/foo/bar/baz/dumb.cc -o ~/foo/bar/baz/dumb.cc.oo`
|
281
|
+
"
|
282
|
+
au Filetype cpp nnoremap <F5> :<C-u> ! g++ -Wall % -o %.oo<CR>
|
283
|
+
augroup END
|
284
|
+
" }}}
|
285
|
+
" }}}
|
286
|
+
" ---------------------------------------------------------------------------
|
287
|
+
" }}}
|
288
|
+
" Wild Ignore ------------------------------------------------------------- {{{
|
289
|
+
set wildignore+=.hg,.git,.svn " Version control
|
290
|
+
set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
|
291
|
+
set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
|
292
|
+
set wildignore+=*.o,*.oo,*.obj,*.exe,*.dll " compiled object files
|
293
|
+
set wildignore+=*.spl " compiled spelling word lists
|
294
|
+
set wildignore+=*.sw? " Vim swap files
|
295
|
+
set wildignore+=*.luac " Lua byte code
|
296
|
+
set wildignore+=*.pyc " Python byte code
|
297
|
+
set wildignore+=*.orig " Merge resolution files
|
298
|
+
set wildignore+=$VIMRUNTIME/doc/*.txt " Individual helpfiles
|
299
|
+
set wildignore+=$VIMRUNTIME/doc/*.tar.gz " compressed helpfiles
|
300
|
+
" For the `**` meaning, do a `:h starstar-wildcard`
|
301
|
+
set wildignore+=**/doc/*.txt
|
302
|
+
" Clojure/Leiningen
|
303
|
+
set wildignore+=classes
|
304
|
+
set wildignore+=lib
|
305
|
+
"}}}
|
306
|
+
" Auto Commands ----------------------------------------------------------- {{{
|
307
|
+
" General filetype {{{
|
308
|
+
" ---------------------------------------------------------------------------
|
309
|
+
" Resize splits when the window is resized
|
310
|
+
au VimResized * :wincmd =
|
311
|
+
" First off, HUGE thanks to Steve Losh !
|
312
|
+
" Read below !
|
313
|
+
" Make {<cr> insert a pair of brackets in such a way that the cursor is correctly
|
314
|
+
" positioned inside of them AND the following code doesn't get unfolded.
|
315
|
+
au Filetype * inoremap <buffer> {<cr> {}<left><cr><space><space><space><space>.<cr><esc>kA<bs>
|
316
|
+
" ---------------------------------------------------------------------------
|
317
|
+
" }}}
|
318
|
+
" Clojure {{{
|
319
|
+
" ---------------------------------------------------------------------------
|
320
|
+
au FileType clojure RainbowParenthesesActivate
|
321
|
+
au syntax clojure RainbowParenthesesLoadRound
|
322
|
+
au syntax clojure RainbowParenthesesLoadSquare
|
323
|
+
au syntax clojure RainbowParenthesesLoadBraces
|
324
|
+
" ---------------------------------------------------------------------------
|
325
|
+
" }}}
|
326
|
+
" Python {{{
|
327
|
+
" ---------------------------------------------------------------------------
|
328
|
+
autocmd BufWritePre *.py normal m`:%s/\s\+$//e ``
|
329
|
+
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
|
330
|
+
au FileType python set omnifunc=pythoncomplete#Complete
|
331
|
+
au FileType python syn keyword pythonDecorator True None False self
|
332
|
+
" ---------------------------------------------------------------------------
|
333
|
+
" }}}
|
334
|
+
" }}}
|
335
|
+
" Custom Functions -------------------------------------------------------- {{{
|
336
|
+
" ---------------------------------------------------------------------------
|
337
|
+
function! MyFoldText() " {{{
|
338
|
+
let line = getline(v:foldstart)
|
339
|
+
|
340
|
+
let nucolwidth = &fdc + &number * &numberwidth
|
341
|
+
let windowwidth = winwidth(0) - nucolwidth - 3
|
342
|
+
let foldedlinecount = v:foldend - v:foldstart
|
343
|
+
|
344
|
+
" expand tabs into spaces
|
345
|
+
let onetab = strpart(' ', 0, &tabstop)
|
346
|
+
let line = substitute(line, '\t', onetab, 'g')
|
347
|
+
|
348
|
+
let line = strpart(line, 0, windowwidth - 2 -len(foldedlinecount))
|
349
|
+
let fillcharcount = windowwidth - len(line) - len(foldedlinecount)
|
350
|
+
return line . ' (' . foldedlinecount . ') ' . '…' . repeat(" ",fillcharcount) . ' '
|
351
|
+
endfunction " }}}
|
352
|
+
" Nyan cat
|
353
|
+
command! NyanMe call NyanMe()
|
354
|
+
" ---------------------------------------------------------------------------
|
355
|
+
function! NyanMe() " {{{
|
356
|
+
hi NyanFur guifg=#BBBBBB
|
357
|
+
hi NyanPoptartEdge guifg=#ffd0ac
|
358
|
+
hi NyanPoptartFrosting guifg=#fd3699 guibg=#fe98ff
|
359
|
+
hi NyanRainbow1 guifg=#6831f8
|
360
|
+
hi NyanRainbow2 guifg=#0099fc
|
361
|
+
hi NyanRainbow3 guifg=#3cfa04
|
362
|
+
hi NyanRainbow4 guifg=#fdfe00
|
363
|
+
hi NyanRainbow5 guifg=#fc9d00
|
364
|
+
hi NyanRainbow6 guifg=#fe0000
|
365
|
+
|
366
|
+
|
367
|
+
echohl NyanRainbow1
|
368
|
+
echon "≈"
|
369
|
+
echohl NyanRainbow2
|
370
|
+
echon "≋"
|
371
|
+
echohl NyanRainbow3
|
372
|
+
echon "≈"
|
373
|
+
echohl NyanRainbow4
|
374
|
+
echon "≋"
|
375
|
+
echohl NyanRainbow5
|
376
|
+
echon "≈"
|
377
|
+
echohl NyanRainbow6
|
378
|
+
echon "≋"
|
379
|
+
echohl NyanRainbow1
|
380
|
+
echon "≈"
|
381
|
+
echohl NyanRainbow2
|
382
|
+
echon "≋"
|
383
|
+
echohl NyanRainbow3
|
384
|
+
echon "≈"
|
385
|
+
echohl NyanRainbow4
|
386
|
+
echon "≋"
|
387
|
+
echohl NyanRainbow5
|
388
|
+
echon "≈"
|
389
|
+
echohl NyanRainbow6
|
390
|
+
echon "≋"
|
391
|
+
echohl None
|
392
|
+
echo ""
|
393
|
+
|
394
|
+
echohl NyanRainbow1
|
395
|
+
echon "≈"
|
396
|
+
echohl NyanRainbow2
|
397
|
+
echon "≋"
|
398
|
+
echohl NyanRainbow3
|
399
|
+
echon "≈"
|
400
|
+
echohl NyanRainbow4
|
401
|
+
echon "≋"
|
402
|
+
echohl NyanRainbow5
|
403
|
+
echon "≈"
|
404
|
+
echohl NyanRainbow6
|
405
|
+
echon "≋"
|
406
|
+
echohl NyanRainbow1
|
407
|
+
echon "≈"
|
408
|
+
echohl NyanRainbow2
|
409
|
+
echon "≋"
|
410
|
+
echohl NyanRainbow3
|
411
|
+
echon "≈"
|
412
|
+
echohl NyanRainbow4
|
413
|
+
echon "≋"
|
414
|
+
echohl NyanRainbow5
|
415
|
+
echon "≈"
|
416
|
+
echohl NyanRainbow6
|
417
|
+
echon "≋"
|
418
|
+
echohl NyanFur
|
419
|
+
echon "╰"
|
420
|
+
echohl NyanPoptartEdge
|
421
|
+
echon "⟨"
|
422
|
+
echohl NyanPoptartFrosting
|
423
|
+
echon "⣮⣯⡿"
|
424
|
+
echohl NyanPoptartEdge
|
425
|
+
echon "⟩"
|
426
|
+
echohl NyanFur
|
427
|
+
echon "⩾^ω^⩽"
|
428
|
+
echohl None
|
429
|
+
echo ""
|
430
|
+
|
431
|
+
echohl NyanRainbow1
|
432
|
+
echon "≈"
|
433
|
+
echohl NyanRainbow2
|
434
|
+
echon "≋"
|
435
|
+
echohl NyanRainbow3
|
436
|
+
echon "≈"
|
437
|
+
echohl NyanRainbow4
|
438
|
+
echon "≋"
|
439
|
+
echohl NyanRainbow5
|
440
|
+
echon "≈"
|
441
|
+
echohl NyanRainbow6
|
442
|
+
echon "≋"
|
443
|
+
echohl NyanRainbow1
|
444
|
+
echon "≈"
|
445
|
+
echohl NyanRainbow2
|
446
|
+
echon "≋"
|
447
|
+
echohl NyanRainbow3
|
448
|
+
echon "≈"
|
449
|
+
echohl NyanRainbow4
|
450
|
+
echon "≋"
|
451
|
+
echohl NyanRainbow5
|
452
|
+
echon "≈"
|
453
|
+
echohl NyanRainbow6
|
454
|
+
echon "≋"
|
455
|
+
echohl None
|
456
|
+
echon " "
|
457
|
+
echohl NyanFur
|
458
|
+
echon "” ‟"
|
459
|
+
echohl None
|
460
|
+
|
461
|
+
sleep 1
|
462
|
+
redraw
|
463
|
+
echo " "
|
464
|
+
echo " "
|
465
|
+
echo "Noms?"
|
466
|
+
redraw
|
467
|
+
endfunction " }}}
|
468
|
+
" }}}
|
469
|
+
" Plugin Settings --------------------------------------------------------- {{{
|
470
|
+
" Airline {{{
|
471
|
+
let g:airline_theme = 'sol'
|
472
|
+
let g:airline_left_sep=''
|
473
|
+
let g:airline_left_alt_sep='|'
|
474
|
+
let g:airline_right_sep=''
|
475
|
+
let g:airline_right_alt_sep='|'
|
476
|
+
let g:airline_powerline_fonts = 1
|
477
|
+
let g:airline#extensions#tabline#enabled = 1
|
478
|
+
let g:airline#extensions#tabline#fnamemod = ':~:.'
|
479
|
+
" let g:airline#extensions#tabline#fnamemod = ':t:~'
|
480
|
+
" let g:airline#extensions#tabline#fnamemod = ':p:~'
|
481
|
+
|
482
|
+
" Get rid of the arrows in tabline
|
483
|
+
let g:airline#extensions#tabline#left_sep = ' '
|
484
|
+
let g:airline#extensions#tabline#left_alt_sep = '|'
|
485
|
+
|
486
|
+
" Enable Fugitive support in airline
|
487
|
+
let g:airline#extensions#branch#enabled = 1
|
488
|
+
|
489
|
+
" Show hunks, only if there is change in file,
|
490
|
+
" with respect to the version last commited into git
|
491
|
+
let g:airline#extensions#hunks#non_zero_only = 1
|
492
|
+
|
493
|
+
" Display buffers in a single tab
|
494
|
+
" (also this is required for the next setting)
|
495
|
+
let g:airline#extensions#tabline#show_buffers = 1
|
496
|
+
|
497
|
+
" Show tabline only if more than 2 buffers exist
|
498
|
+
let g:airline#extensions#tabline#buffer_min_count = 2
|
499
|
+
|
500
|
+
" unicode symbols
|
501
|
+
let g:airline_branch_prefix = 'Br:'
|
502
|
+
let g:airline_paste_symbol = 'ρ'
|
503
|
+
|
504
|
+
" Reducing mode strings to a single chars
|
505
|
+
let g:airline_mode_map = {
|
506
|
+
\ '__' : '-',
|
507
|
+
\ 'n' : 'N',
|
508
|
+
\ 'i' : 'I',
|
509
|
+
\ 'R' : 'R',
|
510
|
+
\ 'c' : 'C',
|
511
|
+
\ 'v' : 'V',
|
512
|
+
\ 'V' : 'V',
|
513
|
+
\ '' : 'V',
|
514
|
+
\ 's' : 'S',
|
515
|
+
\ 'S' : 'S',
|
516
|
+
\ '' : 'S',
|
517
|
+
\ }
|
518
|
+
|
519
|
+
" Custom Function to display a slightly modified airline
|
520
|
+
" Slight change to show branch info on the right side
|
521
|
+
" rather than next to the hunks
|
522
|
+
function! AirlineInit()
|
523
|
+
let g:airline_section_a = airline#section#create(['mode'])
|
524
|
+
let g:airline_section_b = airline#section#create_left(['hunks'])
|
525
|
+
let g:airline_section_c = airline#section#create(['%f'])
|
526
|
+
let g:airline_section_y = airline#section#create_right(['branch', 'ffenc'])
|
527
|
+
endfunction
|
528
|
+
autocmd VimEnter * call AirlineInit()
|
529
|
+
" }}}
|
530
|
+
" Startify {{{
|
531
|
+
|
532
|
+
let g:startify_bookmarks = [
|
533
|
+
\ '~/.vim/vimrc',
|
534
|
+
\ ]
|
535
|
+
let g:startify_files_number = 8
|
536
|
+
let g:startify_change_to_dir = 0
|
537
|
+
let g:startify_change_to_vcs_root = 1
|
538
|
+
let g:startify_skiplist = [
|
539
|
+
\ '.git/COMMIT_EDITMSG',
|
540
|
+
\ '.gtkrc-2.0',
|
541
|
+
\ '/usr/share/vim/vim74/doc',
|
542
|
+
\ '/etc/*',
|
543
|
+
\ $VIMRUNTIME . '*/doc',
|
544
|
+
\ 'bundle/.*/doc'
|
545
|
+
\ ]
|
546
|
+
|
547
|
+
let g:startify_list_order = [
|
548
|
+
\ [' MRU:'],
|
549
|
+
\ 'files',
|
550
|
+
\ [' Sess:'],
|
551
|
+
\ 'sessions',
|
552
|
+
\ [' Markers:'],
|
553
|
+
\ 'bookmarks'
|
554
|
+
\ ]
|
555
|
+
" Startify Custom Header
|
556
|
+
"let g:startify_custom_header = [
|
557
|
+
"\ ' .____---^^ ^^---____. ',
|
558
|
+
"\ ' TI * * IT Three Rings for the Elvin-Kings under the sky. ',
|
559
|
+
"\ ' !I * I! Seven for the DwarfLords in their halls of stone. ',
|
560
|
+
"\ ' X X Nine for the Mortal Men doomed to die. ',
|
561
|
+
"\ ' XL JX One for the Dark Lord on his dark throne. ',
|
562
|
+
"\ ' II / \ II In the Land of Mordor where the Shadow Lies. ',
|
563
|
+
"\ ' II / \ / \ / \ II ',
|
564
|
+
"\ ' X / v v \ X One Ring to rule them all,One Ring to find them, ',
|
565
|
+
"\ ' ``/ _ _ \'' One Ring to bring them all and in the Darkness ',
|
566
|
+
"\ ' \\- _-_ -_- _-_ -// Bind Them ',
|
567
|
+
"\ ' \\_- -_- -_// In the Land of Mordor where the Shadows Lie. ',
|
568
|
+
"\ ' `` '' ',
|
569
|
+
"\ ' ``-_-'' ',
|
570
|
+
"\ ' "Lord Of THe Rings" ',
|
571
|
+
"\ ' by J.R.R. Tolkien ',
|
572
|
+
"\ '',
|
573
|
+
"\ ]
|
574
|
+
" }}}
|
575
|
+
" CtrlP {{{
|
576
|
+
|
577
|
+
" make CtrlP exclude these type of files from adding to MRUFiles cache
|
578
|
+
let g:ctrlp_mruf_exclude = '*.tar.gz\|'
|
579
|
+
let g:ctrlp_clear_cache_on_exit = 1
|
580
|
+
let g:ctrlp_cache_dir = $HOME.'/.cache/ctrlp'
|
581
|
+
" }}}
|
582
|
+
" SuperTab {{{
|
583
|
+
|
584
|
+
" let g:SuperTabDefaultCompletionType = \"<c-p>"
|
585
|
+
let g:SuperTabDefaultCompletionType = "<c-n>"
|
586
|
+
let g:SuperTabLongestHighlight = 1
|
587
|
+
let g:SuperTabCrMapping = 1
|
588
|
+
" }}}
|
589
|
+
" Indent Guides {{{
|
590
|
+
|
591
|
+
let g:indent_guides_guide_size = 1
|
592
|
+
" let g:indent_guides_enable_on_vim_startup = 1
|
593
|
+
" }}}
|
594
|
+
" ---------------------------------------------------------------------------
|
595
|
+
"}}}
|
596
|
+
"
|