aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/sphinx/_static/notations.js
blob: eb7f211e8b78b6e9210c4af858c65d52e45f4dbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/************************************************************************/
/*         *   The Coq Proof Assistant / The Coq Development Team       */
/*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       */
/* <O___,, *       (see CREDITS file for the list of authors)           */
/*   \VV/  **************************************************************/
/*    //   *    This file is distributed under the terms of the         */
/*         *     GNU Lesser General Public License Version 2.1          */
/*         *     (see LICENSE file for the text of the license)         */
/************************************************************************/
function annotateSup(marker) {
    switch (marker) {
    case "?":
        return "This block is optional.";
    case "*":
        return "This block is optional, and may be repeated.";
    case "+":
        return "This block may be repeated.";
    }
}

function annotateSub(separator) {
    return "Use “" + separator + "” to separate repetitions of this block.";
}

// function translatePunctuation(original) {
//     var mappings = { ",": "⸴" }; // ,
//     return mappings[original] || original;
// }

function annotateNotations () {
    $(".repeat-wrapper > sup")
        .attr("data-hint", function() {
            return annotateSup($(this).text());
        }).addClass("hint--top hint--rounded");

    $(".repeat-wrapper > sub")
        .attr("data-hint", function() {
            return annotateSub($(this).text());
        }).addClass("hint--bottom hint--rounded");
    //.text(function(i, text) { return translatePunctuation(text); });
}

$(annotateNotations);