@@ -84,9 +84,6 @@ const build_changes_markdown = (
8484
8585export const replace_changes_symbol = async ( params : {
8686 instruction : string
87- after_context ?: boolean
88- workspace_provider : WorkspaceProvider
89- is_no_context_web_mode ?: boolean
9087} ) : Promise < string > => {
9188 const matches = params . instruction . match (
9289 / # C h a n g e s : ( [ ^ \s , ; : . ! ? ] + (?: \/ [ ^ \s , ; : . ! ? ] + ) ? ) /
@@ -97,20 +94,6 @@ export const replace_changes_symbol = async (params: {
9794
9895 const branch_spec = matches [ 1 ]
9996
100- if ( params . after_context ) {
101- let branch_name = branch_spec
102- const multi_root_match = branch_spec . match ( / ^ ( [ ^ / ] + ) \/ ( .+ ) $ / )
103-
104- if ( multi_root_match ) {
105- branch_name = multi_root_match [ 2 ]
106- }
107-
108- return params . instruction . replace (
109- new RegExp ( `#Changes:${ branch_spec } ` , 'g' ) ,
110- `(Changes against ${ branch_name } branch)`
111- )
112- }
113-
11497 const multi_root_match = branch_spec . match ( / ^ ( [ ^ / ] + ) \/ ( .+ ) $ / )
11598
11699 if ( multi_root_match ) {
@@ -354,18 +337,8 @@ const build_commit_changes_markdown = (
354337
355338export const replace_commit_symbol = async ( params : {
356339 instruction : string
357- after_context ?: boolean
358340} ) : Promise < string > => {
359- const regex = / # C o m m i t : ( [ ^ : ] + ) : ( [ a - f A - F 0 - 9 ] + ) \s * (?: " ( [ ^ " ] * ) " ) ? / g
360- if ( params . after_context ) {
361- return params . instruction . replace (
362- regex ,
363- ( _match , _folder_name , _commit_hash , commit_message ) => {
364- if ( commit_message ) return `(Commit: ${ commit_message } )`
365- return '(Commit)'
366- }
367- )
368- }
341+ const regex = / # C o m m i t : ( [ ^ : ] + ) : ( [ a - f A - F 0 - 9 ] + ) \s * (?: " ( (?: [ ^ " \\ ] | \\ .) * ) " ) ? / g
369342
370343 let result_instruction = params . instruction
371344 const matches = [ ...result_instruction . matchAll ( regex ) ]
@@ -379,7 +352,7 @@ export const replace_commit_symbol = async (params: {
379352 const full_match = match [ 0 ]
380353 const folder_name = match [ 1 ]
381354 const commit_hash = match [ 2 ]
382- const commit_message = match [ 3 ]
355+ const commit_message = match [ 3 ] ?. replace ( / \\ ( . ) / g , '$1' )
383356
384357 const target_folder = workspace_folders . find (
385358 ( folder ) => folder . name === folder_name
@@ -452,13 +425,10 @@ const build_context_at_commit_xml = (
452425
453426export const replace_context_at_commit_symbol = async ( params : {
454427 instruction : string
455- after_context ?: boolean
456428 workspace_provider : WorkspaceProvider
457429} ) : Promise < string > => {
458- const regex = / # C o n t e x t A t C o m m i t : ( [ ^ : ] + ) : ( [ a - f A - F 0 - 9 ] + ) \s * (?: " ( [ ^ " ] * ) " ) ? / g
459- if ( params . after_context ) {
460- return params . instruction . replace ( regex , '<archive/>' )
461- }
430+ const regex =
431+ / # C o n t e x t A t C o m m i t : ( [ ^ : ] + ) : ( [ a - f A - F 0 - 9 ] + ) \s * (?: " ( (?: [ ^ " \\ ] | \\ .) * ) " ) ? / g
462432
463433 let result_instruction = params . instruction
464434 const matches = [ ...result_instruction . matchAll ( regex ) ]
0 commit comments