فهرست منبع

支持 自定义显示内容和tag

visuddhinanda 1 هفته پیش
والد
کامیت
6c5364b1cd
1فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 10 2
      api-v13/app/Http/Api/TemplateRender.php

+ 10 - 2
api-v13/app/Http/Api/TemplateRender.php

@@ -405,8 +405,16 @@ class TemplateRender
     private function render_term()
     private function render_term()
     {
     {
         $word = $this->get_param($this->param, "word", 1);
         $word = $this->get_param($this->param, "word", 1);
-
-        $props = $this->getTermProps($word, '');
+        if (str_contains($word, '@')) {
+            [$wordHead, $tag] = explode('@', $word);
+        }
+        if (str_contains($word, '#')) {
+            [$wordHead, $display] = explode('#', $word);
+        }
+        $props = $this->getTermProps($wordHead ?? $word, $tag ?? '');
+        if (isset($display)) {
+            $props['meaning'] = $display;
+        }
 
 
         $output = $props['word'];
         $output = $props['word'];
         switch ($this->format) {
         switch ($this->format) {