Extension:BibliaVulgata

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
BibliaVulgata

Release status:Extension status unknown

ImplementationTemplate:Extension#type Tag
DescriptionTemplate:Extension#description Links a Bible reference to the text of the latin Vulgata Clementina at Vulsearch
Author(s)Template:Extension#username Marjorie Burghart
Latest versionTemplate:Extension#version 1.0 (2007-02-08)
LicenseTemplate:Extension#license No license specified
Download No link

Translate the BibliaVulgata extension if it is available at translatewiki.net

Check usage and version matrix.

The BibliaVulgata extension is designed to easily insert links to the latin text of the Bible available at Vulsearch (Biblia Vulgata Clementina).

Installation[edit]

Add this line at the end of your LocalSettings.php file:

include('extensions/BibliaVulgata.php');

Create a file extensions/BibliaVulgata.php containing the following code:

<?php
# Biblia Latina Vulgata
# Version: 1.0
#
# Links a Bible reference to the text of the Vulgata Clementina at Vulsearch
# 
# Tag :
#   <bible>ref</bible>
# Example :
#   Job 7:1
#   <bible>Job 7:1</bible>
# 
# The use of the standard Vulsearch abreviations for book names is mandatory in the <bible> tage; 
# a list is available here :
# http://vulsearch.sourceforge.net/abbrev-o.html
# 

$wgExtensionFunctions[] = 'wfBibliaVulgata';
$wgExtensionCredits['parserhook'][] = array(
        'name' => 'Biblia Latina Vulgata',
        'description' => 'Links Bible References to Vulsearch (Vulgata Clementina)',
        'author' => 'Marjorie Burghart',
        'url' => 'http://meta.wikimedia.org/wiki/BibliaVulgata'
);

// Matches an abreviation with the full name of a book ; 
// We do not make use of this name in this extension, but it might be of interest
// in a future version
$bookTitle['Gn'] = 'Genesis';
$bookTitle['Ex'] = 'Exodus';
$bookTitle['Lv'] = 'Leviticus';
$bookTitle['Nm'] = 'Numeri';
$bookTitle['Dt'] = 'Deuteronomium';
$bookTitle['Jos'] = 'Josue';
$bookTitle['Jdc'] = 'Judicum';
$bookTitle['Rt'] = 'Ruth';
$bookTitle['1Rg'] = 'Regum I';
$bookTitle['2Rg'] = 'Regum II';
$bookTitle['3Rg'] = 'Regum III';
$bookTitle['4Rg'] = 'Regum IV';
$bookTitle['1Par'] = 'Paralipomenon I';
$bookTitle['2Par'] = 'Paralipomenon II';
$bookTitle['Esr'] = 'Esdræ';
$bookTitle['Neh'] = 'Nehemiæ';
$bookTitle['Tob'] = 'Tobiæ';
$bookTitle['Jdt'] = 'Judith';
$bookTitle['Est'] = 'Esther';
$bookTitle['Job'] = 'Job';
$bookTitle['Ps'] = 'Psalmi';
$bookTitle['Pr'] = 'Proverbia';
$bookTitle['Ecl'] = 'Ecclesiastes';
$bookTitle['Ct'] = 'Canticum Canticorum';
$bookTitle['Sap'] = 'Sapientia';
$bookTitle['Sir'] = 'Ecclesiasticus';
$bookTitle['Is'] = 'Isaias';
$bookTitle['Jr'] = 'Jeremias';
$bookTitle['Lam'] = 'Lamentationes';
$bookTitle['Bar'] = 'Baruch';
$bookTitle['Ez'] = 'Ezechiel';
$bookTitle['Dn'] = 'Daniel';
$bookTitle['Os'] = 'Osee';
$bookTitle['Joel'] = 'Joel';
$bookTitle['Am'] = 'Amos';
$bookTitle['Abd'] = 'Abdias';
$bookTitle['Jon'] = 'Jonas';
$bookTitle['Mch'] = 'Michæa';
$bookTitle['Nah'] = 'Nahum';
$bookTitle['Hab'] = 'Habacuc';
$bookTitle['Soph'] = 'Sophonias';
$bookTitle['Agg'] = 'Aggæus';
$bookTitle['Zach'] = 'Zacharias';
$bookTitle['Mal'] = 'Malachias';
$bookTitle['1Mcc'] = 'Machabæorum I';
$bookTitle['2Mcc'] = 'Machabæorum II';
$bookTitle['Mt'] = 'Matthæus';
$bookTitle['Mc'] = 'Marcus';
$bookTitle['Lc'] = 'Lucas';
$bookTitle['Jo'] = 'Joannes';
$bookTitle['Act'] = 'Actus Apostolorum';
$bookTitle['Rom'] = 'ad Romanos';
$bookTitle['1Cor'] = 'ad Corinthios I';
$bookTitle['2Cor'] = 'ad Corinthios II';
$bookTitle['Gal'] = 'ad Galatas';
$bookTitle['Eph'] = 'ad Ephesios';
$bookTitle['Phlp'] = 'ad Philippenses';
$bookTitle['Col'] = 'ad Colossenses';
$bookTitle['1Thes'] = 'ad Thessalonicenses I';
$bookTitle['2Thes'] = 'ad Thessalonicenses II';
$bookTitle['1Tim'] = 'ad Timotheum I';
$bookTitle['2Tim'] = 'ad Timotheum II';
$bookTitle['Tit'] = 'ad Titum';
$bookTitle['Phlm'] = 'ad Philemonem';
$bookTitle['Hbr'] = 'ad Hebræos';
$bookTitle['Jac'] = 'Jacobi';
$bookTitle['1Ptr'] = 'Petri I';
$bookTitle['2Ptr'] = 'Petri II';
$bookTitle['1Jo'] = 'Joannis I';
$bookTitle['2Jo'] = 'Joannis II';
$bookTitle['3Jo'] = 'Joannis III';
$bookTitle['Jud'] = 'Judæ';
$bookTitle['Apc'] = 'Apocalypsis';


function wfBibliaVulgata() {
        global $wgParser;
        $wgParser->setHook('bible', 'linkVulsearch');
}




# The callback function for converting the input text to HTML output
function linkVulsearch($input, $args) {                
                                
                                global $bookTitle;
        
        // explode the input to isolate the distinct parts of the reference
        $refa = explode(' ', $input);   
        $book = $refa[0];                       
                                
                                
                                // check if the book is a regular Vulsearch abreviation
                                if (!array_key_exists($book,$bookTitle)) {
                                        $abbr = 0;
                                } else {
                                        $abbr = 1;
                                }       
                                
        $refb = explode(':', $refa[1]);
        if (sizeof($refb) > 0)
                $chapter = $refb[0];
        else 
                $chapter = 1;
                
                                // Vulsearch doesn't support the reference to a span of text, you have to link to the first verse
        $refc = explode('-', $refb[1]);
        $verse = $refc[0];
        
        // if the first word of in the <Bible> element is not a regular Vulsearch abreviation for book names, 
                                // inserts a link to Vulsearch first page
        if ($abbr != 0) {
        $output  = " <sup><a href='http://vulsearch.sourceforge.net/html/".urlencode($book).".html#x".urlencode($chapter)."_".urlencode($verse)."'";        
        // if 'thisframe' is not specified in the XML tag, load it in a new window
        if (!isset($args['thiswindow']))        $output .= " target='_blank'";
        // end of tag        
        $output .= ">".$input."</a></sup>";
        } 
                                else {
        $output = " <sup><a href='http://vulsearch.sourceforge.net/html/' target='_blank'>$input</a></sup>";                            
                                }
        
        return $output;
}
?>

Usage[edit]

Example : ''Militia est vita hominis super terram''<bible>Job 7:1</bible>

Vulsearch will open in a new window by default, but if you would rather it opened in the same window add the flag 'thiswindow'.

Example : ''Militia est vita hominis super terram''<bible thiswindow>Job 7:1</bible>

Please note that BibliaVulgata uses the same syntax as Extension:BibleRef

Credits[edit]

Created by Marjorie Burghart (marjorie dot burghart at ehess dot fr)


See also[edit]