Skip to content

Commit

Permalink
handle e pepet
Browse files Browse the repository at this point in the history
  • Loading branch information
stoikal committed Aug 29, 2021
1 parent 67588e4 commit ecc8345
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 12 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<template>
<div id="app">
<textarea v-model="srcText" rows="8" cols="60"/>
<h1>Aksara Latin ke Aksara Jawa (simplified)</h1>
<textarea :value="inputText" rows="8" cols="60" @input.prevent="handleInputChange"/>
<br />
<textarea id="result" :value="resultText" rows="8" cols="60" disabled/>
<textarea :value="resultText" rows="8" cols="60" disabled/>
</div>
</template>

Expand All @@ -14,12 +15,19 @@ export default Vue.extend({
name: 'App',
data() {
return {
srcText: ''
inputText: ''
}
},
computed: {
resultText(): string {
return toJavaneseScript(this.srcText)
return toJavaneseScript(this.inputText)
}
},
methods: {
handleInputChange(e: Event) {
const { value } = e.currentTarget as HTMLInputElement;
this.inputText = value.replaceAll('#', 'ê')
}
}
})
Expand Down
4 changes: 1 addition & 3 deletions src/methods/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ export default class Text {
}

toJavanese() {
console.log('=================')
for (const char of this.source.trim().toLowerCase()) {
console.log(char, this._state)
if (this._state.swara) this._processSyllable()

const { nglegena } = this._state
Expand All @@ -96,7 +94,7 @@ export default class Text {
} else {
if(this._isDoubleChar(char)) {
this._state.nglegena += char
} else if ('yrlw'.includes(char)) {
} else if ('yrlw'.includes(char) && !['r', 'h'].includes(nglegena)) {
this._state.wyanjana += char
} else {
this._state.sesigeg += nglegena
Expand Down

0 comments on commit ecc8345

Please sign in to comment.