From 6094d462513e4a81dca2943a24c330a2afa9923e Mon Sep 17 00:00:00 2001 From: funderburkjim Date: Sun, 30 Jan 2022 18:10:39 -0500 Subject: [PATCH] Correction for csl-apidev version to provide links to [Page...]text; > Ref https://github.com/sanskrit-lexicon/PWG/issues/50 --- basicadjust.php | 3 ++- basicdisplay.php | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/basicadjust.php b/basicadjust.php index 56d358b..0e992b6 100644 --- a/basicadjust.php +++ b/basicadjust.php @@ -53,7 +53,8 @@ public function line_adjust($line) { $line = preg_replace('/¦/',' ',$line); $line = preg_replace_callback('|(.*?)|','BasicAdjust::s_callback',$line); $line = preg_replace_callback('|(.*?)|','BasicAdjust::key2_callback',$line); - $line = preg_replace("|\[Page.*?\]|", "$0",$line); + //$line = preg_replace("|\[Page.*?\]|", "$0",$line); + $line = preg_replace("|\[(Page.*?)\]|", "$1",$line); $line = preg_replace('/Page(.*)<\/pc>/',"\\1",$line); diff --git a/basicdisplay.php b/basicdisplay.php index 1b1edb7..1782e71 100644 --- a/basicdisplay.php +++ b/basicdisplay.php @@ -15,8 +15,8 @@ // constructor is either a string or an array of strings. */ require_once("dbgprint.php"); +require_once("parm.php"); class BasicDisplay { - public $parentEl; public $row; public $row1; @@ -30,10 +30,20 @@ class BasicDisplay { public $sdata; // class to use for Sanskrit public $filterin; // transcoding for output public $key; // the original key being searched for + public $basicOption,$serve; public function __construct($key,$string_or_array,$filterin,$dict) { + $this->key = $key; $this->dict = $dict; $this->filterin = $filterin; + $this->getParms = new Parm(); + $this->basicOption = $this->getParms->basicOption; + if ($this->basicOption) { + $this->serve = "../webtc/servepdf.php"; + } else { + $this->serve = "servepdf.php"; + } + $this->pagecol=""; $this->dbg=false; #false; $this->inSanskrit=false; @@ -652,7 +662,7 @@ public function chrhndl($xp,$data) { } } else if ($this->parentEl == "key1"){ // nothing printed } else if ($this->parentEl == "pb") { - if (in_array($this->dict,array("pwg"))) { + if (true) { // (in_array($this->dict,array("pwg"))) { $hrefdata = $this->getHrefPage($data); $style = "font-size:smaller; font-weight:bold;"; $this->row .= " $hrefdata"; @@ -741,15 +751,16 @@ public function getHrefPage($data) { */ $ans=""; //$lnums = preg_split('/[,-]/',$data); + $serve = $this->serve; $lnums = preg_split('/[,]/',$data); //%{pfx} - $serve = "../webtc/servepdf.php"; foreach($lnums as $lnum) { #list($page,$col) = preg_split('/[-]/',$lnum); $page = $lnum; # this may be dictionary specific. if ($ans == "") { - $args = "page=$page"; + $dict = $this->dict; + $args = "dict=$dict&page=$page"; #$ans = "$lnum"; - $dictup = strtoupper($this->dict); + $dictup = strtoupper($dict); $style = "color:rgb(130,130,130);"; $ans = "$lnum"; }else {