Skip to content

Commit

Permalink
Add support for World of Warcraft .toc files
Browse files Browse the repository at this point in the history
* Add language rule and heuristic for WoW Addon data

* Add test fixtures for the .toc extension

* Add grammar for syntax highlighting

* Define colour of WoW .toc files

* Refine heuristic to include a commonly-used keyword

* Check whitespace in WoW-token heuristic

* Include additional TeX keywords in .toc heuristic

* Update grammar submodules

* Cache license for WoW-toc grammar

* Reverting sourcepawn update
  • Loading branch information
Alhadis authored and arfon committed May 4, 2016
1 parent 8cf3b7a commit 9ae19a1
Show file tree
Hide file tree
Showing 16 changed files with 121 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,9 @@
[submodule "vendor/grammars/language-graphql"]
path = vendor/grammars/language-graphql
url = https://github.com/rmosolgo/language-graphql
[submodule "vendor/grammars/language-toc-wow"]
path = vendor/grammars/language-toc-wow
url = https://github.com/nebularg/language-toc-wow
[submodule "vendor/grammars/sublime-autoit"]
path = vendor/grammars/sublime-autoit
url = https://github.com/AutoIt/SublimeAutoItScript
3 changes: 2 additions & 1 deletion grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ vendor/grammars/SublimeBrainfuck:
vendor/grammars/SublimeClarion/:
- source.clarion
vendor/grammars/SublimePapyrus/:
- source.papyrus.fallout4
- source.papyrus.skyrim
vendor/grammars/SublimePuppet/:
- source.puppet
Expand Down Expand Up @@ -372,6 +371,8 @@ vendor/grammars/language-shellscript:
- text.shell-session
vendor/grammars/language-supercollider:
- source.supercollider
vendor/grammars/language-toc-wow:
- source.toc
vendor/grammars/language-xbase:
- source.harbour
vendor/grammars/language-yaml:
Expand Down
8 changes: 8 additions & 0 deletions lib/linguist/heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,14 @@ def call(data)
Language["SQL"]
end
end

disambiguate ".toc" do |data|
if /^## |@no-lib-strip@/.match(data)
Language["World of Warcraft Addon Data"]
elsif /^\\(contentsline|defcounter|beamer|boolfalse)/.match(data)
Language["TeX"]
end
end

disambiguate ".ts" do |data|
if data.include?("<TS ")
Expand Down
8 changes: 8 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3830,6 +3830,14 @@ WebIDL:
tm_scope: source.webidl
ace_mode: text

World of Warcraft Addon Data:
type: data
color: "#e0b330"
extensions:
- .toc
tm_scope: source.toc
ace_mode: text

X10:
type: programming
aliases:
Expand Down
9 changes: 9 additions & 0 deletions samples/TeX/beispiel.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
\beamer@endinputifotherversion {3.07pt}
\select@language {german}
\beamer@sectionintoc {1}{Geschichte}{3}{0}{1}
\beamer@sectionintoc {2}{Merkmale}{4}{0}{2}
\beamer@sectionintoc {3}{Kritikpunkte}{5}{0}{3}
\beamer@sectionintoc {4}{Perl-Kultur und Spa{\ss}}{6}{0}{4}
\beamer@sectionintoc {5}{Siehe auch}{7}{0}{5}
\beamer@sectionintoc {6}{Einzelnachweise}{8}{0}{6}
\beamer@sectionintoc {7}{Bedingte Ausf\"{u}hrung}{12}{0}{7}
19 changes: 19 additions & 0 deletions samples/TeX/perl.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
\contentsline {section}{\numberline {1}History}{3}
\contentsline {subsection}{\numberline {1.1}Early versions}{3}
\contentsline {subsection}{\numberline {1.2}Early Perl 5}{3}
\contentsline {subsection}{\numberline {1.3}2000-present}{3}
\contentsline {subsection}{\numberline {1.4}Name}{3}
\contentsline {subsection}{\numberline {1.5}Camel symbol}{3}
\contentsline {subsection}{\numberline {1.6}Onion symbol}{3}
\contentsline {section}{\numberline {2}Overview}{3}
\contentsline {subsection}{\numberline {2.1}Features}{3}
\contentsline {subsection}{\numberline {2.2}Design}{3}
\contentsline {subsection}{\numberline {2.3}Applications}{3}
\contentsline {subsection}{\numberline {2.4}Implementation}{3}
\contentsline {section}{\numberline {3}Database interfaces}{3}
\contentsline {section}{\numberline {4}Distribution}{4}
\contentsline {subsection}{\numberline {4.1}Availability}{4}
\contentsline {subsubsection}{\numberline {4.3.1}Windows}{5}
\contentsline {subsubsection}{\numberline {4.3.2}Mac OS X}{6}
\contentsline {subsubsection}{\numberline {4.3.3}OpenBSD}{6}
\contentsline {subsubsection}{\numberline {4.3.4}FreeBSD}{6}
6 changes: 6 additions & 0 deletions samples/World of Warcraft Addon Data/addon.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Interface: 60200
## Title: Vahevian Lotus Vane
## Notes: "Critical Threat Range"
## Version: 4.2
Vahevia.xml
Lotus_Vane.lua
11 changes: 11 additions & 0 deletions samples/World of Warcraft Addon Data/lingua.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Internationalisation example

## Title: Test
## Title-esES: Pruebas
## Title-huHU: Próba
## Notes: "Testing this shit"
## Notes-esES: "Probando la mierda esta"
## Notes-huHU: "Kipróbálom ezt a szart"

Tests.xml
Elk.lua
24 changes: 24 additions & 0 deletions samples/World of Warcraft Addon Data/linguist.toc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Addon manifest file

## Interface: 60200
## Title: Linguist
## Notes: "Language savant"
## RequiredDeps: charlockHolmes, escapeUtils, mimeTypes, rugged
## LoadOnDemand: 1
## Version: 4.9

# This is a comment
## SavedVariables: foo, bar
## SavedVariablesPerCharacter: fewburt

Languages.xml
Heuristics.xml
h-counter.lua
ruby-isnt.lua

#
# It is possible for addons to query values of any tags with a "X-" prefix.
# Some possibilities include:
#
## X-Date: "2016-04-28"
## X-Website: "https://github.com/"
2 changes: 1 addition & 1 deletion vendor/grammars/language-javascript
1 change: 1 addition & 0 deletions vendor/grammars/language-toc-wow
Submodule language-toc-wow added at 6eb5ee
2 changes: 1 addition & 1 deletion vendor/grammars/vue-syntax-highlight
25 changes: 25 additions & 0 deletions vendor/licenses/grammar/language-toc-wow.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
type: grammar
name: language-toc-wow
license: mit
---
Copyright (c) 2016 Kyle Buller

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit 9ae19a1

Please sign in to comment.