Skip to content

Commit

Permalink
Don't force any attributes when using xml formatting #913
Browse files Browse the repository at this point in the history
  • Loading branch information
jcubic committed Apr 20, 2024
1 parent 446beb9 commit b90b736
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
@@ -1,4 +1,6 @@
## 2.39.4
## 2.40.0
### Features
* Don't force any attributes when using xml (`span`, `img`, and `a` tags) [#913](https://github.com/jcubic/jquery.terminal/issues/913)
### Bugfix
* fix init and resize of long prompt [#919](https://github.com/jcubic/jquery.terminal/issues/919)
* fix occasional selecting Accessibility label (about clipboard textarea) in CMD
Expand Down
15 changes: 12 additions & 3 deletions js/xml_formatting.js
Expand Up @@ -80,8 +80,12 @@
return '[[;' + color + ';' + background + ';;;' + style + ']';
},
img: function(attrs) {
var cls = attrs.class || '';
var alt = attrs.alt || '';
return '[[@;;;' + attrs.class + ';' + attrs.src + ']' + alt + ']';
var src = attrs.src || '';
delete attrs.alt;
var formatting = ['@', '', '', cls, src, JSON.stringify(attrs)];
return '[[' + formatting.join(';') + ']' + alt + ']';
},
bold: function() {
return '[[b;rgba(255,255,255,0.9);]';
Expand All @@ -102,10 +106,15 @@
return '[[i;;]';
},
span: function(attrs) {
return '[[;;;' + attrs.class + ']';
var cls = attrs.class || '';
var formatting = ['', '', '', cls, '', JSON.stringify(attrs)];
return '[[' + formatting.join(';') + ']';
},
link: function(attrs) {
return '[[!;;;' + attrs.class + ';' + attrs.href + ';]';
var cls = attrs.class || '';
var href = attrs.href || '';
var formatting = ['!', '', '', cls, href, JSON.stringify(attrs)];
return '[[' + formatting.join(';') + ']';
}
};
// short aliases
Expand Down

0 comments on commit b90b736

Please sign in to comment.