MCPcopy Index your code
hub / github.com/plotly/plotly.js / parseTag

Function parseTag

stackgl_modules/index.js:38971–39021  ·  view source on GitHub ↗
(tag, TAG_CHR, str, map)

Source from the content-addressed store, hash-verified

38969var CHR_sub = '-1'
38970
38971function parseTag(tag, TAG_CHR, str, map) {
38972
38973 var opnTag = "<" + tag + ">"
38974 var clsTag = "</" + tag + ">"
38975
38976 var nOPN = opnTag.length
38977 var nCLS = clsTag.length
38978
38979 var isRecursive = (TAG_CHR[0] === CHR_super0) ||
38980 (TAG_CHR[0] === CHR_sub0);
38981
38982 var a = 0
38983 var b = -nCLS
38984 while (a > -1) {
38985 a = str.indexOf(opnTag, a)
38986 if(a === -1) break
38987
38988 b = str.indexOf(clsTag, a + nOPN)
38989 if(b === -1) break
38990
38991 if(b <= a) break
38992
38993 for(var i = a; i < b + nCLS; ++i){
38994 if((i < a + nOPN) || (i >= b)) {
38995 map[i] = null
38996 str = str.substr(0, i) + " " + str.substr(i + 1)
38997 } else {
38998 if(map[i] !== null) {
38999 var pos = map[i].indexOf(TAG_CHR[0])
39000 if(pos === -1) {
39001 map[i] += TAG_CHR
39002 } else { // i.e. to handle multiple sub/super-scripts
39003 if(isRecursive) {
39004 // i.e to increase the sub/sup number
39005 map[i] = map[i].substr(0, pos + 1) + (1 + parseInt(map[i][pos + 1])) + map[i].substr(pos + 2)
39006 }
39007 }
39008 }
39009 }
39010 }
39011
39012 var start = a + nOPN
39013 var remainingStr = str.substr(start, b - start)
39014
39015 var c = remainingStr.indexOf(opnTag)
39016 if(c !== -1) a = c
39017 else a = b + nCLS
39018 }
39019
39020 return map
39021}
39022
39023function transformPositions(positions, options, size) {
39024 var align = options.textAlign || "start"

Callers 1

getPixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…