Skip to content

Commit

Permalink
Merge pull request #1 from azotova/cyrillicsMay2016
Browse files Browse the repository at this point in the history
Cyrillics may2016
  • Loading branch information
azotova committed May 13, 2016
2 parents 39f5bcb + a3f9582 commit 71df982
Show file tree
Hide file tree
Showing 267 changed files with 8,789 additions and 8,365 deletions.
3 changes: 2 additions & 1 deletion .arcconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"project_id": "KaTeX",
"conduit_uri": "https://phabricator.khanacademy.org/"
"conduit_uri": "https://phabricator.khanacademy.org/",
"lint.engine": "ArcanistConfigurationDrivenLintEngine"
}
9 changes: 9 additions & 0 deletions .arclint
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"linters": {
"katex-linter": {
"type": "script-and-regex",
"script-and-regex.script": "make lint || true",
"script-and-regex.regex": "/^(?P<file>\\S+): line (?P<line>\\d+), col \\d+, (?P<message>.*)$/m"
}
}
}
86 changes: 86 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"rules": {
"arrow-spacing": 2,
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
// We'd possibly like to remove the 'properties': 'never' one day.
"camelcase": [2, { "properties": "never" }],
"comma-dangle": [2, "always-multiline"],
"comma-spacing": [2, { "before": false, "after": true }],
"constructor-super": 2,
"curly": 2,
"eol-last": 2,
"eqeqeq": [2, "allow-null"],
"guard-for-in": 2,
"indent": [2, 4, {"SwitchCase": 1}],
"linebreak-style": [2, "unix"],
"max-len": [2, 80, 4, { "ignoreUrls": true, "ignorePattern": "\\brequire\\([\"']|eslint-disable" }],
"no-alert": 2,
"no-array-constructor": 2,
"no-console": 2,
"no-const-assign": 2,
"no-debugger": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-extra-bind": 2,
"no-new": 2,
"no-new-func": 2,
"no-new-object": 2,
"no-spaced-func": 2,
"no-this-before-super": 2,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undef": 2,
"no-unexpected-multiline": 2,
"no-unreachable": 2,
"no-unused-vars": [2, {"args": "none", "varsIgnorePattern": "^_*$"}],
"no-useless-call": 2,
"no-with": 2,
"one-var": [2, "never"],
"prefer-const": 2,
"prefer-spread": 2,
"semi": [2, "always"],
"space-after-keywords": 2,
"space-before-blocks": 2,
"space-before-function-paren": [2, "never"],
"space-before-keywords": 2,
"space-infix-ops": 2,
"space-return-throw-case": 2,
"space-unary-ops": 2,
// ---------------------------------------
// Stuff we explicitly disable.
// We turned this off because it complains when you have a
// multi-line string, which I think is going too far.
"prefer-template": 0,
// We've decided explicitly not to care about this.
"arrow-parens": 0,
// ---------------------------------------
// Stuff that's disabled for now, but maybe shouldn't be.
// disabled because KaTeX doesn't use ES6
"no-var": 0,
// TODO(csilvers): enable these if/when community agrees on it.
"prefer-arrow-callback": 0,
"object-curly-spacing": [0, "always"],
// Might be nice to turn this on one day, but since we don't
// use jsdoc anywhere it seems silly to require it yet.
"valid-jsdoc": 0,
"require-jsdoc": 0
},
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"destructuring": true,
"experimentalObjectRestSpread": true,
"forOf": true,
"jsx": true,
"restParams": true,
"spread": true,
"templateStrings": true
},
"env": {
// "es6": true,
"node": true,
"browser": true
},
"extends": "eslint:recommended"
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ node_modules
npm-debug.log
last.png
diff.png
/test/screenshotter/tex/
/test/screenshotter/diff/
/test/symgroups.tex
/test/symgroups.aux
/test/symgroups.log
/test/symgroups.pdf
67 changes: 0 additions & 67 deletions .jshintrc

This file was deleted.

13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
language: node_js
node_js:
- "0.11"
- "0.10"
- stable
sudo: required
services:
- docker
before_script:
- docker pull selenium/standalone-firefox:2.48.2
- docker pull selenium/standalone-chrome:2.48.2
- docker images --no-trunc
script:
- npm test
- dockers/Screenshotter/screenshotter.sh --verify
24 changes: 19 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@

We welcome pull requests to KaTeX. If you'd like to add a new symbol, or try to
tackle adding a larger feature, keep reading. If you have any questions, or want
help solving a problem, feel free to stop by the [#katex room on
freenode](http://webchat.freenode.net/?channels=katex).
help solving a problem, feel free to stop by our [gitter channel](https://gitter.im/Khan/KaTeX).

## Helpful contributions

If you'd like to contribute, try contributing new symbols or functions that
KaTeX doesn't currently support. The wiki has a page which lists [all of the
supported
functions](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX). You
can check there to see if we don't support a function you like, or try your
functions](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX) as
well as a page that describes how to [examine TeX commands and where to find
rules](https://github.com/Khan/KaTeX/wiki/Examining-TeX) which can be quite
useful when adding new commands. There's also a user-contributed [preview page]
(http://utensil-site.github.io/available-in-katex/)
showing how KaTeX would render a series of symbols/functions (including the ones
MathJax listed in their documentation and the extra ones supported by KaTeX). You
can check them to see if we don't support a function you like, or try your
function in the interactive demo at
[http://khan.github.io/KaTeX/](http://khan.github.io/KaTeX/).

Expand Down Expand Up @@ -83,7 +88,7 @@ changed and why. Otherwise, figure out what is causing the changes and fix it!

If you add a feature that is dependent on the final output looking the way you
created it, add a screenshot test. See
[ss_data.json](test/screenshotter/ss_data.json).
[ss_data.yaml](test/screenshotter/ss_data.yaml).

#### Testing in other browsers

Expand All @@ -100,9 +105,18 @@ Code
- 80 character line length
- commas last
- declare variables in the outermost scope that they are used
- camelCase for variables in JavaScript
- snake_case for variables in Python

In general, try to make your code blend in with the surrounding code.

## Pull Requests

- link back to the original issue(s) whenever possible
- new commands should be added to the [wiki](https://github.com/Khan/KaTeX/wiki/Function-Support-in-KaTeX)
- commits should be squashed before merging
- large pull requests should be broken into separate pull requests (or multiple logically cohesive commits), if possible

## CLA

In order to contribute to KaTeX, you must first sign the CLA, found at www.khanacademy.org/r/cla
Expand Down
10 changes: 8 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
The MIT License (MIT)

Copyright (c) 2014 Khan Academy
Copyright (c) 2015 Khan Academy

This software also uses portions of the underscore.js project, which is
MIT licensed with the following copyright:

Copyright (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative
Reporters & Editors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +24,4 @@ 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.
SOFTWARE.
50 changes: 40 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
.PHONY: build lint setup copy serve clean metrics test zip
build: setup lint build/katex.min.js build/katex.min.css zip compress
.PHONY: build dist lint setup copy serve clean metrics test zip contrib
build: lint build/katex.min.js build/katex.min.css contrib zip compress

dist: build
rm -rf dist/
cp -R build/katex/ dist/

# Export these variables for use in contrib Makefiles
export BUILDDIR = $(realpath build)
export BROWSERIFY = $(realpath ./node_modules/.bin/browserify)
export UGLIFYJS = $(realpath ./node_modules/.bin/uglifyjs) \
--mangle \
--beautify \
ascii_only=true,beautify=false

setup:
npm install

lint: katex.js $(wildcard src/*.js)
./node_modules/.bin/jshint $^
lint: katex.js server.js cli.js $(wildcard src/*.js) $(wildcard test/*.js) $(wildcard contrib/*/*.js) $(wildcard dockers/*/*.js)
./node_modules/.bin/eslint $^

build/katex.js: katex.js $(wildcard src/*.js)
./node_modules/.bin/browserify $< --standalone katex > $@
$(BROWSERIFY) $< --standalone katex > $@

build/katex.min.js: build/katex.js
./node_modules/.bin/uglifyjs --mangle --beautify ascii_only=true,beautify=false < $< > $@
$(UGLIFYJS) < $< > $@

build/katex.less.css: static/katex.less $(wildcard static/*.less)
./node_modules/.bin/lessc $< $@
Expand All @@ -27,15 +39,27 @@ build/fonts:
cp static/fonts/$$font* $@; \
done

contrib: build/contrib

.PHONY: build/contrib
build/contrib:
mkdir -p build/contrib
@# Since everything in build/contrib is put in the built files, make sure
@# there's nothing in there we don't want.
rm -rf build/contrib/*
$(MAKE) -C contrib/auto-render

.PHONY: build/katex
build/katex: build/katex.min.js build/katex.min.css build/fonts README.md
build/katex: build/katex.min.js build/katex.min.css build/fonts README.md build/contrib
mkdir -p build/katex
rm -rf build/katex/*
cp -r $^ build/katex

build/katex.tar.gz: build/katex
cd build && tar czf katex.tar.gz katex/

build/katex.zip: build/katex
rm -f $@
cd build && zip -rq katex.zip katex/

zip: build/katex.tar.gz build/katex.zip
Expand All @@ -52,13 +76,19 @@ serve:
node server.js

test:
./node_modules/.bin/jasmine-node test/katex-spec.js
JASMINE_CONFIG_PATH=test/jasmine.json node_modules/.bin/jasmine

PERL=perl
PYTHON=$(shell python2 --version >/dev/null 2>&1 && echo python2 || echo python)

metrics:
cd metrics && ./mapping.pl | ./extract_tfms.py | ./extract_ttfs.py | ./replace_line.py
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py > ../src/fontMetricsData.js

extended_metrics:
cd metrics && $(PERL) ./mapping.pl | $(PYTHON) ./extract_tfms.py | $(PYTHON) ./extract_ttfs.py | $(PYTHON) ./format_json.py --width > ../src/fontMetricsData.js

clean:
rm -rf build/*

screenshots:
docker run --volume=$(shell pwd):/KaTeX ss
dockers/Screenshotter/screenshotter.sh
Loading

0 comments on commit 71df982

Please sign in to comment.