Skip to content

Commit

Permalink
Remove KaTeX from repository
Browse files Browse the repository at this point in the history
  • Loading branch information
tatetian committed Mar 26, 2015
1 parent f9f8792 commit 364dab7
Show file tree
Hide file tree
Showing 51 changed files with 46 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tex/
build/
node_modules/
static/katex/
npm-debug.log
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

build: lint build/pseudocode.min.js build/pseudocode.min.css

setup:
setup: setup-katex
npm install
mkdir -p build
ln -s ../static/fonts build/fonts
ln -s ../static/katex build/katex

setup-katex:
@rm -rf static/katex
cd static && wget https://github.com/Khan/KaTeX/releases/download/v0.2.0/katex.zip && unzip katex.zip
@rm -rf static/katex.zip

# Watch the changes to js source code and update the target js code
watch-js: pseudocode.js $(wildcard src/*.js)
Expand All @@ -21,18 +27,17 @@ lint: pseudocode.js $(wildcard src/*.js)
./node_modules/.bin/jshint $^

build/pseudocode.js: pseudocode.js $(wildcard src/*.js)
./node_modules/.bin/browserify $< --standalone pseudocode -o $@
./node_modules/.bin/browserify --exclude katex $< --standalone pseudocode -o $@

build/pseudocode.min.js: build/pseudocode.js
./node_modules/.bin/uglifyjs --mangle --beautify beautify=false < $< > $@

build/pseudocode.css: static/pseudocode.css
cp static/pseudocode.css build/pseudocode.css

build/pseudocode.min.css: build/pseudocode.css
./node_modules/.bin/cleancss -o $@ $<

build/pseudocode.css: static/pseudocode.css static/katex.min.css
cp static/katex.min.css build/pseudocode.css
cat static/pseudocode.css >> build/pseudocode.css

build/pseudocode: build/pseudocode.min.js build/pseudocode.min.css README.md
mkdir -p build/pseudocode
cp -r $^ build/pseudocode
Expand Down
3 changes: 2 additions & 1 deletion src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ Parser.prototype._parseAtom = function() {
if (tokenText === null) continue;

var anyWhitespace = this._lexer.get().whitespace;
return new AtomNode(atomType, tokenText.toLowerCase(), anyWhitespace);
if (atomType !== 'ordinary') tokenText = tokenText.toLowerCase();
return new AtomNode(atomType, tokenText, anyWhitespace);
}
return null;
};
Expand Down
13 changes: 8 additions & 5 deletions src/Renderer.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* */
var katex = require('katex');
var utils = require('./utils');

/*
Expand Down Expand Up @@ -52,8 +51,8 @@ TextStyle.prototype._fontCommandTable = {
// font-family
normalfont: { 'font-family': 'KaTeX_Main'},
rmfamily: { 'font-family': 'KaTeX_Main'},
sffamily: { 'font-family': 'KaTeX_SansSerif'},
ttfamily: { 'font-family': 'KaTeX_Typewriter'},
sffamily: { 'font-family': 'KaTeX_SansSerif_Replace'},
ttfamily: { 'font-family': 'KaTeX_Typewriter_Replace'},
// weight
bfseries: { 'font-weight': 'bold'},
mdseries: { 'font-weight': 'medium'},
Expand All @@ -67,8 +66,8 @@ TextStyle.prototype._fontCommandTable = {
// font-family
textnormal: { 'font-family': 'KaTeX_Main'},
textrm: { 'font-family': 'KaTeX_Main'},
textsf: { 'font-family': 'KaTeX_SansSerif'},
texttt: { 'font-family': 'KaTeX_Typewriter'},
textsf: { 'font-family': 'KaTeX_SansSerif_Replace'},
texttt: { 'font-family': 'KaTeX_Typewriter_Replace'},
// weight
textbf: { 'font-weight': 'bold'},
textmd: { 'font-weight': 'medium'},
Expand Down Expand Up @@ -162,6 +161,10 @@ TextEnvironment.prototype.renderToHTML = function() {
this._html.putText(text);
break;
case 'math':
if (!katex) {
try { katex = require('katex'); }
catch(e) { throw 'katex is required to render math'; }
}
var mathHTML = katex.renderToString(text);
this._html.putSpan(mathHTML);
break;
Expand Down
Binary file removed static/fonts/KaTeX_AMS-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_AMS-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_AMS-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_AMS-Regular.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Bold.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Bold.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Bold.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Bold.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Italic.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Italic.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Italic.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Italic.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Main-Regular.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-BoldItalic.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-BoldItalic.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-BoldItalic.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-BoldItalic.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Italic.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Italic.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Italic.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Italic.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Math-Regular.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size1-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size1-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size1-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size1-Regular.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size2-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size2-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size2-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size2-Regular.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size3-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size3-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size3-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size3-Regular.woff2
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size4-Regular.eot
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size4-Regular.ttf
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size4-Regular.woff
Binary file not shown.
Binary file removed static/fonts/KaTeX_Size4-Regular.woff2
Binary file not shown.
1 change: 0 additions & 1 deletion static/katex.min.css

This file was deleted.

24 changes: 20 additions & 4 deletions static/pseudocode.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@

@font-face{
font-family:KaTeX_Typewriter_Replace;
src:url(fonts/KaTeX_Typewriter-Regular.eot);
src:url(fonts/KaTeX_Typewriter-Regular.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_Typewriter-Regular.woff2) format('woff2'),url(fonts/KaTeX_Typewriter-Regular.woff) format('woff'),url(fonts/KaTeX_Typewriter-Regular.ttf) format('ttf');
font-weight:400;font-style:normal
}

@font-face{
font-family:KaTeX_SansSerif_Replace;
src:url(fonts/KaTeX_SansSerif-Bold.eot);
src:url(fonts/KaTeX_SansSerif-Bold.eot#iefix) format('embedded-opentype'),url(fonts/KaTeX_SansSerif-Bold.woff2) format('woff2'),url(fonts/KaTeX_SansSerif-Bold.woff) format('woff'),url(fonts/KaTeX_SansSerif-Bold.ttf) format('ttf');
font-weight:700;
font-style:normal
}

.ps-root {
font-family: KaTeX_Main;
font-family: KaTeX_Main, 'Times New Roman', Times, serif;
font-size: 1em;
font-weight: 100;
-webkit-font-smoothing: antialiased !important;
Expand All @@ -22,21 +38,21 @@
line-height: 1.2;
}
.ps-root .ps-funcname {
font-family: serif;
font-family: KaTeX_Main, 'Times New Roman', Times, serif;
font-weight: normal;
font-variant: small-caps;
font-style: normal;
text-transform: none;
}
.ps-root .ps-keyword {
font-family: KaTeX_Main;
font-family: KaTeX_Main, 'Times New Roman', Times, serif;
font-weight: bold;
font-variant: normal;
font-style: normal;
text-transform: none;
}
.ps-root .ps-comment {
font-family: KaTeX_Main;
font-family: KaTeX_Main, 'Times New Roman', Times, serif;
font-weight: normal;
font-variant: normal;
font-style: normal;
Expand Down
6 changes: 4 additions & 2 deletions static/test-suite.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../build/katex/katex.min.css" type="text/css">
<link rel="stylesheet" href="../build/pseudocode.css" type="text/css">
<script src="../build/katex/katex.min.js" type="text/javascript"></script>
<script src="../build/pseudocode.js" type="text/javascript"></script>
<title>Test suite of PseudoCode.js</title>
</head>
Expand All @@ -14,7 +16,7 @@
\PROCEDURE{Test-Declarations}{}
\STATE font families: {\sffamily sffamily, \ttfamily ttfamily, \normalfont normalfont, \rmfamily rmfamily.}
\STATE font weights: {normal weight, \bfseries bold, \mdseries
medium, \lfseries lighter. }after braces
medium, \lfseries lighter. }
\STATE font shapes: {\itshape itshape \scshape Small-Caps \slshape slshape \upshape upshape.}
\STATE font sizings: \tiny tiny \scriptsize scriptsize \footnotesize
footnotesize \small small \normalsize normal \large large \Large Large
Expand Down Expand Up @@ -82,7 +84,7 @@
\caption{Test statements and comments}
\begin{algorithmic}
\PROCEDURE{Test-Statements}{}
\STATE this is a normal statement
\STATE This is a normal statement
\PRINT \texttt{`this is print statement'}
\RETURN $retval$
\ENDPROCEDURE
Expand Down

0 comments on commit 364dab7

Please sign in to comment.