-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle sub pages regardless of location
- Loading branch information
Showing
4 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { ZipHandler } from '../../../lib/anki/zip'; | ||
import { PrepareDeck } from '../../../lib/parser/DeckParser'; | ||
import Package from '../../../lib/parser/Package'; | ||
import Settings from '../../../lib/parser/Settings'; | ||
|
||
export const getPackagesFromZip = async ( | ||
fileContents: string, | ||
isPatreon: boolean, | ||
settings: Settings | ||
) => { | ||
const zipHandler = new ZipHandler(); | ||
let hasMarkdown = false; | ||
const packages = []; | ||
|
||
await zipHandler.build(fileContents, isPatreon); | ||
|
||
for (const fileName of zipHandler.getFileNames()) { | ||
if (fileName.match(/.html$/)) { | ||
const d = await PrepareDeck(fileName, zipHandler.files, settings); | ||
if (d) { | ||
packages.push(new Package(d.name, d.apkg)); | ||
} | ||
} else if (fileName.match(/.md$/)) { | ||
hasMarkdown = true; | ||
} | ||
} | ||
|
||
return [packages, hasMarkdown]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters