Action

Bible Plan

Posted by mark_boerger, Last update about 23 hours ago

This will generate a Bible reading plan. One chapter in Old Testament. One chapter in Psalms. One chapter in the Gospels. One chapter in the rest of the New Testament starting in Acts.

Steps

  • script

    // See online documentation for examples
    // https://docs.getdrafts.com/docs/actions/scripting
    
    // Drafts Action - Generate Bible Reading Plan
    
    function generateReadingPlan() {
        let bibleStructure = {
            "Old Testament": [
                {"Genesis": 50}, {"Exodus": 40}, {"Leviticus": 27}, {"Numbers": 36}, {"Deuteronomy": 34},
                {"Joshua": 24}, {"Judges": 21}, {"Ruth": 4}, {"1 Samuel": 31}, {"2 Samuel": 24},
                {"1 Kings": 22}, {"2 Kings": 25}, {"1 Chronicles": 29}, {"2 Chronicles": 36},
                {"Ezra": 10}, {"Nehemiah": 13}, {"Esther": 10}, {"Job": 42}, {"Proverbs": 31},
                {"Ecclesiastes": 12}, {"Song of Solomon": 8}, {"Isaiah": 66}, {"Jeremiah": 52},
                {"Lamentations": 5}, {"Ezekiel": 48}, {"Daniel": 12}, {"Hosea": 14}, {"Joel": 3},
                {"Amos": 9}, {"Obadiah": 1}, {"Jonah": 4}, {"Micah": 7}, {"Nahum": 3}, {"Habakkuk": 3},
                {"Zephaniah": 3}, {"Haggai": 2}, {"Zechariah": 14}, {"Malachi": 4}
            ],
            "Psalms": [{"Psalms": 150}],
            "Gospels": [{"Matthew": 28}, {"Mark": 16}, {"Luke": 24}, {"John": 21}],
            "New Testament": [
                {"Acts": 28}, {"Romans": 16}, {"1 Corinthians": 16}, {"2 Corinthians": 13},
                {"Galatians": 6}, {"Ephesians": 6}, {"Philippians": 4}, {"Colossians": 4},
                {"1 Thessalonians": 5}, {"2 Thessalonians": 3}, {"1 Timothy": 6}, {"2 Timothy": 4},
                {"Titus": 3}, {"Philemon": 1}, {"Hebrews": 13}, {"James": 5}, {"1 Peter": 5},
                {"2 Peter": 3}, {"1 John": 5}, {"2 John": 1}, {"3 John": 1}, {"Jude": 1}, {"Revelation": 22}
            ]
        };
        
        function getChapters(list) {
            let chapters = [];
            for (let book of list) {
                let bookName = Object.keys(book)[0];
                for (let i = 1; i <= book[bookName]; i++) {
                    chapters.push(`${bookName} ${i}`);
                }
            }
            return chapters;
        }
        
        let oldTestament = getChapters(bibleStructure["Old Testament"]);
        let psalms = getChapters(bibleStructure["Psalms"]);
        let gospels = getChapters(bibleStructure["Gospels"]);
        let newTestament = getChapters(bibleStructure["New Testament"]);
        
        let maxDays = Math.max(oldTestament.length, psalms.length, gospels.length, newTestament.length);
        
        let output = "# Bible Reading Plan\n\n";
        for (let day = 0; day < 365; day++) {
            output += `Day ${day + 1}: `;
            output += oldTestament[day % oldTestament.length] + ", ";
            output += psalms[day % psalms.length] + ", ";
            output += gospels[day % gospels.length] + ", ";
            output += newTestament[day % newTestament.length] + "\n";
        }
        
        draft.content = output;
        draft.update();
    }
    
    generateReadingPlan();
    

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.