- var buttonName = this.innerHTML;
-
- if(buttonName == "słowo obce") {
- startTag = "<slowo_obce>";
- endTag = "</slowo_obce>";
- } else if (buttonName == "wyróżnienie") {
- startTag = "<wyroznienie>";
- endTag = "</wyroznienie>";
- } else if (buttonName == "tytuł dzieła") {
- startTag = "<tytul_dziela>";
- endTag = "</tytul_dziela>";
- } else if (buttonName == "znak spec."){
- addSymbol();
+ var tag = "";
+ var $this = $(this);
+
+ if ($this.data('tag')) {
+ tag = $this.data('tag');
+ startTag = "<" + $this.data('tag') + ">";
+ endTag = "</" + $this.data('tag') + ">";
+ } else if ($this.data('tag-selfclosing')){
+ startTag = "<" + $this.data('tag-selfclosing') + "/>";
+ } else if ($this.data('act')) {
+ if ($this.data('act') == 'spec') {
+ addSymbol();
+ }