Skip to content

Commit

Permalink
Add hash warning
Browse files Browse the repository at this point in the history
  • Loading branch information
ggodlewski committed Dec 13, 2024
1 parent cde32cc commit 801b067
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/containers/transform/TransformContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,16 @@ export class TransformContainer extends Container {
newContent = newContent.replace(/(gdoc:[A-Z0-9_-]+)(#[^'")\s]*)?/ig, (str: string) => {
let fileId = str.substring('gdoc:'.length).replace(/#.*/, '');
let hash = getUrlHash(str) || '';
if (hash && this.globalHeadersMap[str]) {
const idx = this.globalHeadersMap[str].indexOf('#');
if (idx >= 0) {
fileId = this.globalHeadersMap[str].substring('gdoc:'.length, idx);
hash = this.globalHeadersMap[str].substring(idx);
if (hash) {
if (this.globalHeadersMap[str]) {
const idx = this.globalHeadersMap[str].indexOf('#');
if (idx >= 0) {
fileId = this.globalHeadersMap[str].substring('gdoc:'.length, idx);
hash = this.globalHeadersMap[str].substring(idx);
}
} else {
const fullLink = str;
this.logger.warn(`In ${fileName} there is a link to ${fullLink} which can't be translated into bookmark link`);
}
}
const lastLog = this.localLog.findLastFile(fileId);
Expand Down

0 comments on commit 801b067

Please sign in to comment.