-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trying to implement ldita-bootstrap.lunr in the bootstrap ditaot plugin but facing some error #23
Comments
Hi Gurushesh, Did you figure this out already? I have encountered the same issue, and been trying to debug it. I suspect this has something to do with the file paths created by the plugin. They contain a mix of forward and backslashes, and when a backslash is combined with a certain letter (G in your case, for me it was S), the JSON parsing fails and the index is not created. It's a case of JSON escape characters. Here's a screenshot of the invalid JSON file in my test case. You can see that all first level file paths are correct, but more than one level deep all the slashes are backslashes, which the JSON parser tries to interpret as escape characters: If you want to confirm this, try building a simple test map with topics in only one folder. The build should work ok. |
I suspect this is a combination of two things:
That would leave JSON Would a simple ANT dita uninstall dita-bootstrap.lunr
dita install https://github.com/jason-fox/dita-bootstrap.lunr/archive/feature/slash.zip Since I don't run on Windows, I can't reproduce this test case. |
With the fix @jason-fox provided the build doesn't fail. However, the file paths in preview.json still contain the In this case, the search is unable to find the topic with the corrupted link. |
That just requires the same fix to be applied to the other file. see here - try pulling again. |
Works like a charm now. The JSON is valid and the search is working. |
* release/5.3.4: (21 commits) Bump plug-in version attribute to 5.3.4 Bump prettier from 3.1.1 to 3.2.5 (#42) Migrate Husky to v9 Bump husky from 8.0.3 to 9.0.10 (#41) Use depend.preprocess.post endpoint (#40) Bump lint-staged from 15.2.0 to 15.2.1 (#37) Convert Prettier runtime config to YAML Bump prettier from 3.1.0 to 3.1.1 (#36) Preserve unstaged changes with the --no-stash flag Bump lint-staged from 15.0.2 to 15.2.0 (#35) Bump prettier from 3.0.3 to 3.1.0 (#33) Fix close button (#31) Reverse backslashes for Windows Filepath (#30) Add Greek language (#29) Fix #23 - Switch link backslash to forward slash (#28) Bump @prettier/plugin-xml from 3.2.1 to 3.2.2 (#27) Bump lint-staged from 14.0.1 to 15.0.2 (#26) Bump lunr-languages from 1.13.0 to 1.14.0 (#25) Bump actions/setup-node from 3 to 4 (#24) Bump actions/checkout from 3 to 4 (#22) ...
[gen-index-json] Result: 1
[gen-index-json] node:internal/modules/cjs/loader:1325
[gen-index-json] throw err;
[gen-index-json] ^
[gen-index-json]
[gen-index-json] SyntaxError: C:\Users\Admin\AppData\Local\Temp\temp20231019184255754\lunr.json: Unexpected token G in JSON at position 38
[gen-index-json] at parse ()
[gen-index-json] at Module._extensions..json (node:internal/modules/cjs/loader:1322:39)
[gen-index-json] at Module.load (node:internal/modules/cjs/loader:1117:32)
[gen-index-json] at Module._load (node:internal/modules/cjs/loader:958:12)
[gen-index-json] at Module.require (node:internal/modules/cjs/loader:1141:19)
[gen-index-json] at require (node:internal/modules/cjs/helpers:110:18)
[gen-index-json] at Object. (C:\Users\Admin\AppData\Local\Temp\temp20231019184255754\null10407635299677372326:10:19)
[gen-index-json] at Module._compile (node:internal/modules/cjs/loader:1254:14)
[gen-index-json] at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
[gen-index-json] at Module.load (node:internal/modules/cjs/loader:1117:32)
[gen-index-json]
[gen-index-json] Node.js v18.15.0
Error: Lunr.js failed to generate search index
The text was updated successfully, but these errors were encountered: