File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 1
1
# Change Log
2
2
3
+ ## [ 0.10.2] - 2023-06-08
4
+
5
+ - Try to load bib files similar to v0.9.3 because the newer versions are not working for some users (issue #41 )
6
+
3
7
## [ 0.10.1] - 2023-06-08
4
8
5
9
- Try to fix citation autocompletion not showing up if a workspace is not loaded
Original file line number Diff line number Diff line change 2
2
"name" : " pandocciter" ,
3
3
"displayName" : " Pandoc Citer" ,
4
4
"description" : " Autocomplete bibtex citations for markdown/pandoc" ,
5
- "version" : " 0.10.1 " ,
5
+ "version" : " 0.10.2 " ,
6
6
"publisher" : " notZaki" ,
7
7
"license" : " MIT" ,
8
8
"engines" : {
Original file line number Diff line number Diff line change @@ -44,12 +44,26 @@ export class Manager {
44
44
45
45
findBib ( ) : void {
46
46
let foundFiles : string [ ] = [ ] ;
47
+ const activeText = vscode . window . activeTextEditor ! . document . getText ( ) ;
48
+
49
+ // Re-use the old reg-ex approach in case the yaml parser fails
50
+ const bibRegex = / ^ b i b l i o g r a p h y : \s * \[ ( .* ) \] / m;
51
+ let bibresult = activeText . match ( bibRegex ) ;
52
+ if ( bibresult ) {
53
+ const bibFiles = bibresult [ 1 ] . split ( ',' ) . map ( item => item . trim ( ) ) ;
54
+ for ( let i in bibFiles ) {
55
+ let bibFile = this . stripQuotes ( bibFiles [ i ] ) ;
56
+ bibFile = this . resolveBibFile ( bibFile , undefined ) ;
57
+ this . extension . log ( `Looking for .bib file: ${ bibFile } ` ) ;
58
+ this . addBibToWatcher ( bibFile ) ;
59
+ foundFiles . push ( bibFile ) ;
60
+ }
61
+ }
47
62
63
+ // This is the newer approach using yaml-js
48
64
const docURI = vscode . window . activeTextEditor ! . document . uri ;
49
65
const configuration = vscode . workspace . getConfiguration ( 'PandocCiter' , docURI ) ;
50
66
const rootFolder = vscode . workspace . getWorkspaceFolder ( docURI ) ?. uri . fsPath ;
51
-
52
- const activeText = vscode . window . activeTextEditor ! . document . getText ( ) ;
53
67
const yamltext = activeText . match ( / - - - \r ? \n ( ( .+ \r ? \n ) + ) - - - / gm)
54
68
const parsedyaml = yaml . loadAll ( yamltext ) [ 0 ]
55
69
if ( parsedyaml && parsedyaml . bibliography ) {
You can’t perform that action at this time.
0 commit comments