aboutsummaryrefslogtreecommitdiff
path: root/sample-question-unauthenticated.el
blob: 6adc9bb234fa66056c2e1c93ac8bd30c3aca46ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(defvar sample-question-unauthenticated
  (json-read-file "sample-question-unauthenticated.json"))
(defvar sample-frontpage
  (json-read-file "sample-frontpage.json"))

;;; A sample of data offered by the question object, without authentication.
;; (pp sample-question-unauthenticated (current-buffer))

(defun sample-question-markdown ()
  "Renders the question list usiong markdown for the content.
Doesn't seem like markdown gets fontified. Which is disapointing. :-("
  (interactive)
  (find-file "sample.org")
  (setf (buffer-string)
        (org-element-interpret-data
         (stack-lto--question sample-question-unauthenticated))))

(defun sample-frontpage-markdown ()
  "Renders the question list usiong markdown for the content.
Doesn't seem like markdown gets fontified. Which is disapointing. :-("
  (interactive)
  (find-file "sample.org")
  (erase-buffer)
  (mapcar
   (lambda (x) 
     (insert 
      (org-element-interpret-data
       (stack-lto--question x))))
   (nthcdr 25 (mapcar #'identity (cdr (assoc 'items sample-frontpage)))))
  (org-global-cycle 1)
  (stack-navigation-mode))

(defun sample-frontpage-html ()
  "Renders the question list usiong markdown for the content.
Doesn't seem like markdown gets fontified. Which is disapointing. :-("
  (interactive)
  (let ((stack-lto-body-src-block nil))
    (sample-frontpage-markdown)))

(provide 'sample-question-unauthenticated)