ソースを参照

用 case 里面的语法信息

visuddhinanda 3 年 前
コミット
70956f07fa
1 ファイル変更11 行追加6 行削除
  1. 11 6
      app/Http/Controllers/ExportWbwController.php

+ 11 - 6
app/Http/Controllers/ExportWbwController.php

@@ -53,18 +53,23 @@ class ExportWbwController extends Controller
 
                 $wordsList = $xmlWord->xpath('//word');
                 foreach ($wordsList as $word) {
-                    $type = $word->type->__toString();
+                    $pali = $word->real->__toString();
+                    $case = explode("#",$word->case->__toString()) ;
+                    $type = $case[0];
+                    $grammar = $case[1];
+                    $grammar = str_replace("null","",$grammar);
                     $style = $word->style->__toString();
-                    if($type !== '.ctl.' && $style !== 'note'){
+                    $factormeaning = str_replace("
","",$word->om->__toString());
+                    $factormeaning = str_replace("↓↓","",$factormeaning);
+                    if($type !== '.ctl.' && $style !== 'note' && !empty($pali)){
                         $sent['data'][]=[
                             'pali'=>$word->real->__toString(),
-                            'mean' => $word->mean->__toString(),
+                            'mean' => str_replace("
","",$word->mean->__toString()),
                             'type' => ltrim($type,'.'),
-                            'grammar' => ltrim(str_replace('$.',',',$word->gramma->__toString()),'.') ,
-                            'case' => ltrim(str_replace(['$.','#.'],[' ',' '],$word->case->__toString()),'.') ,
+                            'grammar' => ltrim(str_replace('$.',',',$grammar),'.') ,
                             'parent' => $word->parent->__toString(),
                             'factors' => $word->org->__toString(),
-                            'factormeaning' => $word->om->__toString()
+                            'factormeaning' => $factormeaning
                         ];
                     }