-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e58ae54
Showing
20 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
hashes.json | ||
_build/ | ||
_releases/ | ||
_data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Inforge\BbMath\BbCode; | ||
|
||
class Math | ||
{ | ||
private static function loadMathjax(\XF\BbCode\Renderer\AbstractRenderer $renderer) | ||
{ | ||
$renderer->getTemplater()->includeJs([ | ||
'src' => 'inforge/bbmath/mathjax-loader.js', | ||
'addon' => 'Inforge/BbMath', | ||
'min' => true, | ||
]); | ||
} | ||
|
||
public static function renderMathTag($tagChildren, $tagOption, $tag, | ||
array $options, \XF\BbCode\Renderer\AbstractRenderer $renderer) | ||
{ | ||
self::loadMathjax($renderer); | ||
return '$$\[' . $tagChildren[0] . '$$\]'; | ||
} | ||
|
||
public static function renderInlineMathTag($tagChildren, $tagOption, $tag, | ||
array $options, \XF\BbCode\Renderer\AbstractRenderer $renderer) | ||
{ | ||
self::loadMathjax($renderer); | ||
return '$$\(' . $tagChildren[0] . '$$\)'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Contributing to BbMath | ||
|
||
## First setup | ||
|
||
1. You need [XenForo 2.x](https://xenforo.com/). You can setup a Scotch Box | ||
environment as described in the [Xenforo 2.x Development | ||
Documentation](https://xenforo.com/xf2-docs/dev/scotchbox/) | ||
2. Fork TwitchPiper | ||
3. Move in the `src/addon/` folder of your development enviroment and `mkdir Inforge && cd Inforge` | ||
4. `git clone https://github.com/<your-username>/BbMath && cd BbMath` | ||
5. `git remote add upstream https://github.com/InforgeNet/BbMath` | ||
|
||
## Pull request | ||
|
||
Each time you want to submit a pull request, do the following: | ||
|
||
1. Download latest upstream modifications: `git fetch upstream` | ||
2. Ceate a new branch: `git checkout -b whatever-you-want-feature upstream/master` | ||
3. Make you changes, add them and commit | ||
4. `git push -u origin whatever-you-want-feature` | ||
5. Visit `https://github.com/<your-username>/BbMath` and create a new pull request | ||
|
||
### Commit message | ||
|
||
Follow these guidelines to write a proper commit message: [How to Write a Git | ||
Commit Message](https://chris.beams.io/posts/git-commit/). | ||
|
||
### Code style | ||
|
||
General guidelines: | ||
|
||
* Indent code with a **single tab** | ||
* Avoid brackets when they are not necessary | ||
* Try to keep lines under 80 columns, assuming a tab width equal to 8 spaces | ||
(yes!) | ||
* Follow the [XenForo 2.x](https://xenforo.com/xf2-docs/dev/) code style | ||
conventions | ||
* In general, I like the [Linux Kernel Coding | ||
Style](https://www.kernel.org/doc/html/latest/process/coding-style.html) and | ||
try to adapt it to PHP, JS and every other C-like language | ||
* Check out the code already in the repository and try to follow the same style | ||
* Use common sense |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Niccolò Scatena (Inforge) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# BbMath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
window.MathJax = { | ||
loader: { | ||
load: ['ui/safe'] | ||
}, | ||
options: { | ||
enableMenu: false | ||
}, | ||
tex: { | ||
inlineMath: [['$$\\(', '$$\\)']], | ||
displayMath: [['$$\\[', '$$\\]']], | ||
processEscapes: false, | ||
processRefs: true, | ||
processEnvironments: false, | ||
tags: 'ams' | ||
}, | ||
svg: { | ||
fontCache: 'global' | ||
} | ||
}; | ||
|
||
(function() { | ||
var script = document.createElement('script'); | ||
script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js'; | ||
script.async = true; | ||
document.head.appendChild(script); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"imath.json": { | ||
"hash": "2608cc85133fd555483293fb02c28a5a" | ||
}, | ||
"math.json": { | ||
"hash": "0e73d0c917ba4a663b3fb8481e3e5287" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"bb_code_mode": "callback", | ||
"has_option": "no", | ||
"replace_html": "", | ||
"replace_html_email": "", | ||
"replace_text": "", | ||
"callback_class": "Inforge\\BbMath\\BbCode\\Math", | ||
"callback_method": "renderInlineMathTag", | ||
"option_regex": "", | ||
"trim_lines_after": 1, | ||
"plain_children": true, | ||
"disable_smilies": false, | ||
"disable_nl2br": false, | ||
"disable_autolink": true, | ||
"allow_empty": false, | ||
"allow_signature": false, | ||
"editor_icon_type": "fa", | ||
"editor_icon_value": "fas fa-function", | ||
"active": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"bb_code_mode": "callback", | ||
"has_option": "no", | ||
"replace_html": "", | ||
"replace_html_email": "", | ||
"replace_text": "", | ||
"callback_class": "Inforge\\BbMath\\BbCode\\Math", | ||
"callback_method": "renderMathTag", | ||
"option_regex": "", | ||
"trim_lines_after": 1, | ||
"plain_children": true, | ||
"disable_smilies": false, | ||
"disable_nl2br": false, | ||
"disable_autolink": true, | ||
"allow_empty": false, | ||
"allow_signature": false, | ||
"editor_icon_type": "fa", | ||
"editor_icon_value": "fas fa-sigma", | ||
"active": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"custom_bb_code_desc.imath.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "25e1a125b615656d98e1e9a0d86aed23" | ||
}, | ||
"custom_bb_code_desc.math.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "a57476785e78e7548ee37d0dac689b89" | ||
}, | ||
"custom_bb_code_example.imath.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "8c7879343f05c33e441c866208774770" | ||
}, | ||
"custom_bb_code_example.math.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "29cdf8f73f4470841a427c6c1567d148" | ||
}, | ||
"custom_bb_code_output.imath.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "d41d8cd98f00b204e9800998ecf8427e" | ||
}, | ||
"custom_bb_code_output.math.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "d41d8cd98f00b204e9800998ecf8427e" | ||
}, | ||
"custom_bb_code_title.imath.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "f6b210b4351f3ce4b04695f8b3b122ce" | ||
}, | ||
"custom_bb_code_title.math.txt": { | ||
"global_cache": false, | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"hash": "aa8a105043d90127c760e67170853c2c" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Shows an inline LaTeX formula. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Shows a LaTeX equation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
some text [IMATH]\left(\frac{1}{\sqrt{x}}\right)[/IMATH] some text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[MATH] | ||
\begin{cases} | ||
x'(t) = \sin x(t), & t\in\mathbb{R}\\ | ||
x(0)=x_0 | ||
\end{cases} | ||
[/MATH] |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Inline Math |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Equation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"legacy_addon_id": "", | ||
"title": "[Inforge] BbMath", | ||
"description": "Add BBCode to support equations and inline math.", | ||
"version_id": 1000070, | ||
"version_string": "1.0.0", | ||
"dev": "Inforge", | ||
"dev_url": "https://www.inforge.net", | ||
"faq_url": "https://github.com/InforgeNet/BbMath/wiki/Frequently-Asked-Questions", | ||
"support_url": "https://github.com/InforgeNet/BbMath/issues", | ||
"extra_urls": { | ||
"Forum": "https://www.inforge.net/forum", | ||
"GitHub": "https://github.com/InforgeNet/BbMath" | ||
}, | ||
"require": { | ||
"XF": [ | ||
2020010, | ||
"XenForo 2.2.0+" | ||
] | ||
}, | ||
"icon": "far fa-function" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"additional_files": [ | ||
"js/inforge/bbmath" | ||
], | ||
"minify": [ | ||
"js/inforge/bbmath/mathjax-loader.js" | ||
] | ||
} |