File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ const registerDiscourseDatalogTranslators = () => {
101101 const isACandidateCallback : Parameters <
102102 typeof registerDatalogTranslator
103103 > [ 0 ] [ "callback" ] = ( { source, target } ) => {
104+ const stripLeadingHash = ( value : string ) : string =>
105+ value . startsWith ( "#" ) ? value . slice ( 1 ) : value ;
106+
104107 const nodeByTypeOrText = Object . fromEntries ( [
105108 ...discourseNodes . map ( ( n ) => [ n . type , n ] as const ) ,
106109 ...discourseNodes . map ( ( n ) => [ n . text , n ] as const ) ,
@@ -129,7 +132,10 @@ const registerDiscourseDatalogTranslators = () => {
129132 } ,
130133 ] ,
131134 } ,
132- ...getTitleDatalog ( { source : variableRef , target : node . tag } ) ,
135+ ...getTitleDatalog ( {
136+ source : variableRef ,
137+ target : stripLeadingHash ( node . tag ) ,
138+ } ) ,
133139 ] ,
134140 } ;
135141 } ) ,
@@ -153,7 +159,10 @@ const registerDiscourseDatalogTranslators = () => {
153159 } ,
154160 ] ,
155161 } ,
156- ...getTitleDatalog ( { source : variableRef , target : targetNodeTag } ) ,
162+ ...getTitleDatalog ( {
163+ source : variableRef ,
164+ target : stripLeadingHash ( targetNodeTag ) ,
165+ } ) ,
157166 ] ;
158167 } ;
159168 const unregisters = new Set < ( ) => void > ( ) ;
You can’t perform that action at this time.
0 commit comments