File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed
Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,21 @@ const rngScript = (seed) => `
2222 window.dice = new rpgDiceRoller.DiceRoller();
2323 </script>
2424` ;
25+ const rngScriptLines = rngScript ( 0 ) . split ( '\n' ) . length - 1 ;
2526
2627export function render ( generator , entries , config ) {
27- return renderTemplate (
28- ( generator . passEntriesToJS ? `<script> let entries = ${ JSON . stringify ( entries ) } ;</script>` : '' ) +
29- rngScript ( config . seed ?? 'test-seed' ) +
30- generator . printTemplate ,
31- { config : config , images : generator . images , entries : entries }
32- ) ;
28+ return new Promise ( ( resolve , reject ) => {
29+ renderTemplate (
30+ ( generator . passEntriesToJS ? `<script> let entries = ${ JSON . stringify ( entries ) } ;</script>` : '' ) +
31+ rngScript ( config . seed ?? 'test-seed' ) +
32+ generator . printTemplate ,
33+ { config : config , images : generator . images , entries : entries }
34+ )
35+ . then ( resolve )
36+ . catch ( ( err ) => {
37+ // fix the error line number by removing the rngScript lines from it.
38+ err . line -= rngScriptLines ;
39+ reject ( err ) ;
40+ } ) ;
41+ } ) ;
3342}
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export const parseError = (e) => {
4949 if ( match ) {
5050 return {
5151 line : parseInt ( match [ 1 ] ) ,
52- column : parseInt ( match [ 2 ] ) ,
52+ column : parseInt ( match [ 2 ] ) + 1 ,
5353 error : match [ 3 ] ,
5454 } ;
5555 }
You can’t perform that action at this time.
0 commit comments