Add plugin_languages_aliases options #343
This commit is contained in:
@@ -48,15 +48,16 @@ For better results, it's advised to add either your surnames and eventually no-r
|
||||
with:
|
||||
# ... other options
|
||||
plugin_languages: yes
|
||||
plugin_languages_ignored: html, css # List of languages to ignore
|
||||
plugin_languages_skipped: my-test-repo # List of repositories to skip
|
||||
plugin_languages_colors: "0:orange, javascript:#ff0000, ..." # Make most used languages orange and JavaScript red
|
||||
plugin_languages_details: bytes-size, percentage # Additionally display total bytes size and percentage
|
||||
plugin_languages_threshold: 2% # Hides all languages less than 2%
|
||||
plugin_languages_limit: 8 # Display up to 8 languages
|
||||
plugin_languages_sections: most-used, recently-used # Display most used and recently used languages stats
|
||||
plugin_languages_indepth: no # Get indepth stats (see documentation before enabling)
|
||||
plugin_languages_recent_load: 500 # Load up to 500 events to compute recently used stats
|
||||
plugin_languages_recent_days: 7 # Limit recently used stats to last week
|
||||
commits_authoring: lowlighter@users.noreply.github.com # Surnames or email addresses used to identify your commits
|
||||
plugin_languages_ignored: html, css # List of languages to ignore
|
||||
plugin_languages_skipped: my-test-repo # List of repositories to skip
|
||||
plugin_languages_colors: "0:orange, javascript:#ff0000, ..." # Make most used languages orange and JavaScript red
|
||||
plugin_languages_aliases: "JavaScript:JS, TypeScript:TS, ..." # Customize languages names with aliases
|
||||
plugin_languages_details: bytes-size, percentage # Additionally display total bytes size and percentage
|
||||
plugin_la nguages_threshold: 2% # Hides all languages less than 2%
|
||||
plugin_languages_limit: 8 # Display up to 8 languages
|
||||
plugin_languages_sections: most-used, recently-used # Display most used and recently used languages stats
|
||||
plugin_languages_indepth: no # Get indepth stats (see documentation before enabling)
|
||||
plugin_languages_recent_load: 500 # Load up to 500 events to compute recently used stats
|
||||
plugin_languages_recent_days: 7 # Limit recently used stats to last week
|
||||
commits_authoring: lowlighter@users.noreply.github.com # Surnames or email addresses used to identify your commits
|
||||
```
|
||||
|
||||
@@ -17,11 +17,13 @@ export default async function({login, data, imports, q, rest, account}, {enabled
|
||||
}
|
||||
|
||||
//Load inputs
|
||||
let {ignored, skipped, colors, details, threshold, limit, indepth, sections, "recent.load":_recent_load, "recent.days":_recent_days} = imports.metadata.plugins.languages.inputs({data, account, q})
|
||||
let {ignored, skipped, colors, aliases, details, threshold, limit, indepth, sections, "recent.load":_recent_load, "recent.days":_recent_days} = imports.metadata.plugins.languages.inputs({data, account, q})
|
||||
threshold = (Number(threshold.replace(/%$/, "")) || 0) / 100
|
||||
skipped.push(...data.shared["repositories.skipped"])
|
||||
if (!limit)
|
||||
limit = Infinity
|
||||
console.log(aliases, aliases.split(",").filter(alias => /^[\s\S]+:[\s\S]+$/.test(alias)).map(alias => alias.trim().split(":")))
|
||||
aliases = Object.fromEntries(aliases.split(",").filter(alias => /^[\s\S]+:[\s\S]+$/.test(alias)).map(alias => alias.trim().split(":")).map(([key, value]) => [key.toLocaleLowerCase(), value]))
|
||||
|
||||
//Custom colors
|
||||
const colorsets = JSON.parse(`${await imports.fs.readFile(`${imports.__module(import.meta.url)}/colorsets.json`)}`)
|
||||
@@ -77,6 +79,13 @@ export default async function({login, data, imports, q, rest, account}, {enabled
|
||||
}
|
||||
}
|
||||
|
||||
console.log(aliases)
|
||||
//Apply aliases
|
||||
for (const section of ["favorites", "recent"])
|
||||
for (const language of languages[section])
|
||||
if (language.name.toLocaleLowerCase() in aliases)
|
||||
language.name = aliases[language.name.toLocaleLowerCase()]
|
||||
|
||||
//Results
|
||||
return languages
|
||||
}
|
||||
|
||||
@@ -61,10 +61,18 @@ inputs:
|
||||
type: array
|
||||
format:
|
||||
- comma-separated
|
||||
- /((?<index>[0-9])|(?<language>[-+a-z0-9#])):(?<color>#?[-a-z0-9]+)/
|
||||
- /((?<index>[0-9])|(?<language>[-+a-z0-9#]+)):(?<color>#?[-a-z0-9]+)/
|
||||
default: github
|
||||
example: javascript:red, 0:blue, 1:#ff00aa
|
||||
|
||||
# Overrides default languages name
|
||||
# Use `${language}:${alias}` to change the name of language (e.g. "javascript:JS" to make JavaScript render as "JS", case of left operand ignored)
|
||||
plugin_languages_aliases:
|
||||
description: Custom languages names
|
||||
type: string
|
||||
default: ""
|
||||
example: javascript:JS typescript:TS
|
||||
|
||||
# Languages additional details
|
||||
plugin_languages_details:
|
||||
description: Additional details
|
||||
|
||||
Reference in New Issue
Block a user