Skip to content

Commit

Permalink
Code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cedx committed Nov 2, 2024
1 parent f3bd236 commit fd44799
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions example/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ app.use (ctx, next) ->
# Render the view as HTML or PDF depending on content negotiation.
app.use (ctx) ->
items = [{name: "Arthion Xyrlynn"}, {name: "Elen Naenan"}, {name: "Paeris Xilmenor"}]
if ctx.accepts("pdf") then ctx.renderPdf("main", {items}) else ctx.render("main", {items})
if ctx.accepts "pdf" then ctx.renderPdf "main", {items} else ctx.render "main", {items}

# Start the application.
unless app.env is "test" then app.listen 3000, "127.0.0.1", -> console.log("Server listening on http://127.0.0.1:3000...")
unless app.env is "test" then app.listen 3000, "127.0.0.1", -> console.log "Server listening on http://127.0.0.1:3000..."
export default app;
2 changes: 1 addition & 1 deletion src/eta.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export eta = (application, rendererOptions = {}) ->
renderPdf = (view, data = {}, renderingOptions = {}) -> # coffeelint: disable-line = missing_fat_arrows
viewData = {@state..., data...}
html = await if renderingOptions.async then Promise.resolve renderer.render view, viewData else renderer.renderAsync view, viewData
pdf = await htmlToPdf(html, {browser: rendererOptions.browser, pdf: renderingOptions})
pdf = await htmlToPdf html, browser: rendererOptions.browser, pdf: renderingOptions
if renderingOptions.writeResponse ? yes
@body = pdf
@type = "pdf"
Expand Down
2 changes: 1 addition & 1 deletion src/puppeteer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import puppeteer from "puppeteer"
###*
# Converts the specified HTML code into a PDF document.
# @param {string} html TODO
# @param {{browser?: import("puppeteer").PuppeteerLaunchOptions, pdf?: import("puppeteer").PDFOptions}} options
# @param {Partial<{browser: import("puppeteer").PuppeteerLaunchOptions, pdf: import("puppeteer").PDFOptions}>} options
# @returns {Promise<Buffer>} TODO
###
export htmlToPdf = (html, options = {}) ->
Expand Down
2 changes: 1 addition & 1 deletion test/eta_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {after, before, describe, it} from "node:test"
import app from "../example/server.js"

###*
# Tests the features of the {@link render} and {@link renderPdf} functions.
# Tests the features of the `render()` and `renderPdf()` functions.
###
describe "eta()", ->
controller = new AbortController
Expand Down

0 comments on commit fd44799

Please sign in to comment.