From 050d4311efb31d219dcb3fc007a18d7c6758eaa8 Mon Sep 17 00:00:00 2001 From: funderburkjim Date: Tue, 8 Feb 2022 16:46:58 -0500 Subject: [PATCH] basicadjust: Activate links to HARIV (Calcutta) for PWG,PW,MW. Ref: https://github.com/sanskrit-lexicon/PWG/issues/49 --- basicadjust.php | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/basicadjust.php b/basicadjust.php index 0e992b6..10fab19 100644 --- a/basicadjust.php +++ b/basicadjust.php @@ -64,7 +64,7 @@ public function line_adjust($line) { }else {$this->pagecol = $matches[1];} } /* Replace the 'title' part of a known ls with its capitalized form - This is probably particular to pwg and/or pw + This is probably particular to pwg and/or pw */ if (in_array($this->getParms->dict,array('pw','pwg'))) { $line = preg_replace_callback('|(.*?)|', @@ -321,7 +321,7 @@ public function ls_callback_pwg_href($code,$data) { return $href; } if ($this->dict == 'pwg') { - // This is an reference to 1st edition of Indische Spruche in pwg. + // This is a reference to 1st edition of Indische Spruche in pwg. // Link to boesp as above is not correct. return $href; } @@ -336,7 +336,7 @@ public function ls_callback_pwg_href($code,$data) { } if (preg_match('|^(MBH[.]) *([0-9]+) *, *([0-9]+)[.]?$|',$data,$matches)) { // Mahabharata, Calcutta edition for pwg. - // Note that PW refs to MBH are different, using 3 parameters + // Some PW refs to MBH are different, using 3 parameters (Bombay) $pfx = $matches[1]; $parvan = $matches[2]; $verse = $matches[3]; @@ -344,6 +344,14 @@ public function ls_callback_pwg_href($code,$data) { dbgprint($dbg,"$pfx: href=$href\n"); return $href; } + if (preg_match('|^(HARIV[.]) *([0-9]+)[.]?$|',$data,$matches)) { + // Mahabharata, Calcutta edition for harivamsa + $pfx = $matches[1]; + $verse = $matches[2]; + $href = "https://sanskrit-lexicon-scans.github.io/hariv?$verse"; + dbgprint($dbg,"$pfx: href=$href\n"); + return $href; + } if (!preg_match('|^(.*?)[.] *([0-9]+)[ ,]+([0-9]+)[ ,]+([0-9]+)(.*)$|',$data,$matches)) { return $href; } @@ -462,7 +470,7 @@ public function ls_callback_mw_href($code,$n,$data) { $dbg = false; dbgprint($dbg,"ls_callback_mw_href. code=$code, n='$n', data='$data'\n"); $code_to_pfx = array('RV.' => 'rv', 'AV.' => 'av', 'Pāṇ.' => 'p', - 'MBh.' => 'MBH.'); + 'MBh.' => 'MBH.','Hariv.' => 'hariv'); if (!isset($code_to_pfx[$code])) { dbgprint($dbg,"ls_callback_mw_hrev. Code is unknown:'$code'\n"); return $href; @@ -521,6 +529,14 @@ public function ls_callback_mw_href($code,$n,$data) { dbgprint($dbg,"$pfx: href=$href\n"); return $href; } + if (preg_match('|^(Hariv[.]) *([0-9]+)[.]?$|',$data,$matches)) { + // Mahabharata, Calcutta edition for harivamsa. For MW. + $pfx = $matches[1]; + $verse = $matches[2]; + $href = "https://sanskrit-lexicon-scans.github.io/hariv?$verse"; + dbgprint($dbg,"$pfx: href=$href\n"); + return $href; + } return $href; }