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

24
LINES

< > BotCompany Repo | #1006400 // hopeningTag - make opening HTML tag

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (3283L/18K).

sS mapMethodLike hopeningTag(S tag, Map params) {
  ret hopeningTag(tag, mapToParams(params));
}

static S hopeningTag(S tag, O... params) {
  new StringBuilder buf;
  buf.append("<" + tag);
  params = unrollParams(params);
  for (int i = 0; i < l(params); i += 2) {
    S name = (S) get(params, i);
    O val = get(params, i+1);
    if (nempty(name) && val != null) {
      if (eqOneOf(val, html_valueLessParam(), true))
        buf.append(" " + name);
      else {
        S s = str(val);
        if (!empty(s))
          buf.append(" " + name + "=" + htmlQuote(s));
      }
    }
  }
  buf.append(">");
  ret str(buf);
}

Author comment

Began life as a copy of #1002214

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1006400
Snippet name: hopeningTag - make opening HTML tag
Eternal ID of this version: #1006400/6
Text MD5: 14c791b667f9ddf5afa99bee184f1da4
Transpilation MD5: f1cd99bffb526028aae526560ca321e4
Author: stefan
Category: javax html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-27 09:05:49
Source code size: 646 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 567 / 692
Version history: 5 change(s)
Referenced in: [show references]