-
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.
Move notation plugin to separate file and use it in Analyze.vue (#38)
- Loading branch information
1 parent
5a9d7f1
commit 174924c
Showing
3 changed files
with
30 additions
and
25 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
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
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,25 @@ | ||
import jskos from "jskos-tools" | ||
|
||
export default (notation, { item }) => { | ||
let fill = "" | ||
// For DDC and SDNB only: fill number notation with trailing zeros | ||
if (jskos.compare({ | ||
uri: "http://dewey.info/scheme/edition/e23/", | ||
identifier: [ | ||
"http://bartoc.org/en/node/241", | ||
"http://bartoc.org/en/node/18497", | ||
"http://www.wikidata.org/entity/Q67011877", | ||
"http://id.loc.gov/vocabulary/classSchemes/sdnb", | ||
"http://uri.gbv.de/terminology/sdnb", | ||
], | ||
}, item.inScheme && item.inScheme[0]) && !isNaN(parseInt(notation))) { | ||
while (notation.length + fill.length < 3) { | ||
fill += "0" | ||
} | ||
} | ||
if (fill.length) { | ||
// Using the shared `jskos-vue-text-lightGrey` CSS class | ||
notation += `<span class='jskos-vue-text-lightGrey'>${fill}</span>` | ||
} | ||
return notation | ||
} |