This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
2022-02-13 06:20:14 -08:00
|
|
|
<template>
|
|
|
|
<span>
|
2022-02-13 14:29:56 -08:00
|
|
|
<template v-for="(meaning, abbr) in abbrs"><abbr v-if="meaning" :title="meaning">{{abbr}}</abbr><span v-else>{{abbr}}</span> </template><slot v-bind:abbrs="abbrs" v-bind:word="word"></slot>
|
2022-02-13 06:20:14 -08:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { abbreviations } from '../src/data';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
v: {required: true},
|
|
|
|
},
|
|
|
|
data() {
|
2022-02-13 14:29:56 -08:00
|
|
|
const abbrs = {};
|
|
|
|
let word = this.v.trim();
|
|
|
|
let m = null;
|
|
|
|
while ((m = word.match(/^(\w+\.?) /)) !== null) {
|
|
|
|
const abbr = m[1];
|
|
|
|
abbrs[abbr] = abbreviations[abbr] || null;
|
|
|
|
word = word.substring(abbr.length + 1).trim();
|
2022-02-13 06:20:14 -08:00
|
|
|
}
|
2022-02-13 14:29:56 -08:00
|
|
|
|
|
|
|
return { abbrs, word };
|
2022-02-13 06:20:14 -08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
@import "assets/variables";
|
|
|
|
|
|
|
|
abbr {
|
|
|
|
text-decoration-color: $text-muted;
|
|
|
|
}
|
|
|
|
</style>
|