File tree Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Expand file tree Collapse file tree 3 files changed +31
-3
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " rpgledoc" ,
3
- "version" : " 0.0.25 " ,
3
+ "version" : " 0.0.26 " ,
4
4
"description" : " " ,
5
5
"main" : " indexfile.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -77,7 +77,35 @@ function interpretMarkers(str)
77
77
return out ;
78
78
}
79
79
80
+ /**
81
+ * Generate unique reference ID
82
+ * <ul>
83
+ * <li>Symbols that are not exported are prefixed with their filename
84
+ * <li>Symbols that are not global are prefixed with their procedure / data structure
85
+ * </ul>
86
+ * <p>
87
+ * I.e a field in a global data structure non exported will have the following ref ID: {@code
88
+ * $FILE_NAME:$DS_NAME:$FIELD_NAME}.
89
+ * <p>
90
+ * The pattern can be described like this: {@code [$FILE_NAME:][$PROC_NAME:][$DS_NAME:]$SYMBOL}
91
+ */
92
+ function ref ( tag , index )
93
+ {
94
+ const ref = [ 'ref' ] ;
95
+ if ( ! tag . exported )
96
+ ref . push ( index . filename ) ;
97
+ /* Inside procedure */
98
+ if ( tag . scope . proc && tag . scope . refname !== tag . scope . proc )
99
+ ref . push ( tag . scope . proc ) ;
100
+ /* Inside data structure */
101
+ if ( tag . scope . ds && tag . scope . refname !== tag . scope . ds )
102
+ ref . push ( tag . scope . ds ) ;
103
+ ref . push ( tag . refname ) ;
104
+ return ref . join ( ':' ) ;
105
+ }
106
+
80
107
module . exports = {
81
108
escapeHtml : escapeHtml ,
82
- interpretMarkers : interpretMarkers
109
+ interpretMarkers : interpretMarkers ,
110
+ ref : ref
83
111
} ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ block content
26
26
button( type ="submit" ) Search
27
27
each index in indicies
28
28
each tag in index .tags
29
- section( id =" ref:" + (tag . exported ? ' ' : index . filename + ' : ' ) + tag . refname ,
29
+ section( id =util . ref (tag, index) ,
30
30
data-file =index .filename ,
31
31
data-exported =String (tag .exported ))
32
32
header
You can’t perform that action at this time.
0 commit comments