/* * Modle Init. * public * @param param1 (type) * * Example usage: * @code * @endcode */ function editor_layout_init(){ } function layoutWordHeadCode(showTo,obj){ menu_view_script(showTo,obj.value); } function menu_view_script(showto,code){ var xAllWord = gXmlBookDataBody.getElementsByTagName("word"); if(showto==0 && code=="org"){ for(iWord=0;iWord0){ xPali.innerHTML=arrDestWords[iWord+1]; } else{ xPali.innerHTML=getNodeText(xAllWord[iWord],"pali"); } } } if (xmlScript == null){ alert("error:can not load dict."); return; } } function editro_layout_loadStyle(){ var strStyle = getNodeText(gXmlBookDataHead,"style"); document.getElementById("id_layout_style").value=strStyle; document.getElementById("mycss").innerHTML=strStyle; } function editor_layout_applyNewStyle(){ var strStyle=document.getElementById("id_layout_style").value; document.getElementById("mycss").innerHTML=strStyle; setNodeText(gXmlBookDataHead,"style",strStyle); } //自动将逐词译段落切分为句子 function layout_wbw_auto_cut(){ var xBlock=gXmlBookDataBody.getElementsByTagName("block"); for(var iBlock=0;iBlock=1){ var pre_pali_spell=getNodeText(allWord[iWord-1],"pali"); var pre_pali_type=getNodeText(allWord[iWord-1],"type") var pre_pali_Gramma=getNodeText(allWord[iWord-1],"gramma") var pre_pali_Case=getNodeText(allWord[iWord-1],"case") if(pre_pali_type=="" && pre_pali_Case!=""){ pre_pali_type=pre_pali_Case.split("#")[0]; } if(pre_pali_Case!="" && pre_pali_Case.lastIndexOf("$")!=-1){ var pre_case_array=pre_pali_Case.split("$"); pre_pali_Case=pre_case_array[pre_case_array.length-1] } } if((iWord+2)<=allWord.length){ var next_pali_spell=getNodeText(allWord[iWord+1],"pali"); var next_pali_type=getNodeText(allWord[iWord+1],"type") var next_pali_Gramma=getNodeText(allWord[iWord+1],"gramma") var next_pali_Case=getNodeText(allWord[iWord+1],"case") if(next_pali_type=="" && next_pali_Case!=""){ next_pali_type=next_pali_Case.split("#")[0]; } if(next_pali_Case!="" && next_pali_Case.lastIndexOf("$")!=-1){ var next_case_array=next_pali_Case.split("$"); next_pali_Case=next_case_array[next_case_array.length-1] } } if(next_pali_spell=="("){ Note_Mark=1; } else if(pre_pali_spell==")" && Note_Mark==1){ Note_Mark=0; } else{ } var isEndOfSen=false; if(wPali=="." && iWord>=1 && isNaN(pre_pali_spell) && iWord!=allWord.length-1 && Note_Mark==0){//以.結尾且非註釋 if(next_pali_spell!="("){ isEndOfSen=true; } } /*else if(wPali=="," && iWord>=1 && isNaN(pre_pali_spell) && iWord!=allWord.length-1 && pre_pali_type==".v." && Note_Mark==0){ isEndOfSen=true; }导致自动匹配前后,句子切分不一致,注释*/ else if(wPali=="–" && allWord.length>=(iWord+2) && next_pali_spell=="‘" && iWord!=allWord.length-1 && Note_Mark==0){ isEndOfSen=true; } else if(allWord.length>=(iWord+2) && iWord!=allWord.length-1 && Note_Mark==0){//以!或?或;結尾 if(/*wPali=="!" || */wPali==";" || wPali=="?"){ if(next_pali_spell!="("){ isEndOfSen=true; } } } if(isEndOfSen==true){ var wEnter=getNodeText(allWord[iWord],"enter"); if(wEnter=="" || wEnter==0){ setNodeText(allWord[iWord],"enter","1"); } var sent_ID="sent_"+par_num+"_"+sent_num; sent_num+=1 word_length_count=0; sent_gramma_i=0; arr_Para_ID.push(wID); } if(wPali==","){ if(next_pali_Case.lastIndexOf(".voc.")!=-1 || pre_pali_Case.lastIndexOf(".voc.")!=-1){ sent_gramma_i += 0; } else{ sent_gramma_i+=1; } } if(wType==".v:ind." && allWord.length>=(iWord+2) && next_pali_spell!=","){ sent_gramma_i += 1; } else if(wType==".v." && allWord.length>=(iWord+2) && next_pali_spell!="." && next_pali_spell!=","){ sent_gramma_i += 1; } }//段落结束 //重绘 //_display_sbs=1; //updateWordParBlockInner(xBlock[iBlock]); var sent_ID="sent_"+par_num+"_"+sent_num; arr_Para_ID.push(wID); arr_par_sent_num.push(sent_ID); g_arr_Para_ID[par_num]=arr_Para_ID; //设置已经切分标志 setNodeText(xmlParInfo,"splited","1"); } } } }