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).

1  
sS mapMethodLike hopeningTag(S tag, Map params) {
2  
  ret hopeningTag(tag, mapToParams(params));
3  
}
4  
5  
static S hopeningTag(S tag, O... params) {
6  
  new StringBuilder buf;
7  
  buf.append("<" + tag);
8  
  params = unrollParams(params);
9  
  for (int i = 0; i < l(params); i += 2) {
10  
    S name = (S) get(params, i);
11  
    O val = get(params, i+1);
12  
    if (nempty(name) && val != null) {
13  
      if (eqOneOf(val, html_valueLessParam(), true))
14  
        buf.append(" " + name);
15  
      else {
16  
        S s = str(val);
17  
        if (!empty(s))
18  
          buf.append(" " + name + "=" + htmlQuote(s));
19  
      }
20  
    }
21  
  }
22  
  buf.append(">");
23  
  ret str(buf);
24  
}

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: 519 / 628
Version history: 5 change(s)
Referenced in: [show references]