Update CodeMirror to version 5.49.0 (#8381)

* Update CodeMirror to version 5.49.0

* Update CodeMirror versions in librejs and VERSIONS
This commit is contained in:
oscar.lofwenhamn 2019-10-15 10:40:42 +02:00 committed by Lauris BH
parent 6fa14ac3c8
commit 1e9b330525
352 changed files with 14625 additions and 2451 deletions

View file

@ -6,10 +6,12 @@
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="../../addon/edit/closebrackets.js"></script>
<script src="../../addon/edit/matchbrackets.js"></script>
<script src="clojure.js"></script>
<style>.CodeMirror {background: #f8f8f8;}</style>
<div id=nav>
<a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a>
<ul>
<li><a href="../../index.html">Home</a>
@ -25,65 +27,67 @@
<article>
<h2>Clojure mode</h2>
<form><textarea id="code" name="code">
; Conway's Game of Life, based on the work of:
;; Laurent Petit https://gist.github.com/1200343
;; Christophe Grand http://clj-me.cgrand.net/2011/08/19/conways-game-of-life
(ns game-of-life
"Conway's Game of Life, based on the work of
Christophe Grand (http://clj-me.cgrand.net/2011/08/19/conways-game-of-life)
and Laurent Petit (https://gist.github.com/1200343).")
(ns ^{:doc "Conway's Game of Life."}
game-of-life)
;;; Core game of life's algorithm functions
;; Core game of life's algorithm functions
(defn neighbours
"Given a cell's coordinates, returns the coordinates of its neighbours."
(defn neighbors
"Given a cell's coordinates `[x y]`, returns the coordinates of its
neighbors."
[[x y]]
(for [dx [-1 0 1] dy (if (zero? dx) [-1 1] [-1 0 1])]
(for [dx [-1 0 1]
dy (if (zero? dx)
[-1 1]
[-1 0 1])]
[(+ dx x) (+ dy y)]))
(defn step
"Given a set of living cells, computes the new set of living cells."
"Given a set of living `cells`, computes the new set of living cells."
[cells]
(set (for [[cell n] (frequencies (mapcat neighbours cells))
:when (or (= n 3) (and (= n 2) (cells cell)))]
(set (for [[cell n] (frequencies (mapcat neighbors cells))
:when (or (= n 3)
(and (= n 2)
(cells cell)))]
cell)))
;; Utility methods for displaying game on a text terminal
;;; Utility methods for displaying game on a text terminal
(defn print-board
"Prints a board on *out*, representing a step in the game."
[board w h]
(doseq [x (range (inc w)) y (range (inc h))]
(if (= y 0) (print "\n"))
(print (if (board [x y]) "[X]" " . "))))
(defn print-grid
"Prints a `grid` of `w` columns and `h` rows, on *out*, representing a
step in the game."
[grid w h]
(doseq [x (range (inc w))
y (range (inc h))]
(when (= y 0) (println))
(print (if (grid [x y])
"[X]"
" . "))))
(defn display-grids
"Prints a squence of boards on *out*, representing several steps."
(defn print-grids
"Prints a sequence of `grids` of `w` columns and `h` rows on *out*,
representing several steps."
[grids w h]
(doseq [board grids]
(print-board board w h)
(print "\n")))
(doseq [grid grids]
(print-grid grid w h)
(println)))
;; Launches an example board
;;; Launches an example grid
(def
^{:doc "board represents the initial set of living cells"}
board #{[2 1] [2 2] [2 3]})
(def grid
"`grid` represents the initial set of living cells"
#{[2 1] [2 2] [2 3]})
(display-grids (take 3 (iterate step board)) 5 5)
;; Let's play with characters
(println \1 \a \# \\
\" \( \newline
\} \" \space
\tab \return \backspace
\u1000 \uAaAa \u9F9F)
;; Let's play with numbers
(+ 1 -1 1/2 -1/2 -0.5 0.5)
</textarea></form>
(print-grids (take 3 (iterate step grid)) 5 5)</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
autoCloseBrackets: true,
lineNumbers: true,
matchBrackets: true,
mode: 'text/x-clojure'
});
</script>
<p><strong>MIME types defined:</strong> <code>text/x-clojure</code>.</p>