Skip to content

Commit

Permalink
Fix a sitegen problem with Blorbs - when the file doesn't have an ext…
Browse files Browse the repository at this point in the history
…ension, Babel prints an extra warning
  • Loading branch information
curiousdannii committed Feb 4, 2024
1 parent 1cafb48 commit d491f07
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test-and-deploy.yml
Expand Up @@ -11,7 +11,7 @@ jobs:
build-emglken:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get Emglken commit ref
Expand All @@ -35,10 +35,10 @@ jobs:
needs: build-emglken
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
Expand Down
3 changes: 3 additions & 0 deletions src/iplayif.com/app/src/metadata.ts
Expand Up @@ -120,6 +120,9 @@ export async function get_metadata(file_name: string, file_path: string) {
}

const identify_data = identify_results.stdout.split('\n')
if (identify_data[0].startsWith('Warning: Story format could not be positively identified. Guessing')) {
identify_data.shift()
}

const [babel_format] = identify_data[2].split(',')
const result = new FileMetadata(file_name, stats.size, parchment_formats[babel_format], /IFID: ([-\w]+)/i.exec(identify_data[1])![1])
Expand Down
12 changes: 10 additions & 2 deletions src/iplayif.com/app/src/templates.ts
Expand Up @@ -43,6 +43,10 @@ export function wrapper(opts: WrapperOptions) {
ul.list {
margin: 1em 0;
}
.Error {
font-family: monospace;
white-space: pre-wrap;
}
</style>
</head>
<body>
Expand All @@ -58,11 +62,15 @@ export function wrapper(opts: WrapperOptions) {
</html>`
}

export function error(msg: string) {
export function error(err: Error) {
return `
<div class="Description">
<p><b>Error:</b></p>
<p class="Error">${escape(msg)}</p>
<p class="Error">${escape(err.toString())}</p>
<details>
<summary>Stacktrace</summary>
<p class="Error">${escape(err.stack)}</p>
</details>
</div>`
}

Expand Down
2 changes: 1 addition & 1 deletion src/upstream/asyncglk

0 comments on commit d491f07

Please sign in to comment.