mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Grammar update
This commit is contained in:
2
vendor/grammars/sublime_man_page_support/.gitignore
vendored
Normal file
2
vendor/grammars/sublime_man_page_support/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.cache
|
||||
*.pyc
|
||||
20
vendor/grammars/sublime_man_page_support/LICENSE
vendored
Normal file
20
vendor/grammars/sublime_man_page_support/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 carsonoid
|
||||
|
||||
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.
|
||||
23
vendor/grammars/sublime_man_page_support/Main.sublime-menu
vendored
Normal file
23
vendor/grammars/sublime_man_page_support/Main.sublime-menu
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"id": "tools",
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"id": "packages",
|
||||
"caption": "Packages",
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"caption": "Man Page Editing",
|
||||
"id": "man_page_dev",
|
||||
"children":
|
||||
[
|
||||
{ "caption": "New Man Page", "command": "man_page_new" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
4
vendor/grammars/sublime_man_page_support/ManPage.sublime-build
vendored
Normal file
4
vendor/grammars/sublime_man_page_support/ManPage.sublime-build
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"target": "man_page_preview",
|
||||
"selector": "text.groff"
|
||||
}
|
||||
10
vendor/grammars/sublime_man_page_support/ManPage.sublime-commands
vendored
Normal file
10
vendor/grammars/sublime_man_page_support/ManPage.sublime-commands
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
{
|
||||
"caption": "Create New Man Page",
|
||||
"command": "man_page_new"
|
||||
},
|
||||
{
|
||||
"caption": "Preview Current Man Page",
|
||||
"command": "man_page_preview"
|
||||
}
|
||||
]
|
||||
10
vendor/grammars/sublime_man_page_support/README.md
vendored
Normal file
10
vendor/grammars/sublime_man_page_support/README.md
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
#Sublime Man Page Support
|
||||
|
||||
Sublime Text 2 Support for Unix style manual pages.
|
||||
|
||||
## Includes:
|
||||
|
||||
* groff syntax highlighting
|
||||
* command to create a new man page skeleton
|
||||
* snippet that will add useful macros to your man pages on older systems (must come before man page content)
|
||||
* Preview command, build-system, and syntax
|
||||
201
vendor/grammars/sublime_man_page_support/groff-enhancements.sublime-snippet
vendored
Normal file
201
vendor/grammars/sublime_man_page_support/groff-enhancements.sublime-snippet
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<snippet>
|
||||
<content><![CDATA[
|
||||
.\\" Convenience macros that enable easier support for comman man actions
|
||||
.\\" Includes support for synopsis, options, url, email, etc.
|
||||
.\\" copied from the tmac file distributed with Linux Mint 17
|
||||
|
||||
.\\" Convention: Auxiliary macros and registers start with `m' followed
|
||||
.\\" by an uppercase letter or digit.
|
||||
.
|
||||
.
|
||||
.\\" Protect against being sourced twice.
|
||||
.nr mX +1
|
||||
.if \\n(mX>1 \\
|
||||
. nx
|
||||
.
|
||||
.\\" Check whether we are using grohtml.
|
||||
.nr mH 0
|
||||
.if \\n(.g \\
|
||||
. if '\\*(.T'html' \\
|
||||
. nr mH 1
|
||||
.
|
||||
.
|
||||
.\\" Map mono-width fonts to standard fonts for groff's TTY device.
|
||||
.if n \\{\\
|
||||
. do ftr CR R
|
||||
. do ftr CI I
|
||||
. do ftr CB B
|
||||
.\\}
|
||||
.
|
||||
.\\" groff has glyph entities for angle brackets.
|
||||
.ie \\n(.g \\{\\
|
||||
. ds la \\(la\\"
|
||||
. ds ra \\(ra\\"
|
||||
.\\}
|
||||
.el \\{\\
|
||||
. ds la <\\"
|
||||
. ds ra >\\"
|
||||
. \\" groff's man macros control hyphenation with this register.
|
||||
. nr HY 1
|
||||
.\\}
|
||||
.
|
||||
.nr mS 0
|
||||
.
|
||||
.
|
||||
.\\" Declare start of command synopsis. Sets up hanging indentation.
|
||||
.de SY
|
||||
. ie !\\\\n(mS \\{\\
|
||||
. nh
|
||||
. nr mS 1
|
||||
. nr mA \\\\n(.j
|
||||
. ad l
|
||||
. nr mI \\\\n(.i
|
||||
. \\}
|
||||
. el \\{\\
|
||||
. br
|
||||
. ns
|
||||
. \\}
|
||||
.
|
||||
. nr mT \\w'\\fB\\\\\$1\\fP\\ '
|
||||
. HP \\\\n(mTu
|
||||
. B "\\\\\$1"
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" End of command synopsis. Restores adjustment.
|
||||
.de YS
|
||||
. in \\\\n(mIu
|
||||
. ad \\\\n(mA
|
||||
. hy \\\\n(HY
|
||||
. nr mS 0
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" Declare optional option.
|
||||
.de OP
|
||||
. ie \\\\n(.\$-1 \\
|
||||
. RI "[\\fB\\\\\$1\\fP" "\\ \\\\\$2" "]"
|
||||
. el \\
|
||||
. RB "[" "\\\\\$1" "]"
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" Start URL.
|
||||
.de UR
|
||||
. ds m1 \\\\\$1\\"
|
||||
. nh
|
||||
. if \\\\n(mH \\{\\
|
||||
. \\" Start diversion in a new environment.
|
||||
. do ev URL-div
|
||||
. do di URL-div
|
||||
. \\}
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" End URL.
|
||||
.de UE
|
||||
. ie \\\\n(mH \\{\\
|
||||
. br
|
||||
. di
|
||||
. ev
|
||||
.
|
||||
. \\" Has there been one or more input lines for the link text?
|
||||
. ie \\\\n(dn \\{\\
|
||||
. do HTML-NS "<a href=""\\\\*(m1"">"
|
||||
. \\" Yes, strip off final newline of diversion and emit it.
|
||||
. do chop URL-div
|
||||
. do URL-div
|
||||
\\c
|
||||
. do HTML-NS </a>
|
||||
. \\}
|
||||
. el \\
|
||||
. do HTML-NS "<a href=""\\\\*(m1"">\\\\*(m1</a>"
|
||||
\\&\\\\\$*\\"
|
||||
. \\}
|
||||
. el \\
|
||||
\\\\*(la\\\\*(m1\\\\*(ra\\\\\$*\\"
|
||||
.
|
||||
. hy \\\\n(HY
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" Start email address.
|
||||
.de MT
|
||||
. ds m1 \\\\\$1\\"
|
||||
. nh
|
||||
. if \\\\n(mH \\{\\
|
||||
. \\" Start diversion in a new environment.
|
||||
. do ev URL-div
|
||||
. do di URL-div
|
||||
. \\}
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" End email address.
|
||||
.de ME
|
||||
. ie \\\\n(mH \\{\\
|
||||
. br
|
||||
. di
|
||||
. ev
|
||||
.
|
||||
. \\" Has there been one or more input lines for the link text?
|
||||
. ie \\\\n(dn \\{\\
|
||||
. do HTML-NS "<a href=""mailto:\\\\*(m1"">"
|
||||
. \\" Yes, strip off final newline of diversion and emit it.
|
||||
. do chop URL-div
|
||||
. do URL-div
|
||||
\\c
|
||||
. do HTML-NS </a>
|
||||
. \\}
|
||||
. el \\
|
||||
. do HTML-NS "<a href=""mailto:\\\\*(m1"">\\\\*(m1</a>"
|
||||
\\&\\\\\$*\\"
|
||||
. \\}
|
||||
. el \\
|
||||
\\\\*(la\\\\*(m1\\\\*(ra\\\\\$*\\"
|
||||
.
|
||||
. hy \\\\n(HY
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" Continuation line for .TP header.
|
||||
.de TQ
|
||||
. br
|
||||
. ns
|
||||
. TP \\\\\$1\\" no doublequotes around argument!
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" Start example.
|
||||
.de EX
|
||||
. nr mE \\\\n(.f
|
||||
. nf
|
||||
. nh
|
||||
. ft CW
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" End example.
|
||||
.de EE
|
||||
. ft \\\\n(mE
|
||||
. fi
|
||||
. hy \\\\n(HY
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" Start display.
|
||||
.de DS
|
||||
. \\" XXX to be written
|
||||
..
|
||||
.
|
||||
.
|
||||
.\\" End display.
|
||||
.de DE
|
||||
. \\" XXX to be written
|
||||
..
|
||||
.
|
||||
.\\" EOF
|
||||
|
||||
]]></content>
|
||||
</snippet>
|
||||
|
||||
85
vendor/grammars/sublime_man_page_support/man-groff.JSON-tmLanguage
vendored
Normal file
85
vendor/grammars/sublime_man_page_support/man-groff.JSON-tmLanguage
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
{ "name": "Man Page (groff/troff)",
|
||||
"scopeName": "text.groff",
|
||||
"fileTypes": ["man", "groff"],
|
||||
"patterns": [
|
||||
{
|
||||
"name": "comment.macro.text.groff",
|
||||
"match": "^\\.\\\\\".*$",
|
||||
"comment": "comments"
|
||||
},
|
||||
{
|
||||
"name": "uri.macro.text.groff",
|
||||
"begin": "^(\\.UR)\\b(.*)$",
|
||||
"beginCaptures": {
|
||||
"1": { "name": "keyword.text.groff" },
|
||||
"2": { "name": "constant.other.text.groff" }
|
||||
},
|
||||
"end": "^(\\.UE)",
|
||||
"endCaptures": {
|
||||
"1": { "name": "keyword.text.groff" }
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.text.groff",
|
||||
"match": "."
|
||||
}
|
||||
],
|
||||
"comment": "email address macro"
|
||||
},
|
||||
{
|
||||
"name": "emailaddress.macro.text.groff",
|
||||
"begin": "^(\\.MT)\\b(.*)$",
|
||||
"beginCaptures": {
|
||||
"1": { "name": "keyword.text.groff" },
|
||||
"2": { "name": "constant.other.text.groff" }
|
||||
},
|
||||
"end": "^(\\.ME)",
|
||||
"endCaptures": {
|
||||
"1": { "name": "keyword.text.groff" }
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.text.groff",
|
||||
"match": "."
|
||||
}
|
||||
],
|
||||
"comment": "email address macro"
|
||||
},
|
||||
{
|
||||
"name": "option.macro.text.groff",
|
||||
"match": "^(\\.OP)\\s([^\\s]+)\\s?(.*)$",
|
||||
"captures": {
|
||||
"1": { "name": "keyword.text.groff" },
|
||||
"2": { "name": "support.constant.text.groff" },
|
||||
"3": { "name": "string.text.groff" }
|
||||
},
|
||||
"comment": "text style macros"
|
||||
},
|
||||
{
|
||||
"name": "style.macro.text.groff",
|
||||
"begin": "^(\\.SM|\\.SB|\\.BI|\\.IB|\\.RI|\\.IR|\\.BR|\\.RB|\\.B|\\.I)\\b",
|
||||
"beginCaptures": {
|
||||
"1": { "name": "keyword.text.groff" }
|
||||
},
|
||||
"end": "$",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.text.groff",
|
||||
"match": ".",
|
||||
"comment": "catch-all"
|
||||
}
|
||||
],
|
||||
"comment": "text style macros"
|
||||
},
|
||||
{
|
||||
"name": "macro.text.groff",
|
||||
"match": "^(\\.[a-zA-Z]*\\s?)(\\s?.+)?$",
|
||||
"captures": {
|
||||
"1": { "name": "keyword.text.groff" },
|
||||
"2": { "name": "entity.text.groff" }
|
||||
},
|
||||
"comment": "marco catch-all"
|
||||
}
|
||||
],
|
||||
"uuid": "9f281c08-ae81-4ccd-b910-a67b17d1952e"
|
||||
}
|
||||
184
vendor/grammars/sublime_man_page_support/man-groff.tmLanguage
vendored
Normal file
184
vendor/grammars/sublime_man_page_support/man-groff.tmLanguage
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>fileTypes</key>
|
||||
<array>
|
||||
<string>man</string>
|
||||
<string>groff</string>
|
||||
</array>
|
||||
<key>name</key>
|
||||
<string>Man Page (groff/troff)</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>comments</string>
|
||||
<key>match</key>
|
||||
<string>^\.\\".*$</string>
|
||||
<key>name</key>
|
||||
<string>comment.macro.text.groff</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\.UR)\b(.*)$</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>constant.other.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>email address macro</string>
|
||||
<key>end</key>
|
||||
<string>^(\.UE)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>uri.macro.text.groff</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>.</string>
|
||||
<key>name</key>
|
||||
<string>string.text.groff</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\.MT)\b(.*)$</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>constant.other.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>email address macro</string>
|
||||
<key>end</key>
|
||||
<string>^(\.ME)</string>
|
||||
<key>endCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>name</key>
|
||||
<string>emailaddress.macro.text.groff</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>.</string>
|
||||
<key>name</key>
|
||||
<string>string.text.groff</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>support.constant.text.groff</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>string.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>text style macros</string>
|
||||
<key>match</key>
|
||||
<string>^(\.OP)\s([^\s]+)\s?(.*)$</string>
|
||||
<key>name</key>
|
||||
<string>option.macro.text.groff</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>begin</key>
|
||||
<string>^(\.SM|\.SB|\.BI|\.IB|\.RI|\.IR|\.BR|\.RB|\.B|\.I)\b</string>
|
||||
<key>beginCaptures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>text style macros</string>
|
||||
<key>end</key>
|
||||
<string>$</string>
|
||||
<key>name</key>
|
||||
<string>style.macro.text.groff</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>comment</key>
|
||||
<string>catch-all</string>
|
||||
<key>match</key>
|
||||
<string>.</string>
|
||||
<key>name</key>
|
||||
<string>string.text.groff</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.text.groff</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>entity.text.groff</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>comment</key>
|
||||
<string>marco catch-all</string>
|
||||
<key>match</key>
|
||||
<string>^(\.[a-zA-Z]*\s?)(\s?.+)?$</string>
|
||||
<key>name</key>
|
||||
<string>macro.text.groff</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>scopeName</key>
|
||||
<string>text.groff</string>
|
||||
<key>uuid</key>
|
||||
<string>9f281c08-ae81-4ccd-b910-a67b17d1952e</string>
|
||||
</dict>
|
||||
</plist>
|
||||
32
vendor/grammars/sublime_man_page_support/man-preview.JSON-tmLanguage
vendored
Normal file
32
vendor/grammars/sublime_man_page_support/man-preview.JSON-tmLanguage
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
{ "name": "Man Page Preview",
|
||||
"scopeName": "source.man",
|
||||
"fileTypes": ["man"],
|
||||
"uuid": "f3ff3e8d-4f68-432c-af44-e00d6e15c81a",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "string.source.man",
|
||||
"match": "^(man\\((\\d+)\\))(.+)(man\\((\\d+)\\).*)$",
|
||||
"captures": {
|
||||
"0": { "name": "string.source.man" },
|
||||
"2": { "name": "constant.source.man" },
|
||||
"3": { "name": "keyword.source.man" },
|
||||
"5": { "name": "constant.source.man" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "string.source.man",
|
||||
"match": "^(\\d\\.\\d(\\.\\d)?)(.+)(man\\((\\d+)\\).*)$",
|
||||
"captures": {
|
||||
"1": { "name": "constant.source.man" },
|
||||
"2": { "name": "storage.source.man" },
|
||||
"3": { "name": "keyword.source.man" },
|
||||
"4": { "name": "string.source.man" },
|
||||
"5": { "name": "constant.source.man" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "keyword.source.man",
|
||||
"match": "^[A-Z][A-Z\\s]+\\s$"
|
||||
}
|
||||
]
|
||||
}
|
||||
88
vendor/grammars/sublime_man_page_support/man-preview.tmLanguage
vendored
Normal file
88
vendor/grammars/sublime_man_page_support/man-preview.tmLanguage
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>fileTypes</key>
|
||||
<array>
|
||||
<string>man</string>
|
||||
</array>
|
||||
<key>name</key>
|
||||
<string>Man Page Preview</string>
|
||||
<key>patterns</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>0</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>string.source.man</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>constant.source.man</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.source.man</string>
|
||||
</dict>
|
||||
<key>5</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>constant.source.man</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>match</key>
|
||||
<string>^(man\((\d+)\))(.+)(man\((\d+)\).*)$</string>
|
||||
<key>name</key>
|
||||
<string>string.source.man</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>captures</key>
|
||||
<dict>
|
||||
<key>1</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>constant.source.man</string>
|
||||
</dict>
|
||||
<key>2</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>storage.source.man</string>
|
||||
</dict>
|
||||
<key>3</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>keyword.source.man</string>
|
||||
</dict>
|
||||
<key>4</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>string.source.man</string>
|
||||
</dict>
|
||||
<key>5</key>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>constant.source.man</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>match</key>
|
||||
<string>^(\d\.\d(\.\d)?)(.+)(man\((\d+)\).*)$</string>
|
||||
<key>name</key>
|
||||
<string>string.source.man</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>match</key>
|
||||
<string>^[A-Z][A-Z\s]+\s$</string>
|
||||
<key>name</key>
|
||||
<string>keyword.source.man</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>scopeName</key>
|
||||
<string>source.man</string>
|
||||
<key>uuid</key>
|
||||
<string>f3ff3e8d-4f68-432c-af44-e00d6e15c81a</string>
|
||||
</dict>
|
||||
</plist>
|
||||
59
vendor/grammars/sublime_man_page_support/new_page.py
vendored
Normal file
59
vendor/grammars/sublime_man_page_support/new_page.py
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import sublime, sublime_plugin
|
||||
import os, time
|
||||
import subprocess
|
||||
|
||||
from sublime_lib.path import root_at_packages, get_package_name
|
||||
|
||||
class ManPagePreview(sublime_plugin.WindowCommand):
|
||||
def run(self):
|
||||
# exit if file is dirty, we can't run a man command against a file that doesn't exist
|
||||
if self.window.active_view().is_dirty():
|
||||
o = self.window.get_output_panel("manfail")
|
||||
o.run_command("insert_snippet", {"contents": "Unable to preview unsaved file."})
|
||||
self.window.run_command("show_panel", {"panel": "output.manfail"})
|
||||
return
|
||||
|
||||
# process document with groff
|
||||
curpath = self.window.active_view().file_name()
|
||||
c = subprocess.Popen(["groff", "-Tascii", "-man", curpath], stdout=subprocess.PIPE)
|
||||
output, err = c.communicate()
|
||||
|
||||
# run groff output through col to clean it up
|
||||
col = subprocess.Popen(["col", "-bx"], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
cleanout, err = col.communicate(output)
|
||||
|
||||
# write clean output to new window
|
||||
v = self.window.new_file()
|
||||
v.settings().set('default_dir', root_at_packages('User'))
|
||||
v.set_syntax_file('Packages/Man Page Support/man-preview.tmLanguage')
|
||||
e = v.begin_edit()
|
||||
p = v.text_point(0,0)
|
||||
v.insert(e, p, cleanout)
|
||||
v.end_edit(e)
|
||||
|
||||
class ManPageNewCommand(sublime_plugin.WindowCommand):
|
||||
def run(self):
|
||||
v = self.window.new_file()
|
||||
v.settings().set('default_dir', root_at_packages('User'))
|
||||
v.set_syntax_file('Packages/Man Page Support/man-groff.tmLanguage')
|
||||
|
||||
template = """.\\\" Manpage for ${1:<COMMAND>}.
|
||||
.\\\" Contact ${2:<AUTHOR_EMAIL>} to correct errors or typos.
|
||||
.TH man 8 "%s" "1.0" "${1:<COMMAND>}"
|
||||
.SH NAME
|
||||
${1:<COMMAND>}
|
||||
.SH SYNOPSIS
|
||||
.SY
|
||||
${1:<COMMAND>}
|
||||
.YS
|
||||
.SH DESCRIPTION
|
||||
${1:<COMMAND>}
|
||||
.SH BUGS
|
||||
No known bugs.
|
||||
.SH SEE ALSO
|
||||
.SH AUTHOR
|
||||
.MT ${2:<AUTHOR_EMAIL>}
|
||||
${3:<AUTHOR_NAME>}
|
||||
.ME
|
||||
""" %(time.strftime("%B %Y"))
|
||||
v.run_command("insert_snippet", {"contents": template})
|
||||
Reference in New Issue
Block a user