Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-qtype_stack
Commits
5df2b174
Commit
5df2b174
authored
2 years ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Code tidy.
parent
3a0f6e20
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
cli/unicode_data_process.php
+6
-5
6 additions, 5 deletions
cli/unicode_data_process.php
stack/cas/parsingrules/180_char_based_superscripts.filter.php
+3
-5
3 additions, 5 deletions
...k/cas/parsingrules/180_char_based_superscripts.filter.php
with
9 additions
and
10 deletions
cli/unicode_data_process.php
+
6
−
5
View file @
5df2b174
...
...
@@ -27,11 +27,12 @@ define('CLI_SCRIPT', true);
require
(
__DIR__
.
'/../../../../config.php'
);
require_once
(
$CFG
->
libdir
.
'/clilib.php'
);
$greek
=
file_get_contents
(
'https://raw.githubusercontent.com/numbas/unicode-math-normalization/main/final_data/greek.json'
);
$letters
=
file_get_contents
(
'https://raw.githubusercontent.com/numbas/unicode-math-normalization/main/final_data/letters.json'
);
$subscripts
=
file_get_contents
(
'https://raw.githubusercontent.com/numbas/unicode-math-normalization/main/final_data/subscripts.json'
);
$superscripts
=
file_get_contents
(
'https://raw.githubusercontent.com/numbas/unicode-math-normalization/main/final_data/superscripts.json'
);
$symbols
=
file_get_contents
(
'https://raw.githubusercontent.com/numbas/unicode-math-normalization/main/final_data/symbols.json'
);
$baseurl
=
'https://raw.githubusercontent.com/numbas/unicode-math-normalization/main/final_data/'
;
$greek
=
file_get_contents
(
$baseurl
.
'greek.json'
);
$letters
=
file_get_contents
(
$baseurl
.
'letters.json'
);
$subscripts
=
file_get_contents
(
$baseurl
.
'subscripts.json'
);
$superscripts
=
file_get_contents
(
$baseurl
.
'superscripts.json'
);
$symbols
=
file_get_contents
(
$baseurl
.
'symbols.json'
);
if
(
$greek
===
false
||
$letters
===
false
||
$subscripts
===
false
||
$superscripts
===
false
||
$symbols
===
false
)
{
die
(
'Problem fetching the data.'
);
...
...
This diff is collapsed.
Click to expand it.
stack/cas/parsingrules/180_char_based_superscripts.filter.php
+
3
−
5
View file @
5df2b174
...
...
@@ -32,11 +32,9 @@ class stack_ast_filter_180_char_based_superscripts implements stack_cas_astfilte
self
::
$ssmap
=
json_decode
(
file_get_contents
(
__DIR__
.
'/../../maximaparser/unicode/superscript-stack.json'
),
true
);
}
$process
=
function
(
$node
)
use
(
&
$errors
,
&
$answernotes
)
{
if
(
$node
instanceof
MP_Identifier
&&
!
(
isset
(
$node
->
position
[
'invalid'
])
&&
$node
->
position
[
'invalid'
]))
{
// Iterate over the name to detect when we move from
// normal to superscript.
// Iterate over the name to detect when we move from normal to superscript.
$norm
=
true
;
// Split to chars.
$chars
=
preg_split
(
'//u'
,
$node
->
value
,
-
1
,
PREG_SPLIT_NO_EMPTY
);
...
...
@@ -70,7 +68,7 @@ class stack_ast_filter_180_char_based_superscripts implements stack_cas_astfilte
// Now if we have segments we need to deal with them.
if
(
count
(
$segments
)
>
1
)
{
// Parts between which we have insert stars.
// x²x²x²x -> x^2*x^2*x^2*x
//
E.g.
x²x²x²x -> x^2*x^2*x^2*x
.
$parts
=
[];
while
(
count
(
$segments
)
>
1
)
{
$base
=
new
MP_Identifier
(
array_shift
(
$segments
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment