בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,540
רעדאגירונגען
אין תקציר עריכה |
אין תקציר עריכה |
||
| שורה 1: | שורה 1: | ||
// Function to convert Tanakh citations to Sefaria links | |||
function convertTanakhCitations(wikitext) { | |||
$ | // Regular expression to match the {{תנ"ך|Sefer|Chapter|Verse}} pattern | ||
const regex = /{{תנ"ך\|([^|]+)\|([^|]+)\|([^|]+)}}/g; | |||
return wikitext.replace(regex, function(match, sefer, chapter, verse) { | |||
// Construct the Sefaria URL | |||
const url = `https://www.sefaria.org/${sefer}.${chapter}.${verse}`; | |||
// Return the HTML link with Sefaria's logo | |||
return `<a href="${url}" target="_blank"><img src="https://www.sefaria.org/static/img/sefaria_logo.png" alt="Sefaria" style="vertical-align: middle; width: 20px; height: 20px;"/> ${sefer} ${chapter}:${verse}</a>`; | |||
}); | |||
} | |||
// Example usage | |||
const wikitext = 'Some text {{תנ"ך|Bamidbar|3|4}} more text.'; | |||
const convertedText = convertTanakhCitations(wikitext); | |||
console.log(convertedText); | |||
רעדאגירונגען