@@ -308,7 +308,7 @@ function parseInput(state) {
308
308
scope = mergeObject ( scope , newScope ) ;
309
309
}
310
310
311
- return { navs, scope, base, baseKeys, state } ;
311
+ return { navs, scope, base, baseKeys } ;
312
312
}
313
313
314
314
/**
@@ -390,12 +390,15 @@ function generateDocs(inpt, state) {
390
390
391
391
if ( ! "tips" . match ( regGen ) ) return ;
392
392
393
- generateTips ( inpt ) ;
393
+ generateTips ( inpt , state ) ;
394
394
generateTsx ( inpt ) ;
395
395
}
396
396
397
- /** @param {DSInput } scope */
398
- function generateTips ( { base, scope, state } ) {
397
+ /**
398
+ * @param {DSInput } scope
399
+ * @param {GenState } state
400
+ */
401
+ function generateTips ( { base, scope } , state ) {
399
402
state . curDoc = getSrcDir ( D_VER , state , state . curScope + '-tips.json' ) ;
400
403
/** @type {DSScopeRaw } */
401
404
let tsubf ;
@@ -473,7 +476,7 @@ function generateDoc(state, inpt, name) {
473
476
if ( dbg ) app . UpdateProgressBar ( state . progress , state . curScope + '.' + name + " get data" ) ;
474
477
475
478
const m = fillMissingFuncProps ( ps ) ;
476
- data = getDocData ( inpt , m ) ;
479
+ data = getDocData ( inpt , state , m ) ;
477
480
desc = m . desc ;
478
481
479
482
// function line with popups
@@ -640,8 +643,8 @@ function adjustDoc(state, html, name) {
640
643
function formatDesc ( inpt , state , desc , name , hasData ) {
641
644
desc = desc . charAt ( 0 ) . toUpperCase ( ) + desc . slice ( 1 ) ;
642
645
643
- const samplesJs = getSamples ( inpt , name ) ;
644
- const samplesPy = getSamples ( inpt , name , "-py" ) ;
646
+ const samplesJs = getSamples ( inpt . scope , state , name ) ;
647
+ const samplesPy = getSamples ( inpt . scope , state , name , "-py" ) ;
645
648
let sampcnt = keys ( samplesJs ) . length ;
646
649
if ( ! has ( desc , '.' ) ) desc += '.' ;
647
650
@@ -670,9 +673,9 @@ function formatDesc(inpt, state, desc, name, hasData) {
670
673
. replace ( / \s * < b r > \s * / g, "<br>\n\t\t" )
671
674
// expandable samples (per <sample name> tag or add to desc)
672
675
. replace ( / < s a m p l e ( .* ?) > / g, ( m , /** @type {string } */ t ) =>
673
- `</p>\n\t\t${ toHtmlSamp ( t , samplesJs [ t ] , samplesPy [ t ] , inpt . state ) + ( delete samplesJs [ t ] , '' ) } <p>` )
676
+ `</p>\n\t\t${ toHtmlSamp ( t , samplesJs [ t ] , samplesPy [ t ] , state ) + ( delete samplesJs [ t ] , '' ) } <p>` )
674
677
. replace ( / ( “ .* ?” ) / g, "<docstr>$1</docstr>" )
675
- + keys ( samplesJs ) . map ( t => toHtmlSamp ( t , samplesJs [ t ] , samplesPy [ t ] , inpt . state ) ) . join ( "" ) ;
678
+ + keys ( samplesJs ) . map ( t => toHtmlSamp ( t , samplesJs [ t ] , samplesPy [ t ] , state ) ) . join ( "" ) ;
676
679
}
677
680
678
681
/**
@@ -705,9 +708,10 @@ function fillMissingFuncProps(f) {
705
708
706
709
/** converts a function object into an html snippets object
707
710
* @param {DSInput } inpt
711
+ * @param {GenState } state
708
712
* @param {DSMethod } f */
709
- function getDocData ( inpt , f , useAppPop = false ) {
710
- const { base, state } = inpt ;
713
+ function getDocData ( inpt , state , f , useAppPop = false ) {
714
+ const { base } = inpt ;
711
715
/** @type {string[] } */
712
716
const mArgs = [ ] ;
713
717
let i , fretval = "" ;
@@ -801,11 +805,12 @@ function getDocData(inpt, f, useAppPop = false) {
801
805
}
802
806
803
807
/** read and return html converted example snippets file
804
- * @param {DSInput } inpt
808
+ * @param {DSScope } scope
809
+ * @param {GenState } state
805
810
* @param {string } func
806
811
* @param {string } ext
807
812
*/
808
- function getSamples ( { scope, state } , func , ext = "" ) {
813
+ function getSamples ( scope , state , func , ext = "" ) {
809
814
/** @type {Obj<Sample> } */
810
815
const samples = { } ;
811
816
let index = 0 ;
@@ -931,7 +936,7 @@ function typeDesc(inpt, state, stypes) {
931
936
default :
932
937
if ( ! type [ 0 ] . endsWith ( "o" ) )
933
938
Throw ( Error ( "unknown typex " + type [ 1 ] ) ) ;
934
- if ( inpt . state . curDoc . endsWith ( type [ 2 ] + ".htm" ) )
939
+ if ( state . curDoc . endsWith ( type [ 2 ] + ".htm" ) )
935
940
return s [ i ] + type [ 2 ] ;
936
941
if ( ! type [ 2 ] . startsWith ( "@" ) && ! inpt . scope [ type [ 2 ] ] )
937
942
Throw ( Error ( "link required for " + type [ 2 ] ) ) ;
@@ -1016,7 +1021,7 @@ function toArgPop(inpt, state, name, stypes, doSwitch) {
1016
1021
default :
1017
1022
if ( ! type [ 0 ] . endsWith ( "o" ) )
1018
1023
Throw ( Error ( "unknown typex " + type [ 1 ] ) ) ;
1019
- if ( inpt . state . curDoc . endsWith ( type [ 2 ] + ".htm" ) )
1024
+ if ( state . curDoc . endsWith ( type [ 2 ] + ".htm" ) )
1020
1025
return s2 [ i ] + type [ 2 ] ;
1021
1026
if ( ! type [ 2 ] . startsWith ( "@" ) && ! inpt . scope [ type [ 2 ] ] )
1022
1027
Throw ( Error ( "link required for " + type [ 2 ] ) ) ;
0 commit comments