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

29
LINES

< > BotCompany Repo | #1005220 // getHtmlTagParameters - TODO: fix

JavaX fragment (include)

static bool getHtmlTagParameters_debug;

static SS getHtmlTagParameters(S tag) {
  if (empty(tag)) null;
  L<S> tok = codeTokens(tok_joinMinusIdentifiers(htmlFineTok(tag)));
  if (getHtmlTagParameters_debug)
    printStruct(tok);
  assertEquals("<", tok.get(0));
  int i = 1;
  if (eq(tok.get(1), "/")) ++i;
  S name = tok.get(i++);
  if (!isMinusIdentifier(name))
    fail(tag + " (" + name + ")");
  new SS map;
  while (i < l(tok)) {
    S t = tok.get(i);
    if (eqOneOf(t, "/", ">")) break;
    if (!isMinusIdentifier(t))
      fail(tag + " (" + t + ")");
    ++i;
    S value = "1";
    if (eq(tok.get(i), "=")) {
      ++i;
      value = htmlunquote(tok.get(i++));
    }
    map.put(t, value);
  }
  ret map;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005220
Snippet name: getHtmlTagParameters - TODO: fix
Eternal ID of this version: #1005220/11
Text MD5: cf02a969362cf227aece1ca35d2f278f
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-23 00:07:00
Source code size: 745 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 662 / 639
Version history: 10 change(s)
Referenced in: #1005224 - getHtmlTagParameter
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1009182 - xml_getArg - get parameter of XML tag
#1030437 - htmlTagFullParamString
#1032928 - ciTagParams