Compare commits

...

13 Commits

Author SHA1 Message Date
Seppe Stas
8f86998866 Add some linguist-detectable attributes (#3806)
This allows to test a use-case where markdown should be reported
in the language stats (e.g because the main purpose of the repo is to
hold prose in markdown format) while HTML should be excluded from the
language stats (e.g because it's example output).
2017-09-19 18:02:05 +01:00
Adam Roben
d4c8fb8a28 Add some linguist-documentation attributes 2015-02-12 10:11:53 -05:00
Arfon Smith
351c1cc8fd Test fixture 2014-09-29 16:25:50 -05:00
Arfon Smith
7ee006cbcb Update .gitattributes
Adding some additional attributes for testing.
2014-09-29 15:05:20 -05:00
The rugged tests are fragile
525304738e Fake Gitattributes for testing 2014-09-11 13:26:26 +02:00
Arfon Smith
4a017d9033 Merge pull request #1509 from github/cut-release-v3.1.5
3.1.5
2014-09-05 13:58:58 -05:00
Arfon Smith
6f896d988f 3.1.5 2014-09-05 13:24:39 -05:00
Arfon Smith
35a9d241fc Samples 2014-09-05 13:23:10 -05:00
Arfon Smith
9ba0a7db64 Merge pull request #1506 from pchaigno/cgi-scripts
Add .cgi as an extension for Python and Bash
2014-09-05 13:21:33 -05:00
Arfon Smith
9968503872 Merge pull request #1508 from github/prolog-script
Scripty Prolog
2014-09-05 13:17:48 -05:00
Arfon Smith
34218c5f58 Scripty Prolog 2014-09-05 13:00:19 -05:00
Arfon Smith
ebd41f1f20 Merge pull request #1507 from github/cut-release-v3.1.4
3.1.4
2014-09-05 11:25:36 -05:00
Paul Chaignon
2dfb864e4e Add .cgi as an extension for Python and Bash 2014-09-04 20:32:45 -04:00
8 changed files with 258 additions and 54 deletions

9
.gitattributes vendored Normal file
View File

@@ -0,0 +1,9 @@
Gemfile linguist-vendored=true
lib/linguist.rb linguist-language=Java
test/*.rb linguist-language=Java
Rakefile linguist-generated
test/fixtures/* linguist-vendored=false
README.md linguist-documentation=false
samples/Arduino/* linguist-documentation
samples/Markdown/*.md linguist-detectable=true
samples/HTML/*.html linguist-detectable=false

View File

@@ -1841,6 +1841,7 @@ Python:
color: "#3581ba"
extensions:
- .py
- .cgi
- .gyp
- .lmi
- .pyde
@@ -2150,6 +2151,7 @@ Shell:
- .sh
- .bash
- .bats
- .cgi
- .tmux
- .zsh
interpreters:

View File

@@ -516,7 +516,8 @@
"Prolog": [
".ecl",
".pl",
".prolog"
".prolog",
".script!"
],
"Propeller Spin": [
".spin"
@@ -528,6 +529,7 @@
".purs"
],
"Python": [
".cgi",
".py",
".pyde",
".pyp",
@@ -624,6 +626,7 @@
],
"Shell": [
".bash",
".cgi",
".script!",
".sh",
".zsh"
@@ -851,8 +854,8 @@
"exception.zep.php"
]
},
"tokens_total": 659332,
"languages_total": 905,
"tokens_total": 659559,
"languages_total": 908,
"tokens": {
"ABAP": {
"*/**": 1,
@@ -55996,16 +55999,16 @@
"TWO_PI": 1
},
"Prolog": {
"-": 350,
"-": 354,
"module": 4,
"(": 1161,
"(": 1165,
"cpa_admin": 1,
"[": 290,
"[": 291,
"change_password_form//1": 1,
"]": 288,
")": 1158,
".": 232,
"use_module": 20,
"]": 289,
")": 1162,
".": 235,
"use_module": 21,
"user": 45,
"user_db": 1,
"library": 19,
@@ -56395,6 +56398,17 @@
"save": 1,
"with": 3,
"br": 1,
"SHEBANG#!swipl": 1,
"set_prolog_flag": 1,
"verbose": 1,
"silent": 1,
"dleak": 2,
"initialization": 1,
"main": 2,
"halt.": 1,
"current_prolog_flag": 1,
"argv": 1,
"File": 2,
"subset": 2,
"Set": 4,
"Subset": 6,
@@ -59062,6 +59076,86 @@
"entry.completed": 1
},
"Python": {
"SHEBANG#!python": 5,
"from": 37,
"model": 9,
"import": 59,
"Feed": 1,
"session": 1,
"datetime": 1,
"sys": 4,
"argv": 5,
"session.argv": 1,
"(": 859,
")": 871,
"feed": 1,
"Feed.get": 1,
"guid": 1,
"[": 168,
"]": 168,
"action": 5,
"if": 162,
"when": 4,
"feed.notify_interval": 1,
"*": 39,
"feed.notify_unit": 1,
"elif": 5,
"len": 12,
"int": 2,
"else": 35,
"print": 40,
"%": 34,
"sys.exit": 2,
"feed.notify_next": 1,
"datetime.datetime.utcnow": 1,
"+": 52,
"datetime.timedelta": 1,
"seconds": 1,
"feed.save": 1,
"response": 1,
"t": 9,
"be": 2,
"notified": 1,
"for": 70,
"another": 2,
"<span>": 1,
"class=": 2,
"{": 28,
"duration": 1,
"}": 28,
"</span>": 1,
".": 2,
"</p>": 3,
"<p>": 2,
"Actions": 1,
"<ul>": 1,
"<li>": 3,
"<a>": 4,
"href=": 4,
"Edit": 1,
"this": 3,
"reminder": 2,
"</a>": 4,
"</li>": 3,
"Create": 1,
"Visit": 1,
"the": 7,
"Reminder": 2,
"Me": 2,
"site": 1,
"</ul>": 1,
"</div>": 2,
"</body>": 1,
"</html>": 1,
"month": 1,
"week": 1,
"day": 1,
"hour": 1,
"minute": 1,
"second": 1,
"s": 2,
".join": 5,
"duration_list": 1,
"xspacing": 4,
"#": 28,
"How": 2,
@@ -59071,7 +59165,6 @@
"each": 1,
"horizontal": 1,
"location": 1,
"be": 1,
"spaced": 1,
"maxwaves": 3,
"total": 1,
@@ -59082,24 +59175,18 @@
"together": 1,
"theta": 3,
"amplitude": 3,
"[": 165,
"]": 165,
"Height": 1,
"wave": 2,
"dx": 8,
"yvalues": 7,
"def": 87,
"setup": 2,
"(": 850,
")": 861,
"size": 5,
"frameRate": 1,
"colorMode": 1,
"RGB": 1,
"w": 2,
"width": 1,
"+": 51,
"for": 69,
"i": 13,
"in": 91,
"range": 5,
@@ -59109,25 +59196,19 @@
"many": 1,
"pixels": 1,
"before": 1,
"the": 6,
"repeats": 1,
"dx.append": 1,
"TWO_PI": 1,
"/": 26,
"*": 38,
"_": 6,
"yvalues.append": 1,
"draw": 2,
"background": 2,
"calcWave": 2,
"renderWave": 2,
"len": 11,
"j": 7,
"x": 34,
"if": 160,
"%": 33,
"sin": 1,
"else": 33,
"cos": 1,
"noStroke": 2,
"fill": 2,
@@ -59137,14 +59218,11 @@
"enumerate": 2,
"ellipse": 1,
"height": 1,
"import": 55,
"os": 2,
"sys": 3,
"json": 1,
"c4d": 1,
"c4dtools": 1,
"itertools": 1,
"from": 36,
"c4d.modules": 1,
"graphview": 1,
"as": 14,
@@ -59158,9 +59236,7 @@
"__res__": 1,
"settings": 2,
"c4dtools.helpers.Attributor": 2,
"{": 27,
"res.file": 3,
"}": 27,
"align_nodes": 2,
"nodes": 11,
"mode": 5,
@@ -59171,7 +59247,6 @@
"return": 68,
"raise": 23,
"ValueError": 6,
".join": 4,
"get_0": 12,
"lambda": 6,
"x.x": 1,
@@ -59418,7 +59493,6 @@
"field.name": 14,
"base.__name__": 2,
"base._meta.abstract": 2,
"elif": 4,
"attr_name": 3,
"base._meta.module_name": 1,
"auto_created": 1,
@@ -59456,7 +59530,6 @@
"is_next": 9,
"cls.get_previous_in_order": 1,
"make_foreign_order_accessors": 2,
"model": 8,
"field.rel.to": 2,
"cls.__name__.lower": 2,
"method_get_order": 2,
@@ -59739,7 +59812,6 @@
"A": 1,
"which": 1,
"methods": 5,
"this": 2,
"pluggable": 1,
"view": 2,
"can": 1,
@@ -59751,7 +59823,6 @@
"based": 1,
"views": 1,
"as_view": 1,
".": 1,
"However": 1,
"since": 1,
"moves": 1,
@@ -59761,7 +59832,6 @@
"place": 1,
"where": 1,
"it": 1,
"s": 1,
"also": 1,
"used": 1,
"instantiating": 1,
@@ -59840,14 +59910,11 @@
"Person": 1,
"_message.Message": 1,
"_reflection.GeneratedProtocolMessageType": 1,
"SHEBANG#!python": 4,
"print": 39,
"main": 4,
"usage": 3,
"string": 1,
"command": 4,
"sys.argv": 2,
"sys.exit": 1,
"printDelimiter": 4,
"get": 1,
"a": 2,
@@ -59885,7 +59952,6 @@
"V": 12,
"np.genfromtxt": 8,
"delimiter": 8,
"t": 8,
"U_err": 7,
"offset": 13,
"np.mean": 1,
@@ -60032,7 +60098,6 @@
"help": 2,
"dest": 1,
"default": 1,
"action": 1,
"version": 6,
"parser.parse_args": 1,
"absolute_import": 1,
@@ -60120,7 +60185,6 @@
"connection": 5,
"content_length": 6,
"headers.get": 2,
"int": 1,
"self.stream.max_buffer_size": 1,
"self.stream.read_bytes": 1,
"self._on_request_body": 1,
@@ -63919,18 +63983,18 @@
"assert_checkfalse": 1
},
"Shell": {
"SHEBANG#!bash": 8,
"SHEBANG#!bash": 9,
"typeset": 5,
"-": 391,
"-": 397,
"i": 2,
"n": 22,
"n": 28,
"bottles": 6,
"no": 16,
"while": 3,
"[": 85,
"]": 85,
"do": 8,
"echo": 71,
"echo": 85,
"case": 9,
"{": 63,
"}": 61,
@@ -63988,7 +64052,7 @@
"long": 2,
"format...": 2,
"ll": 2,
"|": 17,
"|": 29,
"less": 2,
"XF": 2,
"pipe": 2,
@@ -64166,7 +64230,7 @@
"it": 2,
"pg": 2,
"patch": 2,
"sed": 2,
"sed": 14,
"awk": 2,
"diff": 2,
"grep": 8,
@@ -64651,6 +64715,12 @@
"#residual_args": 1,
"SHEBANG#!sh": 2,
"SHEBANG#!zsh": 2,
"day": 1,
"month": 1,
"year": 1,
"hour": 1,
"minute": 1,
"second": 1,
"name": 1,
"foodforthought.jpg": 1,
"name##*fo": 1
@@ -73186,11 +73256,11 @@
"PostScript": 107,
"PowerShell": 12,
"Processing": 74,
"Prolog": 6916,
"Prolog": 6948,
"Propeller Spin": 13519,
"Protocol Buffer": 63,
"PureScript": 1652,
"Python": 6587,
"Python": 6725,
"QMake": 119,
"R": 1790,
"RDoc": 279,
@@ -73212,7 +73282,7 @@
"Scaml": 4,
"Scheme": 3515,
"Scilab": 69,
"Shell": 3744,
"Shell": 3801,
"ShellSession": 233,
"Shen": 3472,
"Slash": 187,
@@ -73401,11 +73471,11 @@
"PostScript": 1,
"PowerShell": 2,
"Processing": 1,
"Prolog": 7,
"Prolog": 8,
"Propeller Spin": 10,
"Protocol Buffer": 1,
"PureScript": 4,
"Python": 10,
"Python": 11,
"QMake": 4,
"R": 7,
"RDoc": 1,
@@ -73427,7 +73497,7 @@
"Scaml": 1,
"Scheme": 2,
"Scilab": 3,
"Shell": 37,
"Shell": 38,
"ShellSession": 3,
"Shen": 3,
"Slash": 1,
@@ -73468,5 +73538,5 @@
"fish": 3,
"wisp": 1
},
"md5": "3778b7ad7414915c83e6960531006542"
"md5": "1a8591982ec28c592a742122734c142c"
}

View File

@@ -1,3 +1,3 @@
module Linguist
VERSION = "3.1.4"
VERSION = "3.1.5"
end

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env swipl
:- set_prolog_flag(verbose, silent).
:- use_module(dleak).
:- initialization
main, halt.
main :-
current_prolog_flag(argv, [File]),
dleak(File).

82
samples/Python/action.cgi Normal file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/python
from model import Feed
import session
import datetime
import sys
argv = session.argv()
feed = Feed.get(guid=argv[1])
action = argv[2]
if action == 'done':
when = feed.notify_interval * feed.notify_unit
elif action == 'snooze':
if len(argv) > 3:
when = int(argv[3])
else:
when = 3600
else:
print '''Status: 400 Bad request
Content-type: text/html
Unknown action %s''' % action
sys.exit(1)
feed.notify_next = datetime.datetime.utcnow() + datetime.timedelta(seconds=when)
feed.save()
response = '''Content-type: text/html
<html><head><title>Alarm reset</title>
<link rel="stylesheet" href="{base_url}/style.css">
</head>
<body>
<div class="container">
<h1>Alarm reset</h1>
<div>
<p id="reset">Alarm "<span class="name">{name}</span>" has been reset. You won't be notified for another <span class="duration">{duration}</span>.</p>
<p>Actions:</p>
<ul>
<li><a href="{edit_url}?feed={guid}">Edit this reminder</a></li>
<li><a href="{edit_url}">Create another reminder</a></li>
<li><a href="{base_url}">Visit the Reminder Me site</a></li>
</ul>
</div>
</div>
<p class="back"><a href=".">Reminder Me</a></p>
</body></html>'''
when_left = when
duration_list = []
for (label,period) in [('month',86400*365/12),
('week',86400*7),
('day',86400),
('hour',3600),
('minute',60),
('second',1)]:
if when == period:
duration_list = [label]
break
val = when_left/period
if val:
duration_list.append("%d %s%s" % (
val,
label,
val > 1 and 's' or ''))
when_left -= val*period
basedir=session.request_script_dir()
print response.format(guid=feed.guid,
name=feed.name,
edit_url="%s/edit.cgi" % basedir,
base_url=basedir,
duration=', '.join(duration_list))

27
samples/Shell/settime.cgi Normal file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
echo "Content-type: text/html"
day=`echo "$QUERY_STRING" | sed -n 's/^.*day=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
month=`echo "$QUERY_STRING" | sed -n 's/^.*month=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
year=`echo "$QUERY_STRING" | sed -n 's/^.*year=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
hour=`echo "$QUERY_STRING" | sed -n 's/^.*hour=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
minute=`echo "$QUERY_STRING" | sed -n 's/^.*minute=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
second=`echo "$QUERY_STRING" | sed -n 's/^.*second=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`
echo ""
echo "<html><body>"
echo "<pre> $(killall ems) </pre>"
echo "<pre> $(date $month$day$hour$minute$year.$second) </pre>"
echo "<pre> $(/sbin/hwclock -w>/dev/null & /sbin/reboot) </pre>"
echo "<pre> $(/sbin/reboot) </pre>"
echo "</body></html>"

3
test/fixtures/foo.rb Normal file
View File

@@ -0,0 +1,3 @@
def foo
return "BAR"
end