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)

static S htag(S tag) {
  ret htag(tag, "");
}

static S mapMethodLike htag(S tag, O contents, O... params) {
  S openingTag = hopeningTag(tag, params);
  S s = str(contents);
  if (empty(s) && neqic(tag, "script"))
    ret dropLast(openingTag) + "/>";
  ret openingTag + s + "</" + tag + ">";
}

download  show line numbers  debug dex   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, qsqiayxyrbia, tslmcundralx, tvejysmllsmz, 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: 558 / 1437
Version history: 7 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1002214 & http://1002214.tinybrain.de