Skip to content

Commit

Permalink
Merge pull request github-linguist#3126 from Alhadis/roff
Browse files Browse the repository at this point in the history
Improve Roff support / Add RUNOFF to recognised languages
  • Loading branch information
larsbrinkhoff authored Jul 29, 2016
2 parents b871460 + abfe89d commit 1466b70
Show file tree
Hide file tree
Showing 13 changed files with 12,506 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@
[submodule "vendor/grammars/bro-sublime"]
path = vendor/grammars/bro-sublime
url = https://github.com/bro/bro-sublime
[submodule "vendor/grammars/sublime_man_page_support"]
path = vendor/grammars/sublime_man_page_support
url = https://github.com/carsonoid/sublime_man_page_support
[submodule "vendor/grammars/sublime-MuPAD"]
path = vendor/grammars/sublime-MuPAD
url = https://github.com/ccreutzig/sublime-MuPAD
Expand Down Expand Up @@ -755,3 +752,6 @@ url = https://github.com/austinwagner/sublime-sourcepawn
[submodule "vendor/grammars/SublimeGDB"]
path = vendor/grammars/SublimeGDB
url = https://github.com/quarnster/SublimeGDB
[submodule "vendor/grammars/language-roff"]
path = vendor/grammars/language-roff
url = https://github.com/Alhadis/language-roff
6 changes: 3 additions & 3 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,9 @@ vendor/grammars/language-renpy:
- source.renpy
vendor/grammars/language-restructuredtext:
- text.restructuredtext
vendor/grammars/language-roff:
- text.roff
- text.runoff
vendor/grammars/language-shellscript:
- source.shell
- text.shell-session
Expand Down Expand Up @@ -593,9 +596,6 @@ vendor/grammars/sublime_cobol:
- source.cobol
- source.jcl
- source.opencobol
vendor/grammars/sublime_man_page_support:
- source.man
- text.groff
vendor/grammars/sublimeassembly/:
- source.assembly
vendor/grammars/sublimeprolog/:
Expand Down
8 changes: 8 additions & 0 deletions lib/linguist/heuristics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,14 @@ def call(data)
end
end

disambiguate ".rno" do |data|
if /^\.!|^\.end lit(?:eral)?\b/i.match(data)
Language["RUNOFF"]
elsif /^\.\\" /.match(data)
Language["Groff"]
end
end

disambiguate ".rpy" do |data|
if /(^(import|from|class|def)\s)/m.match(data)
Language["Python"]
Expand Down
16 changes: 15 additions & 1 deletion lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1411,9 +1411,14 @@ Groff:
- .n
- .rno
- .roff
tm_scope: text.groff
- .tmac
filenames:
- mmn
- mmt
tm_scope: text.roff
aliases:
- nroff
- troff
ace_mode: text

Groovy:
Expand Down Expand Up @@ -3171,6 +3176,15 @@ RMarkdown:
- .rmd
tm_scope: source.gfm

RUNOFF:
type: markup
color: "#665a4e"
extensions:
- .rnh
- .rno
tm_scope: text.runoff
ace_mode: text

Racket:
type: programming
color: "#22228f"
Expand Down
215 changes: 215 additions & 0 deletions samples/Groff/an-ext.tmac
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
.\" -*- nroff -*-
.\"
.\" an-ext.tmac
.\"
.\" Copyright (C) 2007-2014 Free Software Foundation, Inc.
.\"
.\" Written by Eric S. Raymond <[email protected]>
.\" Werner Lemberg <[email protected]>
.\"
.\" You may freely use, modify and/or distribute this file.
.\"
.\" The code below provides extension macros for the `man' macro package.
.\" Care has been taken to make the code portable; groff extensions are
.\" properly hidden so that all troff implementations can use it without
.\" changes.
.\"
.\" With groff, this file is sourced by the `man' macro package itself.
.\" Man page authors who are concerned about portability might add the
.\" used macros directly to the prologue of the man page(s).
.
.
.\" 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
. do ds mF \\n[.fam]
. nr mE \\n(.f
. nf
. nh
. do fam C
. ft CW
..
.
.
.\" End example.
.de EE
. do fam \\*(mF
. ft \\n(mE
. fi
. hy \\n(HY
..
.
.
.\" Start display.
.de DS
. \" XXX to be written
..
.
.
.\" End display.
.de DE
. \" XXX to be written
..
.
.\" EOF
35 changes: 35 additions & 0 deletions samples/Groff/refs.rno
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.\" Copyright (c) 1980 Regents of the University of California.
.\" All rights reserved. The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\" @(#)refs.rno 6.1 (Berkeley) 4/29/86
.\"
.NS 1 "References"
.sp
.ip "[Bac78]"
John Backus, \*(lqCan Programming Be Liberated from the von Neumann Style?
A Functional Style and Its Algebra of Programs,\*(rq \fICACM\fP, Turing
Award Lecture, 21, 8 (August 1978), 613-641.
.sp 6p
.ip "[Fod80]"
John K. Foderaro, \*(lqThe \s-2FRANZ LISP\s+2
Manual,\*(rq University of California,
Berkeley, California, 1980.
.sp 6p
.ip "[Joy79]"
W.N. Joy, O. Babaoglu, \*(lqUNIX Programmer's Manual,\*(rq November 7,
1979, Computer Science Division, University of California, Berkeley,
California.
.sp 6p
.ip "[Mc60]"
J. McCarthy, \*(lqRecursive Functions of Symbolic expressions and their
Computation by Machine,\*(rq Part I, \fICACM\fP 3, 4 (April 1960), 184-195.
.sp 6p
.ip "[Pat80]"
Dorab Ratan Patel, \*(lqA System Organization for Applicative Programming,\*(rq
M.S Thesis, University of California, Los Angeles, California, 1980.
.sp 6p
.ip "[Pat81]"
Dorab Patel, \*(lqFunctional Language Interpreter User Manual,\*(rq
University of California, Los Angeles, California, 1981.
.bp
Loading

0 comments on commit 1466b70

Please sign in to comment.