Merge pull request #3 from davorpa/editorconfig-prettier-format
chore: reformat code with EditorConfig + Prettierpull/6/head
commit
ce6be65bb4
|
@ -0,0 +1,50 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
; top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
; define basic and global for any file
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = true
|
||||
curly_bracket_next_line = false
|
||||
spaces_around_operators = true
|
||||
|
||||
; DOS/Windows batch scripts -
|
||||
[*.{bat,cmd}]
|
||||
end_of_line = crlf
|
||||
|
||||
; JavaScript files -
|
||||
[*.{js,ts}]
|
||||
curly_bracket_next_line = true
|
||||
indent_size = 2
|
||||
quote_type = double
|
||||
|
||||
; JSON files (normal and commented version) -
|
||||
[*.{json,jsonc}]
|
||||
indent_size = 2
|
||||
quote_type = double
|
||||
|
||||
; Make - match it own default syntax
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
; Markdown files - preserve trail spaces that means break line
|
||||
[*.{md,markdown}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter
|
||||
[*.{ps1,psd1,psm1}]
|
||||
charset = utf-8-bom
|
||||
end_of_line = crlf
|
||||
|
||||
; YML config files - match it own default syntax
|
||||
[*.{yaml,yml}]
|
||||
indent_size = 2
|
27
index.js
27
index.js
|
@ -7,11 +7,20 @@ const languages = require("./languages");
|
|||
const commandLineArgs = require("command-line-args");
|
||||
|
||||
const optionDefinitions = [
|
||||
{ name: "input", multiple: true, defaultValue: ["./fpb/books", "./fpb/casts", "./fpb/courses", "./fpb/more"] },
|
||||
{
|
||||
name: "input",
|
||||
multiple: true,
|
||||
defaultValue: ["./fpb/books", "./fpb/casts", "./fpb/courses", "./fpb/more"],
|
||||
},
|
||||
{ name: "output", defaultValue: "./parser/fpb.json" },
|
||||
];
|
||||
|
||||
const excludes = ["README.md", "CONTRIBUTING.md", "CODE_OF_CONDUCT.md", "SUMMARY.md"];
|
||||
const excludes = [
|
||||
"README.md",
|
||||
"CONTRIBUTING.md",
|
||||
"CODE_OF_CONDUCT.md",
|
||||
"SUMMARY.md",
|
||||
];
|
||||
|
||||
/**
|
||||
* Parses a list item generated from remark-parse into a readable format.
|
||||
|
@ -51,7 +60,11 @@ function parseListItem(listItem) {
|
|||
entry.author = i.value.slice(3, parenIndex).trim(); // go from " - " until the first "("
|
||||
}
|
||||
}
|
||||
if (i.type === "emphasis" && i.children[0].value.slice(0, 1) === "(" && i.children[0].value.slice(-1) === ")") {
|
||||
if (
|
||||
i.type === "emphasis" &&
|
||||
i.children[0].value.slice(0, 1) === "(" &&
|
||||
i.children[0].value.slice(-1) === ")"
|
||||
) {
|
||||
// access notes found (currently assumes exactly one child, so far this is always the case)
|
||||
entry.accessNotes = i.children[0].value.slice(1, -1);
|
||||
}
|
||||
|
@ -149,7 +162,9 @@ function getLangFromFilename(filename) {
|
|||
function getFilesFromDir(dir) {
|
||||
return fs
|
||||
.readdirSync(dir)
|
||||
.filter((file) => path.extname(file) === ".md" && excludes.indexOf(file) === -1)
|
||||
.filter(
|
||||
(file) => path.extname(file) === ".md" && excludes.indexOf(file) === -1
|
||||
)
|
||||
.map((file) => path.join(dir, file));
|
||||
}
|
||||
|
||||
|
@ -221,7 +236,9 @@ function parseMarkdown(doc) {
|
|||
let lastSection = sections.length - 1;
|
||||
let lastSubSec = sections[lastSection].subsections.length - 1;
|
||||
let contentJson = parseListItem(content);
|
||||
sections[lastSection].subsections[lastSubSec].entries.push(contentJson); // add entry to most recent h4
|
||||
sections[lastSection].subsections[lastSubSec].entries.push(
|
||||
contentJson
|
||||
); // add entry to most recent h4
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
374
languages.js
374
languages.js
|
@ -1,191 +1,191 @@
|
|||
const languages = {
|
||||
'ab': 'Abkhazian',
|
||||
'aa': 'Afar',
|
||||
'af': 'Afrikaans',
|
||||
'ak': 'Akan',
|
||||
'sq': 'Albanian',
|
||||
'am': 'Amharic',
|
||||
'ar': 'Arabic',
|
||||
'an': 'Aragonese',
|
||||
'hy': 'Armenian',
|
||||
'as': 'Assamese',
|
||||
'av': 'Avaric',
|
||||
'ae': 'Avestan',
|
||||
'ay': 'Aymara',
|
||||
'az': 'Azerbaijani',
|
||||
'bm': 'Bambara',
|
||||
'ba': 'Bashkir',
|
||||
'eu': 'Basque',
|
||||
'be': 'Belarusian',
|
||||
'bn': 'Bengali',
|
||||
'bh': 'Bihari languages',
|
||||
'bi': 'Bislama',
|
||||
'bs': 'Bosnian',
|
||||
'br': 'Breton',
|
||||
'bg': 'Bulgarian',
|
||||
'my': 'Burmese',
|
||||
'ca': 'Catalan, Valencian',
|
||||
'km': 'Central Khmer',
|
||||
'ch': 'Chamorro',
|
||||
'ce': 'Chechen',
|
||||
'ny': 'Chichewa, Chewa, Nyanja',
|
||||
'zh': 'Chinese',
|
||||
'cu': 'Church Slavonic, Old Bulgarian, Old Church Slavonic',
|
||||
'cv': 'Chuvash',
|
||||
'kw': 'Cornish',
|
||||
'co': 'Corsican',
|
||||
'cr': 'Cree',
|
||||
'hr': 'Croatian',
|
||||
'cs': 'Czech',
|
||||
'da': 'Danish',
|
||||
'dv': 'Divehi, Dhivehi, Maldivian',
|
||||
'nl': 'Dutch, Flemish',
|
||||
'dz': 'Dzongkha',
|
||||
'en': 'English',
|
||||
'en-US': 'English',
|
||||
'eo': 'Esperanto',
|
||||
'et': 'Estonian',
|
||||
'ee': 'Ewe',
|
||||
'fo': 'Faroese',
|
||||
'fj': 'Fijian',
|
||||
'fi': 'Finnish',
|
||||
'fr': 'French',
|
||||
'ff': 'Fulah',
|
||||
'gd': 'Gaelic, Scottish Gaelic',
|
||||
'gl': 'Galician',
|
||||
'lg': 'Ganda',
|
||||
'ka': 'Georgian',
|
||||
'de': 'German',
|
||||
'ki': 'Gikuyu, Kikuyu',
|
||||
'el': 'Greek (Modern)',
|
||||
'kl': 'Greenlandic, Kalaallisut',
|
||||
'gn': 'Guarani',
|
||||
'gu': 'Gujarati',
|
||||
'ht': 'Haitian, Haitian Creole',
|
||||
'ha': 'Hausa',
|
||||
'he': 'Hebrew',
|
||||
'hz': 'Herero',
|
||||
'hi': 'Hindi',
|
||||
'ho': 'Hiri Motu',
|
||||
'hu': 'Hungarian',
|
||||
'is': 'Icelandic',
|
||||
'io': 'Ido',
|
||||
'ig': 'Igbo',
|
||||
'id': 'Indonesian',
|
||||
'ia': 'Interlingua (International Auxiliary Language Association)',
|
||||
'ie': 'Interlingue',
|
||||
'iu': 'Inuktitut',
|
||||
'ik': 'Inupiaq',
|
||||
'ga': 'Irish',
|
||||
'it': 'Italian',
|
||||
'ja': 'Japanese',
|
||||
'jv': 'Javanese',
|
||||
'kn': 'Kannada',
|
||||
'kr': 'Kanuri',
|
||||
'ks': 'Kashmiri',
|
||||
'kk': 'Kazakh',
|
||||
'rw': 'Kinyarwanda',
|
||||
'kv': 'Komi',
|
||||
'kg': 'Kongo',
|
||||
'ko': 'Korean',
|
||||
'kj': 'Kwanyama, Kuanyama',
|
||||
'ku': 'Kurdish',
|
||||
'ky': 'Kyrgyz',
|
||||
'lo': 'Lao',
|
||||
'la': 'Latin',
|
||||
'lv': 'Latvian',
|
||||
'lb': 'Letzeburgesch, Luxembourgish',
|
||||
'li': 'Limburgish, Limburgan, Limburger',
|
||||
'ln': 'Lingala',
|
||||
'lt': 'Lithuanian',
|
||||
'lu': 'Luba-Katanga',
|
||||
'mk': 'Macedonian',
|
||||
'mg': 'Malagasy',
|
||||
'ms': 'Malay',
|
||||
'ml': 'Malayalam',
|
||||
'mt': 'Maltese',
|
||||
'gv': 'Manx',
|
||||
'mi': 'Maori',
|
||||
'mr': 'Marathi',
|
||||
'mh': 'Marshallese',
|
||||
'ro': 'Moldovan, Moldavian, Romanian',
|
||||
'mn': 'Mongolian',
|
||||
'na': 'Nauru',
|
||||
'nv': 'Navajo, Navaho',
|
||||
'nd': 'Northern Ndebele',
|
||||
'ng': 'Ndonga',
|
||||
'ne': 'Nepali',
|
||||
'se': 'Northern Sami',
|
||||
'no': 'Norwegian',
|
||||
'nb': 'Norwegian Bokmål',
|
||||
'nn': 'Norwegian Nynorsk',
|
||||
'ii': 'Nuosu, Sichuan Yi',
|
||||
'oc': 'Occitan (post 1500)',
|
||||
'oj': 'Ojibwa',
|
||||
'or': 'Oriya',
|
||||
'om': 'Oromo',
|
||||
'os': 'Ossetian, Ossetic',
|
||||
'pi': 'Pali',
|
||||
'pa': 'Panjabi, Punjabi',
|
||||
'ps': 'Pashto, Pushto',
|
||||
'fa': 'Persian',
|
||||
'fa-IR': 'Persian (Iran)',
|
||||
'pl': 'Polish',
|
||||
'pt-BR': 'Portuguese (Brazil)',
|
||||
'pt-PT': 'Portuguese (Portugal)',
|
||||
'qu': 'Quechua',
|
||||
'rm': 'Romansh',
|
||||
'rn': 'Rundi',
|
||||
'ru': 'Russian',
|
||||
'sm': 'Samoan',
|
||||
'sg': 'Sango',
|
||||
'sa': 'Sanskrit',
|
||||
'sc': 'Sardinian',
|
||||
'sr': 'Serbian',
|
||||
'sn': 'Shona',
|
||||
'sd': 'Sindhi',
|
||||
'si': 'Sinhala, Sinhalese',
|
||||
'sk': 'Slovak',
|
||||
'sl': 'Slovenian',
|
||||
'so': 'Somali',
|
||||
'st': 'Sotho, Southern',
|
||||
'nr': 'South Ndebele',
|
||||
'es': 'Spanish, Castilian',
|
||||
'su': 'Sundanese',
|
||||
'sw': 'Swahili',
|
||||
'ss': 'Swati',
|
||||
'sv': 'Swedish',
|
||||
'tl': 'Tagalog',
|
||||
'ty': 'Tahitian',
|
||||
'tg': 'Tajik',
|
||||
'ta': 'Tamil',
|
||||
'tt': 'Tatar',
|
||||
'te': 'Telugu',
|
||||
'th': 'Thai',
|
||||
'bo': 'Tibetan',
|
||||
'ti': 'Tigrinya',
|
||||
'to': 'Tonga (Tonga Islands)',
|
||||
'ts': 'Tsonga',
|
||||
'tn': 'Tswana',
|
||||
'tr': 'Turkish',
|
||||
'tk': 'Turkmen',
|
||||
'tw': 'Twi',
|
||||
'ug': 'Uighur, Uyghur',
|
||||
'uk': 'Ukrainian',
|
||||
'ur': 'Urdu',
|
||||
'uz': 'Uzbek',
|
||||
've': 'Venda',
|
||||
'vi': 'Vietnamese',
|
||||
'vo': 'Volap_k',
|
||||
'wa': 'Walloon',
|
||||
'cy': 'Welsh',
|
||||
'fy': 'Western Frisian',
|
||||
'wo': 'Wolof',
|
||||
'xh': 'Xhosa',
|
||||
'yi': 'Yiddish',
|
||||
'yo': 'Yoruba',
|
||||
'za': 'Zhuang, Chuang',
|
||||
'zu': 'Zulu',
|
||||
ab: "Abkhazian",
|
||||
aa: "Afar",
|
||||
af: "Afrikaans",
|
||||
ak: "Akan",
|
||||
sq: "Albanian",
|
||||
am: "Amharic",
|
||||
ar: "Arabic",
|
||||
an: "Aragonese",
|
||||
hy: "Armenian",
|
||||
as: "Assamese",
|
||||
av: "Avaric",
|
||||
ae: "Avestan",
|
||||
ay: "Aymara",
|
||||
az: "Azerbaijani",
|
||||
bm: "Bambara",
|
||||
ba: "Bashkir",
|
||||
eu: "Basque",
|
||||
be: "Belarusian",
|
||||
bn: "Bengali",
|
||||
bh: "Bihari languages",
|
||||
bi: "Bislama",
|
||||
bs: "Bosnian",
|
||||
br: "Breton",
|
||||
bg: "Bulgarian",
|
||||
my: "Burmese",
|
||||
ca: "Catalan, Valencian",
|
||||
km: "Central Khmer",
|
||||
ch: "Chamorro",
|
||||
ce: "Chechen",
|
||||
ny: "Chichewa, Chewa, Nyanja",
|
||||
zh: "Chinese",
|
||||
cu: "Church Slavonic, Old Bulgarian, Old Church Slavonic",
|
||||
cv: "Chuvash",
|
||||
kw: "Cornish",
|
||||
co: "Corsican",
|
||||
cr: "Cree",
|
||||
hr: "Croatian",
|
||||
cs: "Czech",
|
||||
da: "Danish",
|
||||
dv: "Divehi, Dhivehi, Maldivian",
|
||||
nl: "Dutch, Flemish",
|
||||
dz: "Dzongkha",
|
||||
en: "English",
|
||||
"en-US": "English",
|
||||
eo: "Esperanto",
|
||||
et: "Estonian",
|
||||
ee: "Ewe",
|
||||
fo: "Faroese",
|
||||
fj: "Fijian",
|
||||
fi: "Finnish",
|
||||
fr: "French",
|
||||
ff: "Fulah",
|
||||
gd: "Gaelic, Scottish Gaelic",
|
||||
gl: "Galician",
|
||||
lg: "Ganda",
|
||||
ka: "Georgian",
|
||||
de: "German",
|
||||
ki: "Gikuyu, Kikuyu",
|
||||
el: "Greek (Modern)",
|
||||
kl: "Greenlandic, Kalaallisut",
|
||||
gn: "Guarani",
|
||||
gu: "Gujarati",
|
||||
ht: "Haitian, Haitian Creole",
|
||||
ha: "Hausa",
|
||||
he: "Hebrew",
|
||||
hz: "Herero",
|
||||
hi: "Hindi",
|
||||
ho: "Hiri Motu",
|
||||
hu: "Hungarian",
|
||||
is: "Icelandic",
|
||||
io: "Ido",
|
||||
ig: "Igbo",
|
||||
id: "Indonesian",
|
||||
ia: "Interlingua (International Auxiliary Language Association)",
|
||||
ie: "Interlingue",
|
||||
iu: "Inuktitut",
|
||||
ik: "Inupiaq",
|
||||
ga: "Irish",
|
||||
it: "Italian",
|
||||
ja: "Japanese",
|
||||
jv: "Javanese",
|
||||
kn: "Kannada",
|
||||
kr: "Kanuri",
|
||||
ks: "Kashmiri",
|
||||
kk: "Kazakh",
|
||||
rw: "Kinyarwanda",
|
||||
kv: "Komi",
|
||||
kg: "Kongo",
|
||||
ko: "Korean",
|
||||
kj: "Kwanyama, Kuanyama",
|
||||
ku: "Kurdish",
|
||||
ky: "Kyrgyz",
|
||||
lo: "Lao",
|
||||
la: "Latin",
|
||||
lv: "Latvian",
|
||||
lb: "Letzeburgesch, Luxembourgish",
|
||||
li: "Limburgish, Limburgan, Limburger",
|
||||
ln: "Lingala",
|
||||
lt: "Lithuanian",
|
||||
lu: "Luba-Katanga",
|
||||
mk: "Macedonian",
|
||||
mg: "Malagasy",
|
||||
ms: "Malay",
|
||||
ml: "Malayalam",
|
||||
mt: "Maltese",
|
||||
gv: "Manx",
|
||||
mi: "Maori",
|
||||
mr: "Marathi",
|
||||
mh: "Marshallese",
|
||||
ro: "Moldovan, Moldavian, Romanian",
|
||||
mn: "Mongolian",
|
||||
na: "Nauru",
|
||||
nv: "Navajo, Navaho",
|
||||
nd: "Northern Ndebele",
|
||||
ng: "Ndonga",
|
||||
ne: "Nepali",
|
||||
se: "Northern Sami",
|
||||
no: "Norwegian",
|
||||
nb: "Norwegian Bokmål",
|
||||
nn: "Norwegian Nynorsk",
|
||||
ii: "Nuosu, Sichuan Yi",
|
||||
oc: "Occitan (post 1500)",
|
||||
oj: "Ojibwa",
|
||||
or: "Oriya",
|
||||
om: "Oromo",
|
||||
os: "Ossetian, Ossetic",
|
||||
pi: "Pali",
|
||||
pa: "Panjabi, Punjabi",
|
||||
ps: "Pashto, Pushto",
|
||||
fa: "Persian",
|
||||
"fa-IR": "Persian (Iran)",
|
||||
pl: "Polish",
|
||||
"pt-BR": "Portuguese (Brazil)",
|
||||
"pt-PT": "Portuguese (Portugal)",
|
||||
qu: "Quechua",
|
||||
rm: "Romansh",
|
||||
rn: "Rundi",
|
||||
ru: "Russian",
|
||||
sm: "Samoan",
|
||||
sg: "Sango",
|
||||
sa: "Sanskrit",
|
||||
sc: "Sardinian",
|
||||
sr: "Serbian",
|
||||
sn: "Shona",
|
||||
sd: "Sindhi",
|
||||
si: "Sinhala, Sinhalese",
|
||||
sk: "Slovak",
|
||||
sl: "Slovenian",
|
||||
so: "Somali",
|
||||
st: "Sotho, Southern",
|
||||
nr: "South Ndebele",
|
||||
es: "Spanish, Castilian",
|
||||
su: "Sundanese",
|
||||
sw: "Swahili",
|
||||
ss: "Swati",
|
||||
sv: "Swedish",
|
||||
tl: "Tagalog",
|
||||
ty: "Tahitian",
|
||||
tg: "Tajik",
|
||||
ta: "Tamil",
|
||||
tt: "Tatar",
|
||||
te: "Telugu",
|
||||
th: "Thai",
|
||||
bo: "Tibetan",
|
||||
ti: "Tigrinya",
|
||||
to: "Tonga (Tonga Islands)",
|
||||
ts: "Tsonga",
|
||||
tn: "Tswana",
|
||||
tr: "Turkish",
|
||||
tk: "Turkmen",
|
||||
tw: "Twi",
|
||||
ug: "Uighur, Uyghur",
|
||||
uk: "Ukrainian",
|
||||
ur: "Urdu",
|
||||
uz: "Uzbek",
|
||||
ve: "Venda",
|
||||
vi: "Vietnamese",
|
||||
vo: "Volap_k",
|
||||
wa: "Walloon",
|
||||
cy: "Welsh",
|
||||
fy: "Western Frisian",
|
||||
wo: "Wolof",
|
||||
xh: "Xhosa",
|
||||
yi: "Yiddish",
|
||||
yo: "Yoruba",
|
||||
za: "Zhuang, Chuang",
|
||||
zu: "Zulu",
|
||||
};
|
||||
|
||||
module.exports = languages;
|
Loading…
Reference in New Issue