krz/orgo

Lightning fast org-mode static site generator.

clone: git clone https://gitbay.org/krz/orgo.git

v0.20.2: tests/oracle.el · raw

 1;;; oracle.el --- ground-truth HTML export for the orgo differential tests  -*- lexical-binding: t -*-
 2
 3;; Exports the org file named by $ORG_ORACLE_INPUT to HTML on stdout, using org's own
 4;; exporter — the same one weblorg wraps to publish the corpus this project targets.
 5;; Run with:  ORG_ORACLE_INPUT=x.org emacs -Q --batch -l tests/oracle.el
 6;;
 7;; `-Q' is deliberate: no user init, so the oracle is the stock org exporter and not
 8;; this machine's Emacs configuration. The path is passed by environment variable
 9;; rather than as an argument because batch Emacs would otherwise try to visit it.
10
11(require 'org)
12(require 'ox-html)
13
14;; Presentation settings are normalized so the diff carries semantic divergences only.
15;; Everything that affects *content* is left at its default, because the point is to
16;; learn what stock org does — normalizing that away would be marking our own homework.
17(setq org-export-with-toc nil              ; we emit no table of contents
18      org-export-with-section-numbers nil  ; we do not number headings
19      ;; org-html-toplevel-hlevel is left at its default of 2. orgo's own default
20      ;; heading_offset is 1, which produces the same <h2>, so both sides now agree
21      ;; without the oracle being told to.
22      org-html-htmlize-output-type nil     ; plain <pre>, not htmlize spans: we highlight
23                                           ; with syntect, so comparing code *text* is
24                                           ; the meaningful part
25      org-html-head-include-default-style nil
26      org-html-head-include-scripts nil
27      ;; Fixtures link to ids that live in orgo's own symbol table, not in an
28      ;; `org-id' database. Without this, org aborts the whole export on the first one.
29      org-export-with-broken-links t
30      make-backup-files nil)
31
32(let ((input (getenv "ORG_ORACLE_INPUT")))
33  (unless input
34    (error "ORG_ORACLE_INPUT is not set"))
35  (with-temp-buffer
36    (insert-file-contents input)
37    (org-mode)
38    ;; BODY-ONLY: emit the content, not a full document with <head> chrome.
39    (princ (org-export-as 'html nil nil t nil))))
40
41;;; oracle.el ends here