Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1002214 // htag - make HTML tag. uses trailing slash (e.g. <img ... />) when contents is empty

JavaX fragment (include)

1  
static S htag(S tag) {
2  
  ret htag(tag, "");
3  
}
4  
5  
static S mapMethodLike htag(S tag, O contents, O... params) {
6  
  S openingTag = hopeningTag(tag, params);
7  
  S s = str(contents);
8  
  if (empty(s) && neqic(tag, "script"))
9  
    ret dropLast(openingTag) + "/>";
10  
  ret openingTag + s + "</" + tag + ">";
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, qsqiayxyrbia, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1002214
Snippet name: htag - make HTML tag. uses trailing slash (e.g. <img ... />) when contents is empty
Eternal ID of this version: #1002214/8
Text MD5: f2a365ed8336adcd7dd85264f8579d49
Author: stefan
Category: javax html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-09 13:19:07
Source code size: 304 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 865 / 2301
Version history: 7 change(s)
Referenced in: [show references]