emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt Price <moptop99@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: creating new #+KEYWORD: variables
Date: Sat, 10 Nov 2018 11:17:47 -0500	[thread overview]
Message-ID: <CAN_Dec8xEp443Fd72d3TGHt8bkyVT8pvNimvNds5Cm1YwfVwHA@mail.gmail.com> (raw)
In-Reply-To: <87h8gpcs86.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 2674 bytes --]

On Sat, Nov 10, 2018 at 2:22 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Matt Price <moptop99@gmail.com> writes:
>
> > I am writing this interface to my university's learning management
> system:
> >
> https://github.com/titaniumbones/Org-Marking-Mode/tree/use-structured-course-def
> .
> > I am only using hte exporting system tangentially and I have not defined
> a
> > new exporter. However, I would really like to be able to set some
> variable
> > values in the header section of hte document, e.g.:
> >
> > #+ORG_LMS_COURSE: becomingmodern
>
> You can add keywords specific to a given export back-end in its
> definition, more precisely in :options-alist value. For example, in
> "ox-texinfo", there is
>
>     (org-export-define-backend 'texinfo
>       '((bold . org-texinfo-bold))
>       ...
>       :options-alist
>       '((:texinfo-filename "TEXINFO_FILENAME" nil nil t)
>         ...))
>
> which means `texinfo' back-end should recognize the "#+TEXINFO_FILENAME"
> keyword, and store its value in the :texinfo-filename property from
> "info" paramater, which is passed to each function.
>
> You can write a derived back-end using this new keyword, along with
> a template function that actually uses it. Look at the definition of
> `beamer' back-end for an example.
>
> Thank you as always, Nicolas. I have not written a derived backend for
this, though I guess many of the functions are export-like and in osme ways
thatwould make a lot of sense. But I also need to use the course id to
receive data from the courseware server, so for instance, right now I have
this code:

------
(defun org-lms-get-students (&optional course)
  (unless course
    (setq course org-lms-course))
  (let* ((courseid (plist-get course :id))
         (result
         (org-lms-canvas-request (format "courses/%s/users" courseid) "GET"
                                 '(("enrollment_type[]" . "student")
                                   ("include[]" . "email")))))
    (message "RESULTS")
    ;;(with-temp-file "students-canvas.json" (insert result))
    (loop for student in-ref result
          do
          (if (string-match "," (plist-get student :sortable_name))
              (let ((namelist  (split-string (plist-get student
:sortable_name) ", ")))
                (plist-put student :lastname (car namelist) )
                (plist-put student :firstname (cadr namelist)))))
    result))

---

Is there aclever way to extract the value of ~org-lms-course~ from the
exporter even if what I'm doing really isn't an export? I'm actually
harvesting JSON data  from the server, rather than producing an export
file.


> HTH,
>
> --
> Nicolas Goaziou
>

[-- Attachment #2: Type: text/html, Size: 3982 bytes --]

  reply	other threads:[~2018-11-10 16:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-09  3:32 creating new #+KEYWORD: variables Matt Price
2018-11-09  9:29 ` Diego Zamboni
2018-11-10  2:24   ` Matt Price
2018-11-10  7:22 ` Nicolas Goaziou
2018-11-10 16:17   ` Matt Price [this message]
2018-11-10 17:11     ` John Kitchin
2018-11-10 18:58       ` Nicolas Goaziou
2018-11-15 12:15         ` Matt Price
2018-11-15 19:51           ` John Kitchin
2018-11-12  9:11   ` Diego Zamboni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAN_Dec8xEp443Fd72d3TGHt8bkyVT8pvNimvNds5Cm1YwfVwHA@mail.gmail.com \
    --to=moptop99@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).