Skip to content

Commit

Permalink
pwg, pw, pwkvn, sch, mw: manu link target for BLAM displays
Browse files Browse the repository at this point in the history
  • Loading branch information
funderburkjim committed Sep 9, 2024
1 parent c15a619 commit 2d7b406
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions v02/makotemplates/web/webtc/basicadjust.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ public function ls_callback_mw_href($code,$n,$data) {
'MBh. (ed. Calc.)' => 'MBHC', 'MBh. (ed. Bomb.)' => 'MBHB',
'R.' => 'R', 'R. G.' => 'R', 'R. (G)' => 'R', 'R. (G.)' => 'R', 'R. [G]' => 'R',
'R. ed. Gorresio' => 'R', 'Dhātup.' => 'dp', 'Dhāt.' => 'dp',
'Kathās.' => 'kathas');
'Kathās.' => 'kathas', 'Mn.' => 'M.');
//hrefs for MBHC, MBHB not implemented. MBHC is same as MBH.(?)
if (!isset($code_to_pfx[$code])) {
dbgprint($dbg,"ls_callback_mw_href. Code is unknown:'$code'\n");
Expand Down Expand Up @@ -868,14 +868,38 @@ public function ls_callback_mw_href($code,$n,$data) {
return $href;
}

/******* link to manusmrti ***********/
if (in_array($pfx,array('M.'))) {
// ## two parameters
if(!preg_match("|^$code +([^.,]+), *([0-9]+)|",$data1,$matches)) {
return $href;
}
$adhyaya_raw = $matches[1];
$s = $matches[2];
// normally, in mw adhyaya is in lower-case roman numeral,
// but in a few cases (?), adhyaya is a digit sequence
// The link target requires digit sequence
if (preg_match("|^[0-9]+$|",$adhyaya_raw,$matches_temp)) {
$t = $adhyaya_raw;
} else {
$t = $this->romanToInt($adhyaya_raw);
if ($t == 0) {
// error condition
return $href;
}
}
$href = "https://sanskrit-lexicon-scans.github.io/manu/index.html?$t,$s";
return $href;
}

return $href;
}
public function ls_callback_sch_href($code,$n,$data) {
$href = null; // default if no success
$dbg = false;
dbgprint($dbg,"ls_callback_sch_href. code=$code, n=$n, data=$data\n");
$code_to_pfx = array('ṚV.' => 'rv', 'AV.' => 'av', 'P.' => 'p', 'Hariv.' => 'hariv', 'R. Gorr.' => 'rgorr','R.' => 'rschl', 'Dhātup.' => 'dp', 'Spr.' => 'spr',
'Verz. d. Oxf. H.' => 'verzoxf', 'Kathās.' => 'kathas');
'Verz. d. Oxf. H.' => 'verzoxf', 'Kathās.' => 'kathas', 'M.' => 'M.');
if (!isset($code_to_pfx[$code])) {
return $href;
}
Expand All @@ -885,8 +909,9 @@ public function ls_callback_sch_href($code,$n,$data) {
}else {
$data1 = "$n $data";
}
dbgprint($dbg,"data1=$data1\n");
if (in_array($this->dict,array('sch'))) {
if (preg_match('|^(Spr[.]) ([0-9]+)|',$data,$matches)) {
if (preg_match('|^(Spr[.]) ([0-9]+)|',$data1,$matches)) { // 09-08-2024
// Indische Sprüche in sch is assumed to be volume 2
$code0 = $matches[1];
$verse = $matches[2];
Expand All @@ -897,7 +922,7 @@ public function ls_callback_sch_href($code,$n,$data) {
/******* link to Verz. D. Oxf. H. ***********/
$temparr = array("Verz. d. Oxf. H[.]");
foreach($temparr as $temp) {
if (preg_match("|^($temp) *([0-9]+)|",$data,$matches)) {
if (preg_match("|^($temp) *([0-9]+)|",$data1,$matches)) {
$pfx = $matches[1];
$page = $matches[2];
$href = "https://sanskrit-lexicon-scans.github.io/Oxf_Cat_Aufrecht/index.html?$page";
Expand All @@ -908,7 +933,7 @@ public function ls_callback_sch_href($code,$n,$data) {
/******* link to kathasaritsagara (for sch) ***********/
$temparr = array("Kathās.");
foreach($temparr as $temp) {
if (preg_match("|^($temp) *([0-9]+), *([0-9]+)|",$data,$matches)) {
if (preg_match("|^($temp) *([0-9]+), *([0-9]+)|",$data1,$matches)) {
$t = $matches[2]; // taranga
$s = $matches[3]; // shloka
$href = "https://sanskrit-lexicon-scans.github.io/kss/index.html?$t,$s";
Expand All @@ -917,6 +942,18 @@ public function ls_callback_sch_href($code,$n,$data) {
}
}

/******* link to manava dharmashastra (for sch) ***********/
$temparr = array("M.");
foreach($temparr as $temp) {
if (preg_match("|^($temp) *([0-9]+), *([0-9]+)|",$data1,$matches)) {
$a = $matches[2]; // adhyAya
$s = $matches[3]; // shloka
$href = "https://sanskrit-lexicon-scans.github.io/manu/index.html?$a,$s";
dbgprint($dbg,"$pfx: href=$href\n");
return $href;
}
}

} // end of links for dictionary sch
/******* link to Rgveda, Atharvaveda ***********/
if (in_array($pfx,array('rv','av'))) {
Expand Down

0 comments on commit 2d7b406

Please sign in to comment.