* Parse paged media.
()
| 409 | */ |
| 410 | |
| 411 | function atpage() { |
| 412 | var pos = position(); |
| 413 | var m = match(/^@page */); |
| 414 | if (!m) return; |
| 415 | |
| 416 | var sel = selector() || []; |
| 417 | |
| 418 | if (!open()) return error("@page missing '{'"); |
| 419 | var decls = comments(); |
| 420 | |
| 421 | // declarations |
| 422 | var decl; |
| 423 | while ((decl = declaration())) { |
| 424 | decls.push(decl); |
| 425 | decls = decls.concat(comments()); |
| 426 | } |
| 427 | |
| 428 | if (!close()) return error("@page missing '}'"); |
| 429 | |
| 430 | return pos({ |
| 431 | type: 'page', |
| 432 | selectors: sel, |
| 433 | declarations: decls, |
| 434 | }); |
| 435 | } |
| 436 | |
| 437 | /** |
| 438 | * Parse document. |