Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Mar 30, 2019
2 parents d9ebd33 + 5ea9d89 commit ef6678a
Show file tree
Hide file tree
Showing 69 changed files with 3,746 additions and 31,993 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "document/core/util/katex"]
path = document/core/util/katex
url = https://github.com/Khan/KaTeX.git
url = https://github.com/KaTeX/KaTeX.git
1 change: 1 addition & 0 deletions document/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ bikeshed:
mkdir -p $(BUILDDIR)/bikeshed_mathjax/
bikeshed spec index.bs $(BUILDDIR)/bikeshed_mathjax/index.html
mkdir -p $(BUILDDIR)/html/bikeshed/
(cd util/katex/ && npm install --only=prod)
python util/mathjax2katex.py $(BUILDDIR)/bikeshed_mathjax/index.html \
>$(BUILDDIR)/html/bikeshed/index.html
mkdir -p $(BUILDDIR)/html/bikeshed/katex/dist/
Expand Down
2 changes: 1 addition & 1 deletion document/core/appendix/index-instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Instruction Binary Opcode Type
:math:`\NOP` :math:`\hex{01}` :math:`[] \to []` :ref:`validation <valid-nop>` :ref:`execution <exec-nop>`
:math:`\BLOCK~[t^?]` :math:`\hex{02}` :math:`[] \to [t^\ast]` :ref:`validation <valid-block>` :ref:`execution <exec-block>`
:math:`\LOOP~[t^?]` :math:`\hex{03}` :math:`[] \to [t^\ast]` :ref:`validation <valid-loop>` :ref:`execution <exec-loop>`
:math:`\IF~[t^?]` :math:`\hex{04}` :math:`[] \to [t^\ast]` :ref:`validation <valid-if>` :ref:`execution <exec-if>`
:math:`\IF~[t^?]` :math:`\hex{04}` :math:`[\I32] \to [t^\ast]` :ref:`validation <valid-if>` :ref:`execution <exec-if>`
:math:`\ELSE` :math:`\hex{05}`
(reserved) :math:`\hex{06}`
(reserved) :math:`\hex{07}`
Expand Down
2 changes: 1 addition & 1 deletion document/core/exec/numerics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ When a number is stored into :ref:`memory <syntax-mem>`, it is converted into a
\begin{array}{lll@{\qquad}l}
\bytes_t(i) &=& \littleendian(\bits_t(i)) \\[1ex]
\littleendian(\epsilon) &=& \epsilon \\
\littleendian(d_1^8~d_2^{N-8}) &=& \ibits_8^{-1}(d_1^8)~\littleendian(d_2^{N-8}) \\
\littleendian(d^8~{d'}^\ast~) &=& \littleendian({d'}^\ast)~\ibits_8^{-1}(d^8) \\
\end{array}
Again these functions are invertable bijections.
Expand Down
4 changes: 2 additions & 2 deletions document/core/syntax/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ For each type, several subcategories can be distinguished:
* *Comparisons*: consume two operands of the respective type and produce a Boolean integer result.

* *Conversions*: consume a value of one type and produce a result of another
(the source type of the conversion is the one after the ":math:`\K{/}`").
(the source type of the conversion is the one after the ":math:`\K{\_}`").

Some integer instructions come in two flavors,
where a signedness annotation |sx| distinguishes whether the operands are to be :ref:`interpreted <aux-signed>` as :ref:`unsigned <syntax-uint>` or :ref:`signed <syntax-sint>` integers.
Expand Down Expand Up @@ -377,7 +377,7 @@ In case of |LOOP| it is a *backward jump* to the beginning of the loop.

.. note::
This enforces *structured control flow*.
Intuitively, a branch targeting a |BLOCK| or |IF| behaves like a :math:`\K{break}` statement,
Intuitively, a branch targeting a |BLOCK| or |IF| behaves like a :math:`\K{break}` statement in most C-like languages,
while a branch targeting a |LOOP| behaves like a :math:`\K{continue}` statement.

Branch instructions come in several flavors:
Expand Down
2 changes: 1 addition & 1 deletion document/core/util/katex
Submodule katex updated 557 files
37 changes: 20 additions & 17 deletions document/core/util/katex_fix.patch
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
113c113
< .katex-display {
---
> div > .katex-display {
123c123,126
< font: normal 1.21em KaTeX_Main, Times New Roman, serif;
---
> /* font: normal 1.21em KaTeX_Main, Times New Roman, serif; */
> font-weight: normal;
> font-size: 1.21em;
> font-family: KaTeX_Main, Times New Roman, serif;
127d129
126d128
< text-rendering: auto;
133c135
< display: inline-block;
989c991
< .katex-display {
---
> div > .katex-display {
994c996
< .katex-display > .katex {
---
> div > .katex-display > .katex {
999c1001
< .katex-display > .katex > .katex-html {
---
> div > .katex-display > .katex > .katex-html {
1003c1005
< .katex-display > .katex > .katex-html > .tag {
---
> div > .katex-display > .katex > .katex-html > .tag {
1007c1009,1022
<
---
> /* display: inline-block; */
1060,1065d1061
< .katex svg path {
< fill: currentColor;
< }
< .katex svg line {
< stroke: currentColor;
< }
1142a1139,1152
> }
> /* Force borders on tables */
> table {
> border-collapse: collapse;
Expand All @@ -37,3 +39,4 @@
> }
> .codepre {
> white-space: pre;
> }
13 changes: 4 additions & 9 deletions document/core/util/mathjax2katex.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@


SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
# Update this to invalidate the cache; e.g. when updating katex.
CACHE_VERSION = 2


def FindMatching(data, prefix):
Expand Down Expand Up @@ -67,7 +69,7 @@ def ReplaceMath(cache, data):
data = data.replace('’', '\\text{’}')
data = data.replace('‘', '\\text{‘}')
data = data.replace('\\hfill', '')
data = data.replace('\\mbox', '\\mathrel')
data = data.replace('\\mbox', '\\text')
data = data.replace('\\begin{split}', '\\begin{aligned}')
data = data.replace('\\end{split}', '\\end{aligned}')
data = data.replace('&amp;', '&')
Expand Down Expand Up @@ -121,13 +123,6 @@ def ReplaceMath(cache, data):
# Fix stray spans that come out of katex.
ret = re.sub('[<]span class="vlist" style="height:[0-9.]+em;"[>]',
'<span class="vlist">', ret)
# Drop bad italic font adjustment.
# https://github.com/WebAssembly/spec/issues/669
# https://github.com/Khan/KaTeX/issues/1259
ret = re.sub(
'mathit" style="margin-right:0.[0-9]+em', 'mathit" style="', ret)
ret = re.sub(
'mainit" style="margin-right:0.[0-9]+em', 'mathit" style="', ret)
assert HasBalancedTags(ret)

cache[data] = ret
Expand All @@ -152,7 +147,7 @@ def ExtractMath(match):
return 'x' * len(match.group())

data = open(sys.argv[1]).read()
cache = shelve.open(sys.argv[1] + '.cache')
cache = shelve.open('%s.%d.cache' % (sys.argv[1], CACHE_VERSION))
# Drop index + search links.
data = data.replace(
'<link href="genindex.html" rel="index" title="Index">', '')
Expand Down
Loading

0 comments on commit ef6678a

Please sign in to comment.