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 (2847L/17K).

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 (val == html_valueLessParam())
        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   

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

No comments. add comment

Snippet ID: #1006400
Snippet name: hopeningTag - make opening HTML tag
Eternal ID of this version: #1006400/5
Text MD5: 1a89ce36b6683ad6c650253cad6e4264
Transpilation MD5: 8ef200244e9f41c782dff5290987a7a7
Author: stefan
Category: javax html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-02-22 13:23:52
Source code size: 633 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 355 / 404
Version history: 4 change(s)
Referenced in: [show references]

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