vesta-web 1.2.2__py3-none-any.whl → 1.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -376,19 +376,18 @@ export class Markdown {
376
376
  return tokenList;
377
377
  }
378
378
 
379
- render(tokens) {
379
+ render(tokens, renderingSet = this.HTML_equiv) {
380
380
  let result = ""
381
381
  for(let token_id = 0; token_id < tokens.length; token_id+=1){
382
- const render = this.renderToken(tokens[token_id], token_id, tokens)
382
+ const render = this.renderToken(tokens[token_id], token_id, tokens, renderingSet)
383
383
  token_id = render[1]
384
384
  result = result.concat(render[0])
385
385
  }
386
386
  return result;
387
387
  }
388
388
 
389
- renderToken(token, token_id, tokens){
389
+ renderToken(token, token_id, tokens, renderingSet = this.HTML_equiv){
390
390
  // console.log("render token",token,token_id,tokens)
391
- const old_id = token_id
392
391
  let content = ""
393
392
  switch(token.type) {
394
393
  case ">":
@@ -400,7 +399,7 @@ export class Markdown {
400
399
  content = content.concat(render[0])
401
400
  }
402
401
  token.content = content
403
- return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
402
+ return [fillTemplateLitteral(renderingSet[token.type], token), token_id]
404
403
  case "-#":
405
404
  let smallContent = token.content
406
405
  while (token_id + 1 < tokens.length && tokens[token_id + 1].type !== "endline") {
@@ -410,7 +409,7 @@ export class Markdown {
410
409
  smallContent = smallContent.concat(render[0])
411
410
  }
412
411
  token.content = smallContent
413
- return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
412
+ return [fillTemplateLitteral(renderingSet[token.type], token), token_id]
414
413
  case "*":
415
414
  // this is suboptimal because we're looking for same size closing
416
415
  // smth like *** a ** b * will not work as intended
@@ -420,34 +419,35 @@ export class Markdown {
420
419
  token.content = content
421
420
  if (token.props.level % 2) {
422
421
  if (token.props.level === 3) {
423
- token.content = fillTemplateLitteral(this.HTML_equiv["**"], token)
422
+ token.content = fillTemplateLitteral(renderingSet["**"], token)
424
423
  }
425
- return [fillTemplateLitteral(this.HTML_equiv["*"], token), token_id]
424
+ return [fillTemplateLitteral(renderingSet["*"], token), token_id]
426
425
  } else {
427
- return [fillTemplateLitteral(this.HTML_equiv["**"], token), token_id]
426
+ return [fillTemplateLitteral(renderingSet["**"], token), token_id]
428
427
  }
429
428
  }
430
429
  const render = this.renderToken(tokens[token_id], token_id, tokens)
431
430
  token_id = render[1]
432
431
  content = content.concat(render[0])
433
432
  }
434
- token.content = "*".repeat(token.props.level)
435
- // should be optimized, because we just drop a part of the render here
436
- return [fillTemplateLitteral(this.HTML_equiv["text"], token), old_id]
433
+ // No closing * found, render as text and continue from current position
434
+ token.content = "*".repeat(token.props.level).concat(content)
435
+ return [fillTemplateLitteral(renderingSet["text"], token), token_id]
437
436
  case "~~":
438
437
  case "||":
439
438
  while (token_id + 1 < tokens.length) {
440
439
  token_id += 1
441
440
  if(tokens[token_id].type === token.type){
442
441
  token.content = content
443
- return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
442
+ return [fillTemplateLitteral(renderingSet[token.type], token), token_id]
444
443
  }
445
444
  const render = this.renderToken(tokens[token_id], token_id, tokens)
446
445
  token_id = render[1]
447
446
  content = content.concat(render[0])
448
447
  }
449
- token.content = token.type
450
- return [fillTemplateLitteral(this.HTML_equiv["text"], token), old_id]
448
+ // No closing pair found, render as text and continue from current position
449
+ token.content = token.type.concat(content)
450
+ return [fillTemplateLitteral(renderingSet["text"], token), token_id]
451
451
  case "[":
452
452
  while (token_id + 1 < tokens.length) {
453
453
  token_id += 1
@@ -461,7 +461,7 @@ export class Markdown {
461
461
  tokens[token_id+3].type === ")"){
462
462
  token.content = content
463
463
  token.props.link = tokens[token_id+2].content
464
- return [fillTemplateLitteral(this.HTML_equiv["link"], token), token_id+3]
464
+ return [fillTemplateLitteral(renderingSet["link"], token), token_id+3]
465
465
  }else{
466
466
  break
467
467
  }
@@ -470,14 +470,15 @@ export class Markdown {
470
470
  token_id = render[1]
471
471
  content = content.concat(render[0])
472
472
  }
473
- token.content = token.type
474
- return [fillTemplateLitteral(this.HTML_equiv["text"], token), old_id]
473
+ // No closing ] or proper link syntax found, render as text and continue from current position
474
+ token.content = token.type.concat(content)
475
+ return [fillTemplateLitteral(renderingSet["text"], token), token_id]
475
476
  case "color":
476
477
  while (token_id + 1 < tokens.length) {
477
478
  token_id += 1
478
479
  if(tokens[token_id].type === "/>"){
479
480
  token.content = content
480
- return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
481
+ return [fillTemplateLitteral(renderingSet[token.type], token), token_id]
481
482
  }
482
483
  const render = this.renderToken(tokens[token_id], token_id, tokens)
483
484
  token_id = render[1]
@@ -485,9 +486,9 @@ export class Markdown {
485
486
  }
486
487
  token.type="text"
487
488
  token.content = "<$"+token.props?.color
488
- return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
489
+ return [fillTemplateLitteral(renderingSet[token.type], token), token_id]
489
490
  default:
490
- return [fillTemplateLitteral(this.HTML_equiv[token.type], token), token_id]
491
+ return [fillTemplateLitteral(renderingSet[token.type], token), token_id]
491
492
  }
492
493
  }
493
494
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vesta-web
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: An extensive web framework adding every feature needed for Carbonlab
5
5
  Project-URL: Homepage, https://gitlab.com/Louciole/vesta
6
6
  Project-URL: Issues, https://gitlab.com/Louciole/vesta/-/issues
@@ -39,7 +39,7 @@ vesta/emptyProject/static/home/auth.html,sha256=sz-CC-B4NUqth8aSQqwQCvq2V46AnhaI
39
39
  vesta/emptyProject/static/home/auth.js,sha256=txMlUqr4A-15Czf4MYwaED35XXcaHI_zrc4SpnjItJU,4622
40
40
  vesta/emptyProject/static/home/reset.html,sha256=EcXfX2Vil3NrYhDvEptrIhW9QV9X_kDy59-TK2S_P4w,2655
41
41
  vesta/emptyProject/static/home/verif.html,sha256=tUw96l0FZ5-AXuE8s-7v1nM632onErq5swgCU53zP-s,2906
42
- vesta/emptyProject/static/markdown/markdown.mjs,sha256=tmrT20hbA2w-6IJ--Xu5sY0U-oryWIqX3HFsr5EoHww,23963
42
+ vesta/emptyProject/static/markdown/markdown.mjs,sha256=s51IMYqoDznrcs23ByjL1PhtWlCMZj3kvxQAuhE30w8,24229
43
43
  vesta/emptyProject/static/markdown/utils.mjs,sha256=PGxhsJfub_lt-LEZVqYt8lKEp_RTRVGXuNhGmWxto-k,614
44
44
  vesta/emptyProject/static/translations/en.mjs,sha256=ouMluPVTgB4Q5vmb7zGE6YGTH4URruog5_a52sBDYNE,22
45
45
  vesta/emptyProject/static/translations/fr.mjs,sha256=ouMluPVTgB4Q5vmb7zGE6YGTH4URruog5_a52sBDYNE,22
@@ -56,8 +56,8 @@ vesta/scripts/initDB.py,sha256=4o_J3IK0vcil2oHvk_qmtqLSlWABcRPFBC3M61-oSF8,1842
56
56
  vesta/scripts/install.py,sha256=GvH_HHx5aU5_54RQ1_2vz4DaLCh42AHfUKy-m0q21vY,2125
57
57
  vesta/scripts/testsRun.py,sha256=bXJImdexKQUDW8CR8F9VIKTrgkd7QfnvHQPENEV4x38,2463
58
58
  vesta/scripts/utils.py,sha256=PR2XPonaoZEbegzV3QX1EHfyq67sU-cbDEUexCuJp9Q,6013
59
- vesta_web-1.2.2.dist-info/METADATA,sha256=7d0oKOi2qXIB9cocPpcaBC0_WkV89EmBzkEOjPuvsVI,1584
60
- vesta_web-1.2.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
61
- vesta_web-1.2.2.dist-info/entry_points.txt,sha256=MHMrWJwtkb4FmNz0CTpxZzwQ3LTqndXBh8YBPDfXlW4,49
62
- vesta_web-1.2.2.dist-info/licenses/LICENSE.md,sha256=zoPFEFUUoSgosmDBK5fGTWGRHHBaSVuuJT2ZQIYXuIk,177
63
- vesta_web-1.2.2.dist-info/RECORD,,
59
+ vesta_web-1.2.3.dist-info/METADATA,sha256=R_ENQZRuZmkJDpllpVoqnE3KC_ga3-Ol05LjktJxNio,1584
60
+ vesta_web-1.2.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
61
+ vesta_web-1.2.3.dist-info/entry_points.txt,sha256=MHMrWJwtkb4FmNz0CTpxZzwQ3LTqndXBh8YBPDfXlW4,49
62
+ vesta_web-1.2.3.dist-info/licenses/LICENSE.md,sha256=zoPFEFUUoSgosmDBK5fGTWGRHHBaSVuuJT2ZQIYXuIk,177
63
+ vesta_web-1.2.3.dist-info/RECORD,,