Skip to content

Commit

Permalink
md homonym display adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
funderburkjim committed Feb 17, 2023
1 parent 79ea326 commit 32771e7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion basicadjust.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function line_adjust($line) {
// 2018-07-07 Handle lex tag.
$line = preg_replace_callback('|<lex(.*?)>(.*?)</lex>|',"BasicAdjust::add_lex_markup",$line);

if ($this->getParms->dict == "mw") {
if (in_array($this->getParms->dict, array("mw","md"))) {
$line = $this->move_L_mw($line);
# remove <hom>X</hom> within head portion
$line = preg_replace("|<key2>(.*?)<hom>.*?</hom>(.*?<body>)|","<key2>$1$2",$line);
Expand Down
2 changes: 1 addition & 1 deletion basicdisplay.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ public function chrhndl($xp,$data) {
$this->row .= "<span class='$sdata'><SA>$data</SA></span>";
} else if ($this->parentEl == "hom") {
/* for some dictionaries, show hom elements*/
if (in_array($this->dict,array('mw','pwkvn'))) {
if (in_array($this->dict,array('mw','pwkvn','md'))) {
$this->row .= "<span class='hom' title='Homonym'>$data</span>";
}
} else if ($this->parentEl == 'div') {
Expand Down
6 changes: 5 additions & 1 deletion listhierClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function __construct() {
while($i < count($listmatches)) {
list($code,$key2,$lnum2,$data2) = $listmatches[$i];
$hom2=$this->get_hom($data2);
//dbgprint(true,"listhierClass: lnum2=$lnum2, key2=$key2, data2=\n$data2\n");
if ($i == 0) {
// put 'upward button'
$spc="&nbsp;&nbsp;";
Expand Down Expand Up @@ -271,7 +272,7 @@ public function list_filter($lnum0,$recarrin,$dal) {
// since '$data1' is now html, not xml.
$dict = $dal->dict; // lowercase
$matches=array(); // returned variable
if ($dict != 'mw') {
if (! in_array($dict, array('mw','md'))) {
foreach($recarrin as $rec) {
list($key1,$lnum1,$data1) = $rec; // $data1 is <info>x</info><body>y</body>
$rec1 = array($key1,$lnum1,""); // no use for data1, since not mw
Expand Down Expand Up @@ -374,12 +375,14 @@ public function list_center($key1,$lnum1,$data1,$nprev,$nnext,$dal) {
public function construct_rec1($key1,$lnum1,$data1){
// assume this is for mw. 07-15-2018
// php 8.1.10 deprecates null as 2nd arg to preg_match
//dbgprint(true,"\nenter construct_rec1: key1=$key1, lnum1=$lnum1, data1=\n$data1\n");
if ($data1 == null) {
$data1 = "";
}
if (!preg_match('|<info>(.*?)</info><body>(.*?)</body>|',$data1,$matchrec)) {
$data2 = $data1;
$rec1 = array($key1,$lnum1,$data2);
//dbgprint(true,"leave 1: construct_rec1: key1=$key1, lnum1=$lnum1, data2=\n$data2\n");
return $rec1;
}

Expand Down Expand Up @@ -411,6 +414,7 @@ public function construct_rec1($key1,$lnum1,$data1){

$data2 = join('',$out);
$rec1 = array($key1,$lnum1,$data2);
dbgprint(true,"leave 2: construct_rec1: key1=$key1, lnum1=$lnum1, data2=\n$data2\n");
return $rec1;
}
}
Expand Down

0 comments on commit 32771e7

Please sign in to comment.