Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beta.ordbok.uib.no
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Språksamlingane
beta.ordbok.uib.no
Commits
90705cc1
Commit
90705cc1
authored
4 years ago
by
Ole Voldsæter
Browse files
Options
Downloads
Patches
Plain Diff
fikser meta#272
parent
a280526e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/DefElement.vue
+2
-1
2 additions, 1 deletion
src/components/DefElement.vue
src/utils/helpers.js
+118
-1
118 additions, 1 deletion
src/utils/helpers.js
with
120 additions
and
2 deletions
src/components/DefElement.vue
+
2
−
1
View file @
90705cc1
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<
script
>
<
script
>
import
entities
from
'
../utils/entities.js
'
import
entities
from
'
../utils/entities.js
'
import
helpers
from
'
../utils/helpers.js
'
export
default
{
export
default
{
name
:
'
DefElement
'
,
name
:
'
DefElement
'
,
...
@@ -53,7 +54,7 @@ export default {
...
@@ -53,7 +54,7 @@ export default {
else
if
(
item
.
type_
==
'
superscript
'
)
return
{
type
:
item
.
type_
,
html
:
item
.
text
,
tag
:
'
sup
'
}
else
if
(
item
.
type_
==
'
superscript
'
)
return
{
type
:
item
.
type_
,
html
:
item
.
text
,
tag
:
'
sup
'
}
else
if
(
item
.
type_
==
'
subscript
'
)
return
{
type
:
item
.
type_
,
html
:
item
.
text
,
'
tag
'
:
'
sub
'
}
else
if
(
item
.
type_
==
'
subscript
'
)
return
{
type
:
item
.
type_
,
html
:
item
.
text
,
'
tag
'
:
'
sub
'
}
else
if
(
item
.
type_
==
'
quote_inset
'
)
return
{
type
:
item
.
type_
,
body
:
item
,
html
:
''
,
tag
:
'
DefElement
'
,
props
:
{
body
:
item
,
tag
:
'
i
'
}}
else
if
(
item
.
type_
==
'
quote_inset
'
)
return
{
type
:
item
.
type_
,
body
:
item
,
html
:
''
,
tag
:
'
DefElement
'
,
props
:
{
body
:
item
,
tag
:
'
i
'
}}
else
if
(
item
.
type_
==
'
fraction
'
)
return
{
type
:
item
.
type_
,
html
:
''
,
num
:
item
.
numerator
,
denom
:
item
.
denominator
}
else
if
(
item
.
type_
==
'
fraction
'
)
return
helpers
.
fraction
(
item
.
numerator
,
item
.
denominator
)
else
if
(
item
.
id
)
return
{
type
:
item
.
type_
,
html
:
(
entities
[
lang
][
item
.
id
]
||
{
}
)[
'
expansion
'
]
||
item
.
id
}
else
if
(
item
.
id
)
return
{
type
:
item
.
type_
,
html
:
(
entities
[
lang
][
item
.
id
]
||
{
}
)[
'
expansion
'
]
||
item
.
id
}
else
return
{
type
:
item
.
type_
||
'
plain
'
,
html
:
item
}
else
return
{
type
:
item
.
type_
||
'
plain
'
,
html
:
item
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/utils/helpers.js
+
118
−
1
View file @
90705cc1
...
@@ -71,4 +71,121 @@ var group_list = function(grps, dictionary) {
...
@@ -71,4 +71,121 @@ var group_list = function(grps, dictionary) {
return
Array
.
from
(
grp_collection
).
join
(
'
-
'
)
return
Array
.
from
(
grp_collection
).
join
(
'
-
'
)
}
}
export
default
{
group_list
}
var
fraction
=
function
(
numerator
,
denominator
)
{
var
superscript
=
{
'
0
'
:
'
⁰
'
,
'
1
'
:
'
¹
'
,
'
2
'
:
'
²
'
,
'
3
'
:
'
³
'
,
'
4
'
:
'
⁴
'
,
'
5
'
:
'
⁵
'
,
'
6
'
:
'
⁶
'
,
'
7
'
:
'
⁷
'
,
'
8
'
:
'
⁸
'
,
'
9
'
:
'
⁹
'
,
'
+
'
:
'
⁺
'
,
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ₒ
'
,
'
p
'
:
'
ₚ
'
,
'
r
'
:
'
ᵣ
'
,
'
s
'
:
'
ₛ
'
,
'
t
'
:
'
ₜ
'
,
'
u
'
:
'
ᵤ
'
,
'
v
'
:
'
ᵥ
'
,
'
x
'
:
'
ₓ
'
,
'
'
:
'
'
};
var
fractions
=
{
'
1/2
'
:
'
½
'
,
'
1/3
'
:
'
⅓
'
,
'
2/3
'
:
'
⅔
'
,
'
1/4
'
:
'
¼
'
,
'
3/4
'
:
'
¾
'
,
'
1/5
'
:
'
⅕
'
,
'
2/5
'
:
'
⅖
'
,
'
3/5
'
:
'
⅗
'
,
'
4/5
'
:
'
⅘
'
,
'
1/6
'
:
'
⅙
'
,
'
5/6
'
:
'
⅚
'
,
'
1/7
'
:
'
⅐
'
,
'
1/8
'
:
'
⅛
'
,
'
3/8
'
:
'
⅜
'
,
'
5/8
'
:
'
⅝
'
,
'
7/8
'
:
'
⅞
'
,
'
1/9
'
:
'
⅑
'
,
'
1/10
'
:
'
⅒
'
};
let
other_fraction
=
null
let
num_sup
=
numerator
.
toString
().
split
(
''
).
map
(
x
=>
superscript
[
x
]
||
'
_
'
).
join
(
''
)
let
den_sub
=
denominator
.
toString
().
split
(
''
).
map
(
x
=>
subscript
[
x
]
||
'
_
'
).
join
(
''
)
if
(
!
num_sup
.
includes
(
'
_
'
)
&&
!
den_sub
.
includes
(
'
_
'
))
{
other_fraction
=
num_sup
+
'
⁄
'
+
den_sub
}
return
fractions
[
numerator
+
'
/
'
+
denominator
]
&&
{
type
:
'
plain
'
,
html
:
fractions
[
numerator
+
'
/
'
+
denominator
]
}
||
other_fraction
&&
{
type
:
'
plain
'
,
html
:
other_fraction
}
||
{
type
:
'
fraction
'
,
html
:
''
,
num
:
numerator
,
denom
:
denominator
}
}
export
default
{
group_list
,
fraction
}
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