Compare commits
1031 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c714e7687 | |||
| 6c3523d61c | |||
| 183840b793 | |||
| 4e2856aa64 | |||
| 4627a39165 | |||
| c87cbe83d2 | |||
| f05282badf | |||
| 957879346e | |||
| 87e64f67f3 | |||
| 43840d246d | |||
| 4aeb9af8a7 | |||
| b37acb8bc6 | |||
| 433865e927 | |||
| 5428161e0f | |||
| db0b536b5b | |||
| a4e50908fb | |||
| 96b89fe83d | |||
| adb131f131 | |||
| 757ab87e8a | |||
| f1d1db1159 | |||
| 3942bf60a6 | |||
| e2c0dcc0da | |||
| f63180d8d8 | |||
| 999bbf3d50 | |||
| eab612bdd0 | |||
| 1147186b4c | |||
| a88314e061 | |||
| 9221f5528d | |||
| 520f60cd65 | |||
| 84c85774e8 | |||
| 1f118deed9 | |||
| 55ce07ae73 | |||
| 85677d5e91 | |||
| 04f9be15b8 | |||
| 09cd72a829 | |||
| f5f5ad70e3 | |||
| a0774b320a | |||
| 4feea6051a | |||
| f548ea757b | |||
| abc8ea5280 | |||
| bacd2313fb | |||
| 63295d3f9b | |||
| 9c25eb20cf | |||
| 7f533f33ae | |||
| 352b4e1ed8 | |||
| 9a4252b579 | |||
| ed7011c229 | |||
| 4ddd6a5207 | |||
| 0a74c7cfd2 | |||
| d84fdc7599 | |||
| dac1268266 | |||
| b42db1c7c1 | |||
| 7a7a27c5c7 | |||
| af83186b10 | |||
| a8646f8fe7 | |||
| 01c1e30284 | |||
| b3980f9e39 | |||
| c9fd50d23e | |||
| ea3544f46d | |||
| 4e04f5f540 | |||
| b1021cf233 | |||
| 8fa3529123 | |||
| 3b494c235a | |||
| 1641c3e3e8 | |||
| ccd5d850ac | |||
| b989f160cf | |||
| 54e144564c | |||
| ab8599da6d | |||
| 0885702873 | |||
| 0083bc9302 | |||
| cbc0821928 | |||
| 7a70169d06 | |||
| bf2377ac11 | |||
| 1f79126b27 | |||
| 624e324383 | |||
| 846ebb285e | |||
| e567759935 | |||
| fe706c184e | |||
| 90bbb8e348 | |||
| e21ec540c2 | |||
| 2a4517ced4 | |||
| 8c8d151b3e | |||
| 44a3cf1934 | |||
| 5dcd3c8c8f | |||
| 251bd7cd3d | |||
| 02dfb0a8c1 | |||
| 544d499ab1 | |||
| 8ebc2f7079 | |||
| a31ba16070 | |||
| 60e3baad8a | |||
| f720a84831 | |||
| b74b2c4399 | |||
| 252aa10d75 | |||
| 6f3d362920 | |||
| 9b54e4c79f | |||
| f908d0d170 | |||
| 852ecdd1a9 | |||
| 78f5df5e56 | |||
| 580a61a515 | |||
| 4faf5a0150 | |||
| 1201d2434a | |||
| e1ca392da6 | |||
| 3ee6d22727 | |||
| 28a0329f65 | |||
| 2dc696c940 | |||
| e3acef0e91 | |||
| 62601f1adc | |||
| 982915a22f | |||
| 9f1bbd097f | |||
| 694bd6e74a | |||
| 394cf0bc8e | |||
| 09257deaae | |||
| 21c4b0dd95 | |||
| 3b4662b583 | |||
| 2e2e6457c7 | |||
| 631a7cccd6 | |||
| 2a3d51c7dc | |||
| e7e8a17b61 | |||
| 8fd8a56893 | |||
| 443c453507 | |||
| 0495c89ba1 | |||
| 78e4dfbece | |||
| 1c7a481ed9 | |||
| c3dedcbba5 | |||
| 1c767a0e9f | |||
| f3b0ba49e0 | |||
| 31dfcbaa9e | |||
| 8e11c5f46d | |||
| 70793ff559 | |||
| 6621e71e6c | |||
| 2af164ee9e | |||
| 9227f0a195 | |||
| f18330b494 | |||
| bb32339ab4 | |||
| ddf4378dfe | |||
| 2a607e209b | |||
| a3d85ae8c3 | |||
| fef62b63cb | |||
| 93ec80f773 | |||
| 8e3795c317 | |||
| cb1a633dc5 | |||
| ace4db6938 | |||
| b770062788 | |||
| 4c4dc5398a | |||
| 091945152f | |||
| 4838611273 | |||
| 144f9959c9 | |||
| 291c6a8fa0 | |||
| d5d3581b78 | |||
| 64d90b027c | |||
| a0e9989734 | |||
| b81aa923d6 | |||
| 610925bc5a | |||
| 86eda9bb10 | |||
| ca06aa9a6f | |||
| ca57d9e83d | |||
| 904f975f0c | |||
| 9b9212cf4c | |||
| 404419d1c3 | |||
| 4ee94a6574 | |||
| f929df0419 | |||
| 57587dafbe | |||
| 31a95e81b3 | |||
| 70a4e9551b | |||
| e1a705f975 | |||
| 9057ec82d8 | |||
| 1b53e36666 | |||
| 10fa5c7bd2 | |||
| 06e72a5a60 | |||
| 8fa62fc300 | |||
| 6c345fc508 | |||
| a34eac4ecb | |||
| 10c121e603 | |||
| 2b910167f4 | |||
| 7d5311a075 | |||
| f5581c4b49 | |||
| e09f7cd49c | |||
| 4dab03b61b | |||
| 2b5e017aa1 | |||
| 8b3d944fd2 | |||
| 2d886fd38a | |||
| 80088832b9 | |||
| be1883f317 | |||
| 30119e0c77 | |||
| c90c3b1544 | |||
| 578386f083 | |||
| 3d21ed362e | |||
| 9cf469b035 | |||
| 462c93ae43 | |||
| bda3b7b24d | |||
| d861a22cdd | |||
| 0de1a182da | |||
| b030554348 | |||
| 858bfa9ccd | |||
| ee8ec78da7 | |||
| c8f684895c | |||
| 138a155ba4 | |||
| ad749bf345 | |||
| ff0d59c16b | |||
| df75d2d60c | |||
| 2713aabeaf | |||
| 796d1b44c2 | |||
| 470a7b8f52 | |||
| f699b82a9f | |||
| 44edb8c7da | |||
| bc4fc0edd9 | |||
| 6545fa691b | |||
| 4954553927 | |||
| 9c50ba9eeb | |||
| 9a67da145a | |||
| ca7d82278c | |||
| f6245c53dd | |||
| 6888420cc6 | |||
| c5631f5b7d | |||
| 34e0b49d72 | |||
| bd072264ef | |||
| cfb2d24c71 | |||
| fe0eb72fa3 | |||
| 2783257f06 | |||
| cc11cb866c | |||
| 6a02643bda | |||
| 7f269c8da3 | |||
| ef7f7cebd1 | |||
| 05c24fd5e3 | |||
| b08b97bd28 | |||
| dbb6ce2f71 | |||
| f66f14b593 | |||
| 8a52315dee | |||
| 7c4052906c | |||
| 3a56f39f6a | |||
| 6585ca5dd0 | |||
| 792abae07e | |||
| 74ce648c59 | |||
| 2686e96046 | |||
| 213e2bb432 | |||
| 79bb5c10ab | |||
| 7ea012d786 | |||
| 43591f75de | |||
| 05d82c0569 | |||
| 76c8d3206c | |||
| 00751d05b4 | |||
| b5be5df11a | |||
| 7d159273fc | |||
| 70127922ab | |||
| b95df93775 | |||
| dc06edcf5b | |||
| fdc437dcd5 | |||
| f6873c9612 | |||
| 93754ab32d | |||
| 5759334635 | |||
| f2f543b72d | |||
| 598b052be3 | |||
| a746062422 | |||
| c8868d369f | |||
| 52c6e7474c | |||
| be81f09b0e | |||
| 6fa4504e31 | |||
| 992ba01a12 | |||
| 72c5a74cf1 | |||
| 919f41a0f1 | |||
| 785921cb0f | |||
| 8c8cda5e7d | |||
| 64ef74e7e9 | |||
| 776df4e6ee | |||
| 68465a8651 | |||
| fa16c8960c | |||
| 2c57915781 | |||
| d0527f1aeb | |||
| 75083c5b56 | |||
| 82526594db | |||
| 941d39800c | |||
| a1ae2e8bc0 | |||
| 4af6f366ca | |||
| c7a9534ed9 | |||
| 00bcbbf72b | |||
| ed2254ff9f | |||
| b6633f0ecb | |||
| e08d2d3052 | |||
| fbc0548b43 | |||
| a9807bd1e1 | |||
| 554b80b39d | |||
| 99e74bf00b | |||
| f48e923f28 | |||
| 5400b4bfdd | |||
| f68bebe0f6 | |||
| 4c6019b439 | |||
| 66e08a6b17 | |||
| 7898db70ed | |||
| 7c357116ff | |||
| 69ce0eb0d0 | |||
| 4db31a297b | |||
| e1fca457e4 | |||
| 7f8485ce80 | |||
| 290061fd11 | |||
| a507836936 | |||
| 6524d20a96 | |||
| f1c523aa30 | |||
| 87c08f5613 | |||
| 82913cea20 | |||
| 2ad743e4bd | |||
| fa97b57a96 | |||
| 1b952b6d56 | |||
| 90cc512bd1 | |||
| b82556c9c0 | |||
| fbe3b4bb3b | |||
| 5ffd98ad31 | |||
| cb9dd4d228 | |||
| cd823bf10c | |||
| 5560ec52c2 | |||
| 065151a77f | |||
| 23454f556c | |||
| a2b3ddf931 | |||
| 44b0d2fcfc | |||
| aed4cc590a | |||
| 72ee08b5ab | |||
| 45547624e4 | |||
| f928cfa8be | |||
| 988984846a | |||
| 1149618653 | |||
| 168a033903 | |||
| 6a765c9791 | |||
| e16ae7b511 | |||
| 174334ea44 | |||
| dbdf06930d | |||
| c93e65ddc3 | |||
| 56101ed264 | |||
| 8269c8e574 | |||
| 2246419d1e | |||
| 118a0c318b | |||
| 5401cf2910 | |||
| 432f9b8d2f | |||
| 66fc8a2d31 | |||
| 2f3dd3d227 | |||
| c43fd9fa6c | |||
| 868518e0f5 | |||
| 039b5cce98 | |||
| 4a421842d5 | |||
| cfbb124f81 | |||
| dcb147cde2 | |||
| 8d06b5e67e | |||
| 4776d0b422 | |||
| 58bb340c33 | |||
| ee790a9b7c | |||
| ac432aad78 | |||
| 30207e0a39 | |||
| d98547a33c | |||
| b7cdeabbf6 | |||
| be9907a0cc | |||
| 30f42c50a9 | |||
| 7cba65b138 | |||
| f34a78b336 | |||
| e1942dda03 | |||
| 7142e284fa | |||
| 3c1c588953 | |||
| 52cc6bae34 | |||
| 955c608115 | |||
| 2e00cf312c | |||
| 09bbc144d1 | |||
| d02b63a434 | |||
| 9b63c67d8c | |||
| 05c4bf3374 | |||
| 424b4d3f4e | |||
| f9a6187fab | |||
| d406472882 | |||
| 749b5a5ff8 | |||
| 091d5fe750 | |||
| c8894fb465 | |||
| 2dd41cbfac | |||
| 1f2165e68b | |||
| e9b6bdbdd7 | |||
| c0c77c5ba7 | |||
| 12403172ac | |||
| 3b41ab8d75 | |||
| 7bcf35f5b1 | |||
| 9a7e1c94c7 | |||
| 30c2e675da | |||
| ac405803e8 | |||
| 7dee787a92 | |||
| ae4b1cdeca | |||
| 572982cbf9 | |||
| 74290874f9 | |||
| 847f08d952 | |||
| 0bcd616668 | |||
| 9dd701ccc4 | |||
| 56a5a7d92b | |||
| 0cf0fad50e | |||
| 5f9e91656e | |||
| a7a2479f85 | |||
| a8b230a490 | |||
| 041b01f171 | |||
| 1c475f3215 | |||
| ab699d94b0 | |||
| 942d32c9b6 | |||
| 97f15f0b18 | |||
| ed49358c50 | |||
| 85eeecd140 | |||
| 30fd40fbe5 | |||
| 2ed262cacd | |||
| 29a1ef8f8a | |||
| 772d18ee62 | |||
| dd604d9942 | |||
| 85abc83427 | |||
| 6d8220629c | |||
| 6ff7ada096 | |||
| 8575049de5 | |||
| bb6fb0c253 | |||
| eb2ad9f840 | |||
| d0dd23fc11 | |||
| 7ae4acbdb0 | |||
| 881590ab37 | |||
| 5e479dc5d9 | |||
| 7db9c2e762 | |||
| ce6b0ac095 | |||
| 420bb06988 | |||
| 20566f8acf | |||
| 1d5f69704a | |||
| 0da664299e | |||
| 6e8fb2b457 | |||
| d1c72a4ff3 | |||
| 0bf05392e4 | |||
| 7ecef0c045 | |||
| 33ca329253 | |||
| 01fa4770cb | |||
| b76257c49c | |||
| e2fbf22f38 | |||
| 134432d029 | |||
| 8d4d6e80b8 | |||
| 85e6ef3dca | |||
| 60f1467229 | |||
| 1757242382 | |||
| 55df7bb9c4 | |||
| 686b8acd38 | |||
| a5f9df6170 | |||
| 27f61a870a | |||
| a48e8d1c5c | |||
| b80f74bccd | |||
| 1e768734ef | |||
| 11c9cabeb3 | |||
| 3a14ab92f0 | |||
| 62d5f52398 | |||
| 2b4848566c | |||
| 7c825e877c | |||
| 8417c277e6 | |||
| 9cef423908 | |||
| e73c84490e | |||
| 6cfc807db0 | |||
| be366f8103 | |||
| 2d13bd796f | |||
| 523f8f80ca | |||
| b76fef9143 | |||
| e935af83d5 | |||
| d4e019ef42 | |||
| 2e738828c6 | |||
| fd7dc93778 | |||
| 3df407d9ee | |||
| 6fbba84725 | |||
| 37d20fa9cc | |||
| 410cd912ac | |||
| d234bbd861 | |||
| 3f68d96815 | |||
| 015cd895d2 | |||
| 5fa4b48d85 | |||
| 88a3783bbc | |||
| ea2254b9bd | |||
| 9a0c1f2605 | |||
| 008f26bb7d | |||
| 69e453ea0b | |||
| 88b0b608f4 | |||
| 19e3987ae3 | |||
| c72e91ddaf | |||
| c789dd5067 | |||
| 551949de29 | |||
| 80730ee87a | |||
| 71028adc9e | |||
| a2efebc06c | |||
| a4e277a86b | |||
| 494c80d8b1 | |||
| 02539bfdd3 | |||
| a0f05eaf67 | |||
| 72e26fc90b | |||
| 2261cfabf3 | |||
| c1afa2a0e3 | |||
| d28f454c6e | |||
| f471c80ac0 | |||
| be086d94b5 | |||
| ff719510b6 | |||
| 7b16116b67 | |||
| 8422b71204 | |||
| c9bc2a89f6 | |||
| 387a52a7ba | |||
| 96842d9742 | |||
| 8fcef5401b | |||
| 804c4c678d | |||
| 8558777ece | |||
| 77bb608878 | |||
| 2f574261a7 | |||
| 28c4a2c39e | |||
| bd36cb59b1 | |||
| 998358ada8 | |||
| 75a00e8821 | |||
| b5653464d2 | |||
| 0269cd0b3b | |||
| 88ed662fd4 | |||
| 7c180c86a4 | |||
| f811ac510e | |||
| 3e5054f357 | |||
| 3424a424a7 | |||
| 8eb8af8ef8 | |||
| 8eaf7fc497 | |||
| 3255709399 | |||
| 2dbea36b81 | |||
| e0b7009bff | |||
| 77fb5ec3cb | |||
| 7392bce5dc | |||
| 8188bbd35d | |||
| 80fdea7bfb | |||
| dc9f6ac709 | |||
| ba796bc23d | |||
| e0ecb4c44f | |||
| d4c05304e9 | |||
| ccdbd71517 | |||
| 454fce09c6 | |||
| be4b12b4c8 | |||
| 9fa629de31 | |||
| 78dd5774b3 | |||
| bb9a9cd0db | |||
| ab9d8fb3db | |||
| 6ce76af2be | |||
| 3199a4b2cb | |||
| 6a2d153c3d | |||
| bfd4ad9255 | |||
| 30224515fd | |||
| d7f3acfd05 | |||
| a9e9eeeb54 | |||
| 76fa52b313 | |||
| 67de8e6a3a | |||
| ff78998829 | |||
| 55786e2d29 | |||
| 20534a71b9 | |||
| 316b6feccb | |||
| 6c7417e0a2 | |||
| af89dc881e | |||
| 5714cef3de | |||
| 3d2c8e7cc5 | |||
| 772ffcc5e8 | |||
| 8c30bb3a9f | |||
| 89bc121d3f | |||
| 1cc9d7b647 | |||
| 50e494e8e9 | |||
| 19325930a2 | |||
| ac97f7e9a2 | |||
| 33f133b8b2 | |||
| 2e9995e80a | |||
| 53f676bf2e | |||
| 874d658d2a | |||
| d27c455ab7 | |||
| 9291431c61 | |||
| 2e5f51e9ae | |||
| 2aa7e466ed | |||
| 3767a11d21 | |||
| 8c8b72d482 | |||
| bb9effa282 | |||
| 52e96bfa0f | |||
| 00ded65b7f | |||
| f738aa4234 | |||
| 6ff939451c | |||
| 32930cee01 | |||
| 3f45c76f48 | |||
| 1511baf12d | |||
| 20dd0816a6 | |||
| 41cd43ebc6 | |||
| 4a63899722 | |||
| c31ead493a | |||
| 7485733fba | |||
| e930b5d07b | |||
| 4543781153 | |||
| 1d5bfbb162 | |||
| 7045f7f92d | |||
| 5e7974f30b | |||
| 1079a888d3 | |||
| b1837abbc2 | |||
| 611e1a536c | |||
| c152ae1557 | |||
| de3020c1aa | |||
| f12c3fe06f | |||
| 754485c306 | |||
| 088448a8a1 | |||
| 6e35a09abd | |||
| 8fd11e8fdb | |||
| 40855103ad | |||
| 02041dbdb7 | |||
| 18ccc01501 | |||
| 1ff3f9c0da | |||
| 7a251248f1 | |||
| 971cbb94f6 | |||
| b53c961db2 | |||
| 9c40cbea76 | |||
| a8ce7e93cd | |||
| 4b02b74d6f | |||
| 67dd3afd92 | |||
| 7aca7fa0ec | |||
| c0564a1467 | |||
| b0a8984d3b | |||
| 0f451d6833 | |||
| c704d1f3b3 | |||
| e6d568fd49 | |||
| ee56509302 | |||
| bc5896b51f | |||
| 3224f5f422 | |||
| f9cd97edaa | |||
| e1ce3d46de | |||
| 294a8e9642 | |||
| 44fb6d9648 | |||
| 74c1ba1653 | |||
| 0cb39f049f | |||
| f7a3a8aa55 | |||
| cbc37eb006 | |||
| 097f45eeb3 | |||
| 4c5b3dd76f | |||
| ccf70590a4 | |||
| 3c709a27ac | |||
| 8554654ee9 | |||
| 59ac86cf6e | |||
| a4ecc9a187 | |||
| cc67c8b68e | |||
| b41f660fec | |||
| 00edcbbf64 | |||
| c530c70575 | |||
| 21840bb344 | |||
| 57bc23779d | |||
| 78e649f30a | |||
| eaa7a61f71 | |||
| 150a019b8d | |||
| 5dd1158025 | |||
| c60ca4a8d2 | |||
| e1b28f0805 | |||
| aeeaeb1eae | |||
| 76f87f9094 | |||
| 01e1c92813 | |||
| 22c0206451 | |||
| 5173c258b7 | |||
| ff8b892ebe | |||
| 7b0988cc19 | |||
| a4c79f09f8 | |||
| 7ec3d92215 | |||
| ac9fef784a | |||
| 4822bad4fb | |||
| d7dd90f073 | |||
| bbc19d1800 | |||
| 9ee9e61312 | |||
| f765137f3f | |||
| e160822b0f | |||
| c0e35b0126 | |||
| ac41ed629e | |||
| 8b5dfff2a1 | |||
| e77154bf7a | |||
| 5f5187e05c | |||
| 5db1728a3f | |||
| c7984ceed1 | |||
| 5d3571b7a3 | |||
| c1082b4474 | |||
| 14f16349c0 | |||
| aa7e01a085 | |||
| 484629734e | |||
| 444fca2250 | |||
| 7f17102c86 | |||
| e480998a4c | |||
| 5c642997fe | |||
| 5be5cd5ba5 | |||
| 1d55ed0599 | |||
| 4380aa9803 | |||
| 66e7f240da | |||
| f3e5816547 | |||
| 3d5931c259 | |||
| d510c74456 | |||
| 7154220d0b | |||
| d5155273df | |||
| 60dbe9d0a7 | |||
| f7d3f6b3f0 | |||
| 40fdd2aa74 | |||
| f39ed93ca0 | |||
| 541b2fabb4 | |||
| 067ad72f34 | |||
| 6c137e39c9 | |||
| f8c6cdb207 | |||
| f5de6a809d | |||
| e36b96fca6 | |||
| cd1738bdf6 | |||
| ebcd30fadc | |||
| 3c10a6bf94 | |||
| dc80fd9b15 | |||
| 5d21df9ac7 | |||
| 019e912d7f | |||
| 3479dca0d0 | |||
| 32e5cc4a5a | |||
| 268a9f18fa | |||
| 16a6186570 | |||
| 4b2fb6dd11 | |||
| 67d21bcd64 | |||
| 9b87126f0f | |||
| 1043b4de70 | |||
| 4bc5e7b8ff | |||
| 423b5205bf | |||
| fde288d9e8 | |||
| f2a2d85008 | |||
| 3a91b076e1 | |||
| 27bd608b53 | |||
| 966ba29084 | |||
| 3ea5b0193c | |||
| 97dd1b3b00 | |||
| fe0088d1ae | |||
| 342e1e22f8 | |||
| c9203047fc | |||
| a3a946ccd6 | |||
| 22564f34a9 | |||
| f939c24aa4 | |||
| be93fa747b | |||
| d7f4eeea2c | |||
| 6191f60025 | |||
| 82ccb0cedb | |||
| eb92e4413a | |||
| b0ba205532 | |||
| 4fa2cdf8d9 | |||
| ae30b23d34 | |||
| 1d3905bb71 | |||
| aa1e845f9a | |||
| fbcc69ec67 | |||
| 68b2de6dd7 | |||
| 20389babbc | |||
| f9899033aa | |||
| eb37b17486 | |||
| c428cad286 | |||
| 26486da27b | |||
| cabd0ed85e | |||
| f53e1a60d5 | |||
| ec694e4a99 | |||
| 81e076c924 | |||
| 04070ffc23 | |||
| 6941d6b863 | |||
| 3c88f68f16 | |||
| 82461da704 | |||
| 8e5d17c907 | |||
| 43d2143506 | |||
| 28b729acda | |||
| 584641236b | |||
| ca74897569 | |||
| 61987c85d2 | |||
| cfb75abeed | |||
| fd32706f0b | |||
| d1f90b7d44 | |||
| f09bc4a81a | |||
| 31b3aea282 | |||
| 2e1d236e8e | |||
| 065d06a98f | |||
| 63107566ec | |||
| 4f1dcea806 | |||
| 5da1a2c611 | |||
| 180a214e1f | |||
| bb417c6975 | |||
| 75c02475be | |||
| 2fd07211d9 | |||
| 128f3be596 | |||
| 810333dbb7 | |||
| e465358ec0 | |||
| 2954ed84a0 | |||
| b36cd8a68e | |||
| 8435daa598 | |||
| 38c943d564 | |||
| 8e89ec504f | |||
| a692ec1124 | |||
| 4e5f2c9587 | |||
| 1cc263acfb | |||
| 49c6534da6 | |||
| 02d3a3d7ec | |||
| 1dbe49243c | |||
| 2c12fb7ae8 | |||
| 829c6debbd | |||
| f2d3ed322e | |||
| d90e7db497 | |||
| 26f372a36a | |||
| b037777f83 | |||
| 35ce35b1e0 | |||
| e1517c2907 | |||
| ed5f88daa0 | |||
| 4afda646f0 | |||
| e782538777 | |||
| 4e86be86d9 | |||
| 6c8cfcd7c2 | |||
| 9fc7929665 | |||
| d590bf7d64 | |||
| c0f653340e | |||
| ac2bef083b | |||
| 42c7d0ca44 | |||
| 8a8afcfb24 | |||
| 5d259bb5aa | |||
| d2a24ed4bc | |||
| efd2f49484 | |||
| 9d4d6ccca5 | |||
| 218c894b5a | |||
| 0dec522542 | |||
| 7fa6708483 | |||
| 33af47c282 | |||
| 6b971e9e1b | |||
| 50107504a6 | |||
| 2cb0c9fea6 | |||
| dd7c2cc7f6 | |||
| 857ca14499 | |||
| f022b3fcde | |||
| 9470ff2dcc | |||
| d817a4fdb6 | |||
| 19635b06cf | |||
| 872776660b | |||
| 9644d4b00e | |||
| 04579d7ae6 | |||
| e9a9eb1779 | |||
| 9a1dddaccf | |||
| 4110ab5a82 | |||
| 5d1844e491 | |||
| 6a126d46ee | |||
| f834a0c84f | |||
| 9dfeb237e7 | |||
| b769ba2974 | |||
| fc1feb280f | |||
| bface83af7 | |||
| 9a89a16388 | |||
| 7649abf86a | |||
| b6ad97745d | |||
| 92028e191d | |||
| 7d4427a5d3 | |||
| 2bea800a37 | |||
| 4c1ff7deb7 | |||
| 347260f17b | |||
| 1086fba7da | |||
| 5a7cb129bb | |||
| b29d22e99b | |||
| 12cf102543 | |||
| 3d95730880 | |||
| c5d807dd58 | |||
| d40df79dce | |||
| 3cfa297b49 | |||
| e435769345 | |||
| 9a73877b3e | |||
| e2cd8d93f4 | |||
| afc6ec468f | |||
| 391838cfc3 | |||
| 36a11ded4f | |||
| f540ef2e06 | |||
| b061e0f859 | |||
| 4972fbbc7b | |||
| 1f318de812 | |||
| 0ceeadd75b | |||
| b9dad32707 | |||
| d1cf698b45 | |||
| 9dba3f9c58 | |||
| 8fbbe40300 | |||
| f73c925ad9 | |||
| b7fb4c5950 | |||
| fed49bb98b | |||
| 6aa4e382b2 | |||
| 8051d4f9b0 | |||
| 31a49601b1 | |||
| 4a50635fe1 | |||
| 9b92e9d325 | |||
| 833953d658 | |||
| 198dc8a8e2 | |||
| 78cd65240f | |||
| 02073f827b | |||
| 4cd3fdcdba | |||
| 7c803288e0 | |||
| dc91e0f733 | |||
| adc3abe82a | |||
| 00b6f5c3fb | |||
| b5a2a8df67 | |||
| 0cc4c9f2c2 | |||
| 7317a9ba2d | |||
| d6a4009989 | |||
| 8ee52e7d05 | |||
| b9a970a19a | |||
| bee93eade1 | |||
| 5d157eea54 | |||
| 28b494c913 | |||
| 817f189154 | |||
| 0bfa049778 | |||
| 8745314ad8 | |||
| 846d6d62c7 | |||
| c625440161 | |||
| aa544f03fb | |||
| 8d42c06fb0 | |||
| 4480ff0520 | |||
| eed9b2695a | |||
| 337a9b180e | |||
| 66a6ee97f0 | |||
| 26d5abe7a5 | |||
| bf8246c705 | |||
| 73cd25b05f | |||
| c5cc6905de | |||
| 7b0a714e1f | |||
| b47d83a7f2 | |||
| 5f4d312b8e | |||
| be4c52202c | |||
| 4e9111976e | |||
| 5163f11ecb | |||
| 5a1d5fa4f0 | |||
| d389390523 | |||
| 5a661fdacc | |||
| bd6dfcd51c | |||
| 8014486fd8 | |||
| 654b5b176b | |||
| af09f99c8a | |||
| 108876d9a1 | |||
| 1eb65caff4 | |||
| 7924e8c9a9 | |||
| 101f43947f | |||
| 68a0ead0c5 | |||
| 3d119c0d5d | |||
| f3e8cbf41d | |||
| f0fa42a50e | |||
| a20fd4fdcf | |||
| 32fb1cdb23 | |||
| ac24213d53 | |||
| fa20343253 | |||
| f4d70d3748 | |||
| b311730c7c | |||
| 3cba98fee6 | |||
| 7c799323a5 | |||
| 6926746624 | |||
| af7a52970f | |||
| 5ce3886651 | |||
| 0bc883ee29 | |||
| cc96786ac0 | |||
| 5b84ecf372 | |||
| 620926c379 | |||
| 7a4e57a49d | |||
| cdca60ff1b | |||
| 604f88939e | |||
| 95a7d33848 | |||
| 39e06e48bd | |||
| 9246c1443f | |||
| d3e358817e | |||
| 3682bc8558 | |||
| 8c1f82d894 | |||
| 6887c89d5c | |||
| 5071072c6b | |||
| 1cb7bc96c7 | |||
| 755c303008 | |||
| 381a963971 | |||
| 903ea7c49a | |||
| 41c4801aed | |||
| 3a8d65bd3e | |||
| 095a392359 | |||
| ce770c2e79 | |||
| be9529faee | |||
| 1f948e30d8 | |||
| 50de79171a | |||
| e8b3854682 | |||
| 985fade9f6 | |||
| 39b1177ba0 | |||
| 5fb440171e | |||
| 38673e5f43 | |||
| b8ce2b251d | |||
| 7829e17c27 | |||
| fced891975 | |||
| 35da594bfc | |||
| e8df272729 | |||
| a337b9ba15 | |||
| 685cc358b3 | |||
| 9ce4f0220e | |||
| 2128559186 | |||
| 20e4ca6a56 | |||
| 6f15fafc4a | |||
| cd4704aed7 | |||
| 82fd4d8b26 | |||
| 08a58b7520 | |||
| c7d8026ac5 | |||
| c7729f81ad | |||
| 7e12de0087 | |||
| c9c7db5a53 | |||
| aadbdd8b76 | |||
| b2d372ab3c | |||
| c47a47bc30 | |||
| ad5ec77f41 | |||
| c0bf387cb4 | |||
| 267323c7c3 | |||
| d9b1ea3d51 | |||
| 70bf86f561 | |||
| e1eebb2f75 | |||
| aa258dbe6b | |||
| 5a7659e1c3 | |||
| d51a829038 | |||
| b7ffc4051c | |||
| bb06b566cd | |||
| fc6149a171 | |||
| 4abc32f1ec | |||
| efd734d962 | |||
| 8158610587 | |||
| 2bb62309be | |||
| 401e41b699 | |||
| 3015831d66 | |||
| c2919897e2 | |||
| 83d6cae53f | |||
| 7ad54e3c94 | |||
| c1fc3a92c0 | |||
| 23508d3867 | |||
| b5cb2e6dd6 | |||
| 9efcf8bfb1 | |||
| 1ff486e16c | |||
| c22050fca8 | |||
| e910dd0ccf | |||
| 748d76dff1 | |||
| 2ebed41225 | |||
| 86d14fa7ab | |||
| 82e31e971a | |||
| 3d591b49cb | |||
| df505a7289 | |||
| 17dcde1f61 | |||
| 2a052cae8d | |||
| d3594f6652 | |||
| ad561226b9 | |||
| 8403868ac3 | |||
| a1d760df1e | |||
| e3950d52c1 | |||
| 7427ddd900 | |||
| 364b2b85ae | |||
| a71ab7c418 | |||
| 2bb1937fa9 | |||
| 3c44205be7 | |||
| 4cad535baa | |||
| 5fc3c298c1 | |||
| e5fe89a4fd | |||
| ccaea78901 | |||
| 1111dbb9a2 |
@@ -0,0 +1,32 @@
|
||||
# https://help.github.com/articles/dealing-with-line-endings
|
||||
#
|
||||
# For Mac & Linux
|
||||
# git config --global core.autocrlf input
|
||||
#
|
||||
# For windows
|
||||
# git config --global core.autocrlf true
|
||||
#
|
||||
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||
* text=auto
|
||||
|
||||
# Explicitly declare text files we want to always be normalized and converted
|
||||
# to native line endings on checkout.
|
||||
*.txt text
|
||||
*.md text
|
||||
*.rb text
|
||||
*.js text
|
||||
*.html text
|
||||
*.yml text
|
||||
*.mustache text
|
||||
*.css text
|
||||
Rakefile text
|
||||
Gemfile text
|
||||
LICENSE text
|
||||
COPYRIGHT text
|
||||
gollum text
|
||||
.gitattributes text
|
||||
.gitignore text
|
||||
|
||||
# Denote all files that are truly binary and should not be modified.
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
@@ -3,3 +3,5 @@ pkg
|
||||
.DS_Store
|
||||
.bundle
|
||||
Gemfile.lock
|
||||
*.gem
|
||||
*.swp
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
rvm:
|
||||
- 1.9.3
|
||||
before_install:
|
||||
- sudo apt-get update
|
||||
@@ -1,3 +1,4 @@
|
||||
source "http://rubygems.org"
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gemspec
|
||||
gem 'rake', '~> 10.0.3'
|
||||
|
||||
+54
-2
@@ -1,4 +1,56 @@
|
||||
# HEAD
|
||||
# 2.4.11 / 2013-01-08
|
||||
|
||||
* Numerous security issues have been fixed. Please update to `2.4.11`
|
||||
|
||||
# 1.4.0 / 2012-04-10
|
||||
|
||||
* Minor
|
||||
* Add a way to configure the `#id_prefix` property of Sanitization
|
||||
objects.
|
||||
* Add web sequence diagrams support
|
||||
* Support for updating wysiwyg components when markup language changes
|
||||
* Support RedCarpet 2.0
|
||||
* Allow ftp and irc links in wiki markup
|
||||
* Minor ui fixups
|
||||
|
||||
* Bug Fixes
|
||||
* Include the language of the code snippet when making a uniquely
|
||||
identifiable sha of a code snippet while rendering a page.
|
||||
* Pygments lexer forces utf8 encoding
|
||||
* Remove MathJax, this created problems in production for us.
|
||||
We'll look at bringing it back in future releases
|
||||
|
||||
# 1.3.1 / 2011-07-21
|
||||
|
||||
* Major Enhancements
|
||||
* Allow prefixed ID attributes in headers to support internal linking
|
||||
(#146).
|
||||
* Markdown pages are rendered through Redcarpet by default (#176).
|
||||
* Minor Enhancements
|
||||
* Remove Edit button on Preview pages (#164).
|
||||
* Simplify Wiki#inspect and Page#inspect.
|
||||
* Bug Fixes
|
||||
* Fixed broken preview functionality (#157).
|
||||
* Fixed sidebar/footer rendering problems related to whitespace (#145).
|
||||
|
||||
# 1.3.0 / 2011-04-25
|
||||
|
||||
* Major Enhancements
|
||||
* Listing of all Pages
|
||||
* Support for running Gollum under a separate branch.
|
||||
* Minor Enhancements
|
||||
* Fix a security issue with rendering Mathjax.
|
||||
|
||||
# 1.2.0 / 2011-03-11
|
||||
|
||||
* Major Enhancements
|
||||
* Major HTML/CSS/JS overhaul.
|
||||
* Add Sidebars (similar to Footers).
|
||||
* Add commit reverts.
|
||||
* Minor Enhancements
|
||||
* Optimization in source code highlighting, resulting in a huge
|
||||
decrease in rendering time.
|
||||
* Security fixes related to source code highlighting.
|
||||
|
||||
* Major Enhancements
|
||||
* Add Page sidebars, similar to Page footers.
|
||||
@@ -51,4 +103,4 @@
|
||||
|
||||
# 1.0.0 / 2010-08-12
|
||||
|
||||
* Open Source Birthday!
|
||||
* Open Source Birthday!
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
gollum -- A wiki built on top of Git
|
||||
====================================
|
||||
|
||||
[](http://rubygems.org/gems/gollum)
|
||||
[](http://travis-ci.org/gollum/gollum)
|
||||
[](https://gemnasium.com/gollum/gollum)
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
|
||||
@@ -16,25 +20,41 @@ number of ways depending on your needs. You can edit your wiki locally:
|
||||
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
|
||||
[TomDoc](http://tomdoc.org/) for inline documentation.
|
||||
|
||||
## SYSTEM REQUIREMENTS
|
||||
|
||||
- Python 2.5+ (2.7.3 recommended)
|
||||
- Ruby 1.8.7+ (1.9.3 recommended)
|
||||
- Unix like operating system (OS X, Ubuntu, Debian, and more)
|
||||
- Will not work on Windows (because of [grit](https://github.com/github/grit))
|
||||
|
||||
## SECURITY
|
||||
|
||||
Don't enable `--custom-css` or `--custom-js` unless you trust every user who has the ability to edit the wiki.
|
||||
A better solution with more security is being tracked in [#665](https://github.com/gollum/gollum/issues/665).
|
||||
|
||||
## INSTALLATION
|
||||
|
||||
The best way to install Gollum is with RubyGems:
|
||||
|
||||
$ [sudo] gem install gollum
|
||||
```bash
|
||||
$ [sudo] gem install gollum
|
||||
```
|
||||
|
||||
If you're installing from source, you can use [Bundler][bundler] to pick up all the
|
||||
gems:
|
||||
|
||||
$ bundle install # ([more info](http://gembundler.com/bundle_install.html))
|
||||
```bash
|
||||
$ bundle install
|
||||
```
|
||||
|
||||
In order to use the various formats that Gollum supports, you will need to
|
||||
separately install the necessary dependencies for each format. You only need
|
||||
to install the dependencies for the formats that you plan to use.
|
||||
|
||||
* [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc`
|
||||
* [ASCIIDoc](http://www.methods.co.nz/asciidoc/) -- `brew install asciidoc` on mac or `apt-get install -y asciidoc` on Ubuntu
|
||||
* [Creole](http://wikicreole.org/) -- `gem install creole`
|
||||
* [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install rdiscount`
|
||||
* [Markdown](http://daringfireball.net/projects/markdown/) -- `gem install redcarpet`
|
||||
* [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) -- `gem install github-markdown`
|
||||
* [Org](http://orgmode.org/) -- `gem install org-ruby`
|
||||
* [Pod](http://search.cpan.org/dist/perl/pod/perlpod.pod) -- `Pod::Simple::HTML` comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.
|
||||
* [RDoc](http://rdoc.sourceforge.net/)
|
||||
@@ -44,399 +64,78 @@ to install the dependencies for the formats that you plan to use.
|
||||
|
||||
[bundler]: http://gembundler.com/
|
||||
|
||||
|
||||
## SYNTAX
|
||||
|
||||
Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …).
|
||||
On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
|
||||
|
||||
Check out the [Gollum Wiki](https://github.com/gollum/gollum/wiki) for all of Gollum's formats and syntactic options.
|
||||
|
||||
|
||||
## RUNNING
|
||||
|
||||
To view and edit your Gollum repository locally via the built in web
|
||||
interface, simply install the Gollum gem, navigate to your repository via the
|
||||
command line, and run the executable:
|
||||
|
||||
$ gollum
|
||||
```bash
|
||||
$ gollum
|
||||
```
|
||||
|
||||
This will start up a web server running the Gollum frontend and you can view
|
||||
and edit your wiki at http://localhost:4567. To get help on the command line
|
||||
utility, you can run it like so:
|
||||
|
||||
$ gollum --help
|
||||
```bash
|
||||
$ gollum --help
|
||||
```
|
||||
|
||||
Note that the gollum server will not run on Windows because of [an issue](https://github.com/rtomayko/posix-spawn/issues/9) with posix-spawn (which is used by Grit).
|
||||
|
||||
## REPO STRUCTURE
|
||||
### RACK
|
||||
|
||||
A Gollum repository's contents are designed to be human editable. Page content
|
||||
is written in `page files` and may be organized into directories any way you
|
||||
choose. Special footers can be created in `footer files`. Other content
|
||||
(images, PDFs, etc) may also be present and organized in the same way.
|
||||
You can also run gollum with any rack-compatible server by placing this config.ru
|
||||
file inside your wiki repository. This allows you to utilize any Rack middleware
|
||||
like Rack::Auth, OmniAuth, etc.
|
||||
|
||||
```ruby
|
||||
#!/usr/bin/env ruby
|
||||
require 'rubygems'
|
||||
require 'gollum/app'
|
||||
|
||||
## PAGE FILES
|
||||
gollum_path = File.expand_path(File.dirname(__FILE__)) # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO
|
||||
Precious::App.set(:gollum_path, gollum_path)
|
||||
Precious::App.set(:default_markup, :markdown) # set your favorite markup language
|
||||
Precious::App.set(:wiki_options, {:universal_toc => false})
|
||||
run Precious::App
|
||||
```
|
||||
|
||||
Page files may be written in any format supported by
|
||||
[GitHub-Markup](http://github.com/github/markup) (except roff). The
|
||||
current list of formats and allowed extensions is:
|
||||
Your Rack middleware can pass author details to Gollum in a Hash in the session under the 'gollum.author' key.
|
||||
|
||||
* ASCIIDoc: .asciidoc
|
||||
* Creole: .creole
|
||||
* Markdown: .markdown, .mdown, .mkdn, .mkd, .md
|
||||
* Org Mode: .org
|
||||
* Pod: .pod
|
||||
* RDoc: .rdoc
|
||||
* ReStructuredText: .rest.txt, .rst.txt, .rest, .rst
|
||||
* Textile: .textile
|
||||
* MediaWiki: .mediawiki, .wiki
|
||||
## CONFIG FILE
|
||||
|
||||
Gollum detects the page file format via the extension, so files must have one
|
||||
of the supported extensions in order to be converted.
|
||||
Gollum optionally takes a `--config file`. See [config.rb](https://github.com/gollum/gollum/blob/master/config.rb) for an example.
|
||||
|
||||
Page file names may contain any printable UTF-8 character except space
|
||||
(U+0020) and forward slash (U+002F). If you commit a page file with any of
|
||||
these characters in the name it will not be accessible via the web interface.
|
||||
## CUSTOM CSS/JS
|
||||
|
||||
Even though page files may be placed in any directory, there is still only a
|
||||
single namespace for page names, so all page files should have globally unique
|
||||
names regardless of where they are located in the repository.
|
||||
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page.
|
||||
|
||||
The special page file `Home.ext` (where the extension is one of the supported
|
||||
formats) will be used as the entrance page to your wiki. If it is missing, an
|
||||
automatically generated table of contents will be shown instead.
|
||||
|
||||
## SIDEBAR FILES
|
||||
|
||||
Sidebar files allow you to add a simple sidebar to your wiki. Sidebar files
|
||||
are named `_Sidebar.ext` where the extension is one of the supported formats.
|
||||
Sidebars affect all pages in their directory and any subdirectories that do not
|
||||
have a sidebar file of their own.
|
||||
|
||||
## FOOTER FILES
|
||||
|
||||
Footer files allow you to add a simple footer to your wiki. Footer files must
|
||||
be named `_Footer.ext` where the extension is one of the supported formats.
|
||||
Like sidebars, footers affect all pages in their directory and any
|
||||
subdirectories that do not have a footer file of their own.
|
||||
|
||||
|
||||
## HTML SANITIZATION
|
||||
|
||||
For security and compatibility reasons Gollum wikis may not contain custom CSS
|
||||
or JavaScript. These tags will be stripped from the converted HTML. See
|
||||
`docs/sanitization.md` for more details on what tags and attributes are
|
||||
allowed.
|
||||
|
||||
|
||||
## BRACKET TAGS
|
||||
|
||||
A variety of Gollum tags use a double bracket syntax. For example:
|
||||
|
||||
[[Link]]
|
||||
|
||||
Some tags will accept attributes which are separated by pipe symbols. For
|
||||
example:
|
||||
|
||||
[[Link|Page Title]]
|
||||
|
||||
In all cases, the first thing in the link is what is displayed on the page.
|
||||
So, if the tag is an internal wiki link, the first thing in the tag will be
|
||||
the link text displayed on the page. If the tag is an embedded image, the
|
||||
first thing in the tag will be a path to an image file. Use this trick to
|
||||
easily remember which order things should appear in tags.
|
||||
|
||||
Some formats, such as MediaWiki, support the opposite syntax:
|
||||
|
||||
[[Page Title|Link]]
|
||||
|
||||
## PAGE LINKS
|
||||
|
||||
To link to another Gollum wiki page, use the Gollum Page Link Tag.
|
||||
|
||||
[[Frodo Baggins]]
|
||||
|
||||
The above tag will create a link to the corresponding page file named
|
||||
`Frodo-Baggins.ext` where `ext` may be any of the allowed extension types. The
|
||||
conversion is as follows:
|
||||
|
||||
1. Replace any spaces (U+0020) with dashes (U+002D)
|
||||
2. Replace any slashes (U+002F) with dashes (U+002D)
|
||||
|
||||
If you'd like the link text to be something that doesn't map directly to the
|
||||
page name, you can specify the actual page name after a pipe:
|
||||
|
||||
[[Frodo|Frodo Baggins]]
|
||||
|
||||
The above tag will link to `Frodo-Baggins.ext` using "Frodo" as the link text.
|
||||
|
||||
The page file may exist anywhere in the directory structure of the repository.
|
||||
Gollum does a breadth first search and uses the first match that it finds.
|
||||
|
||||
Here are a few more examples:
|
||||
|
||||
[[J. R. R. Tolkien]] -> J.-R.-R.-Tolkien.ext
|
||||
[[Movies / The Hobbit]] -> Movies---The-Hobbit.ext
|
||||
[[モルドール]] -> モルドール.ext
|
||||
|
||||
|
||||
## EXTERNAL LINKS
|
||||
|
||||
As a convenience, simple external links can be placed within brackets and they
|
||||
will be linked to the given URL with the URL as the link text. For example:
|
||||
|
||||
[[http://example.com]]
|
||||
|
||||
External links must begin with either "http://" or "https://". If you need
|
||||
something more flexible, you can resort to the link syntax in the page's
|
||||
underlying markup format.
|
||||
|
||||
|
||||
## ABSOLUTE VS. RELATIVE VS. EXTERNAL PATH
|
||||
|
||||
For Gollum tags that operate on static files (images, PDFs, etc), the paths
|
||||
may be referenced as either relative, absolute, or external. Relative paths
|
||||
point to a static file relative to the page file within the directory
|
||||
structure of the Gollum repo (even though after conversion, all page files
|
||||
appear to be top level). These paths are NOT prefixed with a slash. For
|
||||
example:
|
||||
|
||||
gollum.pdf
|
||||
docs/diagram.png
|
||||
|
||||
Absolute paths point to a static file relative to the Gollum repo's
|
||||
root, regardless of where the page file is stored within the directory
|
||||
structure. These paths ARE prefixed with a slash. For example:
|
||||
|
||||
/pdfs/gollum.pdf
|
||||
/docs/diagram.png
|
||||
|
||||
External paths are full URLs. An external path must begin with either
|
||||
"http://" or "https://". For example:
|
||||
|
||||
http://example.com/pdfs/gollum.pdf
|
||||
http://example.com/images/diagram.png
|
||||
|
||||
All of the examples in this README use relative paths, but you may use
|
||||
whatever works best in your situation.
|
||||
|
||||
|
||||
## FILE LINKS
|
||||
|
||||
To link to static files that are contained in the Gollum repository you should
|
||||
use the Gollum File Link Tag.
|
||||
|
||||
[[Gollum|gollum.pdf]]
|
||||
|
||||
The first part of the tag is the link text. The path to the file appears after
|
||||
the pipe.
|
||||
|
||||
|
||||
## IMAGES
|
||||
|
||||
To display images that are contained in the Gollum repository you should use
|
||||
the Gollum Image Tag. This will display the actual image on the page.
|
||||
|
||||
[[gollum.png]]
|
||||
|
||||
In addition to the simple format, there are a variety of options that you
|
||||
can specify between pipe delimiters.
|
||||
|
||||
To specify alt text, use the `alt=` option. Default is no alt text.
|
||||
|
||||
[[gollum.png|alt=Gollum and his precious wiki]]
|
||||
|
||||
To place the image in a frame, use the `frame` option. When combined with the
|
||||
`alt=` option, the alt text will be used as a caption as well. Default is no
|
||||
frame.
|
||||
|
||||
[[gollum.png|frame|alt=Gollum and his precious wiki]]
|
||||
|
||||
To specify the alignment of the image on the page, use the `align=` option.
|
||||
Possible values are `left`, `center`, and `right`. Default is `left`.
|
||||
|
||||
[[gollum.png|align=center]]
|
||||
|
||||
To float an image so that text flows around it, use the `float` option. When
|
||||
`float` is specified, only `left` and `right` are valid `align` options.
|
||||
Default is not floating. When floating is activated but no alignment is
|
||||
specified, default alignment is `left`.
|
||||
|
||||
[[gollum.png|float]]
|
||||
|
||||
To specify a max-width, use the `width=` option. Units must be specified in
|
||||
either `px` or `em`.
|
||||
|
||||
[[gollum.png|width=400px]]
|
||||
|
||||
To specify a max-height, use the `height=` option. Units must be specified in
|
||||
either `px` or `em`.
|
||||
|
||||
[[gollum.png|height=300px]]
|
||||
|
||||
Any of these options may be composed together by simply separating them with
|
||||
pipes.
|
||||
|
||||
|
||||
## ESCAPING GOLLUM TAGS
|
||||
|
||||
If you need the literal text of a wiki or static link to show up in your final
|
||||
wiki page, simply preface the link with a single quote (like in LISP):
|
||||
|
||||
'[[Page Link]]
|
||||
'[[File Link|file.pdf]]
|
||||
'[[image.jpg]]
|
||||
|
||||
This is useful for writing about the link syntax in your wiki pages.
|
||||
|
||||
|
||||
## SYNTAX HIGHLIGHTING
|
||||
|
||||
In page files you can get automatic syntax highlighting for a wide range of
|
||||
languages (courtesy of [Pygments](http://pygments.org/) - must install
|
||||
separately) by using the following syntax:
|
||||
|
||||
```ruby
|
||||
def foo
|
||||
puts 'bar'
|
||||
end
|
||||
```
|
||||
|
||||
The block must start with three backticks (as the first characters on the
|
||||
line). After that comes the name of the language that is contained by the
|
||||
block. The language must be one of the `short name` lexer strings supported by
|
||||
Pygments. See the [list of lexers](http://pygments.org/docs/lexers/) for valid
|
||||
options.
|
||||
|
||||
If the block contents are indented two spaces or one tab, then that whitespace
|
||||
will be ignored (this makes the blocks easier to read in plaintext).
|
||||
|
||||
The block must end with three backticks as the first characters on a
|
||||
line.
|
||||
|
||||
|
||||
## MATHEMATICAL EQUATIONS
|
||||
|
||||
Page files may contain mathematic equations in TeX syntax that will be nicely
|
||||
typeset into the expected output. A block-style equation is delimited by `\[`
|
||||
and `\]`. For example:
|
||||
|
||||
\[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \]
|
||||
|
||||
Inline equations are delimited by `\(` and `\)`. These equations will appear
|
||||
inline with regular text. For example:
|
||||
|
||||
The Pythagorean theorum is \( a^2 + b^2 = c^2 \).
|
||||
|
||||
Gollum uses [MathJax](http://www.mathjax.org/) to convert the TeX syntax into
|
||||
output suitable for display in web browsers.
|
||||
The `--js` flag will inject `custom.js` from the root of your git repository into each page. `custom.js` must be commited to git or you will get a 302 redirect to the create page.
|
||||
|
||||
|
||||
## API DOCUMENTATION
|
||||
|
||||
The Gollum API allows you to retrieve raw or formatted wiki content from a Git
|
||||
repository, write new content to the repository, and collect various meta data
|
||||
about the wiki as a whole.
|
||||
|
||||
Initialize the Gollum::Repo object:
|
||||
|
||||
# Require rubygems if necessary
|
||||
require 'rubygems'
|
||||
|
||||
# Require the Gollum library
|
||||
require 'gollum'
|
||||
|
||||
# Create a new Gollum::Wiki object by initializing it with the path to the
|
||||
# Git repository.
|
||||
wiki = Gollum::Wiki.new("my-gollum-repo.git")
|
||||
# => <Gollum::Wiki>
|
||||
|
||||
By default, internal wiki links are all absolute from the root. To specify a different base path, you can specify the `:base_path` option:
|
||||
|
||||
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
|
||||
|
||||
Get the latest version of the given human or canonical page name:
|
||||
|
||||
page = wiki.page('page-name')
|
||||
# => <Gollum::Page>
|
||||
|
||||
page.raw_data
|
||||
# => "# My wiki page"
|
||||
|
||||
page.formatted_data
|
||||
# => "<h1>My wiki page</h1>"
|
||||
|
||||
page.format
|
||||
# => :markdown
|
||||
|
||||
vsn = page.version
|
||||
# => <Grit::Commit>
|
||||
|
||||
vsn.id
|
||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||
|
||||
Get the footer (if any) for a given page:
|
||||
|
||||
page.footer
|
||||
# => <Gollum::Page>
|
||||
|
||||
Get a list of versions for a given page:
|
||||
|
||||
vsns = wiki.page('page-name').versions
|
||||
# => [<Grit::Commit, <Grit::Commit, <Grit::Commit>]
|
||||
|
||||
vsns.first.id
|
||||
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
|
||||
|
||||
vsns.first.authored_date
|
||||
# => Sun Mar 28 19:11:21 -0700 2010
|
||||
|
||||
Get a specific version of a given canonical page file:
|
||||
|
||||
wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
|
||||
|
||||
Get the latest version of a given static file:
|
||||
|
||||
file = wiki.file('asset.js')
|
||||
# => <Gollum::File>
|
||||
|
||||
file.raw_data
|
||||
# => "alert('hello');"
|
||||
|
||||
file.version
|
||||
# => <Grit::Commit>
|
||||
|
||||
Get a specific version of a given static file:
|
||||
|
||||
wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
|
||||
|
||||
Get an in-memory Page preview (useful for generating previews for web
|
||||
interfaces):
|
||||
|
||||
preview = wiki.preview_page("My Page", "# Contents", :markdown)
|
||||
preview.formatted_data
|
||||
# => "<h1>Contents</h1>"
|
||||
|
||||
Methods that write to the repository require a Hash of commit data that takes
|
||||
the following form:
|
||||
|
||||
commit = { :message => 'commit message',
|
||||
:name => 'Tom Preston-Werner',
|
||||
:email => 'tom@github.com' }
|
||||
|
||||
Write a new version of a page (the file will be created if it does not already
|
||||
exist) and commit the change. The file will be written at the repo root.
|
||||
|
||||
wiki.write_page('Page Name', :markdown, 'Page contents', commit)
|
||||
|
||||
Update an existing page. If the format is different than the page's current
|
||||
format, the file name will be changed to reflect the new format.
|
||||
|
||||
page = wiki.page('Page Name')
|
||||
wiki.update_page(page, page.name, page.format, 'Page contents', commit)
|
||||
|
||||
To delete a page and commit the change:
|
||||
|
||||
wiki.delete_page(page, commit)
|
||||
The [Gollum API](https://github.com/gollum/gollum-lib/) allows you to retrieve
|
||||
raw or formatted wiki content from a Git repository, write new content to the
|
||||
repository, and collect various meta data about the wiki as a whole.
|
||||
|
||||
|
||||
## CONTRIBUTE
|
||||
|
||||
If you'd like to hack on Gollum, start by forking my repo on GitHub:
|
||||
If you'd like to hack on Gollum, start by forking the repo on GitHub:
|
||||
|
||||
http://github.com/github/gollum
|
||||
http://github.com/gollum/gollum
|
||||
|
||||
To get all of the dependencies, install the gem first. The best way to get
|
||||
your changes merged back into core is as follows:
|
||||
@@ -449,4 +148,57 @@ your changes merged back into core is as follows:
|
||||
1. Do not change the version number, I will do that on my end
|
||||
1. If necessary, rebase your commits into logical chunks, without errors
|
||||
1. Push the branch up to GitHub
|
||||
1. Send a pull request to the github/gollum project.
|
||||
1. Send a pull request to the gollum/gollum project.
|
||||
|
||||
## RELEASING
|
||||
|
||||
Gollum uses [Semantic Versioning](http://semver.org/).
|
||||
|
||||
x.y.z
|
||||
|
||||
For z releases:
|
||||
|
||||
```bash
|
||||
$ rake bump
|
||||
$ rake release
|
||||
```
|
||||
|
||||
For x.y releases:
|
||||
|
||||
```bash
|
||||
Update VERSION in lib/gollum.rb
|
||||
$ rake gemspec
|
||||
$ rake release
|
||||
```
|
||||
|
||||
## BUILDING THE GEM FROM MASTER
|
||||
|
||||
```bash
|
||||
$ gem uninstall -aIx gollum
|
||||
$ git clone https://github.com/gollum/gollum.git
|
||||
$ cd gollum
|
||||
gollum$ rake build
|
||||
gollum$ gem install --no-ri --no-rdoc pkg/gollum*.gem
|
||||
```
|
||||
|
||||
## RUN THE TESTS
|
||||
|
||||
```bash
|
||||
$ bundle install
|
||||
$ bundle exec rake test
|
||||
```
|
||||
|
||||
## WORK WITH TEST REPOS
|
||||
|
||||
An example of how to add a test file to the bare repository lotr.git.
|
||||
|
||||
```bash
|
||||
$ mkdir tmp; cd tmp
|
||||
$ git clone ../lotr.git/ .
|
||||
Cloning into '.'...
|
||||
done.
|
||||
$ git log
|
||||
$ echo "test" > test.md
|
||||
$ git add . ; git commit -am "Add test"
|
||||
$ git push ../lotr.git/ master
|
||||
```
|
||||
|
||||
@@ -17,6 +17,27 @@ def version
|
||||
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
||||
end
|
||||
|
||||
# assumes x.y.z all digit version
|
||||
def next_version
|
||||
# x.y.z
|
||||
v = version.split '.'
|
||||
# bump z
|
||||
v[-1] = v[-1].to_i + 1
|
||||
v.join '.'
|
||||
end
|
||||
|
||||
def bump_version
|
||||
old_file = File.read("lib/#{name}.rb")
|
||||
old_version_line = old_file[/^\s*VERSION\s*=\s*.*/]
|
||||
new_version = next_version
|
||||
# replace first match of old vesion with new version
|
||||
old_file.sub!(old_version_line, " VERSION = '#{new_version}'")
|
||||
|
||||
File.write("lib/#{name}.rb", old_file)
|
||||
|
||||
new_version
|
||||
end
|
||||
|
||||
def date
|
||||
Date.today.to_s
|
||||
end
|
||||
@@ -60,14 +81,6 @@ task :coverage do
|
||||
sh "open coverage/index.html"
|
||||
end
|
||||
|
||||
require 'rake/rdoctask'
|
||||
Rake::RDocTask.new do |rdoc|
|
||||
rdoc.rdoc_dir = 'rdoc'
|
||||
rdoc.title = "#{name} #{version}"
|
||||
rdoc.rdoc_files.include('README*')
|
||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||
end
|
||||
|
||||
desc "Open an irb session preloaded with this library"
|
||||
task :console do
|
||||
sh "irb -rubygems -r ./lib/#{name}.rb"
|
||||
@@ -79,7 +92,14 @@ end
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
desc "Update version number and gemspec"
|
||||
task :bump do
|
||||
puts "Updated version to #{bump_version}"
|
||||
# Execute does not invoke dependencies.
|
||||
# Manually invoke gemspec then validate.
|
||||
Rake::Task[:gemspec].execute
|
||||
Rake::Task[:validate].execute
|
||||
end
|
||||
|
||||
#############################################################################
|
||||
#
|
||||
@@ -87,24 +107,28 @@ end
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
desc 'Create a release build'
|
||||
task :release => :build do
|
||||
unless `git branch` =~ /^\* master$/
|
||||
puts "You must be on the master branch to release!"
|
||||
exit!
|
||||
end
|
||||
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
||||
sh "git pull"
|
||||
sh "git tag v#{version}"
|
||||
sh "git push origin master"
|
||||
sh "git push origin v#{version}"
|
||||
sh "gem push pkg/#{name}-#{version}.gem"
|
||||
end
|
||||
|
||||
desc 'Build gem'
|
||||
task :build => :gemspec do
|
||||
sh "mkdir -p pkg"
|
||||
sh "gem build #{gemspec_file}"
|
||||
sh "mv #{gem_file} pkg"
|
||||
end
|
||||
|
||||
desc 'Update gemspec'
|
||||
task :gemspec => :validate do
|
||||
# read spec file and split out manifest section
|
||||
spec = File.read(gemspec_file)
|
||||
@@ -122,7 +146,7 @@ task :gemspec => :validate do
|
||||
split("\n").
|
||||
sort.
|
||||
reject { |file| file =~ /^\./ }.
|
||||
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
||||
reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
|
||||
map { |file| " #{file}" }.
|
||||
join("\n")
|
||||
|
||||
@@ -133,6 +157,7 @@ task :gemspec => :validate do
|
||||
puts "Updated #{gemspec_file}"
|
||||
end
|
||||
|
||||
desc 'Validate lib files and version file'
|
||||
task :validate do
|
||||
libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
|
||||
unless libfiles.empty?
|
||||
|
||||
+88
-4
@@ -19,7 +19,10 @@ require 'gollum'
|
||||
|
||||
exec = {}
|
||||
options = { 'port' => 4567, 'bind' => '0.0.0.0' }
|
||||
wiki_options = {}
|
||||
wiki_options = {
|
||||
:live_preview => false,
|
||||
:allow_uploads => false,
|
||||
}
|
||||
|
||||
opts = OptionParser.new do |opts|
|
||||
opts.banner = help
|
||||
@@ -45,9 +48,60 @@ opts = OptionParser.new do |opts|
|
||||
options['irb'] = true
|
||||
end
|
||||
|
||||
opts.on("--css", "Inject custom css. Uses custom.css from root repository") do
|
||||
wiki_options[:css] = true
|
||||
end
|
||||
|
||||
opts.on("--js", "Inject custom js. Uses custom.js from root repository") do
|
||||
wiki_options[:js] = true
|
||||
end
|
||||
|
||||
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
|
||||
wiki_options[:page_file_dir] = path
|
||||
end
|
||||
|
||||
opts.on("--base-path [PATH]", "Specify the base path.") do |path|
|
||||
wiki_options[:base_path] = path
|
||||
end
|
||||
|
||||
opts.on("--gollum-path [PATH]", "Specify the gollum path.") do |path|
|
||||
wiki_options[:gollum_path] = path
|
||||
end
|
||||
|
||||
opts.on("--ref [REF]", "Specify the repository ref to use (default: master).") do |ref|
|
||||
wiki_options[:ref] = ref
|
||||
end
|
||||
|
||||
opts.on("--no-live-preview", "Disables livepreview.") do
|
||||
wiki_options[:live_preview] = false
|
||||
end
|
||||
|
||||
opts.on("--live-preview", "Enables livepreview.") do
|
||||
wiki_options[:live_preview] = true
|
||||
end
|
||||
|
||||
opts.on("--allow-uploads", "Allows file uploads.") do
|
||||
wiki_options[:allow_uploads] = true
|
||||
end
|
||||
|
||||
opts.on("--mathjax", "Enables mathjax.") do
|
||||
wiki_options[:mathjax] = true
|
||||
end
|
||||
|
||||
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
|
||||
wiki_options[:user_icons] = source
|
||||
end
|
||||
|
||||
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
|
||||
wiki_options[:show_all] = true
|
||||
end
|
||||
|
||||
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
|
||||
wiki_options[:collapse_tree] = true
|
||||
end
|
||||
opts.on("--h1-title", "Sets page title to value of first h1") do
|
||||
wiki_options[:h1_title] = true
|
||||
end
|
||||
end
|
||||
|
||||
# Read command line options into `options` hash
|
||||
@@ -59,7 +113,10 @@ rescue OptionParser::InvalidOption
|
||||
exit
|
||||
end
|
||||
|
||||
gollum_path = ARGV[0] || Dir.pwd
|
||||
# --gollum-path wins over ARGV[0]
|
||||
gollum_path = wiki_options[:gollum_path] ?
|
||||
wiki_options[:gollum_path] :
|
||||
ARGV[0] || Dir.pwd
|
||||
|
||||
if options['irb']
|
||||
require 'irb'
|
||||
@@ -87,6 +144,7 @@ if options['irb']
|
||||
end
|
||||
|
||||
begin
|
||||
require 'gollum-lib'
|
||||
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
|
||||
if !wiki.exist? then raise Grit::InvalidGitRepositoryError end
|
||||
puts "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
|
||||
@@ -107,7 +165,7 @@ if options['irb']
|
||||
exit 0
|
||||
end
|
||||
else
|
||||
require 'gollum/frontend/app'
|
||||
require 'gollum/app'
|
||||
Precious::App.set(:gollum_path, gollum_path)
|
||||
Precious::App.set(:wiki_options, wiki_options)
|
||||
|
||||
@@ -118,5 +176,31 @@ else
|
||||
require cfg
|
||||
end
|
||||
|
||||
Precious::App.run!(options)
|
||||
base_path = wiki_options[:base_path]
|
||||
|
||||
if wiki_options[:base_path].nil?
|
||||
Precious::App.run!(options)
|
||||
else
|
||||
require 'rack'
|
||||
|
||||
class MapGollum
|
||||
def initialize base_path
|
||||
@mg = Rack::Builder.new do
|
||||
map '/' do
|
||||
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
|
||||
end
|
||||
|
||||
map "/#{base_path}" do
|
||||
run Precious::App
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def call(env)
|
||||
@mg.call(env)
|
||||
end
|
||||
end
|
||||
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
|
||||
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port'], :Host => options['bind']).start
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# Example gollum config
|
||||
# gollum ../wiki --config config.rb
|
||||
#
|
||||
# or run from source with
|
||||
#
|
||||
# bundle exec bin/gollum ../wiki/ --config config.rb
|
||||
|
||||
# Remove const to avoid
|
||||
# warning: already initialized constant FORMAT_NAMES
|
||||
#
|
||||
# only remove if it's defined.
|
||||
# constant Gollum::Page::FORMAT_NAMES not defined (NameError)
|
||||
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
|
||||
# limit to one format
|
||||
Gollum::Page::FORMAT_NAMES = { :markdown => "Markdown" }
|
||||
|
||||
=begin
|
||||
Valid formats are:
|
||||
{ :markdown => "Markdown",
|
||||
:textile => "Textile",
|
||||
:rdoc => "RDoc",
|
||||
:org => "Org-mode",
|
||||
:creole => "Creole",
|
||||
:rest => "reStructuredText",
|
||||
:asciidoc => "AsciiDoc",
|
||||
:mediawiki => "MediaWiki",
|
||||
:pod => "Pod" }
|
||||
=end
|
||||
+498
-770
File diff suppressed because it is too large
Load Diff
+12
-11
@@ -1,5 +1,7 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
# stdlib
|
||||
require 'digest/md5'
|
||||
require 'digest/sha1'
|
||||
require 'ostruct'
|
||||
|
||||
# external
|
||||
@@ -8,19 +10,18 @@ require 'github/markup'
|
||||
require 'sanitize'
|
||||
|
||||
# internal
|
||||
require 'gollum/git_access'
|
||||
require 'gollum/committer'
|
||||
require 'gollum/pagination'
|
||||
require 'gollum/blob_entry'
|
||||
require 'gollum/wiki'
|
||||
require 'gollum/page'
|
||||
require 'gollum/file'
|
||||
require 'gollum/markup'
|
||||
require 'gollum/albino'
|
||||
require 'gollum/sanitization'
|
||||
require File.expand_path('../gollum/uri_encode_component', __FILE__)
|
||||
|
||||
# Set ruby to UTF-8 mode
|
||||
# This is required for Ruby 1.8.7 which gollum still supports.
|
||||
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
||||
|
||||
module Gollum
|
||||
VERSION = '1.2.1'
|
||||
VERSION = '2.5.0'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/public', ::File.dirname(__FILE__))
|
||||
end
|
||||
|
||||
class Error < StandardError; end
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
require 'albino/multi'
|
||||
|
||||
class Gollum::Albino < Albino::Multi
|
||||
self.bin = ::Albino::Multi.bin
|
||||
end
|
||||
@@ -0,0 +1,497 @@
|
||||
# ~*~ encoding: utf-8 ~*~
|
||||
require 'cgi'
|
||||
require 'sinatra'
|
||||
require 'gollum-lib'
|
||||
require 'mustache/sinatra'
|
||||
require 'useragent'
|
||||
require 'stringex'
|
||||
|
||||
require 'gollum'
|
||||
require 'gollum/views/layout'
|
||||
require 'gollum/views/editable'
|
||||
require 'gollum/views/has_page'
|
||||
|
||||
require File.expand_path '../helpers', __FILE__
|
||||
|
||||
#required to upload bigger binary files
|
||||
Grit::Git.git_timeout = 120 # timeout in secs
|
||||
Grit::Git.git_max_size = 190 * 10**6 # size in bytes (10^6=1 MB)
|
||||
|
||||
# Fix to_url
|
||||
class String
|
||||
alias :upstream_to_url :to_url
|
||||
# _Header => header which causes errors
|
||||
def to_url
|
||||
return nil if self.nil?
|
||||
upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
|
||||
end
|
||||
end
|
||||
|
||||
# Run the frontend, based on Sinatra
|
||||
#
|
||||
# There are a number of wiki options that can be set for the frontend
|
||||
#
|
||||
# Example
|
||||
# require 'gollum/app'
|
||||
# Precious::App.set(:wiki_options, {
|
||||
# :universal_toc => false,
|
||||
# }
|
||||
#
|
||||
# See the wiki.rb file for more details on wiki options
|
||||
module Precious
|
||||
class App < Sinatra::Base
|
||||
register Mustache::Sinatra
|
||||
include Precious::Helpers
|
||||
|
||||
dir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
# Detect unsupported browsers.
|
||||
Browser = Struct.new(:browser, :version)
|
||||
|
||||
@@min_ua = [
|
||||
Browser.new('Internet Explorer', '10.0'),
|
||||
Browser.new('Chrome', '7.0'),
|
||||
Browser.new('Firefox', '4.0'),
|
||||
]
|
||||
|
||||
def supported_useragent?(user_agent)
|
||||
ua = UserAgent.parse(user_agent)
|
||||
@@min_ua.detect {|min| ua >= min }
|
||||
end
|
||||
|
||||
# We want to serve public assets for now
|
||||
set :public_folder, "#{dir}/public/gollum"
|
||||
set :static, true
|
||||
set :default_markup, :markdown
|
||||
|
||||
set :mustache, {
|
||||
# Tell mustache where the Views constant lives
|
||||
:namespace => Precious,
|
||||
|
||||
# Mustache templates live here
|
||||
:templates => "#{dir}/templates",
|
||||
|
||||
# Tell mustache where the views are
|
||||
:views => "#{dir}/views"
|
||||
}
|
||||
|
||||
# Sinatra error handling
|
||||
configure :development, :staging do
|
||||
enable :show_exceptions, :dump_errors
|
||||
disable :raise_errors, :clean_trace
|
||||
end
|
||||
|
||||
configure :test do
|
||||
enable :logging, :raise_errors, :dump_errors
|
||||
end
|
||||
|
||||
before do
|
||||
@base_url = url('/', false).chomp('/')
|
||||
# above will detect base_path when it's used with map in a config.ru
|
||||
settings.wiki_options.merge!({ :base_path => @base_url })
|
||||
@css = settings.wiki_options[:css]
|
||||
@js = settings.wiki_options[:js]
|
||||
end
|
||||
|
||||
get '/' do
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect clean_url(::File.join(@base_url, page_dir, wiki_new.index_page))
|
||||
end
|
||||
|
||||
# path is set to name if path is nil.
|
||||
# if path is 'a/b' and a and b are dirs, then
|
||||
# path must have a trailing slash 'a/b/' or
|
||||
# extract_path will trim path to 'a'
|
||||
# name, path, version
|
||||
def wiki_page(name, path = nil, version = nil, exact = true)
|
||||
wiki = wiki_new
|
||||
|
||||
path = name if path.nil?
|
||||
name = extract_name(name) || wiki.index_page
|
||||
path = extract_path(path)
|
||||
path = '/' if exact && path.nil?
|
||||
|
||||
OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
|
||||
:name => name, :path => path)
|
||||
end
|
||||
|
||||
def wiki_new
|
||||
Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
end
|
||||
|
||||
get '/data/*' do
|
||||
if page = wiki_page(params[:splat].first).page
|
||||
page.raw_data
|
||||
end
|
||||
end
|
||||
|
||||
get '/edit/*' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
@name = wikip.name
|
||||
@path = wikip.path
|
||||
|
||||
wiki = wikip.wiki
|
||||
if page = wikip.page
|
||||
if wiki.live_preview && page.format.to_s.include?('markdown') && supported_useragent?(request.user_agent)
|
||||
live_preview_url = '/livepreview/index.html?page=' + encodeURIComponent(@name)
|
||||
if @path
|
||||
live_preview_url << '&path=' + encodeURIComponent(@path)
|
||||
end
|
||||
redirect to(live_preview_url)
|
||||
else
|
||||
@page = page
|
||||
@page.version = wiki.repo.log(wiki.ref, @page.path).first
|
||||
raw_data = page.raw_data
|
||||
@content = raw_data.respond_to?(:force_encoding) ? raw_data.force_encoding('UTF-8') : raw_data
|
||||
mustache :edit
|
||||
end
|
||||
else
|
||||
redirect to("/create/#{encodeURIComponent(@name)}")
|
||||
end
|
||||
end
|
||||
|
||||
post '/uploadFile' do
|
||||
wiki = wiki_new
|
||||
|
||||
unless wiki.allow_uploads
|
||||
@message = "File uploads are disabled"
|
||||
mustache :error
|
||||
return
|
||||
end
|
||||
|
||||
if params[:file]
|
||||
fullname = params[:file][:filename]
|
||||
tempfile = params[:file][:tempfile]
|
||||
end
|
||||
|
||||
dir = 'uploads'
|
||||
ext = ::File.extname(fullname)
|
||||
format = ext.split('.').last || 'txt'
|
||||
filename = ::File.basename(fullname, ext)
|
||||
contents = ::File.read(tempfile)
|
||||
reponame = filename + '.' + format
|
||||
|
||||
head = wiki.repo.head
|
||||
|
||||
options = {
|
||||
:message => "Uploaded file to uploads/#{reponame}",
|
||||
:parent => wiki.repo.head.commit,
|
||||
}
|
||||
author = session['gollum.author']
|
||||
unless author.nil?
|
||||
options.merge! author
|
||||
end
|
||||
|
||||
begin
|
||||
committer = Gollum::Committer.new(wiki, options)
|
||||
committer.add_to_index(dir, filename, format, contents)
|
||||
committer.after_commit do |committer, sha|
|
||||
wiki.clear_cache
|
||||
committer.update_working_dir(dir, filename, format)
|
||||
end
|
||||
committer.commit
|
||||
redirect to('/')
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
end
|
||||
end
|
||||
|
||||
post '/rename/*' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
halt 500 if wikip.nil?
|
||||
wiki = wikip.wiki
|
||||
page = wiki.paged(wikip.name, wikip.path, exact = true)
|
||||
rename = params[:rename]
|
||||
halt 500 if page.nil?
|
||||
halt 500 if rename.nil? or rename.empty?
|
||||
|
||||
# Fixup the rename if it is a relative path
|
||||
# In 1.8.7 rename[0] != rename[0..0]
|
||||
if rename[0..0] != '/'
|
||||
source_dir = ::File.dirname(page.path)
|
||||
source_dir = '' if source_dir == '.'
|
||||
(target_dir, target_name) = ::File.split(rename)
|
||||
target_dir = target_dir == '' ? source_dir : "#{source_dir}/#{target_dir}"
|
||||
rename = "#{target_dir}/#{target_name}"
|
||||
end
|
||||
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = {:committer => committer}
|
||||
|
||||
success = wiki.rename_page(page, rename, commit)
|
||||
if !success
|
||||
# This occurs on NOOPs, for example renaming A => A
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
return
|
||||
end
|
||||
committer.commit
|
||||
|
||||
wikip = wiki_page(rename)
|
||||
page = wiki.paged(wikip.name, wikip.path, exact = true)
|
||||
return if page.nil?
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
end
|
||||
|
||||
post '/edit/*' do
|
||||
path = '/' + clean_url(sanitize_empty_params(params[:path])).to_s
|
||||
page_name = CGI.unescape(params[:page])
|
||||
wiki = wiki_new
|
||||
page = wiki.paged(page_name, path, exact = true)
|
||||
return if page.nil?
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = {:committer => committer}
|
||||
|
||||
update_wiki_page(wiki, page, params[:content], commit, page.name, params[:format])
|
||||
update_wiki_page(wiki, page.header, params[:header], commit) if params[:header]
|
||||
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
|
||||
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
|
||||
committer.commit
|
||||
|
||||
redirect to("/#{page.escaped_url_path}") unless page.nil?
|
||||
end
|
||||
|
||||
get '/delete/*' do
|
||||
wikip = wiki_page(params[:splat].first)
|
||||
name = wikip.name
|
||||
wiki = wikip.wiki
|
||||
page = wikip.page
|
||||
wiki.delete_page(page, { :message => "Destroyed #{name} (#{page.format})" })
|
||||
|
||||
redirect to('/')
|
||||
end
|
||||
|
||||
get '/create/*' do
|
||||
wikip = wiki_page(params[:splat].first.gsub('+', '-'))
|
||||
@name = wikip.name.to_url
|
||||
@path = wikip.path
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
unless page_dir.empty?
|
||||
# --page-file-dir docs
|
||||
# /docs/Home should be created in /Home
|
||||
# not /docs/Home because write_page will append /docs
|
||||
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
|
||||
end
|
||||
@path = clean_path(@path)
|
||||
|
||||
page = wikip.page
|
||||
if page
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
end
|
||||
|
||||
post '/create' do
|
||||
name = params[:page].to_url
|
||||
path = sanitize_empty_params(params[:path]) || ''
|
||||
format = params[:format].intern
|
||||
wiki = wiki_new
|
||||
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message, path)
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
end
|
||||
end
|
||||
|
||||
post '/revert/:page/*' do
|
||||
wikip = wiki_page(params[:page])
|
||||
@path = wikip.path
|
||||
@name = wikip.name
|
||||
wiki = wikip.wiki
|
||||
@page = wiki.paged(@name,@path)
|
||||
shas = params[:splat].first.split("/")
|
||||
sha1 = shas.shift
|
||||
sha2 = shas.shift
|
||||
|
||||
commit = commit_message
|
||||
commit[:message] = "Revert commit #{sha1.chars.take(7).join}"
|
||||
if wiki.revert_page(@page, sha1, sha2, commit)
|
||||
redirect to("/#{@page.escaped_url_path}")
|
||||
else
|
||||
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||
@versions = [sha1, sha2]
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
@message = "The patch does not apply."
|
||||
mustache :compare
|
||||
end
|
||||
end
|
||||
|
||||
post '/preview' do
|
||||
wiki = wiki_new
|
||||
@name = params[:page] || "Preview"
|
||||
@page = wiki.preview_page(@name, params[:content], params[:format])
|
||||
@content = @page.formatted_data
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@h1_title = wiki.h1_title
|
||||
@editable = false
|
||||
@allow_uploads = wiki.allow_uploads
|
||||
mustache :page
|
||||
end
|
||||
|
||||
get '/history/*' do
|
||||
@page = wiki_page(params[:splat].first).page
|
||||
@page_num = [params[:page].to_i, 1].max
|
||||
@versions = @page.versions :page => @page_num
|
||||
mustache :history
|
||||
end
|
||||
|
||||
post '/compare/*' do
|
||||
@file = params[:splat].first
|
||||
@versions = params[:versions] || []
|
||||
if @versions.size < 2
|
||||
redirect to("/history/#{@file}")
|
||||
else
|
||||
redirect to("/compare/%s/%s...%s" % [
|
||||
@file,
|
||||
@versions.last,
|
||||
@versions.first]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
get %r{
|
||||
/compare/ # match any URL beginning with /compare/
|
||||
(.+) # extract the full path (including any directories)
|
||||
/ # match the final slash
|
||||
([^.]+) # match the first SHA1
|
||||
\.{2,3} # match .. or ...
|
||||
(.+) # match the second SHA1
|
||||
}x do |path, start_version, end_version|
|
||||
wikip = wiki_page(path)
|
||||
@path = wikip.path
|
||||
@name = wikip.name
|
||||
@versions = [start_version, end_version]
|
||||
wiki = wikip.wiki
|
||||
@page = wikip.page
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
mustache :compare
|
||||
end
|
||||
|
||||
get %r{/(.+?)/([0-9a-f]{40})} do
|
||||
file_path = params[:captures][0]
|
||||
version = params[:captures][1]
|
||||
wikip = wiki_page(file_path, file_path, version)
|
||||
name = wikip.name
|
||||
path = wikip.path
|
||||
if page = wikip.page
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
mustache :page
|
||||
else
|
||||
halt 404
|
||||
end
|
||||
end
|
||||
|
||||
get '/search' do
|
||||
@query = params[:q]
|
||||
wiki = wiki_new
|
||||
# Sort wiki search results by count (desc) and then by name (asc)
|
||||
@results = wiki.search(@query).sort{ |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
|
||||
@name = @query
|
||||
mustache :search
|
||||
end
|
||||
|
||||
get %r{
|
||||
/pages # match any URL beginning with /pages
|
||||
(?: # begin an optional non-capturing group
|
||||
/(.+) # capture any path after the "/pages" excluding the leading slash
|
||||
)? # end the optional non-capturing group
|
||||
}x do |path|
|
||||
@path = extract_path(path) if path
|
||||
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
|
||||
@results = wiki.pages
|
||||
@results += wiki.files if settings.wiki_options[:show_all]
|
||||
@ref = wiki.ref
|
||||
mustache :pages
|
||||
end
|
||||
|
||||
get '/fileview' do
|
||||
wiki = wiki_new
|
||||
options = settings.wiki_options
|
||||
content = wiki.pages
|
||||
# if showing all files include wiki.files
|
||||
content += wiki.files if options[:show_all]
|
||||
|
||||
# must pass wiki_options to FileView
|
||||
# --show-all and --collapse-tree can be set.
|
||||
@results = Gollum::FileView.new(content, options).render_files
|
||||
@ref = wiki.ref
|
||||
mustache :file_view, { :layout => false }
|
||||
end
|
||||
|
||||
get '/*' do
|
||||
show_page_or_file(params[:splat].first)
|
||||
end
|
||||
|
||||
def show_page_or_file(fullpath)
|
||||
wiki = wiki_new
|
||||
|
||||
name = extract_name(fullpath) || wiki.index_page
|
||||
path = extract_path(fullpath) || '/'
|
||||
|
||||
if page = wiki.paged(name, path, exact = true)
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
|
||||
# Extensions and layout data
|
||||
@editable = true
|
||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||
@mathjax = wiki.mathjax
|
||||
@h1_title = wiki.h1_title
|
||||
@bar_side = wiki.bar_side
|
||||
@allow_uploads = wiki.allow_uploads
|
||||
|
||||
mustache :page
|
||||
elsif file = wiki.file(fullpath, wiki.ref, true)
|
||||
if file.on_disk?
|
||||
send_file file.on_disk_path, :disposition => 'inline'
|
||||
else
|
||||
content_type file.mime_type
|
||||
file.raw_data
|
||||
end
|
||||
else
|
||||
page_path = [path, name].compact.join('/')
|
||||
redirect to("/create/#{clean_url(encodeURIComponent(page_path))}")
|
||||
end
|
||||
end
|
||||
|
||||
def update_wiki_page(wiki, page, content, commit, name = nil, format = nil)
|
||||
return if !page ||
|
||||
((!content || page.raw_data == content) && page.format == format)
|
||||
name ||= page.name
|
||||
format = (format || page.format).to_sym
|
||||
content ||= page.raw_data
|
||||
wiki.update_page(page, name, format, content.to_s, commit)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Options parameter to Gollum::Committer#initialize
|
||||
# :message - The String commit message.
|
||||
# :name - The String author full name.
|
||||
# :email - The String email address.
|
||||
# message is sourced from the incoming request parameters
|
||||
# author details are sourced from the session, to be populated by rack middleware ahead of us
|
||||
def commit_message
|
||||
msg = (params[:message].nil? or params[:message].empty?) ? "[no message]" : params[:message]
|
||||
commit_message = { :message => msg }
|
||||
author_parameters = session['gollum.author']
|
||||
commit_message.merge! author_parameters unless author_parameters.nil?
|
||||
commit_message
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
module Gollum
|
||||
class BlobEntry
|
||||
# Gets the String SHA for this blob.
|
||||
attr_reader :sha
|
||||
|
||||
# Gets the full path String for this blob.
|
||||
attr_reader :path
|
||||
|
||||
# Gets the Fixnum size of this blob.
|
||||
attr_reader :size
|
||||
|
||||
def initialize(sha, path, size = nil)
|
||||
@sha = sha
|
||||
@path = path
|
||||
@size = size
|
||||
@dir = @name = @blob = nil
|
||||
end
|
||||
|
||||
# Gets the normalized directory path String for this blob.
|
||||
def dir
|
||||
@dir ||= self.class.normalize_dir(::File.dirname(@path))
|
||||
end
|
||||
|
||||
# Gets the file base name String for this blob.
|
||||
def name
|
||||
@name ||= ::File.basename(@path)
|
||||
end
|
||||
|
||||
# Gets a Grit::Blob instance for this blob.
|
||||
#
|
||||
# repo - Grit::Repo instance for the Grit::Blob.
|
||||
#
|
||||
# Returns an unbaked Grit::Blob instance.
|
||||
def blob(repo)
|
||||
@blob ||= Grit::Blob.create(repo,
|
||||
:id => @sha, :name => name, :size => @size)
|
||||
end
|
||||
|
||||
# Gets a Page instance for this blob.
|
||||
#
|
||||
# wiki - Gollum::Wiki instance for the Gollum::Page
|
||||
#
|
||||
# Returns a Gollum::Page instance.
|
||||
def page(wiki, commit)
|
||||
blob = self.blob(wiki.repo)
|
||||
page = wiki.page_class.new(wiki).populate(blob, self.dir)
|
||||
page.version = commit
|
||||
page
|
||||
end
|
||||
|
||||
def inspect
|
||||
%(#<Gollum::BlobEntry #{@sha} #{@path}>)
|
||||
end
|
||||
|
||||
# Normalizes a given directory name for searching through tree paths.
|
||||
# Ensures that a directory begins with a slash, or
|
||||
#
|
||||
# normalize_dir("") # => ""
|
||||
# normalize_dir(".") # => ""
|
||||
# normalize_dir("foo") # => "/foo"
|
||||
# normalize_dir("/foo/") # => "/foo"
|
||||
# normalize_dir("/") # => ""
|
||||
# normalize_dir("c:/") # => ""
|
||||
#
|
||||
# dir - String directory name.
|
||||
#
|
||||
# Returns a normalized String directory name, or nil if no directory
|
||||
# is given.
|
||||
def self.normalize_dir(dir)
|
||||
return '' if dir =~ /^.:\/$/
|
||||
if dir
|
||||
dir = ::File.expand_path(dir, '/')
|
||||
dir = '' if dir == '/'
|
||||
end
|
||||
dir
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,217 +0,0 @@
|
||||
module Gollum
|
||||
# Responsible for handling the commit process for a Wiki. It sets up the
|
||||
# Git index, provides methods for modifying the tree, and stores callbacks
|
||||
# to be fired after the commit has been made. This is specifically
|
||||
# designed to handle multiple updated pages in a single commit.
|
||||
class Committer
|
||||
# Gets the instance of the Gollum::Wiki that is being updated.
|
||||
attr_reader :wiki
|
||||
|
||||
# Gets a Hash of commit options.
|
||||
attr_reader :options
|
||||
|
||||
# Initializes the Committer.
|
||||
#
|
||||
# wiki - The Gollum::Wiki instance that is being updated.
|
||||
# options - The commit Hash details:
|
||||
# :message - The String commit message.
|
||||
# :name - The String author full name.
|
||||
# :email - The String email address.
|
||||
# :parent - Optional Grit::Commit parent to this update.
|
||||
# :tree - Optional String SHA of the tree to create the
|
||||
# index from.
|
||||
# :committer - Optional Gollum::Committer instance. If provided,
|
||||
# assume that this operation is part of batch of
|
||||
# updates and the commit happens later.
|
||||
#
|
||||
# Returns the Committer instance.
|
||||
def initialize(wiki, options = {})
|
||||
@wiki = wiki
|
||||
@options = options
|
||||
@callbacks = []
|
||||
end
|
||||
|
||||
# Public: References the Git index for this commit.
|
||||
#
|
||||
# Returns a Grit::Index.
|
||||
def index
|
||||
@index ||= begin
|
||||
idx = @wiki.repo.index
|
||||
if tree = options[:tree]
|
||||
idx.read_tree(tree)
|
||||
elsif parent = parents.first
|
||||
idx.read_tree(parent.tree.id)
|
||||
end
|
||||
idx
|
||||
end
|
||||
end
|
||||
|
||||
# Public: The committer for this commit.
|
||||
#
|
||||
# Returns a Grit::Actor.
|
||||
def actor
|
||||
@actor ||= begin
|
||||
@options[:name] = @wiki.default_committer_name if @options[:name].to_s.empty?
|
||||
@options[:email] = @wiki.default_committer_email if @options[:email].to_s.empty?
|
||||
Grit::Actor.new(@options[:name], @options[:email])
|
||||
end
|
||||
end
|
||||
|
||||
# Public: The parent commits to this pending commit.
|
||||
#
|
||||
# Returns an array of Grit::Commit instances.
|
||||
def parents
|
||||
@parents ||= begin
|
||||
arr = [@options[:parent] || @wiki.repo.commit('master')]
|
||||
arr.flatten!
|
||||
arr.compact!
|
||||
arr
|
||||
end
|
||||
end
|
||||
|
||||
# Adds a page to the given Index.
|
||||
#
|
||||
# dir - The String subdirectory of the Gollum::Page without any
|
||||
# prefix or suffix slashes (e.g. "foo/bar").
|
||||
# name - The String Gollum::Page name.
|
||||
# format - The Symbol Gollum::Page format.
|
||||
# data - The String wiki data to store in the tree map.
|
||||
# allow_same_ext - A Boolean determining if the tree map allows the same
|
||||
# filename with the same extension.
|
||||
#
|
||||
# Raises Gollum::DuplicatePageError if a matching filename already exists.
|
||||
# This way, pages are not inadvertently overwritten.
|
||||
#
|
||||
# Returns nothing (modifies the Index in place).
|
||||
def add_to_index(dir, name, format, data, allow_same_ext = false)
|
||||
path = @wiki.page_file_name(name, format)
|
||||
|
||||
dir = '/' if dir.strip.empty?
|
||||
|
||||
fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
|
||||
fullpath = fullpath[1..-1] if fullpath =~ /^\//
|
||||
|
||||
if index.current_tree && tree = index.current_tree / dir
|
||||
downpath = path.downcase.sub(/\.\w+$/, '')
|
||||
|
||||
tree.blobs.each do |blob|
|
||||
next if page_path_scheduled_for_deletion?(index.tree, fullpath)
|
||||
file = blob.name.downcase.sub(/\.\w+$/, '')
|
||||
file_ext = ::File.extname(blob.name).sub(/^\./, '')
|
||||
if downpath == file && !(allow_same_ext && file_ext == ext)
|
||||
raise DuplicatePageError.new(dir, blob.name, path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
index.add(fullpath, @wiki.normalize(data))
|
||||
end
|
||||
|
||||
# Update the given file in the repository's working directory if there
|
||||
# is a working directory present.
|
||||
#
|
||||
# dir - The String directory in which the file lives.
|
||||
# name - The String name of the page (may be in human format).
|
||||
# format - The Symbol format of the page.
|
||||
#
|
||||
# Returns nothing.
|
||||
def update_working_dir(dir, name, format)
|
||||
unless @wiki.repo.bare
|
||||
if @wiki.page_file_dir
|
||||
dir = dir.size.zero? ? @wiki.page_file_dir : File.join(dir, @wiki.page_file_dir)
|
||||
end
|
||||
|
||||
path =
|
||||
if dir == ''
|
||||
@wiki.page_file_name(name, format)
|
||||
else
|
||||
::File.join(dir, @wiki.page_file_name(name, format))
|
||||
end
|
||||
|
||||
Dir.chdir(::File.join(@wiki.repo.path, '..')) do
|
||||
if file_path_scheduled_for_deletion?(index.tree, path)
|
||||
@wiki.repo.git.rm({'f' => true}, '--', path)
|
||||
else
|
||||
@wiki.repo.git.checkout({}, 'HEAD', '--', path)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Writes the commit to Git and runs the after_commit callbacks.
|
||||
#
|
||||
# Returns the String SHA1 of the new commit.
|
||||
def commit
|
||||
sha1 = index.commit(@options[:message], parents, actor)
|
||||
@callbacks.each do |cb|
|
||||
cb.call(self, sha1)
|
||||
end
|
||||
sha1
|
||||
end
|
||||
|
||||
# Adds a callback to be fired after a commit.
|
||||
#
|
||||
# block - A block that expects this Committer instance and the created
|
||||
# commit's SHA1 as the arguments.
|
||||
#
|
||||
# Returns nothing.
|
||||
def after_commit(&block)
|
||||
@callbacks << block
|
||||
end
|
||||
|
||||
# Determine if a given page (regardless of format) is scheduled to be
|
||||
# deleted in the next commit for the given Index.
|
||||
#
|
||||
# map - The Hash map:
|
||||
# key - The String directory or filename.
|
||||
# val - The Hash submap or the String contents of the file.
|
||||
# path - The String path of the page file. This may include the format
|
||||
# extension in which case it will be ignored.
|
||||
#
|
||||
# Returns the Boolean response.
|
||||
def page_path_scheduled_for_deletion?(map, path)
|
||||
parts = path.split('/')
|
||||
if parts.size == 1
|
||||
deletions = map.keys.select { |k| !map[k] }
|
||||
downfile = parts.first.downcase.sub(/\.\w+$/, '')
|
||||
deletions.any? { |d| d.downcase.sub(/\.\w+$/, '') == downfile }
|
||||
else
|
||||
part = parts.shift
|
||||
if rest = map[part]
|
||||
page_path_scheduled_for_deletion?(rest, parts.join('/'))
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Determine if a given file is scheduled to be deleted in the next commit
|
||||
# for the given Index.
|
||||
#
|
||||
# map - The Hash map:
|
||||
# key - The String directory or filename.
|
||||
# val - The Hash submap or the String contents of the file.
|
||||
# path - The String path of the file including extension.
|
||||
#
|
||||
# Returns the Boolean response.
|
||||
def file_path_scheduled_for_deletion?(map, path)
|
||||
parts = path.split('/')
|
||||
if parts.size == 1
|
||||
deletions = map.keys.select { |k| !map[k] }
|
||||
deletions.any? { |d| d == parts.first }
|
||||
else
|
||||
part = parts.shift
|
||||
if rest = map[part]
|
||||
file_path_scheduled_for_deletion?(rest, parts.join('/'))
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Proxies methods t
|
||||
def method_missing(name, *args)
|
||||
index.send(name, *args)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,64 +0,0 @@
|
||||
module Gollum
|
||||
class File
|
||||
Wiki.file_class = self
|
||||
|
||||
# Public: Initialize a file.
|
||||
#
|
||||
# wiki - The Gollum::Wiki in question.
|
||||
#
|
||||
# Returns a newly initialized Gollum::File.
|
||||
def initialize(wiki)
|
||||
@wiki = wiki
|
||||
@blob = nil
|
||||
@path = nil
|
||||
end
|
||||
|
||||
# Public: The on-disk filename of the file.
|
||||
#
|
||||
# Returns the String name.
|
||||
def name
|
||||
@blob && @blob.name
|
||||
end
|
||||
|
||||
# Public: The raw contents of the page.
|
||||
#
|
||||
# Returns the String data.
|
||||
def raw_data
|
||||
@blob && @blob.data
|
||||
end
|
||||
|
||||
# Public: The Grit::Commit version of the file.
|
||||
attr_reader :version
|
||||
|
||||
# Public: The String path of the file.
|
||||
attr_reader :path
|
||||
|
||||
# Public: The String mime type of the file.
|
||||
def mime_type
|
||||
@blob.mime_type
|
||||
end
|
||||
|
||||
#########################################################################
|
||||
#
|
||||
# Internal Methods
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
# Find a file in the given Gollum repo.
|
||||
#
|
||||
# name - The full String path.
|
||||
# version - The String version ID to find.
|
||||
#
|
||||
# Returns a Gollum::File or nil if the file could not be found.
|
||||
def find(name, version)
|
||||
checked = name.downcase
|
||||
map = @wiki.tree_map_for(version)
|
||||
if entry = map.detect { |entry| entry.path.downcase == checked }
|
||||
@path = name
|
||||
@blob = entry.blob(@wiki.repo)
|
||||
@version = version.is_a?(Grit::Commit) ? version : @wiki.commit_for(version)
|
||||
self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,205 +0,0 @@
|
||||
require 'cgi'
|
||||
require 'sinatra'
|
||||
require 'gollum'
|
||||
require 'mustache/sinatra'
|
||||
|
||||
require 'gollum/frontend/views/layout'
|
||||
require 'gollum/frontend/views/editable'
|
||||
|
||||
module Precious
|
||||
class App < Sinatra::Base
|
||||
register Mustache::Sinatra
|
||||
|
||||
dir = File.dirname(File.expand_path(__FILE__))
|
||||
|
||||
# We want to serve public assets for now
|
||||
|
||||
set :public, "#{dir}/public"
|
||||
set :static, true
|
||||
|
||||
set :mustache, {
|
||||
# Tell mustache where the Views constant lives
|
||||
:namespace => Precious,
|
||||
|
||||
# Mustache templates live here
|
||||
:templates => "#{dir}/templates",
|
||||
|
||||
# Tell mustache where the views are
|
||||
:views => "#{dir}/views"
|
||||
}
|
||||
|
||||
# Sinatra error handling
|
||||
configure :development, :staging do
|
||||
enable :show_exceptions, :dump_errors
|
||||
disable :raise_errors, :clean_trace
|
||||
end
|
||||
|
||||
configure :test do
|
||||
enable :logging, :raise_errors, :dump_errors
|
||||
end
|
||||
|
||||
get '/' do
|
||||
show_page_or_file('Home')
|
||||
end
|
||||
|
||||
get '/edit/*' do
|
||||
@name = params[:splat].first
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
if page = wiki.page(@name)
|
||||
@page = page
|
||||
@content = page.raw_data
|
||||
mustache :edit
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
end
|
||||
|
||||
post '/edit/*' do
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
page = wiki.page(params[:splat].first)
|
||||
name = params[:rename] || page.name
|
||||
committer = Gollum::Committer.new(wiki, commit_message)
|
||||
commit = {:committer => committer}
|
||||
|
||||
update_wiki_page(wiki, page, params[:content], commit, name,
|
||||
params[:format])
|
||||
update_wiki_page(wiki, page.footer, params[:footer], commit) if params[:footer]
|
||||
update_wiki_page(wiki, page.sidebar, params[:sidebar], commit) if params[:sidebar]
|
||||
committer.commit
|
||||
|
||||
redirect "/#{CGI.escape(Gollum::Page.cname(name))}"
|
||||
end
|
||||
|
||||
post '/create' do
|
||||
name = params[:page]
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
|
||||
format = params[:format].intern
|
||||
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message)
|
||||
redirect "/#{CGI.escape(name)}"
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
end
|
||||
end
|
||||
|
||||
post '/revert/:page/*' do
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
@name = params[:page]
|
||||
@page = wiki.page(@name)
|
||||
shas = params[:splat].first.split("/")
|
||||
sha1 = shas.shift
|
||||
sha2 = shas.shift
|
||||
|
||||
if wiki.revert_page(@page, sha1, sha2, commit_message)
|
||||
redirect "/#{CGI.escape(@name)}"
|
||||
else
|
||||
sha2, sha1 = sha1, "#{sha1}^" if !sha2
|
||||
@versions = [sha1, sha2]
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
@message = "The patch does not apply."
|
||||
mustache :compare
|
||||
end
|
||||
end
|
||||
|
||||
post '/preview' do
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
@name = "Preview"
|
||||
@page = wiki.preview_page(@name, params[:content], params[:format])
|
||||
@content = @page.formatted_data
|
||||
mustache :page
|
||||
end
|
||||
|
||||
get '/history/:name' do
|
||||
@name = params[:name]
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
@page = wiki.page(@name)
|
||||
@page_num = [params[:page].to_i, 1].max
|
||||
@versions = @page.versions :page => @page_num
|
||||
mustache :history
|
||||
end
|
||||
|
||||
post '/compare/:name' do
|
||||
@versions = params[:versions] || []
|
||||
if @versions.size < 2
|
||||
redirect "/history/#{CGI.escape(params[:name])}"
|
||||
else
|
||||
redirect "/compare/%s/%s...%s" % [
|
||||
CGI.escape(params[:name]),
|
||||
@versions.last,
|
||||
@versions.first]
|
||||
end
|
||||
end
|
||||
|
||||
get '/compare/:name/:version_list' do
|
||||
@name = params[:name]
|
||||
@versions = params[:version_list].split(/\.{2,3}/)
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
@page = wiki.page(@name)
|
||||
diffs = wiki.repo.diff(@versions.first, @versions.last, @page.path)
|
||||
@diff = diffs.first
|
||||
mustache :compare
|
||||
end
|
||||
|
||||
get %r{^/(javascript|css|images)} do
|
||||
halt 404
|
||||
end
|
||||
|
||||
get %r{/(.+?)/([0-9a-f]{40})} do
|
||||
name = params[:captures][0]
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
if page = wiki.page(name, params[:captures][1])
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
mustache :page
|
||||
else
|
||||
halt 404
|
||||
end
|
||||
end
|
||||
|
||||
get '/search' do
|
||||
@query = params[:q]
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
@results = wiki.search @query
|
||||
@name = @query
|
||||
mustache :search
|
||||
end
|
||||
|
||||
get '/*' do
|
||||
show_page_or_file(params[:splat].first)
|
||||
end
|
||||
|
||||
def show_page_or_file(name)
|
||||
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options)
|
||||
if page = wiki.page(name)
|
||||
@page = page
|
||||
@name = name
|
||||
@content = page.formatted_data
|
||||
mustache :page
|
||||
elsif file = wiki.file(name)
|
||||
content_type file.mime_type
|
||||
file.raw_data
|
||||
else
|
||||
@name = name
|
||||
mustache :create
|
||||
end
|
||||
end
|
||||
|
||||
def update_wiki_page(wiki, page, content, commit_message, name = nil, format = nil)
|
||||
return if !page ||
|
||||
((!content || page.raw_data == content) && page.format == format)
|
||||
name ||= page.name
|
||||
format = (format || page.format).to_sym
|
||||
content ||= page.raw_data
|
||||
wiki.update_page(page, name, format, content.to_s, commit_message)
|
||||
end
|
||||
|
||||
def commit_message
|
||||
{ :message => params[:message] }
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,665 +0,0 @@
|
||||
/*
|
||||
gollum.css
|
||||
A basic stylesheet for Gollum
|
||||
*/
|
||||
|
||||
/* @section core */
|
||||
body, html {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 10px; /* -> 1em */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki-wrapper {
|
||||
margin: 0 auto;
|
||||
overflow: visible;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
a:link {
|
||||
color: #4183c4;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover, a:visited {
|
||||
color: #4183c4;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
|
||||
/* @section head */
|
||||
#head {
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin: 4.5em 0 0.5em;
|
||||
padding: 0.5em 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#head h1 {
|
||||
font-size: 3.3em;
|
||||
float: left;
|
||||
line-height: normal;
|
||||
margin: 0;
|
||||
padding: 0.08em 0 0 0;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
#head ul.actions {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* @section content */
|
||||
#wiki-content {
|
||||
height: 1%;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
#wiki-content .wrap {
|
||||
height: 1%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/* @section comments */
|
||||
#wiki-body #inline-comment {
|
||||
display: none; /* todo */
|
||||
}
|
||||
|
||||
/* @section body */
|
||||
#wiki-body {
|
||||
display: block;
|
||||
float: left;
|
||||
margin-right: 3%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.has-rightbar #wiki-body {
|
||||
width: 68%;
|
||||
}
|
||||
|
||||
/* @section rightbar */
|
||||
#wiki-rightbar {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #ddd;
|
||||
font-size: 13px;
|
||||
float: right;
|
||||
padding: 7px;
|
||||
width: 25%;
|
||||
|
||||
border-radius: 0.5em;
|
||||
-moz-border-radius: 0.5em;
|
||||
-webkit-border-radius: 0.5em;
|
||||
}
|
||||
|
||||
#wiki-rightbar p {
|
||||
margin: 13px 0 0;
|
||||
}
|
||||
|
||||
#wiki-rightbar > p:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#wiki-rightbar p.parent {
|
||||
border-bottom: 1px solid #bbb;
|
||||
font-weight: bold;
|
||||
margin: 0 0 0.5em 0;
|
||||
padding: 0 0 0.5em 0;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
/* Back arrow */
|
||||
#wiki-rightbar p.parent:before {
|
||||
color: #666;
|
||||
content: "← ";
|
||||
}
|
||||
|
||||
#wiki-rightbar h3 {
|
||||
font-size: 1.2em;
|
||||
color: #333;
|
||||
margin: 1.2em 0 0;
|
||||
padding: 0;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
#wiki-rightbar ul {
|
||||
margin: 0.5em 0 1em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki-rightbar ul li {
|
||||
color: #bbb;
|
||||
margin: 0 0 0 1em;
|
||||
padding: 0;
|
||||
line-height: 1.75em;
|
||||
list-style-position: inside;
|
||||
list-style-type: round;
|
||||
}
|
||||
|
||||
#wiki-rightbar #nav ul li a {
|
||||
font-weight: bold;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
/* @section footer */
|
||||
#wiki-footer {
|
||||
clear: both;
|
||||
margin: 2em 0 5em;
|
||||
}
|
||||
|
||||
.has-rightbar #wiki-footer {
|
||||
width: 70%;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #ddd;
|
||||
font-size: 1.2em;
|
||||
line-height: 1.5em;
|
||||
margin-top: 1.5em;
|
||||
padding: 1em;
|
||||
|
||||
border-radius: 0.5em;
|
||||
-moz-border-radius: 0.5em;
|
||||
-webkit-border-radius: 0.5em;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content h3 {
|
||||
font-size: 1.2em;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0 0 0.2em;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content p {
|
||||
margin: 0.5em 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content ul.links {
|
||||
margin: 0.5em 0 0;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content ul.links li {
|
||||
color: #999;
|
||||
float: left;
|
||||
list-style-position: inside;
|
||||
list-style-type: square;
|
||||
padding: 0;
|
||||
margin-left: 0.75em;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content ul.links li a {
|
||||
font-weight: bold;
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
#wiki-footer #footer-content ul.links li:first-child {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.ff #wiki-footer #footer-content ul.links li:first-child {
|
||||
margin: 0 -0.75em 0 0;
|
||||
}
|
||||
|
||||
/* @section page-footer */
|
||||
.page #footer {
|
||||
border-top: 1px solid #ccc;
|
||||
margin: 1em 0 7em;
|
||||
}
|
||||
|
||||
#footer p#last-edit {
|
||||
font-size: 1.2em;
|
||||
line-height: 1.6em;
|
||||
color: #999;
|
||||
margin: 0.9em 0;
|
||||
}
|
||||
|
||||
#footer p#last-edit span.username {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/* @section history */
|
||||
.history h1 {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.history h1 strong {
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#wiki-history {
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
#wiki-history fieldset {
|
||||
border: 0;
|
||||
margin: 2em 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#wiki-history table, #wiki-history tbody {
|
||||
border-collapse: collapse;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#wiki-history table tr {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#wiki-history table tr {
|
||||
background-color: #ebf2f6;
|
||||
}
|
||||
|
||||
#wiki-history table tr td {
|
||||
border: 1px solid #c0dce9;
|
||||
font-size: 1.2em;
|
||||
line-height: 1.6em;
|
||||
margin: 0;
|
||||
padding: 0.3em 0.7em;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.checkbox {
|
||||
min-width: 2em;
|
||||
padding: 0.3em;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.checkbox input {
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
padding-right: 0;
|
||||
padding-top: 0.4em;
|
||||
margin-right: -0.2em;
|
||||
}
|
||||
|
||||
#wiki-history table tr:nth-child(2n),
|
||||
#wiki-history table tr.alt-row {
|
||||
background-color: #f3f7fa;
|
||||
}
|
||||
|
||||
#wiki-history table tr.selected {
|
||||
background-color: #ffffea !important;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.commit-name {
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.commit-name span.time-elapsed {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.author {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.author a {
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.author a span.username {
|
||||
display: block;
|
||||
padding-top: 3px;
|
||||
}
|
||||
|
||||
#wiki-history table tr td img {
|
||||
background-color: #fff;
|
||||
border: 1px solid #999;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 18px;
|
||||
overflow: hidden;
|
||||
margin: 0 0.5em 0 0;
|
||||
width: 18px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
#wiki-history table tr td.commit-name a {
|
||||
font-size: 0.9em;
|
||||
font-family: 'Monaco', 'Andale Mono', Consolas, 'Courier New', monospace;
|
||||
padding: 0 0.2em;
|
||||
}
|
||||
|
||||
.history #wiki-history ul.actions li,
|
||||
.history #footer ul.actions li {
|
||||
margin: 0 0.6em 0 0;
|
||||
}
|
||||
|
||||
|
||||
/* @section edit */
|
||||
.edit h1 {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.edit h1 strong {
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
||||
/* @section search */
|
||||
.results h1 {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.results h1 strong {
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.results #results {
|
||||
border-bottom: 1px solid #ccc;
|
||||
margin-bottom: 2em;
|
||||
padding-bottom: 2em;
|
||||
}
|
||||
|
||||
.results #results ul {
|
||||
margin: 2em 0 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.results #results ul li {
|
||||
font-size: 1.2em;
|
||||
line-height: 1.6em;
|
||||
list-style-position: outside;
|
||||
padding: 0.2em 0;
|
||||
}
|
||||
|
||||
.results #results ul li span.count {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.results p#no-results {
|
||||
font-size: 1.2em;
|
||||
line-height: 1.6em;
|
||||
margin-top: 2em;
|
||||
}
|
||||
|
||||
.results #footer ul.actions li {
|
||||
margin: 0 1em 0 0;
|
||||
}
|
||||
|
||||
|
||||
/* @section compare */
|
||||
.compare h1 {
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.compare h1 strong {
|
||||
color: #000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.compare #compare-content {
|
||||
margin-top: 3em;
|
||||
}
|
||||
|
||||
.compare .data {
|
||||
border: 1px solid #ddd;
|
||||
margin-top: 1em;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.compare .data pre {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.compare .data pre div {
|
||||
padding: 0 0 0 1em;
|
||||
}
|
||||
|
||||
.compare .data tr td {
|
||||
font-family: "Consolas", "Monaco", "Andale Mono", "Courier New", monospace;
|
||||
font-size: 1.2em;
|
||||
line-height: 1.8em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.compare .data td.line_numbers {
|
||||
background: #f7f7f7;
|
||||
border-right: 1px solid #999;
|
||||
color: #999;
|
||||
padding: 0 0 0 0.5em;
|
||||
}
|
||||
|
||||
.compare #compare-content ul.actions li,
|
||||
.compare #footer ul.actions li {
|
||||
margin-left: 0;
|
||||
margin-right: 0.6em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* @control syntax */
|
||||
.highlight { background: #ffffff; }
|
||||
.highlight .c { color: #999988; font-style: italic }
|
||||
.highlight .err { color: #a61717; background-color: #e3d2d2 }
|
||||
.highlight .k { font-weight: bold }
|
||||
.highlight .o { font-weight: bold }
|
||||
.highlight .cm { color: #999988; font-style: italic }
|
||||
.highlight .cp { color: #999999; font-weight: bold }
|
||||
.highlight .c1 { color: #999988; font-style: italic }
|
||||
.highlight .cs { color: #999999; font-weight: bold; font-style: italic }
|
||||
.highlight .gd { color: #000000; background-color: #ffdddd }
|
||||
.highlight .gd .x { color: #000000; background-color: #ffaaaa }
|
||||
.highlight .ge { font-style: italic }
|
||||
.highlight .gr { color: #aa0000 }
|
||||
.highlight .gh { color: #999999 }
|
||||
.highlight .gi { color: #000000; background-color: #ddffdd }
|
||||
.highlight .gi .x { color: #000000; background-color: #aaffaa }
|
||||
.highlight .gc { color: #999; background-color: #EAF2F5 }
|
||||
.highlight .go { color: #888888 }
|
||||
.highlight .gp { color: #555555 }
|
||||
.highlight .gs { font-weight: bold }
|
||||
.highlight .gu { color: #aaaaaa }
|
||||
.highlight .gt { color: #aa0000 }
|
||||
|
||||
|
||||
/* @control minibutton */
|
||||
ul.actions {
|
||||
display: block;
|
||||
list-style-type: none;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
ul.actions li {
|
||||
float: left;
|
||||
font-size: 1.2em;
|
||||
margin-left: 0.6em;
|
||||
}
|
||||
|
||||
.minibutton a {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #d4d4d4;
|
||||
color: #333;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0.4em 1em;
|
||||
height: 1.4em;
|
||||
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
|
||||
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
|
||||
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
}
|
||||
|
||||
#search-submit {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #d4d4d4;
|
||||
color: #333;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
margin: 0;
|
||||
padding: 0.4em 1em;
|
||||
|
||||
text-shadow: 0 1px 0 #fff;
|
||||
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#f4f4f4', endColorstr='#ececec');
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#f4f4f4), to(#ececec));
|
||||
background: -moz-linear-gradient(top, #f4f4f4, #ececec);
|
||||
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
}
|
||||
|
||||
.minibutton a:hover,
|
||||
#search-submit:hover {
|
||||
background: #3072b3;
|
||||
border-color: #518cc6 #518cc6 #2a65a0;
|
||||
color: #fff;
|
||||
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
|
||||
text-decoration: none;
|
||||
|
||||
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#599bdc', endColorstr='#3072b3');
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#599bdc), to(#3072b3));
|
||||
background: -moz-linear-gradient(top, #599bdc, #3072b3);
|
||||
}
|
||||
|
||||
.minibutton a:visited {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
|
||||
/* @special error */
|
||||
#wiki-wrapper.error {
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
top: 50%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#error {
|
||||
background-color: #f9f9f9;
|
||||
border: 1px solid #e4e4e4;
|
||||
left: 50%;
|
||||
overflow: hidden;
|
||||
padding: 2%;
|
||||
margin: -10% 0 0 -35%;
|
||||
position: absolute;
|
||||
width: 70%;
|
||||
|
||||
border-radius: 0.5em;
|
||||
-moz-border-radius: 0.5em;
|
||||
-webkit-border-radius: 0.5em;
|
||||
}
|
||||
|
||||
#error h1 {
|
||||
font-size: 3em;
|
||||
line-height: normal;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#error p {
|
||||
font-size: 1.2em;
|
||||
line-height: 1.6em;
|
||||
margin: 1em 0 0.5em;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/* @control searchbar */
|
||||
#head #searchbar {
|
||||
float: right;
|
||||
margin: 1em 0 0 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#head #searchbar #searchbar-fauxtext {
|
||||
background: #fff;
|
||||
border: 1px solid #d4d4d4;
|
||||
overflow: hidden;
|
||||
|
||||
border-radius: 0.3em;
|
||||
-moz-border-radius: 0.3em;
|
||||
-webkit-border-radius: 0.3em;
|
||||
}
|
||||
|
||||
#head #searchbar #searchbar-fauxtext input#search-query {
|
||||
border: none;
|
||||
color: #000;
|
||||
float: left;
|
||||
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
||||
font-size: 1.2em;
|
||||
height: 1.8em;
|
||||
|
||||
-webkit-focus-ring: none;
|
||||
}
|
||||
|
||||
.ff #head #searchbar #searchbar-fauxtext input#search-query {
|
||||
padding: 0.2em 0 0.2em 0.5em;
|
||||
}
|
||||
|
||||
.ie #head #searchbar #searchbar-fauxtext input#search-query {
|
||||
padding: 0.4em 0 0 0.5em;
|
||||
}
|
||||
|
||||
#head #searchbar #searchbar-fauxtext input#search-query.ph {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#head #searchbar #searchbar-fauxtext #search-submit {
|
||||
border: 0;
|
||||
border-left: 1px solid #d4d4d4;
|
||||
cursor: pointer;
|
||||
margin: 0 !important;
|
||||
padding: 0;
|
||||
float: right;
|
||||
font-size: 1.2em;
|
||||
|
||||
border-radius: 0 3px 3px 0;
|
||||
-moz-border-radius: 0 3px 3px 0;
|
||||
-webkit-border-radius: 0 3px 3px 0;
|
||||
}
|
||||
|
||||
#head #searchbar #searchbar-fauxtext #search-submit span {
|
||||
background-image: url(/images/icon-sprite.png);
|
||||
background-position: -431px -1px;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
height: 2em;
|
||||
overflow: hidden;
|
||||
text-indent: -5000px;
|
||||
width: 28px;
|
||||
}
|
||||
|
||||
.ff #head #searchbar #searchbar-fauxtext #search-submit span,
|
||||
.ie #head #searchbar #searchbar-fauxtext #search-submit span {
|
||||
height: 2.2em;
|
||||
}
|
||||
|
||||
#head #searchbar #searchbar-fauxtext #search-submit:hover span {
|
||||
background-position: -431px -28px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
#MathJax_Message {
|
||||
display: none;
|
||||
}
|
||||
@@ -1,316 +0,0 @@
|
||||
/*
|
||||
Gollum v3 Template
|
||||
*/
|
||||
|
||||
#template {
|
||||
font-size: 13px;
|
||||
line-height: 23px;
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
/* Link Colors */
|
||||
a.absent {
|
||||
color: #c00;
|
||||
}
|
||||
|
||||
/* Primary Body Copy */
|
||||
#template p {
|
||||
margin: 16px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ReST first graf in nested list */
|
||||
#template * li p.first {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Headings */
|
||||
#template h1, #template h2, #template h3,
|
||||
#template h4, #template h5, #template h6 {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#template h1 {
|
||||
border-top: 4px solid #ccc;
|
||||
font-size: 32px;
|
||||
line-height: normal;
|
||||
padding: 10px 0 0;
|
||||
margin: 30px 0 0;
|
||||
}
|
||||
|
||||
#template h2 {
|
||||
border-top: 4px solid #ccc;
|
||||
font-size: 22px;
|
||||
line-height: normal;
|
||||
margin: 22px 0 0;
|
||||
padding: 7px 0 0;
|
||||
}
|
||||
|
||||
#template h3 {
|
||||
font-size: 16px;
|
||||
line-height: 26px;
|
||||
padding: 26px 0 0;
|
||||
}
|
||||
|
||||
#template h4 {
|
||||
font-size: 14px;
|
||||
line-height: 26px;
|
||||
padding: 18px 0 4px;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#template h5 {
|
||||
font-size: 13px;
|
||||
line-height: 26px;
|
||||
margin-bottom: -19px;
|
||||
padding: 14px 0 0;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
#template h6 {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
line-height: 26px;
|
||||
margin-bottom: -19px;
|
||||
padding: 18px 0 0;
|
||||
font-weight: normal;
|
||||
font-variant: italic;
|
||||
}
|
||||
|
||||
#template hr {
|
||||
background-color: #ccc;
|
||||
color: #ccc;
|
||||
border: 2px solid #ccc;
|
||||
margin: 20px 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Border Reset for headers with horizontal rules */
|
||||
#template > h2:first-child,
|
||||
#template > h1:first-child {
|
||||
border: 0;
|
||||
margin: 12px 0 0;
|
||||
padding: 10px 0 0;
|
||||
}
|
||||
|
||||
|
||||
/* Lists, Blockquotes & Such */
|
||||
#template ul,
|
||||
#template ol {
|
||||
margin: 0;
|
||||
padding: 20px 0 0;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/* Nested Lists */
|
||||
#template ul li ul,
|
||||
#template ol li ol,
|
||||
#template ul li ol,
|
||||
#template ol li ul,
|
||||
#template ul ul,
|
||||
#template ol ol {
|
||||
padding: 0 0 0 14px;
|
||||
}
|
||||
|
||||
#template dl {
|
||||
margin: 0;
|
||||
padding: 20px 0 0;
|
||||
}
|
||||
|
||||
#template dl dt {
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
line-height: normal;
|
||||
margin: 0;
|
||||
padding: 20px 0 0;
|
||||
}
|
||||
|
||||
#template dl dt:first-child {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#template dl dd {
|
||||
font-size: 13px;
|
||||
margin: 0;
|
||||
padding: 3px 0 0;
|
||||
}
|
||||
|
||||
/* Tables */
|
||||
#template table {
|
||||
border-collapse: collapse;
|
||||
margin: 20px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#template table * tr {
|
||||
border-top: 1px solid #ccc;
|
||||
background-color: #fff;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#template table * tr:nth-child(2n) {
|
||||
background-color: #f8f8f8;
|
||||
}
|
||||
|
||||
#template table * tr th,
|
||||
#template table * tr td {
|
||||
border: 1px solid #ccc;
|
||||
text-align: left;
|
||||
margin: 0;
|
||||
padding: 6px 13px;
|
||||
}
|
||||
|
||||
/* Images & Stuff */
|
||||
#template img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* Gollum Image Tags */
|
||||
|
||||
/* Framed */
|
||||
#template span.frame {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#template span.frame > span {
|
||||
border: 1px solid #ddd;
|
||||
display: block;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
margin: 13px 0 0;
|
||||
padding: 7px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#template span.frame span img {
|
||||
display: block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#template span.frame span span {
|
||||
clear: both;
|
||||
color: #333;
|
||||
display: block;
|
||||
padding: 5px 0 0;
|
||||
}
|
||||
|
||||
#template span.align-center {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#template span.align-center > span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin: 13px auto 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#template span.align-center span img {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#template span.align-right {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
#template span.align-right > span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin: 13px 0 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#template span.align-right span img {
|
||||
margin: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#template span.float-left {
|
||||
display: block;
|
||||
margin-right: 13px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
}
|
||||
|
||||
#template span.float-left span {
|
||||
margin: 13px 0 0;
|
||||
}
|
||||
|
||||
#template span.float-right {
|
||||
display: block;
|
||||
margin-left: 13px;
|
||||
overflow: hidden;
|
||||
float: right;
|
||||
}
|
||||
|
||||
#template span.float-right > span {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
margin: 13px auto 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
/* Code */
|
||||
#template code, #template tt {
|
||||
background-color: #f8f8f8;
|
||||
border: 1px solid #dedede;
|
||||
font-size: 13px;
|
||||
padding: 1px 5px;
|
||||
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#template .highlight pre, #template pre {
|
||||
background-color: #f8f8f8;
|
||||
border: 1px solid #ccc;
|
||||
font-size: 13px;
|
||||
line-height: 19px;
|
||||
overflow: auto;
|
||||
padding: 6px;
|
||||
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#template pre code, #template pre tt {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
#template .highlight { background: #ffffff; }
|
||||
#template .highlight .c { color: #999988; font-style: italic }
|
||||
#template .highlight .err { color: #a61717; background-color: #e3d2d2 }
|
||||
#template .highlight .k { font-weight: bold }
|
||||
#template .highlight .o { font-weight: bold }
|
||||
#template .highlight .cm { color: #999988; font-style: italic }
|
||||
#template .highlight .cp { color: #999999; font-weight: bold }
|
||||
#template .highlight .c1 { color: #999988; font-style: italic }
|
||||
#template .highlight .cs { color: #999999; font-weight: bold; font-style: italic }
|
||||
#template .highlight .gd { color: #000000; background-color: #ffdddd }
|
||||
#template .highlight .gd .x { color: #000000; background-color: #ffaaaa }
|
||||
#template .highlight .ge { font-style: italic }
|
||||
#template .highlight .gr { color: #aa0000 }
|
||||
#template .highlight .gh { color: #999999 }
|
||||
#template .highlight .gi { color: #000000; background-color: #ddffdd }
|
||||
#template .highlight .gi .x { color: #000000; background-color: #aaffaa }
|
||||
#template .highlight .gc { color: #999; background-color: #EAF2F5 }
|
||||
#template .highlight .go { color: #888888 }
|
||||
#template .highlight .gp { color: #555555 }
|
||||
#template .highlight .gs { font-weight: bold }
|
||||
#template .highlight .gu { color: #aaaaaa }
|
||||
#template .highlight .gt { color: #aa0000 }
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* ../SourceForge/trunk/mathjax/config/MMLorHTML.js
|
||||
*
|
||||
* Copyright (c) 2010 Design Science, Inc.
|
||||
*
|
||||
* Part of the MathJax library.
|
||||
* See http://www.mathjax.org for details.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0;
|
||||
* you may not use this file except in compliance with the License.
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*/
|
||||
|
||||
MathJax.Unpack([
|
||||
['(function(c){var i="1.0";var g=','MathJax.Hub','.Insert({prefer:{MSIE:"MML",Firefox:"MML",Opera:"HTML",other:"HTML"}},(',1,'.config.MMLorHTML||{}));var e={Firefox:3,Opera:9.52,MSIE:6,Chrome:0.3,Safari:2,Konqueror:4};var h=(c','.Browser','.version==="0.0"||','c.Browser.versionAtLeast','(e[c',5,']||0));var b;try{new ActiveXObject("MathPlayer.Factory.1");b=true}catch(d){b=false}var f=(c',5,'.isFirefox&&',7,'("1.5"))||(c',5,'.isMSIE&&b)||(c',5,'.isOpera&&',7,'("9.52"));var a=(g.prefer&&typeof(g.prefer)==="object"?g.prefer[',1,5,']||g.prefer.other||"HTML":g.prefer);if(h||f){if(f&&(a==="MML"||!h)){','c.config.jax.unshift("output/','NativeMML")}else{',24,'HTML-CSS")}}else{c.PreProcess','.disabled=true;','c.prepareScripts',28,'MathJax.Message.Set("Your browser does not support MathJax",null,4000);c.Startup.signal.Post("MathJax not supported")}})(',1,');MathJax.Ajax.loadComplete("[MathJax]/config/MMLorHTML.js");']
|
||||
]);
|
||||
|
||||
@@ -1,590 +0,0 @@
|
||||
/*************************************************************
|
||||
*
|
||||
* MathJax/config/MathJax.js
|
||||
*
|
||||
* This configuration file is loaded when there is no explicit
|
||||
* configuration script in the <script> tag that loads MathJax.js
|
||||
*
|
||||
* Use it to customize the MathJax settings. See comments below.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2009-10 Design Science, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
MathJax.Hub.Config({
|
||||
|
||||
//
|
||||
// A comma-separated list of configuration files to load
|
||||
// when MathJax starts up. E.g., to define local macros, etc.
|
||||
// The default directory is the MathJax/config directory.
|
||||
//
|
||||
// Example: config: ["local/local.js"],
|
||||
// Example: config: ["local/local.js","MMLtoHTML.js"],
|
||||
//
|
||||
config: [],
|
||||
|
||||
//
|
||||
// A comma-separated list of CSS stylesheet files to be loaded
|
||||
// when MathJax starts up. The default directory is the
|
||||
// MathJax/config directory.
|
||||
//
|
||||
// Example: styleSheets: ["MathJax.css"],
|
||||
//
|
||||
styleSheets: [],
|
||||
|
||||
//
|
||||
// Styles to be defined dynamically at startup time.
|
||||
//
|
||||
// Example:
|
||||
// styles: {
|
||||
// ".MathJax .merror": {
|
||||
// color: "blue",
|
||||
// "background-color": "green"
|
||||
// }
|
||||
// },
|
||||
//
|
||||
styles: {},
|
||||
|
||||
//
|
||||
// A comma-separated list of input and output jax to initialize at startup.
|
||||
// Their main code is loaded only when they are actually used, so it is not
|
||||
// inefficient to include jax that may not actually be used on the page. These
|
||||
// are found in the MathJax/jax directory.
|
||||
//
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
|
||||
//
|
||||
// A comma-separated list of extensions to load at startup. The default
|
||||
// directory is MathJax/extensions.
|
||||
//
|
||||
// Example: extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js"],
|
||||
//
|
||||
extensions: ["tex2jax.js"],
|
||||
|
||||
//
|
||||
// Patterns to remove from before and after math script tags. If you are not
|
||||
// using one of the preprocessors (e.g., tex2jax), you need to insert something
|
||||
// extra into your HTML file in order to avoid a bug in Internet Explorer. IE
|
||||
// removes spaces from the DOM that it thinks are redundent, and since a SCRIPT
|
||||
// tag usually doesn't add content to the page, if there is a space before and after
|
||||
// a MathJax SCRIPT tag, IE will remove the first space. When MathJax inserts
|
||||
// the typeset mathematics, this means there will be no space before it and the
|
||||
// preceeding text. In order to avoid this, you should include some "guard characters"
|
||||
// before or after the math SCRIPT tag; define the patterns you want to use below.
|
||||
// Note that these are used as regular expressions, so you will need to quote
|
||||
// special characters. Furthermore, since they are javascript strings, you must
|
||||
// quote javascript special characters as well. So to obtain a backslash, you must
|
||||
// use \\ (doubled for javascript). For example, "\\[" is the pattern \[ in the
|
||||
// regular expression. That means that if you want an actual backslash in your
|
||||
// guard characters, you need to use "\\\\" in order to get \\ in the regular
|
||||
// expression, and \ in the actual text. If both preJax and postJax are defined,
|
||||
// both must be present in order to be removed.
|
||||
//
|
||||
// See also the preRemoveClass comments below.
|
||||
//
|
||||
// Example:
|
||||
// preJax: "\\\\\\\\", // makes a double backslash the preJax text
|
||||
// or
|
||||
// preJax: "\\[\\[", // jax scripts must be enclosed in double brackets
|
||||
// postJax: "\\]\\]",
|
||||
//
|
||||
preJax: null,
|
||||
postJax: null,
|
||||
|
||||
//
|
||||
// The CSS class for a math preview to be removed preceeding a MathJax
|
||||
// SCRIPT tag. If the tag just before the MathJax SCRIPT tag is of this
|
||||
// class, its contents are removed when MathJax processes the SCRIPT
|
||||
// tag. This allows you to include a math preview in a form that will
|
||||
// be displayed prior to MathJax performing its typesetting. It also
|
||||
// avoids the Internet Explorer space-removal bug, and can be used in
|
||||
// place of preJax and postJax if that is more convenient.
|
||||
//
|
||||
// For example
|
||||
//
|
||||
// <span class="MathJax_Preview">[math]</span><script type="math/tex">...</script>
|
||||
//
|
||||
// would display "[math]" in place of the math until MathJax is able to typeset it.
|
||||
//
|
||||
preRemoveClass: "MathJax_Preview",
|
||||
|
||||
//
|
||||
// This value controls whether the "Processing Math: nn%" message are displayed
|
||||
// in the lower left-hand corner. Set to "false" to prevent those messages (though
|
||||
// file loading and other messages will still be shown).
|
||||
//
|
||||
showProcessingMessages: true,
|
||||
|
||||
//
|
||||
// This value controls the verbosity of the messages in the lower left-hand corner.
|
||||
// Set it to "none" to eliminate all messages, or set it to "simple" to show
|
||||
// "Loading..." and "Processing..." rather than showing the full file name and the
|
||||
// percentage of the mathematics processed.
|
||||
//
|
||||
messageStyle: "normal",
|
||||
|
||||
//
|
||||
// These two parameters control the alignment and shifting of displayed equations.
|
||||
// The first can be "left", "center", or "right", and determines the alignment of
|
||||
// displayed equations. When the alignment is not "center", the second determines
|
||||
// an indentation from the left or right side for the displayed equations.
|
||||
//
|
||||
displayAlign: "center",
|
||||
displayIndent: "0em",
|
||||
|
||||
//
|
||||
// Normally MathJax will perform its starup commands (loading of
|
||||
// configuration, styles, jax, and so on) as soon as it can. If you
|
||||
// expect to be doing additional configuration on the page, however, you
|
||||
// may want to have it wait until the page's onload hander is called. If so,
|
||||
// set this to "onload".
|
||||
//
|
||||
delayStartupUntil: "none",
|
||||
|
||||
//
|
||||
// Normally MathJax will typeset the mathematics on the page as soon as
|
||||
// the page is loaded. If you want to delay that process, in which case
|
||||
// you will need to call MathJax.Hub.Typeset() yourself by hand, set
|
||||
// this value to true.
|
||||
//
|
||||
skipStartupTypeset: false,
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the tex2jax preprocessor (when you have included
|
||||
// "tex2jax.js" in the extensions list above).
|
||||
//
|
||||
tex2jax: {
|
||||
|
||||
//
|
||||
// The Id of the element to be processed (defaults to full document)
|
||||
//
|
||||
element: null,
|
||||
|
||||
//
|
||||
// The delimiters that surround in-line math expressions. The first in each
|
||||
// pair is the initial delimiter and the second is the terminal delimiter.
|
||||
// Comment out any that you don't want, but be sure there is no extra
|
||||
// comma at the end of the last item in the list -- some browsers won't
|
||||
// be able to handle that.
|
||||
//
|
||||
inlineMath: [
|
||||
// ['$','$'], // uncomment this for standard TeX math delimiters
|
||||
['\\(','\\)']
|
||||
],
|
||||
|
||||
//
|
||||
// The delimiters that surround displayed math expressions. The first in each
|
||||
// pair is the initial delimiter and the second is the terminal delimiter.
|
||||
// Comment out any that you don't want, but be sure there is no extra
|
||||
// comma at the end of the last item in the list -- some browsers won't
|
||||
// be able to handle that.
|
||||
//
|
||||
displayMath: [
|
||||
['$$','$$'],
|
||||
['\\[','\\]']
|
||||
],
|
||||
|
||||
//
|
||||
// This array lists the names of the tags whose contents should not be
|
||||
// processed by tex2jax (other than to look for ignore/process classes
|
||||
// as listed below). You can add to (or remove from) this list to prevent
|
||||
// MathJax from processing mathematics in specific contexts.
|
||||
//
|
||||
skipTags: ["script","noscript","style","textarea","pre","code"],
|
||||
|
||||
//
|
||||
// This is the class name used to mark elements whose contents should
|
||||
// not be processed by tex2jax (other than to look for the
|
||||
// processClass pattern below). Note that this is a regular
|
||||
// expression, and so you need to be sure to quote any regexp special
|
||||
// characters. The pattern is automatically preceeded by '(^| )(' and
|
||||
// followed by ')( |$)', so your pattern will have to match full words
|
||||
// in the class name. Assigning an element this class name will
|
||||
// prevent `tex2jax` from processing its contents.
|
||||
//
|
||||
ignoreClass: "tex2jax_ignore",
|
||||
|
||||
//
|
||||
// This is the class name used to mark elements whose contents SHOULD
|
||||
// be processed by tex2jax. This is used to turn on processing within
|
||||
// tags that have been marked as ignored or skipped above. Note that
|
||||
// this is a regular expression, and so you need to be sure to quote
|
||||
// any regexp special characters. The pattern is automatically
|
||||
// preceeded by '(^| )(' and followed by ')( |$)', so your pattern
|
||||
// will have to match full words in the class name. Use this to
|
||||
// restart processing within an element that has been marked as
|
||||
// ignored above.
|
||||
//
|
||||
processClass: "tex2jax_process",
|
||||
|
||||
//
|
||||
// Set to "true" to allow \$ to produce a dollar without starting in-line
|
||||
// math mode. If you uncomment the ['$','$'] line above, you should change
|
||||
// this to true so that you can insert plain dollar signs into your documents
|
||||
//
|
||||
processEscapes: false,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax processes LaTeX environments outside of math
|
||||
// mode. Set to "false" to prevent processing of environments except within
|
||||
// math mode.
|
||||
//
|
||||
processEnvironments: true,
|
||||
|
||||
//
|
||||
// Controls whether tex2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, when it locates in-line
|
||||
// and display mathetics on the page. The default is "TeX", which
|
||||
// means use the TeX code as the preview (until it is processed by
|
||||
// MathJax). Set to "none" to prevent the previews from being
|
||||
// inserted (the math will simply disappear until it is typeset). Set
|
||||
// to an array containing the description of an HTML snippet in order
|
||||
// to use the same preview for all equations on the page (e.g., you
|
||||
// could have it say "[math]" or load an image).
|
||||
//
|
||||
// E.g., preview: ["[math]"],
|
||||
// or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]]
|
||||
//
|
||||
preview: "TeX"
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the mml2jax preprocessor (when you have included
|
||||
// "mml2jax.js" in the extensions list above).
|
||||
//
|
||||
mml2jax: {
|
||||
|
||||
//
|
||||
// The Id of the element to be processed (defaults to full document)
|
||||
//
|
||||
element: null,
|
||||
|
||||
//
|
||||
// Controls whether mml2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, whrn it locates
|
||||
// mathematics on the page. The default is "alttext", which means use
|
||||
// the <math> tag's alttext attribute as the preview (until it is
|
||||
// processed by MathJax), if the tag has one. Set to "none" to
|
||||
// prevent the previews from being inserted (the math will simply
|
||||
// disappear until it is typeset). Set to an array containing the
|
||||
// description of an HTML snippet in order to use the same preview for
|
||||
// all equations on the page (e.g., you could have it say "[math]" or
|
||||
// load an image).
|
||||
//
|
||||
// E.g., preview: ["[math]"],
|
||||
// or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]]
|
||||
//
|
||||
preview: "alttext"
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the jsMath2jax preprocessor (when you have included
|
||||
// "jsMath2jax.js" in the extensions list above).
|
||||
//
|
||||
jsMath2jax: {
|
||||
|
||||
//
|
||||
// The Id of the element to be processed (defaults to full document)
|
||||
//
|
||||
element: null,
|
||||
|
||||
//
|
||||
// Controls whether jsMath2jax inserts MathJax_Preview spans to make a
|
||||
// preview available, and what preview to use, when it locates
|
||||
// mathematics on the page. The default is "TeX", which means use the
|
||||
// TeX code as the preview (until it is processed by MathJax). Set to
|
||||
// "none" to prevent the previews from being inserted (the math will
|
||||
// simply disappear until it is typeset). Set to an array containing
|
||||
// the description of an HTML snippet in order to use the same preview
|
||||
// for all equations on the page (e.g., you could have it say "[math]"
|
||||
// or load an image).
|
||||
//
|
||||
// E.g., preview: ["[math]"],
|
||||
// or preview: [["img",{src: "http://myserver.com/images/mypic.jpg"}]]
|
||||
//
|
||||
preview: "TeX"
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the TeX input jax.
|
||||
//
|
||||
TeX: {
|
||||
|
||||
//
|
||||
// This specifies the side on which \tag{} macros will place the tags.
|
||||
// Set to "left" to place on the left-hand side.
|
||||
//
|
||||
TagSide: "right",
|
||||
|
||||
//
|
||||
// This is the amound of indentation (from right or left) for the tags.
|
||||
//
|
||||
TagIndent: ".8em",
|
||||
|
||||
//
|
||||
// This is the width to use for the multline environment
|
||||
//
|
||||
MultLineWidth: "85%",
|
||||
|
||||
//
|
||||
// List of macros to define. These are of the form
|
||||
// name: value
|
||||
// where 'value' is the replacement text for the macro \name.
|
||||
// The 'value' can also be [value,n] where 'value' is the replacement
|
||||
// text and 'n' is the number of parameters for the macro.
|
||||
// Note that backslashes must be doubled in the replacement string.
|
||||
//
|
||||
// E.g.,
|
||||
//
|
||||
// Macros: {
|
||||
// RR: '{\\bf R}',
|
||||
// bold: ['{\\bf #1}', 1]
|
||||
// }
|
||||
//
|
||||
Macros: {}
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the MathML inupt jax.
|
||||
//
|
||||
MathML: {
|
||||
//
|
||||
// This specifies whether to use TeX spacing or MathML spacing when the
|
||||
// HTML-CSS output jax is used.
|
||||
//
|
||||
useMathMLspacing: false
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the HTML-CSS output jax.
|
||||
//
|
||||
"HTML-CSS": {
|
||||
|
||||
//
|
||||
// This controls the global scaling of mathematics as compared to the
|
||||
// surrounding text. Values between 100 and 133 are usually good choices.
|
||||
//
|
||||
scale: 100,
|
||||
|
||||
//
|
||||
// This is a list of the fonts to look for on a user's computer in
|
||||
// preference to using MathJax's web-based fonts. These must
|
||||
// correspond to directories available in the jax/output/HTML-CSS/fonts
|
||||
// directory, where MathJax stores data about the characters available
|
||||
// in the fonts. Set this to ["TeX"], for example, to prevent the
|
||||
// use of the STIX fonts, or set it to an empty list, [], if
|
||||
// you want to force MathJax to use web-based or image fonts.
|
||||
//
|
||||
availableFonts: ["STIX","TeX"],
|
||||
|
||||
//
|
||||
// This is the preferred font to use when more than one of those
|
||||
// listed above is available.
|
||||
//
|
||||
preferredFont: "TeX",
|
||||
|
||||
//
|
||||
// This is the web-based font to use when none of the fonts listed
|
||||
// above are available on the user's computer. Note that currently
|
||||
// only the TeX font is available in a web-based form. Set this to
|
||||
//
|
||||
// webFont: null,
|
||||
//
|
||||
// if you want to prevent the use of web-based fonts.
|
||||
//
|
||||
webFont: "TeX",
|
||||
|
||||
//
|
||||
// This is the font to use for image fallback mode (when none of the
|
||||
// fonts listed above are available and the browser doesn't support
|
||||
// web-fonts via the @font-face CSS directive). Note that currently
|
||||
// only the TeX font is available as an image font. Set this to
|
||||
//
|
||||
// imageFont: null,
|
||||
//
|
||||
// if you want to prevent the use of image fonts (e.g., you have not
|
||||
// installed the image fonts on your server). In this case, only
|
||||
// browsers that support web-based fonts will be able to view your pages
|
||||
// without having the fonts installed on the client computer. The browsers
|
||||
// that support web-based fonts include: IE6 and later, Chrome, Safari3.1
|
||||
// and above, Firefox3.5 and later, and Opera10 and later. Note that
|
||||
// Firefox3.0 is NOT on this list, so without image fonts, FF3.0 users
|
||||
// will be required to to download and install either the STIX fonts or the
|
||||
// MathJax TeX fonts.
|
||||
//
|
||||
imageFont: "TeX",
|
||||
|
||||
//
|
||||
// This controls whether the MathJax contextual menu will be available
|
||||
// on the mathematics in the page. If true, then right-clicking (on
|
||||
// the PC) or control-clicking (on the Mac) will produce a MathJax
|
||||
// menu that allows you to get the source of the mathematics in
|
||||
// various formats, change the size of the mathematics relative to the
|
||||
// surrounding text, and get information about MathJax.
|
||||
//
|
||||
// Set this to false to disable the menu. When true, the MathMenu
|
||||
// items below configure the actions of the menu.
|
||||
//
|
||||
showMathMenu: true,
|
||||
|
||||
//
|
||||
// This allows you to define or modify the styles used to display
|
||||
// various math elements created by MathJax.
|
||||
//
|
||||
// Example:
|
||||
// styles: {
|
||||
// ".MathJax_Preview": {
|
||||
// "font-size": "80%", // preview uses a smaller font
|
||||
// color: "red" // and is in red
|
||||
// }
|
||||
// }
|
||||
//
|
||||
styles: {},
|
||||
|
||||
//
|
||||
// Configuration for <maction> tooltips
|
||||
// (see also the #MathJax_Tooltip CSS in MathJax/jax/output/HTML-CSS/config.js,
|
||||
// which can be overriden using the styles values above).
|
||||
//
|
||||
tooltip: {
|
||||
delayPost: 600, // milliseconds delay before tooltip is posted after mouseover
|
||||
delayClear: 600, // milliseconds delay before tooltip is cleared after mouseout
|
||||
offsetX: 10, offsetY: 5 // pixels to offset tooltip from mouse position
|
||||
}
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the NativeMML output jax.
|
||||
//
|
||||
NativeMML: {
|
||||
|
||||
//
|
||||
// This controls the global scaling of mathematics as compared to the
|
||||
// surrounding text. Values between 100 and 133 are usually good choices.
|
||||
//
|
||||
scale: 100,
|
||||
|
||||
//
|
||||
// This controls whether the MathJax contextual menu will be available
|
||||
// on the mathematics in the page. If true, then right-clicking (on
|
||||
// the PC) or control-clicking (on the Mac) will produce a MathJax
|
||||
// menu that allows you to get the source of the mathematics in
|
||||
// various formats, change the size of the mathematics relative to the
|
||||
// surrounding text, and get information about MathJax.
|
||||
//
|
||||
// Set this to false to disable the menu. When true, the MathMenu
|
||||
// items below configure the actions of the menu.
|
||||
//
|
||||
// There is a separate setting for MSIE, since the code to handle that
|
||||
// is a bit delicate; if it turns out to have unexpected consequences,
|
||||
// you can turn it off without turing off other browser support.
|
||||
//
|
||||
showMathMenu: true,
|
||||
showMathMenuMSIE: true,
|
||||
|
||||
//
|
||||
// This allows you to define or modify the styles used to display
|
||||
// various math elements created by MathJax.
|
||||
//
|
||||
// Example:
|
||||
// styles: {
|
||||
// ".MathJax_MathML": {
|
||||
// color: "red" // MathML is in red
|
||||
// }
|
||||
// }
|
||||
//
|
||||
styles: {}
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the contextual menus that are available on the
|
||||
// mathematics within the page (provided the showMathMenu value is true above).
|
||||
//
|
||||
MathMenu: {
|
||||
//
|
||||
// This is the hover delay for the display of submenus in the
|
||||
// contextual menu. When the mouse is still over a submenu label for
|
||||
// this long, the menu will appear. (The menu also will appear if you
|
||||
// click on the label.) It is in milliseconds.
|
||||
//
|
||||
delay: 400,
|
||||
|
||||
//
|
||||
// This is the URL for the MathJax Help menu item.
|
||||
//
|
||||
helpURL: "http://www.mathjax.org/help/user/",
|
||||
|
||||
//
|
||||
// These control whether the "Math Renderer", "Font Preferences",
|
||||
// and "Contextual Menu" submenus will be displayed or not.
|
||||
//
|
||||
showRenderer: true,
|
||||
showFontMenu: false,
|
||||
showContext: false,
|
||||
|
||||
//
|
||||
// These are the settings for the Show Source window. The initial
|
||||
// width and height will be reset after the source is shown in an
|
||||
// attempt to make the window fit the output better.
|
||||
//
|
||||
windowSettings: {
|
||||
status: "no", toolbar: "no", locationbar: "no", menubar: "no",
|
||||
directories: "no", personalbar: "no", resizable: "yes", scrollbars: "yes",
|
||||
width: 100, height: 50
|
||||
},
|
||||
|
||||
//
|
||||
// This allows you to change the CSS that controls the menu
|
||||
// appearance. See the extensions/MathMenu.js file for details
|
||||
// of the default settings.
|
||||
//
|
||||
styles: {}
|
||||
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// These parameters control the MMLorHTML configuration file.
|
||||
// NOTE: if you add MMLorHTML.js to the config array above,
|
||||
// you must REMOVE the output jax from the jax array.
|
||||
//
|
||||
MMLorHTML: {
|
||||
//
|
||||
// The output jax that is to be preferred when both are possible
|
||||
// (set to "MML" for native MathML, "HTML" for MathJax's HTML-CSS output jax).
|
||||
//
|
||||
prefer: {
|
||||
MSIE: "MML",
|
||||
Firefox: "MML",
|
||||
Opera: "HTML",
|
||||
other: "HTML"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
MathJax.Ajax.loadComplete("[MathJax]/config/MathJax.js");
|
||||
@@ -1,37 +0,0 @@
|
||||
/*************************************************************
|
||||
*
|
||||
* MathJax/config/local/local.js
|
||||
*
|
||||
* Include changes and configuration local to your installation
|
||||
* in this file. For example, common macros can be defined here
|
||||
* (see below). To use this file, add "local/local.js" to the
|
||||
* config array in MathJax.js or your MathJax.Hub.Config() call.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (c) 2009 Design Science, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
|
||||
var TEX = MathJax.InputJax.TeX;
|
||||
|
||||
// place macros here. E.g.:
|
||||
// TEX.Macro("R","{\\bf R}");
|
||||
// TEX.Macro("op","\\mathop{\\rm #1}",1); // a macro with 1 parameter
|
||||
|
||||
});
|
||||
|
||||
MathJax.Ajax.loadComplete("[MathJax]/config/local/local.js");
|
||||
@@ -1,4 +0,0 @@
|
||||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: fedf9ba9a5b2ef65b82b1fa1eea24e52
|
||||
tags: fbb0d17656682115ca4d033fb2f83ba1
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1,173 +0,0 @@
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>CSS Style Objects — MathJax v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="_static/mj.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="MathJax v1.0 documentation" href="index.html" />
|
||||
<link rel="next" title="Glossary" href="glossary.html" />
|
||||
<link rel="prev" title="Describing HTML snippets" href="HTML-snippets.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="glossary.html" title="Glossary"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="HTML-snippets.html" title="Describing HTML snippets"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="index.html">MathJax v1.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="css-style-objects">
|
||||
<span id="id1"></span><h1>CSS Style Objects<a class="headerlink" href="#css-style-objects" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Many MathJax components allow you to specify CSS styles that control
|
||||
the look of the elements they create. These are described using CSS
|
||||
style objects, which are JavaScript objects that represent standard
|
||||
CSS declarations. The main CSS style object is a collection of
|
||||
<cite>name:value</cite> pairs where the <cite>name</cite> is the CSS selector that is being
|
||||
defined, and the <cite>value</cite> is an object that gives the style for that
|
||||
selector. Most often, the selector will need to be enclosed in
|
||||
quotation marks, as it will contain special characters, so you would
|
||||
need to use <tt class="docutils literal"><span class="pre">"#myID"</span></tt> rather than just <tt class="docutils literal"><span class="pre">#myID</span></tt> and <tt class="docutils literal"><span class="pre">"ul</span> <span class="pre">li"</span></tt>
|
||||
rather than just <tt class="docutils literal"><span class="pre">ul</span> <span class="pre">li</span></tt>.</p>
|
||||
<p>The value used to define the CSS style can either be a string
|
||||
containing the CSS definition, or a javascript object that is itself a
|
||||
collection of <cite>name:value</cite> pairs, where the <cite>name</cite> is the attribute
|
||||
being defined and <cite>value</cite> is the value that attibute should be given.
|
||||
Note that, since this is a JavaScript object, the pairs are separated
|
||||
by commas (not semi-colons) and the values are enclosed in quotation
|
||||
marks. If the name contains dashes, it should be enclosed in
|
||||
quotation marks as well.</p>
|
||||
<p>For example, <tt class="docutils literal"><span class="pre">jax/output/HTML-CSS/config.js</span></tt> includes the following
|
||||
declaration:</p>
|
||||
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">styles</span><span class="o">:</span> <span class="p">{</span>
|
||||
|
||||
<span class="s2">".MathJax .merror"</span><span class="o">:</span> <span class="p">{</span>
|
||||
<span class="s2">"background-color"</span><span class="o">:</span> <span class="s2">"#FFFF88"</span><span class="p">,</span>
|
||||
<span class="nx">color</span><span class="o">:</span> <span class="s2">"#CC0000"</span><span class="p">,</span>
|
||||
<span class="nx">border</span><span class="o">:</span> <span class="s2">"1px solid #CC0000"</span><span class="p">,</span>
|
||||
<span class="nx">padding</span><span class="o">:</span> <span class="s2">"1px 3px"</span><span class="p">,</span>
|
||||
<span class="s2">"font-family"</span><span class="o">:</span> <span class="s2">"serif"</span><span class="p">,</span>
|
||||
<span class="s2">"font-style"</span><span class="o">:</span> <span class="s2">"normal"</span><span class="p">,</span>
|
||||
<span class="s2">"font-size"</span><span class="o">:</span> <span class="s2">"90%"</span>
|
||||
<span class="p">},</span>
|
||||
|
||||
<span class="s2">".MathJax_Preview"</span><span class="o">:</span> <span class="p">{</span><span class="nx">color</span><span class="o">:</span> <span class="s2">"#888888"</span><span class="p">},</span>
|
||||
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This defines two CSS styles, one for the selector <tt class="docutils literal"><span class="pre">.MathJax</span>
|
||||
<span class="pre">.merror</span></tt>, which specifies a background color, foreground color,
|
||||
border, and so on, and a second for <tt class="docutils literal"><span class="pre">.MathJax_Preview</span></tt> that sets its
|
||||
color.</p>
|
||||
<p>You can add as many such definitions to a <tt class="docutils literal"><span class="pre">styles</span></tt> object as you
|
||||
wish. Note, however, that since this is a JavaScript object, the
|
||||
selectors must be unique (e.g., you can’t use two definitions for
|
||||
<tt class="docutils literal"><span class="pre">"img"</span></tt>, for example, as only the last one would be saved). If you
|
||||
need to use more than one entry for a single selector, you can add
|
||||
comments like <tt class="docutils literal"><span class="pre">/*</span> <span class="pre">1</span> <span class="pre">*/</span></tt> and <tt class="docutils literal"><span class="pre">/*</span> <span class="pre">2</span> <span class="pre">*/</span></tt> to the selector to make them
|
||||
unique.</p>
|
||||
<p>It is possible to include selectors like <tt class="docutils literal"><span class="pre">"@media</span> <span class="pre">print"</span></tt>, in which
|
||||
case the value is a CSS style object. For example:</p>
|
||||
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">styles</span><span class="o">:</span> <span class="p">{</span>
|
||||
<span class="s2">"@media print"</span><span class="o">:</span> <span class="p">{</span>
|
||||
<span class="s2">".MathJax .merror"</span><span class="o">:</span> <span class="p">{</span>
|
||||
<span class="s2">"background-color"</span><span class="o">:</span> <span class="s2">"white"</span><span class="p">,</span>
|
||||
<span class="nx">border</span><span class="o">:</span> <span class="mi">0</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
<span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The various extensions and output processors include more examples of
|
||||
CSS style objects, so see the code for those files for additional
|
||||
samples. In particular, the <tt class="docutils literal"><span class="pre">extensions/MathMenu.js</span></tt>,
|
||||
<tt class="docutils literal"><span class="pre">extensions/MathZoom.js</span></tt>, <tt class="docutils literal"><span class="pre">extensions/FontWarnsing.js</span></tt>, and
|
||||
<tt class="docutils literal"><span class="pre">jax/output/HTML-CSS/jax.js</span></tt> files include such definitions.</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="HTML-snippets.html"
|
||||
title="previous chapter">Describing HTML snippets</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="glossary.html"
|
||||
title="next chapter">Glossary</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/CSS-styles.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="glossary.html" title="Glossary"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="HTML-snippets.html" title="Describing HTML snippets"
|
||||
>previous</a> |</li>
|
||||
<li><a href="index.html">MathJax v1.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2010 Design Science.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0b2.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,170 +0,0 @@
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Describing HTML snippets — MathJax v1.0 documentation</title>
|
||||
<link rel="stylesheet" href="_static/mj.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
VERSION: '1.0',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
HAS_SOURCE: true
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="_static/jquery.js"></script>
|
||||
<script type="text/javascript" src="_static/underscore.js"></script>
|
||||
<script type="text/javascript" src="_static/doctools.js"></script>
|
||||
<link rel="top" title="MathJax v1.0 documentation" href="index.html" />
|
||||
<link rel="next" title="CSS Style Objects" href="CSS-styles.html" />
|
||||
<link rel="prev" title="Converting to MathJax from jsMath" href="jsMath.html" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
accesskey="I">index</a></li>
|
||||
<li class="right" >
|
||||
<a href="CSS-styles.html" title="CSS Style Objects"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="jsMath.html" title="Converting to MathJax from jsMath"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li><a href="index.html">MathJax v1.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
<div class="body">
|
||||
|
||||
<div class="section" id="describing-html-snippets">
|
||||
<span id="html-snippets"></span><h1>Describing HTML snippets<a class="headerlink" href="#describing-html-snippets" title="Permalink to this headline">¶</a></h1>
|
||||
<p>A number of MathJax configuration options allow you to specify an HTML
|
||||
snippet using a JavaScript object. This lets you include HTML in your
|
||||
configutation files even though they are not HTML files themselves.
|
||||
The format is fairly simple, but flexible enough to let you represent
|
||||
complicated HTML trees.</p>
|
||||
<p>An HTML snippet is an array consisting of a series elements that formt
|
||||
he HTML tree. Those elements are one of two things: either a string,
|
||||
which represents text to be included in the snippet, or an array,
|
||||
which represents an HTML tag to be included. In the latter case, the
|
||||
array consists of three items: a string that is the tag name (e.g.,
|
||||
“img”), an optional object that gives attributes for the tag (as
|
||||
described below), and an optional HTML snippet array that gives the
|
||||
contents of the tag.</p>
|
||||
<p>When attributes are provided, they are given as <cite>name:value</cite> pairs,
|
||||
with the <cite>name</cite> giving the attribute name, and <cite>value</cite> giving its
|
||||
value. For example</p>
|
||||
<div class="highlight-javascript"><div class="highlight"><pre><span class="p">[[</span><span class="s2">"img"</span><span class="p">,{</span><span class="nx">src</span><span class="o">:</span><span class="s2">"/images/mypic.jpg"</span><span class="p">}]]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>represents an HTML snippet that includes one element: an <tt class="docutils literal"><span class="pre"><img></span></tt> tag
|
||||
with <tt class="docutils literal"><span class="pre">src</span></tt> set to <tt class="docutils literal"><span class="pre">/images/mypic.jpg</span></tt>. That is, this is
|
||||
equivalent to</p>
|
||||
<div class="highlight-html"><div class="highlight"><pre><span class="nt"><img</span> <span class="na">src=</span><span class="s">"/images/mypic.jpg"</span><span class="nt">></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Note that the snippet has two sets of square brackets. The outermost
|
||||
one is for the array that holds the snippet, and the innermost set is
|
||||
because the first (and only) element in the snippet is a tag, not
|
||||
text. Note that the code <tt class="docutils literal"><span class="pre">["img",{src:"/images/mypic.jpg"}]</span></tt>
|
||||
is invalid as an HTML snippet. It would represent a snippet that
|
||||
starts with “img” as text in the snippet (not a tag), but the second
|
||||
item is neither a string nor an array, and so is illegal. This is a
|
||||
common mistake that should be avoided.</p>
|
||||
<p>A more complex example is the following:</p>
|
||||
<div class="highlight-javascript"><div class="highlight"><pre><span class="p">[</span>
|
||||
<span class="s2">"Please read the "</span><span class="p">,</span>
|
||||
<span class="p">[</span><span class="s2">"a"</span><span class="p">,{</span><span class="nx">href</span><span class="o">:</span><span class="s2">"instructions.html"</span><span class="p">},[</span><span class="s2">"instructions"</span><span class="p">]],</span>
|
||||
<span class="s2">" carefully before proceeding"</span>
|
||||
<span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>which is equivalent to</p>
|
||||
<div class="highlight-html"><div class="highlight"><pre>please read the <span class="nt"><a</span> <span class="na">href=</span><span class="s">"instructions.html"</span><span class="nt">></span>instructions<span class="nt"></a></span> carefully
|
||||
before proceeding.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>A final example shows how to set style attributes on an object:</p>
|
||||
<div class="highlight-javascript"><div class="highlight"><pre><span class="p">[[</span><span class="s2">"span"</span><span class="p">,</span>
|
||||
<span class="p">{</span>
|
||||
<span class="nx">id</span><span class="o">:</span><span class="s2">"mySpan"</span><span class="p">,</span>
|
||||
<span class="nx">style</span><span class="o">:</span> <span class="p">{</span><span class="nx">color</span><span class="o">:</span><span class="s2">"red"</span><span class="p">,</span> <span class="s2">"font-weight"</span><span class="o">:</span><span class="s2">"bold"</span><span class="p">}</span>
|
||||
<span class="p">},</span>
|
||||
<span class="p">[</span><span class="s2">" This is bold text shown in red "</span><span class="p">]</span>
|
||||
<span class="p">]]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>which is equivalent to</p>
|
||||
<div class="highlight-html"><div class="highlight"><pre><span class="nt"><span</span> <span class="na">id=</span><span class="s">"mySpan"</span> <span class="na">style=</span><span class="s">"color: red; font-weight: bold;"</span><span class="nt">></span>
|
||||
This is bold text shown in red
|
||||
<span class="nt"></span></span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="jsMath.html"
|
||||
title="previous chapter">Converting to MathJax from jsMath</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="CSS-styles.html"
|
||||
title="next chapter">CSS Style Objects</a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/HTML-snippets.txt"
|
||||
rel="nofollow">Show Source</a></li>
|
||||
</ul>
|
||||
<div id="searchbox" style="display: none">
|
||||
<h3>Quick search</h3>
|
||||
<form class="search" action="search.html" method="get">
|
||||
<input type="text" name="q" size="18" />
|
||||
<input type="submit" value="Go" />
|
||||
<input type="hidden" name="check_keywords" value="yes" />
|
||||
<input type="hidden" name="area" value="default" />
|
||||
</form>
|
||||
<p class="searchtip" style="font-size: 90%">
|
||||
Enter search terms or a module, class or function name.
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">$('#searchbox').show(0);</script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="related">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li class="right" style="margin-right: 10px">
|
||||
<a href="genindex.html" title="General Index"
|
||||
>index</a></li>
|
||||
<li class="right" >
|
||||
<a href="CSS-styles.html" title="CSS Style Objects"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="jsMath.html" title="Converting to MathJax from jsMath"
|
||||
>previous</a> |</li>
|
||||
<li><a href="index.html">MathJax v1.0 documentation</a> »</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2010 Design Science.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0b2.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 7.1 KiB |
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 6.9 KiB |
-79
@@ -1,79 +0,0 @@
|
||||
.. _css-style-objects:
|
||||
|
||||
*****************
|
||||
CSS Style Objects
|
||||
*****************
|
||||
|
||||
Many MathJax components allow you to specify CSS styles that control
|
||||
the look of the elements they create. These are described using CSS
|
||||
style objects, which are JavaScript objects that represent standard
|
||||
CSS declarations. The main CSS style object is a collection of
|
||||
`name:value` pairs where the `name` is the CSS selector that is being
|
||||
defined, and the `value` is an object that gives the style for that
|
||||
selector. Most often, the selector will need to be enclosed in
|
||||
quotation marks, as it will contain special characters, so you would
|
||||
need to use ``"#myID"`` rather than just ``#myID`` and ``"ul li"``
|
||||
rather than just ``ul li``.
|
||||
|
||||
The value used to define the CSS style can either be a string
|
||||
containing the CSS definition, or a javascript object that is itself a
|
||||
collection of `name:value` pairs, where the `name` is the attribute
|
||||
being defined and `value` is the value that attibute should be given.
|
||||
Note that, since this is a JavaScript object, the pairs are separated
|
||||
by commas (not semi-colons) and the values are enclosed in quotation
|
||||
marks. If the name contains dashes, it should be enclosed in
|
||||
quotation marks as well.
|
||||
|
||||
For example, ``jax/output/HTML-CSS/config.js`` includes the following
|
||||
declaration:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
styles: {
|
||||
|
||||
".MathJax .merror": {
|
||||
"background-color": "#FFFF88",
|
||||
color: "#CC0000",
|
||||
border: "1px solid #CC0000",
|
||||
padding: "1px 3px",
|
||||
"font-family": "serif",
|
||||
"font-style": "normal",
|
||||
"font-size": "90%"
|
||||
},
|
||||
|
||||
".MathJax_Preview": {color: "#888888"},
|
||||
|
||||
}
|
||||
|
||||
This defines two CSS styles, one for the selector ``.MathJax
|
||||
.merror``, which specifies a background color, foreground color,
|
||||
border, and so on, and a second for ``.MathJax_Preview`` that sets its
|
||||
color.
|
||||
|
||||
You can add as many such definitions to a ``styles`` object as you
|
||||
wish. Note, however, that since this is a JavaScript object, the
|
||||
selectors must be unique (e.g., you can't use two definitions for
|
||||
``"img"``, for example, as only the last one would be saved). If you
|
||||
need to use more than one entry for a single selector, you can add
|
||||
comments like ``/* 1 */`` and ``/* 2 */`` to the selector to make them
|
||||
unique.
|
||||
|
||||
It is possible to include selectors like ``"@media print"``, in which
|
||||
case the value is a CSS style object. For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
styles: {
|
||||
"@media print": {
|
||||
".MathJax .merror": {
|
||||
"background-color": "white",
|
||||
border: 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
The various extensions and output processors include more examples of
|
||||
CSS style objects, so see the code for those files for additional
|
||||
samples. In particular, the ``extensions/MathMenu.js``,
|
||||
``extensions/MathZoom.js``, ``extensions/FontWarnsing.js``, and
|
||||
``jax/output/HTML-CSS/jax.js`` files include such definitions.
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
.. _html-snippets:
|
||||
|
||||
************************
|
||||
Describing HTML snippets
|
||||
************************
|
||||
|
||||
A number of MathJax configuration options allow you to specify an HTML
|
||||
snippet using a JavaScript object. This lets you include HTML in your
|
||||
configutation files even though they are not HTML files themselves.
|
||||
The format is fairly simple, but flexible enough to let you represent
|
||||
complicated HTML trees.
|
||||
|
||||
An HTML snippet is an array consisting of a series elements that formt
|
||||
he HTML tree. Those elements are one of two things: either a string,
|
||||
which represents text to be included in the snippet, or an array,
|
||||
which represents an HTML tag to be included. In the latter case, the
|
||||
array consists of three items: a string that is the tag name (e.g.,
|
||||
"img"), an optional object that gives attributes for the tag (as
|
||||
described below), and an optional HTML snippet array that gives the
|
||||
contents of the tag.
|
||||
|
||||
When attributes are provided, they are given as `name:value` pairs,
|
||||
with the `name` giving the attribute name, and `value` giving its
|
||||
value. For example
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
[["img",{src:"/images/mypic.jpg"}]]
|
||||
|
||||
represents an HTML snippet that includes one element: an ``<img>`` tag
|
||||
with ``src`` set to ``/images/mypic.jpg``. That is, this is
|
||||
equivalent to
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<img src="/images/mypic.jpg">
|
||||
|
||||
Note that the snippet has two sets of square brackets. The outermost
|
||||
one is for the array that holds the snippet, and the innermost set is
|
||||
because the first (and only) element in the snippet is a tag, not
|
||||
text. Note that the code ``["img",{src:"/images/mypic.jpg"}]``
|
||||
is invalid as an HTML snippet. It would represent a snippet that
|
||||
starts with "img" as text in the snippet (not a tag), but the second
|
||||
item is neither a string nor an array, and so is illegal. This is a
|
||||
common mistake that should be avoided.
|
||||
|
||||
A more complex example is the following:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
[
|
||||
"Please read the ",
|
||||
["a",{href:"instructions.html"},["instructions"]],
|
||||
" carefully before proceeding"
|
||||
]
|
||||
|
||||
which is equivalent to
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
please read the <a href="instructions.html">instructions</a> carefully
|
||||
before proceeding.
|
||||
|
||||
A final example shows how to set style attributes on an object:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
[["span",
|
||||
{
|
||||
id:"mySpan",
|
||||
style: {color:"red", "font-weight":"bold"}
|
||||
},
|
||||
[" This is bold text shown in red "]
|
||||
]]
|
||||
|
||||
which is equivalent to
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<span id="mySpan" style="color: red; font-weight: bold;">
|
||||
This is bold text shown in red
|
||||
</span>
|
||||
|
||||
-196
@@ -1,196 +0,0 @@
|
||||
.. _api-ajax:
|
||||
|
||||
***********************
|
||||
The MathJax.Ajax Object
|
||||
***********************
|
||||
|
||||
The `MathJax.Ajax` structure holds the data and functions for handling
|
||||
loading of external modules. Modules are loaded only once, even if
|
||||
called for in several places. The loading of files is asynchronous,
|
||||
and so the code that requests an external module will continue to run
|
||||
even when that module has not completed loading, so it is important to
|
||||
be aware of the timing issues this may cause. Similarly, creating or
|
||||
loading stylesheets is an asynchronous action. In particular, all
|
||||
actions that rely on the file or stylesheet having been loaded must be
|
||||
delayed until after the file has been downloaded completely. This is
|
||||
the reason for the large number of routines that take callback
|
||||
functions.
|
||||
|
||||
Any operation that could cause the loading of a file or stylesheet
|
||||
must be synchronized with the rest of the code via such callbacks.
|
||||
Since processing any mathematics might cause files to be loaded (e.g.,
|
||||
little-used markup might be implemented in an extension that is loaded
|
||||
only when that markup is used), any code that dynamically typesets
|
||||
mathematics will need to be structured to use callbacks to guarantee
|
||||
that the mathematics has been completely processed before the code
|
||||
tries to use it. See the :ref:`Synchronizing with MathJax <synchronization>`
|
||||
documentation for details on how to do this properly.
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: timeout
|
||||
|
||||
Number of milliseconds to wait for a file to load before
|
||||
it is considered to have failed to load.
|
||||
|
||||
*Default:* 20 seconds
|
||||
|
||||
.. describe:: STATUS.OK
|
||||
|
||||
The value used to indicate that a file load has occurred
|
||||
successfully.
|
||||
|
||||
.. describe:: STATUS.ERROR
|
||||
|
||||
The value used to indicate that a file load has caused an error or
|
||||
a timeout to occur.
|
||||
|
||||
.. describe:: loaded
|
||||
|
||||
An object containing the names of the files that have been loaded (or
|
||||
requested) so far. ``MathJax.Ajax.loaded["file"]`` will be
|
||||
non-``null`` when the file has been loaded, with the value being
|
||||
the ``MathJax.Ajax.STATUS`` value of the load attempt.
|
||||
|
||||
.. describe:: loading
|
||||
|
||||
An object containing the files that are currently loading, the
|
||||
callbacks that are to be run when they load or timeout, and
|
||||
additional internal data.
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. method:: Require(file[,callback])
|
||||
|
||||
Loads the given file if it hasn't been already. The file must be a
|
||||
JavaScript file or a CSS stylesheet; i.e., it must end in ``.js``
|
||||
or ``.css``. Alternatively, it can be an object with a single
|
||||
`key:value` pair where the `key` is one of ``js`` or ``css`` and
|
||||
the `value` is the file of that type to be loaded (this makes it
|
||||
possible to have the file be created by a CGI script, for example,
|
||||
or to use a ``data::`` URL). The file must be relative to the
|
||||
MathJax home directory and can not contain ``../`` file path
|
||||
components.
|
||||
|
||||
When the file is completely loaded and run, the `callback`, if
|
||||
provided, will be executed passing it the status of the file load.
|
||||
If there was an error while loading the file, or if the file fails
|
||||
to load within the time limit given by ``MathJax.Ajax.timout``,
|
||||
the status will be ``MathJax.Ajax.STATUS.ERROR`` otherwise it
|
||||
will be ``MathJax.Ajax.STATUS.OK``. If the file is already
|
||||
loaded, the callback will be called immediately and the file will
|
||||
not be loaded again.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- name of the file to be loaded
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: Load(file[,callback])
|
||||
|
||||
Used internally to load a given file without checking if it
|
||||
already has been loaded, or where it is to be found.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- name of the file to be loaded
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: loadComplete(file)
|
||||
|
||||
Called from within the loaded files to inform MathJax that the
|
||||
file has been completely loaded and initialized. The `file`
|
||||
parameter is the name of the file that has been loaded. This
|
||||
routine will cause any callback functions registered for the file
|
||||
or included in the :meth:``MathJax.Ajax.Require()`` calls to be
|
||||
executed, passing them the status or the load
|
||||
(`MathJax.Ajax.STATUS.OK`` or ``MathJax.Ajax.STATUS.ERROR``) as
|
||||
their last parameter.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- name of the file that has been loaded
|
||||
:Returns: ``null``
|
||||
|
||||
.. method:: loadTimeout(file)
|
||||
|
||||
Called when the timeout period is over and the file hasn't loaded.
|
||||
This indicates an error condition, and the
|
||||
:meth:`MathJax.Ajax.loadError()` method will be executed, then the
|
||||
file's callback will be run with ``MathJax.Ajax.STATUS.ERROR`` as
|
||||
its parameter.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- name of the file that timed out
|
||||
:Returns: ``null``
|
||||
|
||||
.. method:: loadError(file)
|
||||
|
||||
The default error handler called when a file fails to load. It
|
||||
puts a warning message into the MathJax message box on screen.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- the name of the file that failed to load
|
||||
:Returns: ``null``
|
||||
|
||||
.. method:: loadHook(file,callback)
|
||||
|
||||
Registers a callback to be executed when the given file is
|
||||
loaded. The file load operation need to be started when this
|
||||
method is called, so it can be used to register a hook for a file
|
||||
that may be loaded in the future.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- the name of the file to wait for
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: Styles(styles[,callback])
|
||||
|
||||
Creates a stylesheet from the given style data. `styles` can
|
||||
either be a string containing a stylesheet definition, or an
|
||||
object containing a :ref:`CSS Style Object <css-style-objects>`.
|
||||
For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Styles("body {font-family: serif; font-style: italic}");
|
||||
|
||||
and
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Styles({
|
||||
body: {
|
||||
"font-family": "serif",
|
||||
"font-style": "italic"
|
||||
}
|
||||
});
|
||||
|
||||
both set the body font family and style.
|
||||
|
||||
The callback routine is called when the stylesheet has been
|
||||
created and is available for use.
|
||||
|
||||
:Parameters:
|
||||
- **styles** --- CSS style object for the styles to set
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. note::
|
||||
|
||||
Internet Explorer has a limit of 32 dynamically created
|
||||
stylesheets, so it is best to combine your styles into one
|
||||
large group rather than making several smaller calls.
|
||||
|
||||
.. method:: fileURL(file)
|
||||
|
||||
Returns a complete URL to a file (replacing ``[MathJax]`` with the
|
||||
actual root URL location).
|
||||
|
||||
:Parameters:
|
||||
- **file** --- the file name possibly including ``[MathJax]``
|
||||
:Returns: the full URL for the file
|
||||
-259
@@ -1,259 +0,0 @@
|
||||
.. _api-callback:
|
||||
|
||||
**************************
|
||||
The MathJax.Callback Class
|
||||
**************************
|
||||
|
||||
The ``MathJax.Callback`` object is one of the key mechanisms used by
|
||||
MathJax to synchronize its actions with those that occur
|
||||
asynchronously, like loading files and stylesheets. A `Callback`
|
||||
object is used to tie the execution of a function to the completion of
|
||||
an asynchronous action. See :ref:`Synchronizing with MathJax
|
||||
<synchronization>` for more details, and :ref:`Using Callbacks
|
||||
<using-callbacks>` in particular for examples of how to specify and
|
||||
use MathJax `Callback` objects.
|
||||
|
||||
|
||||
Specifying a callback
|
||||
---------------------
|
||||
|
||||
When a method includes a callback as one of its arguments, that
|
||||
callback can be specified in a number of different ways, depending on
|
||||
the functionality that is required of the callback. The easiest case
|
||||
is to simply provide a function to be called, but it is also possible
|
||||
to include data to pass to the function when it is executed, and even
|
||||
the object that will be used as the javascript `this` object when the
|
||||
function is called.
|
||||
|
||||
Most functions that take callbacks as arguments accept a `callback
|
||||
specification` rather than an actual callback object, though you can
|
||||
use the :meth:`MathJax.Callback` function to convert a callback
|
||||
specification into a Callback object if needed.
|
||||
|
||||
A callback specification is any one of the following:
|
||||
|
||||
.. describe:: fn
|
||||
|
||||
A function that is to be called when the callback is executed.
|
||||
No additional data is passed to it (other that what it is
|
||||
called with at the time the callback is executed), and `this`
|
||||
will be the window object.
|
||||
|
||||
.. describe:: [fn]
|
||||
|
||||
An array containing a function to be called when the callback
|
||||
is executed (as above).
|
||||
|
||||
.. describe:: [fn, data...]
|
||||
|
||||
An array containing a function together with data to be passed
|
||||
to that function when the callback is executed; `this` is still
|
||||
the window object. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
[function (x,y) {return x+y}, 2, 3]
|
||||
|
||||
would specify a callback that would pass ``2`` and ``3`` to
|
||||
the given function, and it would return their sum, ``5``, when
|
||||
the callback is executed.
|
||||
|
||||
.. describe:: [object, fn]
|
||||
|
||||
An array containing an object to use as `this` and a function to
|
||||
call for the callback. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
[{x:'foo', y:'bar'}, function () {this.x}]
|
||||
|
||||
would produce a callback that returns the string ``"foo"``
|
||||
when it is called.
|
||||
|
||||
.. describe:: [object, fn, data...]
|
||||
|
||||
Similar to the previous case, but with data that is passed to
|
||||
the function as well.
|
||||
|
||||
..describe:: ["method", object]
|
||||
|
||||
Here, `object` is an object that has a method called `method`, and
|
||||
the callback will execute that method (with the object as
|
||||
`this`) when it is called. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
["length",[1,2,3,4]]
|
||||
|
||||
would call the `length` method on the array ``[1,2,3,4]`` when
|
||||
the callback is called, returning ``4``.
|
||||
|
||||
.. describe:: ["method", object, data...]
|
||||
|
||||
Similar to the previous case, but with data that is passed to
|
||||
the method. E.g.,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
["slice",[1,2,3,4],1,3]
|
||||
|
||||
would perform the equivalent of ``[1,2,3,4].slice(1,3)``,
|
||||
which returns the array ``[2,3]`` as a result.
|
||||
|
||||
.. describe:: {hook: fn, data: [...], object: this}
|
||||
|
||||
Here the data for the callback are given in an associative
|
||||
array of `key:value` pairs. The value of `hook` is the
|
||||
function to call, the value of `data` is an array of the
|
||||
arguments to pass to the function, and the value of `object`
|
||||
is the object to use as `this` in the function call. The
|
||||
specification need not include all three `key:value` pairs; any
|
||||
that are missing get default values (a function that does
|
||||
nothing, an empty array, and the window object, respectively).
|
||||
|
||||
.. describe:: "string"
|
||||
|
||||
This specifies a callback where the string is executed via an
|
||||
``eval()`` statement. The code is run in the global context,
|
||||
so any variables or functions created by the string become
|
||||
part of the global namespace. The return value is the value of
|
||||
the last statement executed in the string.
|
||||
|
||||
|
||||
Executing a Callback Object
|
||||
===========================
|
||||
|
||||
The `Callback` object is itself a function, and calling that function
|
||||
executes the callback. You can pass the callback additional
|
||||
parameters, just as you can any function, and these will be added to
|
||||
the callback function's argument list following any data that was
|
||||
supplied at the time the callback was created. For example
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var f = function (x,y) {return x + " and " +y}
|
||||
var cb = MathJax.Callback([f, "foo"]);
|
||||
var result = cb("bar"); // sets result to "foo and bar"
|
||||
|
||||
Usually, the callback is not executed by the code that creates it (as
|
||||
it is in the example above), but by some other code that runs at a
|
||||
later time at the completion of some other activity (say the loading
|
||||
of a file), or in response to a user action. For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
function f(x) {alert("x contains "+x)};
|
||||
function DelayedX(time) {
|
||||
var x = "hi";
|
||||
setTimeout(MathJax.Callback([f, x], time);
|
||||
}
|
||||
|
||||
The ``DelayedX`` function arranges for the function ``f`` to be called at
|
||||
a later time, passing it the value of a local variable, ``x``. Normally,
|
||||
this would require the use of a closure, but that is not needed when a
|
||||
`MathJax.Callback` object is used.
|
||||
|
||||
|
||||
Callback Object Properties
|
||||
--------------------------
|
||||
|
||||
.. describe:: hook
|
||||
|
||||
The function to be called when the callback is executed.
|
||||
|
||||
.. describe:: data
|
||||
|
||||
An array containing the arguments to pass to the callback
|
||||
function when it is executed.
|
||||
|
||||
.. describe:: object
|
||||
|
||||
The object to use as `this` during the call to the callback
|
||||
function.
|
||||
|
||||
.. describe:: called
|
||||
|
||||
Set to ``true`` after the callback has been called, and undefined
|
||||
otherwise. A callback will not be exectued a second time unless
|
||||
the callback's :meth:`reset()` method is called first, or its
|
||||
``autoReset`` property is set to ``true``.
|
||||
|
||||
.. describe:: autoReset
|
||||
|
||||
Set this to ``true`` if you want to be able to call the callback
|
||||
more than once. (This is the case for signal listeners, for example).
|
||||
|
||||
.. describe:: isCallback
|
||||
|
||||
Always set to ``true`` (used to detect if an object is a callback
|
||||
or not).
|
||||
|
||||
|
||||
Callback Object Methods
|
||||
-----------------------
|
||||
|
||||
.. method:: reset()
|
||||
|
||||
Clears the callback's `called` property.
|
||||
|
||||
|
||||
MathJax.Callback Methods
|
||||
------------------------
|
||||
|
||||
.. method:: Delay(time[, callback])
|
||||
|
||||
Waits for the specified time (given in milliseconds) and then
|
||||
performs the callback. It returns the Callback object (or a blank
|
||||
one if none was supplied). The returned callback structure has a
|
||||
`timeout` property set to the result of the ``setTimeout()`` call
|
||||
that was used to perform the wait so that you can cancel the wait,
|
||||
if needed. Thus :meth:`MathJax.Callback.Delay()` can be used to
|
||||
start a timeout delay that executes the callback if an action
|
||||
doesn't occur within the given time (and if the action does occur,
|
||||
the timeout can be canceled). Since
|
||||
:meth:`MathJax.Callback.Delay()` returns a callback structure, it
|
||||
can be used in a callback queue to insert a delay between queued
|
||||
commands.
|
||||
|
||||
:Parameters:
|
||||
- **time** --- the amount of time to wait
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: executeHooks(hooks[, data[,reset]])
|
||||
|
||||
Calls each callback in the `hooks` array (or the single hook if it
|
||||
is not an array), passing it the arguments stored in the data
|
||||
array. It `reset` is ``true``, then the callback's
|
||||
:meth:`reset()` method will be called before each hook is
|
||||
executed. If any of the hooks returns a `Callback` object, then
|
||||
it collects those callbacks and returns a new callback that will
|
||||
execute when all the ones returned by the hooks have been
|
||||
completed. Otherwise, :meth:`MathJax.Callback.executeHooks()`
|
||||
returns ``null``.
|
||||
|
||||
:Parameters:
|
||||
- **hooks** --- array of hooks to be called, or a hook
|
||||
- **data** --- array of arguments to pass to each hook in turn
|
||||
- **reset** --- ``true`` if the :meth:`reset()` method should be called
|
||||
:Returns: callback that waits for all the hooks to complete, or ``null``
|
||||
|
||||
.. method:: Queue([callback,...])
|
||||
|
||||
Creates a `MathJax.CallBack.Queue` object and pushes the given
|
||||
callbacks into the queue. See :ref:`Using Queues <using-queues>`
|
||||
for more details about MathJax queues.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- one or more callback specifications
|
||||
:Returns: the `Queue` object
|
||||
|
||||
.. method:: Signal(name)
|
||||
|
||||
Looks for a named signal, creates it if it doesn't already exist,
|
||||
and returns the signal object. See
|
||||
:ref:`Using Signals <using-signals>` for more details.
|
||||
|
||||
:Parameters:
|
||||
- **name** --- name of the signal to get or create
|
||||
:Returns: the `Signal` object
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
.. _api-element-jax:
|
||||
|
||||
****************************
|
||||
The MathJax.ElementJax Class
|
||||
****************************
|
||||
|
||||
The element jax is the bridge between the input and output jax, and
|
||||
contains the data produced by the input jax needed by the output jax
|
||||
to display the results. It is tied to the individual ``<script>`` tag
|
||||
that produced it, and is the object used by JavaScript programs to
|
||||
interact with the mathematics on the page.
|
||||
|
||||
An element jax is stored in the ``jax.js`` file in a subdirectory of
|
||||
the ``jax/element`` directory, with the subdirectory name being the
|
||||
name of the element jax. Currently, there is only one element jax
|
||||
class, the `mml` element jax, and it is stored in ``jax/element/mml``.
|
||||
|
||||
The `MathJax.ElementJax` class is a subclass of the :ref:`MathJax Jax
|
||||
<api-jax>` class, and inherits the properties and methods of that
|
||||
class. Those listed below are the additional or overridden ones from
|
||||
that class.
|
||||
|
||||
|
||||
Class Properties
|
||||
================
|
||||
|
||||
.. describe:: name
|
||||
|
||||
The name of the jax.
|
||||
|
||||
.. describe:: version
|
||||
|
||||
The version number of the jax.
|
||||
|
||||
.. describe:: directory
|
||||
|
||||
The directory where the jax files are stored (e.g., ``"[MathJax]/jax/element/mml"``);
|
||||
|
||||
|
||||
Instance Properties
|
||||
===================
|
||||
|
||||
.. describe:: inputJax
|
||||
|
||||
A reference to the input jax that created the element.
|
||||
|
||||
.. describe:: outputJax
|
||||
|
||||
A reference to the output jax that has processed this element.
|
||||
|
||||
.. describe:: inputID
|
||||
|
||||
The DOM `id` of the ``<script>`` tag that generated this element
|
||||
(if it doesn't have one initially, the MathJax hub will supply
|
||||
one). Note that this is not a reference to the element itself;
|
||||
that element will have a reference to this element jax, and if
|
||||
`inputID` were a reference back, that would cause a reference
|
||||
loop, which some browsers would not free properly during trash
|
||||
collection, thus causing a memory leak.
|
||||
|
||||
.. describe:: originalText
|
||||
|
||||
A string indicating the original input text that was processed for
|
||||
this element.
|
||||
|
||||
.. describe:: mimeType
|
||||
|
||||
The MIME-type of the element jax (`jax/mml` in the case of an
|
||||
`mml` element jax).
|
||||
|
||||
Other data specific to the element jax subclass may also appear here.
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. Method:: Text(text[,callback])
|
||||
|
||||
Sets the input text for this element to the given text and
|
||||
reprocesses the mathematics. (I.e., update the equation to the
|
||||
new one given by `text`). When the processing is complete, the
|
||||
`callback`, if any, is called.
|
||||
|
||||
:Parameters:
|
||||
- **text** --- the new mathematic source string for the element
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. Method:: Reprocess([callback])
|
||||
:noindex:
|
||||
|
||||
Remove the output and produce it again. This may be necessary if
|
||||
there are changes to the CSS styles that would affect the layout
|
||||
of the mathematics, for example. The `callback`, if any, is
|
||||
called when the process completes.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. Method:: Remove()
|
||||
:noindex:
|
||||
|
||||
Removes the output for this element from the web page (but does
|
||||
not remove the original ``<script>``). The ``<script>`` will be
|
||||
considered unprocessed, and the next call to
|
||||
:meth:`MathJax.hub.Typeset()` will re-display it.
|
||||
|
||||
:Returns: ``null``
|
||||
|
||||
.. Method:: SourceElement()
|
||||
|
||||
Returns a reference to the original ``<script>`` DOM element
|
||||
associated to this element jax.
|
||||
|
||||
:Returns: the ``<script>`` element
|
||||
|
||||
Output jax may add new methods to the base element jax class to
|
||||
perform exporting to other formats. For example, a MathML output jax
|
||||
could add ``toMathML()``, or an accessibility output jax could add
|
||||
``toAudible()``. These could be made available via the MathJax
|
||||
contextual menu.
|
||||
-122
@@ -1,122 +0,0 @@
|
||||
.. _api-html:
|
||||
|
||||
***********************
|
||||
The MathJax.HTML Object
|
||||
***********************
|
||||
|
||||
The ``MathJax.HTML`` object provides routines for creating HTML
|
||||
elements and adding them to the page, and int particular, it contains
|
||||
the code that processes MathJax's :ref:`HTML snippets <html-snippets>`
|
||||
and turns them into actual DOM objects. It also implements the
|
||||
methods used to manage the cookies used by MathJax.
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: Cookie.prefix: "mjx"
|
||||
|
||||
The prefix used for names of cookies stored by MathJax.
|
||||
|
||||
.. describe:: Cookie.expires: 365
|
||||
|
||||
The expiration time (in days) for cookies created by MathJax.
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. method:: Element(type[,attributes[,contents]])
|
||||
|
||||
Creates a DOM element of the given type. If `attributes` is
|
||||
non-``null``, it is an object that contains `key:value` pairs of
|
||||
attributes to set for the newly created element. If `contents` is
|
||||
non-``null``, it is an :ref:`HTML snippet <html-snippets>` that
|
||||
describes the contents to create for the element. For example
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var div = MathJax.HTML.Element(
|
||||
"div",
|
||||
{id: "MathDiv", style:{border:"1px solid", padding:"5px"}},
|
||||
["Here is math: $x+1$",["br"],"and a display $$x+1\\over x-1$$"]
|
||||
);
|
||||
|
||||
:Parameters:
|
||||
- **type** --- node type to be created
|
||||
- **attributes** --- object specifying attributes to set
|
||||
- **contents** --- HTML snippet representing contents of node
|
||||
:Returns: the DOM element created
|
||||
|
||||
.. method:: addElement(parent,type[,attributes[,content]])
|
||||
|
||||
Creates a DOM element and appends it to the `parent` node
|
||||
provided. It is equivalent to
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
parent.appendChild(MathJax.HTML.Element(type,attributes,content))
|
||||
|
||||
:Parameters:
|
||||
- **parent** --- the node where the element will be added
|
||||
- **attributes** --- object specifying attributes to set
|
||||
- **contents** --- HTML snippet representing contents of node
|
||||
:Returns: the DOM element created
|
||||
|
||||
.. method:: TextNode(text)
|
||||
|
||||
Creates a DOM text node with the given text as its content.
|
||||
|
||||
:Parameters:
|
||||
- **text** --- the text for the node
|
||||
:Returns: the new text node
|
||||
|
||||
.. method:: addText(parent,text)
|
||||
|
||||
Creates a DOM text node with the given text and appends it to the
|
||||
`parent` node.
|
||||
|
||||
:Parameters:
|
||||
- **parent** --- the node where the text will be added
|
||||
- **text** --- the text for the new node
|
||||
:Returns: the new text node
|
||||
|
||||
.. describe:: Cookie.Set(name,data)
|
||||
|
||||
Creates a MathJax cookie using the ``MathJax.HTML.Cookie.prefix``
|
||||
and the `name` as the cookie name, and the `key:value` pairs in
|
||||
the `data` object as the data for the cookie. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.HTML.Cookie.Set("test",{x:42, y:"It Works!"});
|
||||
|
||||
will create a cookie named "mjx:test" that stores the values of
|
||||
``x`` and ``y`` provided in the `data` object. This data can be
|
||||
retrieved using the :meth:`MathJax.HTML.Cookie.Get()` method
|
||||
discussed below.
|
||||
|
||||
:Parameters:
|
||||
- **name** --- the name that identifies the coookie
|
||||
- **data** --- object containing the data to store in the cookie
|
||||
:Returns: ``null``
|
||||
|
||||
.. describe:: Cookie.Get(name[,obj])
|
||||
|
||||
Looks up the data for the cookie named `name` and merges the data
|
||||
into the given `obj` object, or returns a new object containing
|
||||
the data. For instance, given the cookie stored by the example
|
||||
above,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var data = MathJax.HTML.Cookie.Get("test");
|
||||
|
||||
would set ``data`` to ``{x:42, y:"It Works!"}``, while
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var data = {x:10, z:"Safe"};
|
||||
MathJax.HTML.Cookie.Get("test",data);
|
||||
|
||||
would leave ``data`` as ``{x:42, y:"It Works!", z:"Safe"}``.
|
||||
-330
@@ -1,330 +0,0 @@
|
||||
.. _api-hub:
|
||||
|
||||
**********************
|
||||
The MathJax.Hub Object
|
||||
**********************
|
||||
|
||||
The MathJax Hub, `MathJax.Hub`, is the main control structure for
|
||||
MathJax. It is where input and output :term:`jax` are tied together,
|
||||
and it is what handles processing of the MathJax ``<script>`` tags.
|
||||
Processing of the mathematics on the page may require external files
|
||||
to be loaded (when the mathematics includes less common functionality,
|
||||
for example, that is defined in an extension file), and since file
|
||||
loading is asynchronous, a number of the methods below may return
|
||||
before their actions are completed. For this reason, they include
|
||||
callback functions that are called when the action completes. These
|
||||
can be used to synchronize actions that require the mathematics to be
|
||||
completed before those action occur. See the :ref:`Using Callbacks
|
||||
<using-callbacks>` documentation for more details.
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: config: { ... }
|
||||
|
||||
This holds the configuration parameters for MathJax. Set these
|
||||
values using :meth:`MathJax.Hub.Config()` described below. The
|
||||
options and their default values are given in the :ref:`Core
|
||||
Options <configure-hub>` reference page.
|
||||
|
||||
.. describe:: processUpdateTime: 500
|
||||
|
||||
The minimum time (in milliseconds) between updates of the
|
||||
"Processing Math" message.
|
||||
|
||||
.. describe:: signal
|
||||
|
||||
The hub processing signal (tied to the
|
||||
:meth:`MathJax.Hub.Register.MessageHook()` method).
|
||||
|
||||
.. describe:: Browser
|
||||
|
||||
The name of the browser as determined by MathJax. It will be one
|
||||
of ``Firefox``, ``Safari``, ``Chrome``, ``Opera``, ``MSIE``,
|
||||
``Konqueror``, or ``unkown``. This is actually an object with
|
||||
additional properties and methods concerning the browser:
|
||||
|
||||
.. describe:: version
|
||||
|
||||
The browser version number, e.g., ``"4.0"``
|
||||
|
||||
.. describe:: isMac and isPC
|
||||
|
||||
These are boolean values that indicate whether the browser is
|
||||
running on a Macintosh computer or a Windows computer. They
|
||||
will both be ``false`` for a Linux computer
|
||||
|
||||
.. describe:: isForefox, isSafari, isChrome, isOpera, isMSIE, isKonqueror
|
||||
|
||||
These are ``true`` when the browser is the indicated one, and
|
||||
``false`` otherwise.
|
||||
|
||||
.. describe:: versionAtLeast(version)
|
||||
|
||||
This tests whether the browser version is at least that given
|
||||
in the `version` string. Note that you can not simply do a
|
||||
numeric comparison, as version 4.10 should be considered later
|
||||
than 4.9, for example. Similarly, 4.10 is different from 4.1,
|
||||
for instance.
|
||||
|
||||
.. describe:: Select(choices)
|
||||
|
||||
This lets you perform browser-specific functions. Here,
|
||||
`choices` is an object whose properties are the names of the
|
||||
browsers and whose values are the functions to be performed.
|
||||
Each function is passed one parameter, which is the
|
||||
``MathJax.Hub.Browser`` object. You do not need to include
|
||||
every browser as one of your choices (only those for which you
|
||||
need to do special processing. For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Hub.Browser.Select(
|
||||
MSIE: function (browser) {
|
||||
if (browser.versionAtLeast("8.0")) {... do version 8 stuff ... }
|
||||
... do general MSIE stuff ...
|
||||
},
|
||||
|
||||
Firefox: function (browser) {
|
||||
if (browser.isMac) {... do Mac stuff ... }
|
||||
... do general Firefox stuff
|
||||
}
|
||||
);
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. Method:: Config(options)
|
||||
|
||||
Sets the configuration options (stored in ``MathJax.Hub.config``)
|
||||
to the values stored in the `options` object. See
|
||||
:ref:`Configuring MathJax <configuration>` for details on how this
|
||||
is used and the options that you can set.
|
||||
|
||||
:Parameters:
|
||||
- **options** --- object containing options to be set
|
||||
:Returns: ``null``
|
||||
|
||||
.. describe:: Register.PreProcessor(callback)
|
||||
|
||||
Used by preprocessors to register themselves with MathJax so that
|
||||
they will be called during the :meth:`MathJax.Hub.PreProcess()`
|
||||
action.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- the callback specification for the preprocessor
|
||||
:Returns: ``null``
|
||||
|
||||
.. describe:: Register.MessageHook(type,callback)
|
||||
|
||||
Registers a listener for a particular message being sent to the
|
||||
hub processing signal (where `PreProcessing`, `Processing`, and
|
||||
`New Math` messages are sent). When the message equals the
|
||||
`type`, the `callback` will be called with the message as its
|
||||
parameter.
|
||||
|
||||
:Parameters:
|
||||
- **type** --- a string indicating the message to look for
|
||||
- **callback** --- a callback specification
|
||||
:Returns: ``null``
|
||||
|
||||
.. describe:: Register.StartupHook(type,callback)
|
||||
|
||||
Registers a listener for a particular message being sent to the
|
||||
startup signal (where initialization and component startup
|
||||
messages are sent). When the message equals the `type`, the
|
||||
`callback will be called with the message as its parameter.
|
||||
See the :ref:`Using Signals <using-signals>` dcocumentation for
|
||||
more details.
|
||||
|
||||
:Parameters:
|
||||
- **type** --- a string indicating the message to look for
|
||||
- **callback** --- a callback specification
|
||||
:Returns: ``null``
|
||||
|
||||
.. describe:: Register.LoadHook(file,callback)
|
||||
|
||||
Registers a callback to be called when a particular file is
|
||||
completely loaded and processed. (The callback is called when the
|
||||
file makes its :meth:`MathJax.Ajax.loadComplete()` call.) The
|
||||
`file` should be the complete file name, e.g.,
|
||||
``"[MathJax]/config/MathJax.js"``.
|
||||
|
||||
:Parameters:
|
||||
- **file** --- the name of the file to wait for
|
||||
- **callback** --- a callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. Method:: Queue(callback,...)
|
||||
:noindex:
|
||||
|
||||
Pushes the given callbacks onto the main MathJax command queue.
|
||||
This synchronizes the commands with MathJax so that they will be
|
||||
performed in the proper order even when some run asynchronously.
|
||||
See :ref:`Using Queues <using-queues>` for more details about how
|
||||
to use queues, and the MathJax queue in particular. You may
|
||||
supply as many `callback` specifications in one call to the
|
||||
:meth:`Queue()` method as you wish.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- a callback specification
|
||||
:Returns: the callback object for the last callback added to the queue
|
||||
|
||||
.. Method:: Typeset([element[,callback]])
|
||||
|
||||
Calls the preprocessors on the given element, and then typesets
|
||||
any math elements within the element. If no `element` is
|
||||
provided, the whole document is processed. The `element` is
|
||||
either the DOM `id` of the element, or a reference to the DOM
|
||||
element itself. The `callback` is called when the process is
|
||||
complete. See the :ref:`Modifying Math <typeset-math>` section
|
||||
for details of how to use this method properly.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element whose math is to be typeset
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: PreProcess([element[,callback]])
|
||||
|
||||
Calls the loaded preprocessors on the entire document, or on the
|
||||
given DOM element. The `element` is either the DOM `id` of the
|
||||
element, or a reference to the DOM element itself. The `callback`
|
||||
is called when the processing is complete.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element to be preprocessed
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: Process([element[,callback]])
|
||||
|
||||
Scans either the entire document or a given DOM `element` for
|
||||
MathJax ``<script>`` tags and processes the math those tags
|
||||
contain. The `element` is either the DOM `id` of the element to
|
||||
scan, or a reference to the DOM element itself. The `callback` is
|
||||
called when the processing is complete.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element to be processed
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: Update([element[,callback]])
|
||||
|
||||
Scans either the entire document or a given DOM element for
|
||||
mathematics that has changed since the last time it was processed,
|
||||
or is new, and typesets the mathematics they contain. The
|
||||
`element` is either the DOM `id` of the element to scan, or a
|
||||
reference to the DOM element itself. The `callback` is called
|
||||
when the processing is complete.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element to be updated
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: Reprocess([element[,callback]])
|
||||
|
||||
Removes any typeset mathematics from the document or DOM
|
||||
element, and then processes the mathematics again,
|
||||
re-typesetting everything. This may be necessary, for example, if
|
||||
the CSS styles have changed and those changes would affect the
|
||||
mathematics. The `element` is either the DOM `id` of the element
|
||||
to scan, or a reference to the DOM element itself. The `callback`
|
||||
is called when the processing is complete.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element to be reprocessed
|
||||
- **callback** --- the callback specification
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: getAllJax([element])
|
||||
|
||||
Returns a list of all the element jax in the document or a
|
||||
specific DOM element. The `element` is either the DOM `id` of the
|
||||
element, or a reference to the DOM element itself.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element to be searched
|
||||
:Returns: array of `element jax` objects
|
||||
|
||||
.. method:: getJaxByType(type[,element])
|
||||
|
||||
Returns a list of all the element jax of a given MIME-type in the
|
||||
document or a specific DOM element. The `element` is either the
|
||||
DOM `id` of the element to search, or a reference to the DOM
|
||||
element itself.
|
||||
|
||||
:Parameters:
|
||||
- **type** --- MIME-type of `element jax` to find
|
||||
- **element** --- the element to be searched
|
||||
:Returns: array of `element jax` objects
|
||||
|
||||
.. method:: getJaxByInputType(type[,element])
|
||||
|
||||
Returns a list of all the element jax associated with input
|
||||
``<script>`` tags with the given MIME-type within the given DOM
|
||||
element or the whole document. The `element` is either the DOM
|
||||
`id` of the element to search, or a reference to the DOM element
|
||||
itself.
|
||||
|
||||
:Parameters:
|
||||
- **type** --- MIME-type of input (e.g., ``"math/tex"``)
|
||||
- **element** --- the element to be searched
|
||||
:Returns: array of `element jax` objects
|
||||
|
||||
.. method:: getJaxFor(element)
|
||||
|
||||
Returns the element jax associated with a given DOM
|
||||
element. If the element does not have an associated element jax,
|
||||
``null`` is returned. The `element` is either the DOM `id` of the
|
||||
element, or a reference to the DOM element itself.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element whose element jax is required
|
||||
:Returns: `element jax` object or ``null``
|
||||
|
||||
.. method:: isJax(element)
|
||||
|
||||
Returns ``0`` if the element is not a ``<script>`` that can be
|
||||
processed by MathJax or the result of an output jax, returns ``-1``
|
||||
if element is an unprocessed ``<script>`` tag that could be
|
||||
handled by MathJax, and returns ``1`` if element is a processed
|
||||
``<script>`` tag or an element that is the result of an output jax.
|
||||
|
||||
:Parameters:
|
||||
- **element** --- the element to inspect
|
||||
:Returns: integer (-1, 0, 1)
|
||||
|
||||
.. Method:: Insert(dst,src)
|
||||
|
||||
Inserts data from the `src` object into the `dst` object. The
|
||||
`key:value` pairs in `src` are (recursively) copied into `dst`, so
|
||||
that if `value` is itself an object, its contents is copied into
|
||||
the corresponding object in `dst`. That is, objects within `src`
|
||||
are merged into the corresponding objects in `dst` (they don't
|
||||
replace them).
|
||||
|
||||
:Parameters:
|
||||
- **dst** --- the destination object
|
||||
- **src** --- the source object
|
||||
:Returns: the modified destination object
|
||||
|
||||
.. Method:: formatError(script,error)
|
||||
|
||||
This is called when an internal error occurs during the processing
|
||||
of a math element (i.e., an error in the MathJax code itself).
|
||||
The `script` is a reference to the ``<script>`` tag where the
|
||||
error occurred, and `error` is the ``Error`` object for the error.
|
||||
The default action is to insert an HTML snippet at the location of
|
||||
the script, but this routine can be overriden durring MathJax
|
||||
configuration in order to perform some other action.
|
||||
``MathJax.Hub.lastError`` holds the ``error`` value of the last
|
||||
error on the page.
|
||||
|
||||
:Parameters:
|
||||
- **script** --- the ``<script>`` tag causing the error
|
||||
- **error** --- the ``Error`` object for the error
|
||||
:Returns: ``null``
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
.. _mathjax-api:
|
||||
|
||||
===============
|
||||
The MathJax API
|
||||
===============
|
||||
|
||||
The following links document the various components that make up
|
||||
MathJax. These are implemented as JavaScript objects contained within
|
||||
the single global variable, ``MathJax``. Although JavaScript includes
|
||||
an objects with some inheritance capabilities, they do not constitute
|
||||
a full object-oriented programming model, so MathJax implements
|
||||
its own object library. This means there is an ambiguity when we
|
||||
speak of an "object", as it could be either a native JavaScript
|
||||
object, or a MathJax object. We will use `Object` (capitalized) or
|
||||
`MathJax.Object` for, when the distinction is important.
|
||||
|
||||
You may also want to view the :ref:`advanced topics <advanced-topics>`
|
||||
on the main MathJax documentation page.
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
The MathJax variable <variable>
|
||||
The MathJax.Hub object <hub>
|
||||
The MathJax.Ajax object <ajax>
|
||||
The MathJax.Message object <message>
|
||||
The MathJax.HTML object <html>
|
||||
The MathJax.CallBack class <callback>
|
||||
The MathJax.CallBack.Queue class <queue>
|
||||
The MathJax.CallBack.Signal class <signal>
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
The MathJax.InputJax class <inputjax>
|
||||
The MathJax.OutputJax class <outputjax>
|
||||
The MathJax.ElementJax class <elementjax>
|
||||
The base Jax class <jax>
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
The MathJax Object-Oriented Programming Model <object>
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
.. _api-input-jax:
|
||||
|
||||
**************************
|
||||
The MathJax.InputJax Class
|
||||
**************************
|
||||
|
||||
Input jax are the components of MathJax that translate
|
||||
mathematics from its original format (like :term:`TeX` or
|
||||
:term:`MathML`) to the MathJax internal format (an `element jax`).
|
||||
|
||||
An input jax is stored as a pair of files in a subdirectory of the
|
||||
``jax/input`` directory, with the subdirectory name being the name of
|
||||
the input jax. For example, the TeX input jax is stored in
|
||||
`jax/input/TeX`. The first file, ``config.js``, is loaded when
|
||||
MathJax is being loaded and configured, and is indicated by listing
|
||||
the input jax directory in the `jax` array of the MathJax
|
||||
configuration. The ``config.js`` file creates a subclass of the
|
||||
`MathJax.InputJax` object for the new input jax and registers that
|
||||
with MathJax, along with the MIME-type that will be used to indicate
|
||||
the mathematics that is to be processed by the input jax.
|
||||
|
||||
The main body of the input jax is stored in the second file,
|
||||
``jax.js``, which is loaded when the input jax is first called on to
|
||||
translate some mathematics. This file augments the original input jax
|
||||
subclass with the additional methods needed to do the translation.
|
||||
MathJax calls the input jax's :meth:`Translate()` method when it needs
|
||||
the input jax to translate the contents of a math ``<script>`` tag.
|
||||
|
||||
The `MathJax.InputJax` class is a subclass of the :ref:`MathJax Jax
|
||||
<api-jax>` class, and inherits the properties and methods of that
|
||||
class. Those listed below are the additional or overridden ones from
|
||||
that class.
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: name
|
||||
|
||||
The name of the jax.
|
||||
|
||||
.. describe:: version
|
||||
|
||||
The version number of the jax.
|
||||
|
||||
.. describe:: directory
|
||||
|
||||
The directory where the jax files are stored (e.g., ``"[MathJax]/jax/input/TeX"``);
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. Method:: Translate(script)
|
||||
:noindex:
|
||||
|
||||
This is the main routine called by MathJax when a ``<script>`` of
|
||||
the appropriate type is found. The default :meth:`Translate()`
|
||||
method simply loads the ``jax.js`` file and returns that callback
|
||||
for that load function so that MathJax will know when to try
|
||||
the :meth:`Translate()` action again. When the ``jax.js`` file
|
||||
loads, it should override the default :meth:`Translate()` with its
|
||||
own version that does the actual translation; that way, when the
|
||||
second Translate call is made, it will be to the actual
|
||||
translation routine rather than the default loader.
|
||||
|
||||
The translation process should include the creation of an
|
||||
:ref:`Element Jax <api-element-jax>` that stores the data needed
|
||||
for this element.
|
||||
|
||||
:Parameters:
|
||||
- **script** --- the ``<script>`` element to be translated
|
||||
:Returns: the `element jax` resulting from the translation
|
||||
|
||||
.. Method:: Register(mimetype)
|
||||
:noindex:
|
||||
|
||||
This registers the MIME-type associated with this input jax so
|
||||
that MathJax knows to call this input jax when it sees a
|
||||
``<script>`` of that type. An input jax can register more than
|
||||
one type, but it will be responsible for distinguishing elements
|
||||
of the various types from one another.
|
||||
|
||||
:Parameters:
|
||||
- **mimetype** --- the MIME-type of the input this jax processes
|
||||
:Returns: ``null``
|
||||
-148
@@ -1,148 +0,0 @@
|
||||
.. _api-jax:
|
||||
|
||||
******************
|
||||
The Base Jax Class
|
||||
******************
|
||||
|
||||
The `MathJax.InputJax`, `MathJax.OutputJax` and `MathJax.ElementJax`
|
||||
classes are all subclasses of the base `Jax` class in MathJax. This
|
||||
is a private class that implements the methods common to all three
|
||||
other jax classes.
|
||||
|
||||
Unlike most MathJax.Object classes, calling the class object creates a
|
||||
*subclass* of the class, rather than an instance of the class. E.g.,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.InputJax.MyInputJax = MathJax.InputJax({
|
||||
name: "MyInputJax",
|
||||
version: "1.0",
|
||||
...
|
||||
});
|
||||
|
||||
creates ``MathJax.InputJax.MyInputJax`` as a subclass of ``MathJax.InputJax``.
|
||||
|
||||
|
||||
Class Properties
|
||||
================
|
||||
|
||||
.. describe:: directory
|
||||
|
||||
The name of the jax directory (usually ``"[MathJax]/jax").
|
||||
Overridden in the subclass to be the specific directory for the
|
||||
class, e.g. ``"[MathJax]/jax/input"``.
|
||||
|
||||
.. describe:: extensionDir
|
||||
|
||||
The name of the extensions directory (usually ``"[MathJax]/extensions"``).
|
||||
|
||||
|
||||
Instance Properties
|
||||
===================
|
||||
|
||||
.. describe:: name
|
||||
|
||||
The name of the jax.
|
||||
|
||||
.. describe:: version
|
||||
|
||||
The version number of the jax.
|
||||
|
||||
.. describe:: directory
|
||||
|
||||
The directory for the jax (e.g., ``"[MathJax]/jax/input/TeX"``).
|
||||
|
||||
.. describe:: require: null
|
||||
|
||||
An array of files to load before the ``jax.js`` file calls the
|
||||
:meth:`MathJax.Ajax.loadComplete()` method.
|
||||
|
||||
.. describe:: config: {}
|
||||
|
||||
An object that contains the default configuration options for the
|
||||
jax. These can be modified by the author by including a
|
||||
configuration subsection for the specific jax in question.
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. Method:: Translate(script)
|
||||
|
||||
This is the method that the ``MathJax.Hub`` calls when it needs
|
||||
the input or output jax to process the given math ``<script>``
|
||||
call. Its default action is to start loading the jax's ``jax.js``
|
||||
file, and redefine the :meth:`Translate()` method to be the
|
||||
:meth:`noTranslate()` method below. The ``jax.js`` file should
|
||||
redefine the :meth:`Translate()` method to perform the translation
|
||||
operation for the specific jax. For an input jax, it should
|
||||
return the `ElementJax` object that it created.
|
||||
|
||||
:Parameters:
|
||||
- **script** --- reference to the DOM ``<script>`` object for
|
||||
the mathematics to be translated
|
||||
:Returns: an `ElementJax` object, or ``null``
|
||||
|
||||
.. Method:: noTranslate(script)
|
||||
|
||||
This is a temporary routine that is used while the ``jax.js`` file
|
||||
is loading. It throws an error indicating the the
|
||||
:meth:`Translate()` method hasn't been redefined. That way, if
|
||||
the ``jax.js`` file failes to load for some reason, you will
|
||||
receive an error trying to process mathematics with this input
|
||||
jax.
|
||||
|
||||
:Parameters:
|
||||
- **script** --- reference to the DOM ``<script>`` object for
|
||||
the mathematics to be translated
|
||||
:Returns: ``null``
|
||||
|
||||
.. Method:: Register(mimetype)
|
||||
|
||||
This method is overridden in the `InputJax`, `OutputJax` and
|
||||
`ElementJax` subclasses to handle the registration of those
|
||||
classes of jax.
|
||||
|
||||
:Parameters:
|
||||
- **mimetype** --- the MIME-type to be associated with the jax
|
||||
:Returns: ``null``
|
||||
|
||||
.. Method:: Config()
|
||||
:noindex:
|
||||
|
||||
Inserts the configuration block for this jax from the author's
|
||||
configuration specification into the jax's ``config`` property.
|
||||
If the configuration includes an ``Augment`` object, that is used
|
||||
to augment the jax (that is, the configuration can override the
|
||||
methods of the object, as well as the data). This is called
|
||||
automatically during the loading of the ``jax.js`` file.
|
||||
|
||||
.. Method:: Startup()
|
||||
|
||||
This is a method that can be overridden in the subclasses to
|
||||
perform initialization at startup time (after the configuration
|
||||
has occurred).
|
||||
|
||||
.. Method:: loadComplete (file)
|
||||
:noindex:
|
||||
|
||||
This is called by the ``config.js`` and ``jax.js`` files when they
|
||||
are completely loaded and are ready to signal that fact to
|
||||
MathJax. For ``config.js``, this simply calls the
|
||||
:meth:`MathJax.Ajax.loadComplete()` method for the ``config.js``
|
||||
file. For ``jax.js``, the actions performed here are the
|
||||
following:
|
||||
|
||||
1. Post the "[name] Jax Config" message to the startup signal.
|
||||
2. Perform the jax's :meth:`Config()` method.
|
||||
3. Post the "[name] Jax Require" message to the startup signal.
|
||||
4. Load the files from the jax's ``require`` array (which may
|
||||
have been modified during the configuration process).
|
||||
5. Post the "[name] Jax Startup" message to the startup signal.
|
||||
6. Perform the jax's :meth:`Startup()` method.
|
||||
7. Post the "[name] Jax Ready" message to the startup signal.
|
||||
8. perform the :meth:`MathJax.Ajax.loadComplete()` call for the
|
||||
``jax.js`` file.
|
||||
|
||||
|
||||
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
.. _api-message:
|
||||
|
||||
**************************
|
||||
The MathJax.Message Object
|
||||
**************************
|
||||
|
||||
The ``MathJax.Message`` object contains the methods used to manage the
|
||||
small message area that appears at the lower-left corner of the
|
||||
window. MathJax uses this area to inform the user of time-consuming
|
||||
actions, like loading files and fonts, or how far along in the
|
||||
typesetting process it is.
|
||||
|
||||
The page author can customize the look of the message window by
|
||||
setting styles for the ``#MathJax_Message`` selector (which can be
|
||||
set via
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Hub.Config({
|
||||
styles: {
|
||||
"#MathJax_Message": {
|
||||
...
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Because of a bug in Internet Explorer, in order to change the side of
|
||||
the screen where the the message occurs, you must also set the side
|
||||
for ``#MathJax_MSIE_Frame``, as in
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Hub.Config({
|
||||
styles: {
|
||||
"#MathJax_Message": {left: "", right: 0},
|
||||
"#MathJax_MSIE_Frame": {left: "", right: 0}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
It is possible that a message is already being displayed when another
|
||||
message needs to be posted. For this reason, when a message is
|
||||
displayed on screen, it gets an id number that is used when you want
|
||||
to remove or change that message. That way, when a message is
|
||||
removed, the previous message (if any) can be redisplayed if it hasn't
|
||||
been removed. This allows for intermittent messages (like file
|
||||
loading messages) to obscure longer-term message (like "Processing
|
||||
Math" messages) temporarily.
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. method:: Set(message,[n,[delay]])
|
||||
|
||||
This sets the message being displayed to the given `message`
|
||||
string. If `n` is not ``null``, it represents a message id
|
||||
number and the text is set for that message id, otherwise a new id
|
||||
number is created for this message. If `delay` is provided, it is
|
||||
the time (in milliseconds) to display the message before it is
|
||||
cleared. If `delay` is not provided, the message will not be
|
||||
removed automatically; you must call the
|
||||
:meth:`MathJax.Messsage.Clear()` method by hand to remove it.
|
||||
|
||||
:Parameters:
|
||||
- **message** --- the text to display in the message area
|
||||
- **n** --- the message id number
|
||||
- **delay** --- amout of time to display the message
|
||||
:Returns: the message id nuber for this message.
|
||||
|
||||
.. method:: Clear(n[,delay])
|
||||
|
||||
This causes the message with id `n` to be removed after the given
|
||||
`delay`, in milliseconds. The default delay is 600 milliseconds.
|
||||
|
||||
:Parameters:
|
||||
- **n** --- the message id number
|
||||
- **delay** --- the delay before removing the message
|
||||
:Returns: ``null``
|
||||
|
||||
.. method:: Log()
|
||||
|
||||
Returns a string of all the messages issued so far, separated by
|
||||
newlines. This is used in debugging MathJax operations.
|
||||
|
||||
:Returns: string of all messages so far
|
||||
-210
@@ -1,210 +0,0 @@
|
||||
.. _api-object:
|
||||
|
||||
*********************************************
|
||||
The MathJax Object-Oriented Programming Model
|
||||
*********************************************
|
||||
|
||||
MathJax uses an object-oriented programming model for its main
|
||||
components, such as the `Input jax`, `Output jax`, and `Element jax`.
|
||||
The model is intended to be light-weight and is based on JavaScript's
|
||||
prototype inheritance mechanism. Object classes are created by making
|
||||
subclasses of `MathJax.Object` or one of its subclasses, and are
|
||||
instantiated by calling the object class as you would a function.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Object.Foo = MathJax.Object.Subclass({
|
||||
Init: function (x) {this.SetX(x)},
|
||||
getX: function () {return this.x},
|
||||
setX: function (x) {this.x = x}
|
||||
});
|
||||
var foo = MathJax.Object.Foo("bar");
|
||||
foo.getX(); // returns "bar"
|
||||
foo.setX("foobar");
|
||||
foo.getX(); // returns "foobar"
|
||||
|
||||
Object classes can have static properties and methods, which are
|
||||
accessed via the object class variable. E.g.,
|
||||
``MathJax.Object.Foo.SUPER`` or ``MathJax.Object.Foo.Augment()`` for
|
||||
the object in the example above. Static values are not inherited by
|
||||
subclasses.
|
||||
|
||||
|
||||
Static Properties
|
||||
=================
|
||||
|
||||
.. describe:: SUPER
|
||||
|
||||
Pointer to the super class for this subclass. (It is a reference to
|
||||
`MathJax.Object` in the example above.)
|
||||
|
||||
|
||||
Static Methods
|
||||
==============
|
||||
|
||||
.. method:: Subclass(def[,static])
|
||||
|
||||
Creates a subclass of the given class using the contents of the
|
||||
`def` object to define new methods and properties of the object
|
||||
class, and the contents of the optional `static` object to define
|
||||
new static methods and properties.
|
||||
|
||||
:Parameters:
|
||||
- **def** --- object that defines the properties and methods
|
||||
- **static** --- object that defines static properties and methods
|
||||
:Returns: the new object class
|
||||
|
||||
.. method:: Augment(def[,static])
|
||||
|
||||
Adds new properties and methods to the class prototype. All
|
||||
instances of the object already in existence will receive the new
|
||||
properties and methods automatically.
|
||||
|
||||
:Parameters:
|
||||
- **def** --- object that defines the properties and methods
|
||||
- **static** --- object that defines static properties and methods
|
||||
:Returns: the object class itself
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: constructor
|
||||
|
||||
Pointer to the constructor function for this class. E.g.,
|
||||
``foo.constructor`` would be a reference to ``MathJax.Object.Foo``
|
||||
in the example above.
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. method:: Init([data])
|
||||
|
||||
An optional function that is called when an instance of the class
|
||||
is created. When called, the `this` variable is set to the newly
|
||||
instantiated object, and the `data` is whatever was passed to the
|
||||
object constructor. For instance, in the example above, the
|
||||
variable ``foo`` is created by calling
|
||||
``MathJax.Object.Foo("bar")``, which calls the
|
||||
``MathJax.Object.Foo`` object's :meth:`Init()` method with `data`
|
||||
equal to ``"bar"``. If desired, the :meth:`Init()` method can
|
||||
create a *different* object, and return that, in which case this
|
||||
becomes the return value for the object constructor.
|
||||
|
||||
:Parameters:
|
||||
- **data** --- the data from the constructor call
|
||||
:Returns: ``null`` or the object to be returned by the constructor
|
||||
|
||||
|
||||
.. method:: isa(class)
|
||||
|
||||
Returns ``true`` if the object is an instance of the given class,
|
||||
or of a subclass of the given class, and ``false`` otherwise. So
|
||||
using the ``foo`` value defined above,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
foo.isa(MathJax.Object); // returns true
|
||||
foo.isa(MathJax.Object.Foo); // returns true
|
||||
foo.isa(MathJax.InputJax); // returns false
|
||||
|
||||
.. method:: can(method)
|
||||
|
||||
Checks if the object has the given `method` and returns ``true``
|
||||
if so, otherwise returns ``false``. This allows you to test if an
|
||||
object has a particular function available before trying to call
|
||||
it (i.e., if an object implements a particular feature). For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
foo.can("getX"); // returns true
|
||||
foo.can("bar"); // returns false
|
||||
|
||||
.. method:: has(property)
|
||||
|
||||
Checks if the object has the given `property` and returns ``true``
|
||||
if so, otherwise returns ``false``. This allows you to test if an
|
||||
object has a particular property available before trying to use
|
||||
it. For example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
foo.has("getX"); // returns true
|
||||
foo.has("x"); // returns true
|
||||
foo.has("bar"); // returns false
|
||||
|
||||
|
||||
Accessing the Super Class
|
||||
=========================
|
||||
|
||||
If a subclass overrides a method of its parent class, it may want to
|
||||
call the original function as part of its replacement method. The
|
||||
semantics for this are a bit awkward, but work efficiently. Within a
|
||||
method, the value ``arguments.callee.SUPER`` refers to the super
|
||||
class, so you can access any method of the superclass using that. In
|
||||
order to have `this` refer to the current object when you call the
|
||||
super class, however, you need to use ``call()`` or
|
||||
``apply()`` to access the given method.
|
||||
|
||||
For example, ``arguments.callee.SUPER.method.call(this,data)`` would
|
||||
call the superclass' `method` and pass it `data` as its argument,
|
||||
properly passing the current object as `this`. Alternatively, you can
|
||||
use ``this.SUPER(arguments)`` in place of ``arguments.callee.SUPER``.
|
||||
It is also possible to refer to the super class explicitly rather than
|
||||
through ``arguments.callee.SUPER``, as in the following example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Class1 = MathJax.Object.Subclass({
|
||||
Init: function(x) {this.x = x},
|
||||
XandY: function(y) {return "Class1: x and y = " + this.x + " and " + y}
|
||||
});
|
||||
|
||||
MathJax.Class2 = MathJax.Class1.Subclass({
|
||||
XandY: function (y) {return "Class2: "+arguments.callee.SUPER.XandY.call(this,y)}
|
||||
});
|
||||
|
||||
MathJax.Class3 = MathJax.Class2.Subclass({
|
||||
XandY: function (y) {return "Class3: "+MathJax.Class2.prototype.XandY.call(this,y)}
|
||||
});
|
||||
|
||||
MathJax.Class4 = MathJax.Class1.Subclass({
|
||||
XandY: function (y) {return "Class4: "+this.SUPER(arguments).XandY.call(this,y)}
|
||||
});
|
||||
|
||||
var foo = MathJax.Class2("foo");
|
||||
foo.XandY("bar"); // returns "Class2: Class1: x and y = foo and bar"
|
||||
var bar = MathJax.Class3("bar");
|
||||
bar.XandY("foo"); // returns "Class3: Class2: Class1: x and y = bar and foo"
|
||||
var moo = MathJax.Class4("moo");
|
||||
moo.XandY("cow"); // returns "Class4: Class1: x and y = moo and cow"
|
||||
|
||||
Since both of these mechanisms are rather awkward, MathJax provides an
|
||||
alternative syntax that is easier on the programmer, but at the cost
|
||||
of some inefficiency in creating the subclass and in calling methods
|
||||
that access the super class.
|
||||
|
||||
Since most calls to the super class are to the overridden method, not
|
||||
to some other method, the method name and the ``call()`` are
|
||||
essentially redundant. You can get a more convenient syntax by
|
||||
wrapping the `def` for the :meth:`Subclass()` call in a call to
|
||||
``MathJax.Object.SimpleSUPER()``, as in the following example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Class1 = MathJax.Object.Subclass({
|
||||
Init: function (x) {this.x = x},
|
||||
XandY: function (y) {return "Class1: x and y = " + this.x + " and " + y}
|
||||
});
|
||||
|
||||
MathJax.Class2 = MathJax.Class1.Subclass(
|
||||
MathJax.Object.SimpleSUPER({
|
||||
XandY: function (y) {return "Class2: "+this.SUPER(y)},
|
||||
AnotherMethod: function () {return this.x} // it's OK if a method doesn't use SUPER
|
||||
})
|
||||
);
|
||||
|
||||
var foo = MathJax.Class2("foo");
|
||||
foo.XandY("bar"); // returns "Class2: Class1: x and y = foo and bar"
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
.. _api-output-jax:
|
||||
|
||||
***************************
|
||||
The MathJax.OutputJax Class
|
||||
***************************
|
||||
|
||||
Output jax are the components of MathJax that translate
|
||||
mathematics from the MathJax internal format (an `element jax`)
|
||||
to whatever output is required to represent the mathematics (e.g.,
|
||||
MathML elements, or HTML-with-CSS that formats the mathematics on screen).
|
||||
|
||||
An output jax is stored as a pair of files in a subdirectory of the
|
||||
the ``jax/output`` directory, with the subdirectory name being the
|
||||
name of the output jax. For example, the NativeMML output jax is
|
||||
stored in `jax/output/NativeMML`. The first file, ``config.js``, is
|
||||
loaded when MathJax is being loaded and configured, and is indicated
|
||||
by listing the input jax directory in the `jax` array of the MathJax
|
||||
configuration. The ``config.js`` file creates a subclass of the
|
||||
`MathJax.OutputJax` object for the new output jax and registers it
|
||||
with MathJax, along with the MIME-type of the element jax that it can
|
||||
process.
|
||||
|
||||
The main body of the output jax is stored in the second file, ``jax.js``,
|
||||
which is loaded when the output jax is first called on to translate
|
||||
some mathematics. This file augments the original output jax
|
||||
subclass with the additional methods needed to produce the output.
|
||||
MathJax calls the input jax's :meth:`Translate()` method when it needs
|
||||
the output jax to translate an element jax to produce output.
|
||||
|
||||
The `MathJax.OutputJax` class is a subclass of the :ref:`MathJax Jax
|
||||
<api-jax>` class, and inherits the properties and methods of that
|
||||
class. Those listed below are the additional or overridden ones from
|
||||
that class.
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: name
|
||||
|
||||
The name of the jax.
|
||||
|
||||
.. describe:: version
|
||||
|
||||
The version number of the jax.
|
||||
|
||||
.. describe:: directory
|
||||
|
||||
The directory where the jax files are stored (e.g., ``"[MathJax]/jax/output/HTML-CSS"``);
|
||||
|
||||
|
||||
Methods
|
||||
=======
|
||||
|
||||
.. Method:: Translate(script)
|
||||
:noindex:
|
||||
|
||||
This is the main routine called by MathJax when an element jax is
|
||||
to be converted to output. The default :meth:`Translate()`
|
||||
method simply loads the ``jax.js`` file and returns that callback
|
||||
for that load function so that MathJax will know when to try
|
||||
the :meth:`Translate()` action again. When the ``jax.js`` file
|
||||
loads, it should override the default :meth:`Translate()` with its
|
||||
own version that does the actual translation; that way, when the
|
||||
second Translate call is made, it will be to the actual
|
||||
translation routine rather than the default loader.
|
||||
|
||||
You should use ``MathJax.Hub.getJaxFor(script)`` to obtain the
|
||||
element jax for the given script. The translation process may add
|
||||
modify the element jax (e.g., if it has data that needs to be
|
||||
stored with the jax), and may insert DOM elements into the
|
||||
document near the jax's ``<script>`` tag.
|
||||
|
||||
:Parameters:
|
||||
- **script** --- the ``<script>`` element to be translated
|
||||
:Returns: the `element jax` resulting from the translation
|
||||
|
||||
.. Method:: Register(mimetype)
|
||||
:noindex:
|
||||
|
||||
This registers the MIME-type for the element jax associated with
|
||||
this output jax so that MathJax knows to call this jax when it
|
||||
wants to display an element jax of that type. Several output jax
|
||||
may register for the same input jax, in which case the first one
|
||||
to register will be the default one for that type.
|
||||
|
||||
:Parameters:
|
||||
- **mimetype** --- the MIME-type of the input this jax processes
|
||||
:Returns: ``null``
|
||||
|
||||
.. Method:: Remove(jax)
|
||||
:noindex:
|
||||
|
||||
Removes the output associated with the given element jax. The
|
||||
routine can use ``jax.SourceElement()`` to locate the ``<script>``
|
||||
tag associated with the element jax.
|
||||
|
||||
:Parameters:
|
||||
- **jax** --- the element jax whose display should be removed
|
||||
:Returns: ``null``
|
||||
-99
@@ -1,99 +0,0 @@
|
||||
.. _api-queue:
|
||||
|
||||
********************************
|
||||
The MathJax.Callback.Queue Class
|
||||
********************************
|
||||
|
||||
The ``MathJax.Callback.Queue`` object is one of the key mechanisms
|
||||
used by MathJax to synchronize its actions with those that occur
|
||||
asynchronously, like loading files and stylesheets. A `Queue` obejct
|
||||
is used to coordinate a sequence of actions so that they are performed
|
||||
one after another, even when one action has to wait for an
|
||||
asynchronous process to complete. This guarantees that operations are
|
||||
performed in the right order even when the code must wait for some
|
||||
other action to occur. See :ref:`Synchronizing with MathJax
|
||||
<synchronization>` for more details, and :ref:`Using Queues
|
||||
<using-queues>` in particular for examples of how to specify and use
|
||||
MathJax `Queue` objects.
|
||||
|
||||
|
||||
Properties
|
||||
----------
|
||||
|
||||
.. describe:: pending
|
||||
|
||||
This is non-zero when the queue is waiting for a command to
|
||||
complete, i.e. a command being processed returns a `Callback`
|
||||
object, indicating that the queue should wait for that action to
|
||||
complete before processing additional commands.
|
||||
|
||||
.. describe:: running
|
||||
|
||||
This is non-zero when the queue is executing one of the commands in
|
||||
the queue.
|
||||
|
||||
.. describe:: queue
|
||||
|
||||
An array containing the queued commands that are yet to be performed.
|
||||
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: Push(callback,...)
|
||||
|
||||
Adds commands to the queue and runs them (if the queue is not
|
||||
pending or running another command). If one of the callbacks is
|
||||
an actual `Callback` object rather than a callback specification,
|
||||
then the command queued is an internal command to wait for the
|
||||
given callback to complete. That is, that callback is not itself
|
||||
queued to be executed, but a wait for that callback is queued.
|
||||
The :meth:`Push()` method returns the last callback that was
|
||||
added to the queue (so that it can be used for further
|
||||
synchronization, say as an entry in some other queue).
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- the callback specifications to be added to the queue
|
||||
:Returns: the last callback object added to the queue
|
||||
|
||||
.. method:: Process()
|
||||
:noindex:
|
||||
|
||||
Process the commands in the queue, provided the queue is not
|
||||
waiting for another command to complete. This method is used
|
||||
internally; you should not need to call it yourself.
|
||||
|
||||
.. method:: Suspend()
|
||||
|
||||
Increments the `running` property, indicating that any commands that
|
||||
are added the queue should not be executed immediately, but should
|
||||
be queued for later execution (when its :meth:`Resume()` is
|
||||
called). This method is used internally; you should not need to
|
||||
call it yourself.
|
||||
|
||||
.. method:: Resume()
|
||||
|
||||
Decrements the `running` property, if it is positive. When it is
|
||||
zero, commands can be processed, but that is not done
|
||||
automatically --- you would need to call :meth:`Process()` to make
|
||||
that happen. This method is used internally; you should not need
|
||||
to call it yourself.
|
||||
|
||||
.. method:: wait(callback)
|
||||
|
||||
Used internally when an entry in the queue is a `Callback` object
|
||||
rather than a callback specification. A callback to this function
|
||||
(passing it the original callback) is queued instead, and it
|
||||
simply returns the callback it was passed. Since the queue will
|
||||
wait for a callback if it is the return value of one of the
|
||||
commands it executes, this effectively make the queue wait for the
|
||||
original callback at that point in the command queue.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- the function to complete before returning to the queue
|
||||
:Returns: the passed callback function
|
||||
|
||||
.. method:: call()
|
||||
|
||||
An internal function used to restart processing of the queue after
|
||||
it has been waiting for a command to complete.
|
||||
-154
@@ -1,154 +0,0 @@
|
||||
.. _api-signal:
|
||||
|
||||
*********************************
|
||||
The MathJax.Callback.Signal Class
|
||||
*********************************
|
||||
|
||||
The ``MathJax.Callback.Signal`` object is one of the key mechanisms
|
||||
used by MathJax to synchronize its actions with those that occur
|
||||
asynchronously, like loading files and stylesheets. A `Signal` object
|
||||
is used to pulicise the fact that MathJax has performed certain
|
||||
actions, giving other code running the the web page the chance to
|
||||
react to those actions. See :ref:`Synchronizing with MathJax
|
||||
<synchronization>` for more details, and :ref:`Using Signals
|
||||
<using-signals>` in particular for examples of how to specify and use
|
||||
MathJax `Signal` objects.
|
||||
|
||||
The `Callback Signal` object is a subclass of the :ref:`Callback Queue
|
||||
<api-queue>` object.
|
||||
|
||||
|
||||
Properties
|
||||
----------
|
||||
|
||||
.. describe:: name
|
||||
|
||||
The name of the signal. Each signal is named so that
|
||||
various components can access it. The first one to request a
|
||||
particular signal causes it to be created, and other requests for
|
||||
the signal return references to the same object.
|
||||
|
||||
.. describe:: posted
|
||||
|
||||
Array used internally to stored the post history so that when new
|
||||
listeners express interests in this signal, they can be informed
|
||||
of the signals that have been posted so far. This can be cleared
|
||||
using the signal's :meth:`Clear()` method.
|
||||
|
||||
.. describe:: listeners
|
||||
|
||||
Array of callbacks to the listeners who have expressed interest in
|
||||
hearing about posts to this signal. When a post occurs, the
|
||||
listeners are called in each turn, passing them the message that
|
||||
was posted.
|
||||
|
||||
|
||||
Methods
|
||||
-------
|
||||
|
||||
.. method:: Post(message[,callback])
|
||||
|
||||
Posts a message to all the listeners for the signal. The listener
|
||||
callbacks are called in turn (with the message as an argument),
|
||||
and if any return a `Callback` object, the posting will be
|
||||
suspended until the callback is exectured. In this way, the
|
||||
:meth:`Post()` call can operate asynchronously, and so the
|
||||
`callback` parameter is used to synchronize with its operation;
|
||||
the `callback` will be called when all the listeners have responded
|
||||
to the post.
|
||||
|
||||
If a :meth:`Post()` to this signal occurs while waiting for the
|
||||
response from a listener (either because a listener returned a
|
||||
`Callback` object and we are waiting for it to complete when the
|
||||
:meth:`Post()` occurred, or because the listener itself called the
|
||||
``Post()`` method), the new message will be queued and will be
|
||||
posted after the current message has been sent to all the
|
||||
listeners, and they have all responded. This is another way in
|
||||
which posting can be asynchronous; the only sure way to know that
|
||||
a posting has occurred is through its `callback`. When the posting
|
||||
is complete, the callback is called, passing it the signal object
|
||||
that has just completed.
|
||||
|
||||
Returns the callback object (or a blank callback object if none
|
||||
was provided).
|
||||
|
||||
:Parameters:
|
||||
- **message** --- the message to send through the signal
|
||||
- **callback** --- called after the message is posted
|
||||
:Returns: the callback or a blank callback
|
||||
|
||||
.. method:: Clear([callback])
|
||||
:noindex:
|
||||
|
||||
This causes the history of past messages to be cleared so new
|
||||
listeners will not receive them. Note that since the signal may
|
||||
be operating asynchronously, the :meth:`Clear()` may be queued for
|
||||
later. In this way, the :meth:`Post()` and :meth:`Clear()`
|
||||
operations will be performed in the proper order even when they
|
||||
are delayed. The `callback` is called when the :meth:`Clear()`
|
||||
operation is completed.
|
||||
|
||||
Returns the callback (or a blank callback if none is provided).
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- called after the signal history is cleared
|
||||
:Returns: the callback or a blank callback
|
||||
|
||||
.. method:: Interest(callback[,ignorePast])
|
||||
|
||||
This method registers a new listener on the signal. It creates a
|
||||
`Callback` object from the callback specification, attaches it to
|
||||
the signal, and returns that `Callback` object. When new messages
|
||||
are posted to the signal, it runs the callback, passing it the
|
||||
message that was posted. If the callback itself returns a
|
||||
`Callback` object, that indicates that the listener has started an
|
||||
asynchronous operation and the poster should wait for that
|
||||
callback to complete before allowing new posts on the signal.
|
||||
|
||||
If `ignorePast` is ``false`` or not present, then before
|
||||
:meth:`Interest()` returns, the callback will be called with all
|
||||
the past messages that have been sent to the signal.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- called whenever a message is posted (past or present)
|
||||
- **ignorePast** --- ``true`` means ignore previous messages
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: NoInterest(callback)
|
||||
|
||||
This removes a listener from the signal so that no new messages
|
||||
will be sent to it. The callback should be the one returned by
|
||||
the original :meth:`Interest()` call that attached the listener to
|
||||
the signal in the first place. Once removed, the listener will no
|
||||
longer receive messages from the signal.
|
||||
|
||||
:Parameters:
|
||||
- **callback** --- the listener to be removed from signal
|
||||
:Returns: ``null``
|
||||
|
||||
.. method:: MessageHook(message, callback)
|
||||
|
||||
This creates a callback that is called whenever the signal posts
|
||||
the given message. This is a little easier than having to write a
|
||||
function that must check the message each time it is called.
|
||||
Although the `message` here is a string, if a message posted to the
|
||||
signal is an array, then only the first element of that array is
|
||||
used to match against message. That way, if a message contains an
|
||||
identifier plus arguments, the hook will match the identifier and
|
||||
still get called with the complete set of arguments.
|
||||
|
||||
Returns the `Callback` object that was produced.
|
||||
|
||||
:Parameters:
|
||||
- **message** --- the message to look for from the signal
|
||||
- **callback** --- called when the message is posted
|
||||
:Returns: the callback object
|
||||
|
||||
.. method:: ExecuteHook(message)
|
||||
|
||||
Used internally to call the listeners when a particular
|
||||
message is posted to the signal.
|
||||
|
||||
:Parameters:
|
||||
- **message** --- the posted message
|
||||
:Returns: ``null``
|
||||
-83
@@ -1,83 +0,0 @@
|
||||
********************
|
||||
The MathJax variable
|
||||
********************
|
||||
|
||||
MathJax has a single global variable, ``MathJax``, in which all its
|
||||
data, and the data for loaded components, are stored. The MathJax
|
||||
variable is a nested structure, with its top-level properties being
|
||||
objects themselves.
|
||||
|
||||
|
||||
Main MathJax Components
|
||||
=======================
|
||||
|
||||
.. describe:: MathJax.Hub
|
||||
|
||||
Contains the MathJax hub code and variables, including the startup
|
||||
code, the onload handler, the browser data, and so forth.
|
||||
|
||||
.. describe:: MathJax.Ajax
|
||||
|
||||
Contains the code for loading external modules and creating
|
||||
stylesheets. Most of the code that causes most of MathJax to
|
||||
operate asynchronously is handled here.
|
||||
|
||||
.. describe:: MathJax.Message
|
||||
|
||||
Contains the code to handle the intermittant message window that
|
||||
periodically appears in the lower left-hand corner of the window.
|
||||
|
||||
.. describe:: MathJax.HTML
|
||||
|
||||
Contains support code for creating HTML elements dynamically from
|
||||
descriptions stored in JavaScript objects.
|
||||
|
||||
.. describe:: MathJax.CallBack
|
||||
|
||||
Contains the code for managing MathJax callbacks, queues and
|
||||
signals.
|
||||
|
||||
.. describe:: MathJax.Extensions
|
||||
|
||||
Initially empty, this is where extensions can load their code.
|
||||
For example, the `tex2jax` preprocessor creates
|
||||
``MathJax.Extensions.tex2jax`` for its code and variables.
|
||||
|
||||
.. describe:: MathJax.Object
|
||||
|
||||
Contains the code for the MathJax object-oriented programming model.
|
||||
|
||||
|
||||
.. describe:: MathJax.InputJax
|
||||
|
||||
The base class for all input `jax` objects. Subclasses for
|
||||
specific input jax are created as sub-objects of
|
||||
``MathJax.InputJax``. For example, the TeX input jax loads itself
|
||||
as ``MathJax.InputJax.TeX``.
|
||||
|
||||
.. describe:: MathJax.OutputJax
|
||||
|
||||
The base class for all output `jax` objects. Subclasses for
|
||||
specific output jax are created as sub-objects of
|
||||
``MathJax.OutputJax``. For example, the HTML-CSS output jax loads
|
||||
itself as ``MathJax.OutputJax["HTML-CSS"]``.
|
||||
|
||||
.. describe:: MathJax.ElementJax
|
||||
|
||||
The base class for all element `jax` objects. Subclasses for
|
||||
specific element jax are creates as sub-objects of
|
||||
``MathJax.ElementJax``. For example, the mml element jax loads
|
||||
itself as ``MathJax.ElementJax.mml``.
|
||||
|
||||
|
||||
Properties
|
||||
==========
|
||||
|
||||
.. describe:: MathJax.version
|
||||
|
||||
The version number of the MathJax library.
|
||||
|
||||
.. describe:: MathJax.isReady
|
||||
|
||||
This is set to ``true`` when MathJax is set up and ready to
|
||||
perform typesetting actions (and is ``null`` otherwise).
|
||||
-228
@@ -1,228 +0,0 @@
|
||||
.. _using-callbacks:
|
||||
|
||||
***************
|
||||
Using Callbacks
|
||||
***************
|
||||
|
||||
A "callback" is a function that MathJax calls when it completes an
|
||||
action that may occur asynchronously (like loading a file). Many of
|
||||
MathJax's functions operate asynchronously, and MathJax uses callbacks
|
||||
to allow you to synchronize your code with the action of those
|
||||
functions. The `MathJax.Callback` structure manages these callbacks.
|
||||
Callbacks can include not only a function to call, but also data to be
|
||||
passed to the function, and an object to act as the JavaScript `this`
|
||||
value in the resulting call (i.e., the object on which the callback is
|
||||
to execute).
|
||||
|
||||
Callbacks can be collected into :ref:`Queues <using-queues>` where the
|
||||
callbacks will be processed in order, with later callbacks waiting
|
||||
until previous ones have completed before they are called. They are
|
||||
also used with :ref:`Signals <using-signals>` as the means of
|
||||
receiving information about the signals as they occur.
|
||||
|
||||
A number of methods in `MathJax.Hub` and `MathJax.Ajax` accept
|
||||
callback specifications as arguments and return callback structures.
|
||||
These routines always will return a callback even when none was
|
||||
specified in the arguments, and in that case, the callback is a "do
|
||||
nothing" callback. The reason for this is so that the resulting
|
||||
callback can be used can be used in a `MathJax.Callback.Queue` for
|
||||
synchronization purposes, so that the actions following it in the
|
||||
queue will not be performed until after the callback has been fired.
|
||||
|
||||
For example, the :meth:`MathJax.Ajax.Require()` method can be used to
|
||||
load external files, and it returns a callback that is called when the
|
||||
file has been loaded and executed. If you want to load several files
|
||||
and wait for them all to be loaded before performing some action, you
|
||||
can create a `Queue` into which you push the results of the
|
||||
:meth:`MathJax.Ajax.Require()` calls, and then push a callback for the
|
||||
action. The final action will not be performed until all the
|
||||
file-load callbacks (which preceed it int he queue) have been called;
|
||||
i.e., the action will not occur until all the files are loaded.
|
||||
|
||||
|
||||
Specifying a Callback
|
||||
---------------------
|
||||
|
||||
Callbacks can be specified in a number of different ways, depending on
|
||||
the functionality that is required of the callback. The easiest case
|
||||
is to simply provide a function to be called, but it is also possible
|
||||
to include data to pass to the function when it is called, and to
|
||||
specify the object that will be used as `this` when the function is
|
||||
called.
|
||||
|
||||
For example, the :meth:`MathJax.Ajax.Require()` method can accept a
|
||||
callback as its second argument (it will be called when the file given
|
||||
as the first argument is loaded and executed). So you can call
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Require("[MathJax]/config/myConfig.js",function () {
|
||||
alert("My configuration file is loaded");
|
||||
});
|
||||
|
||||
and an alert will appear when the file is loaded. An example of
|
||||
passing arguments to the callback function includes the following:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
function loadHook (x) {alert("loadHook: "+x)}
|
||||
MathJax.Ajax.Require("[MathJax]/config/myConfig.js",[loadHook,"myConfig"]);
|
||||
|
||||
Here, the ``loadHook()`` function accepts one argument and generates
|
||||
an alert that includes the value passed to it. The callback in the
|
||||
:meth:`MathJax.Ajax.Require()` call is ``[loadHook,"myConfig"]``,
|
||||
which means that (the equivalent of) ``loadHook("myConfig")`` will be
|
||||
performed when the file is loaded. The result should be an alert with
|
||||
the text `loadHook: myConfig`.
|
||||
|
||||
The callback for the :meth:`MathJax.Ajax.Require()` method actually
|
||||
gets called with a status value, in addition to any parameters already
|
||||
included in the callback specification, that indicates whether the
|
||||
file loaded successfully, or failed for some reason (perhaps the file
|
||||
couldn't be found, or it failed to compile and run). So you could use
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Require("[MathJax]/config/myConfig.js",function (status) {
|
||||
if (status === MathJax.Ajax.STATUS.OK) {
|
||||
alert("My configuration file is loaded");
|
||||
} else {
|
||||
alert("My configuration file failed to load!");
|
||||
}
|
||||
});
|
||||
|
||||
to check if the file loaded properly. With additional parameters, the
|
||||
example might be
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
function loadHook (x,status) {alert("loadHook: "+x+" has status "+status)}
|
||||
MathJax.Ajax.Require("[MathJax]/config/myConfig.js",[loadHook,"myConfig"]);
|
||||
|
||||
Note that the parameters given in the callback specification are used
|
||||
first, and then additional parameters from the call to the callback
|
||||
come afterward.
|
||||
|
||||
|
||||
Callbacks to Object Methods
|
||||
===========================
|
||||
|
||||
When you use a method of a JavaScript object, a special variable
|
||||
called `this` is defined that refers to the object whose method is
|
||||
being called. It allows you to access other methods or properties of
|
||||
the object without knowing explicitly where the object is stored.
|
||||
|
||||
For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var aPerson = {
|
||||
firstname: "John",
|
||||
lastname: "Smith",
|
||||
showName: function () {alert(this.firstname+" "+this.lastname)}
|
||||
};
|
||||
|
||||
creates an object that contains three items, a `firstname`, and
|
||||
`lastname`, and a method that shows the person's full name in an
|
||||
alert. So ``aPerson.fullName()`` would cause an alert with the text
|
||||
``John Smith`` to appear. Note, however that this only works if the
|
||||
method is called as ``aPerson.showName()``; if instead you did
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var f = aPerson.showName; // assign f the function from aPerson
|
||||
f(); // and call the function
|
||||
|
||||
the association of the function with the data in ``aPerson`` is lost,
|
||||
and the alert will probably show ``undefined undefined``. (In this
|
||||
case, ``f`` will be called with ``this`` set to the ``window``
|
||||
variable, and so ``this.firstname`` and ``this.lastname`` will refer
|
||||
to undefined values.)
|
||||
|
||||
Because of this, it is difficult to use an object's method as a
|
||||
callback if you refer to it as a function directly. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
var aFile = {
|
||||
name: "[MathJax]/config/myConfig.js",
|
||||
onload: function (status) {
|
||||
alert(this.name+" is loaded with status "+status);
|
||||
}
|
||||
};
|
||||
|
||||
MathJax.Ajax.Require(aFile.name,aFile.onload);
|
||||
|
||||
would produce an alert indicating that "undefined" was loaded with a
|
||||
particular status. That is because ``aFile.onload`` is a reference to
|
||||
the `onload` method, which is just a function, and the association
|
||||
with the `aFile` object is lost. One could do
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Require(aFile.name,function (status) {aFile.onload(status)});
|
||||
|
||||
but that seems needlessly verbose, and it produces a closure when one
|
||||
is not really needed. Instead, MathJax provides an alternative
|
||||
specification for a callback that allows you to specify both the
|
||||
method and the object it comes from:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Require(aFile.name,["onload",aFile]);
|
||||
|
||||
This requests that the callback should call ``aFile.onload`` as the
|
||||
function, which will maintain the connection between ``aFile`` and its
|
||||
method, thus preserving the correct value for `this` within the method.
|
||||
|
||||
As in the previous cases, you can pass parameters to the method as
|
||||
well by including them in the array that specifies the callback:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Ajax.Require("filename",["method",object,arg1,arg2,...]);
|
||||
|
||||
This approach is useful when you are pushing a callback for one one
|
||||
MathJax's Hub routines into the MathJax processing queue. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
MathJax.Hub.Queue(["Typeset",MathJax.Hub,"MathDiv"]);
|
||||
|
||||
pushes the equivalent of ``MathJax.Hub.Typeset("MathDiv")`` into the
|
||||
processing queue.
|
||||
|
||||
See the :ref:`Callback Object <api-callback>` reference pages for more
|
||||
information about the valid methods of specifying a callback.
|
||||
|
||||
|
||||
Creating a Callback Explicitly
|
||||
==============================
|
||||
|
||||
When you call a method that accpets a callback, you usually pass it a
|
||||
callback specification (like in the examples above), which *describes*
|
||||
a callback (the method will create the actual `Callback` object, and
|
||||
return that to you as its return value). You don't usually create
|
||||
`Callback` objects directly yourself.
|
||||
|
||||
There are times, however, when you may wish to create a callback
|
||||
object for use with functions that don't create callbacks for you.
|
||||
For example, the ``setTimeout()`` function can take a function as its
|
||||
argument, and you may want that function to be a method of an object,
|
||||
and would run into the problem described in the previous section if
|
||||
you simply passed the object's method to ``setTimeout()``. Or you
|
||||
might want to pass an argument to the function called by
|
||||
``setTimeout()``. (Altough the ``setTimeout()`` function can accept
|
||||
additional arguements that are supposed to be passed on to the code
|
||||
when it is called, Internet Explorer does not implement that feature,
|
||||
so you can't rely on it.) You can use a `Callback` object to
|
||||
do this, and the :meth:`MathJax.Callback()` method will create one for
|
||||
you. For example,
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
function myTimer (x) {alert("x = "+x)}
|
||||
setTimeout(MathJax.Callback([f,"Hello World!"]),500);
|
||||
|
||||
would create a callback that calls ``f("Hello World!")``, and
|
||||
schedules it to be called in half a second.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user