mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 12:47:48 +00:00
fix: ignore case when inferring file extension from codeSample lang prop (#991)
This commit is contained in:
@@ -122,6 +122,20 @@ export function escapeLanguageName(lang: string) {
|
||||
return lang.replace(/#/g, '_sharp').replace(/\//, '_').replace(/\s/g, '');
|
||||
}
|
||||
|
||||
export function langToExt(lang: string) {
|
||||
const langObj: any = {
|
||||
php: '.php',
|
||||
'c#': '.cs',
|
||||
shell: '.sh',
|
||||
curl: '.sh',
|
||||
bash: '.sh',
|
||||
javascript: '.js',
|
||||
js: '.js',
|
||||
python: '.py',
|
||||
};
|
||||
return langObj[lang.toLowerCase()];
|
||||
}
|
||||
|
||||
export class CircularJSONNotSupportedError extends Error {
|
||||
constructor(public originalError: Error) {
|
||||
super(originalError.message);
|
||||
|
||||
Reference in New Issue
Block a user