unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Request to add tomelr package to GNU ELPA
@ 2022-05-03 10:57 Kaushal Modi
  2022-05-03 13:09 ` Stefan Monnier
                   ` (2 more replies)
  0 siblings, 3 replies; 32+ messages in thread
From: Kaushal Modi @ 2022-05-03 10:57 UTC (permalink / raw)
  To: Emacs developers

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

Hello,

I have been working on a small library very much inspired and reused from
the core library json.el.

The library is called tomelr, and it does just one job: convert the input
lisp S-exp (alist or plist) to a TOML (see https://toml.io) config string.

Purpose: I plan to replace a lot of custom logic for TOML generation in my
ox-hugo package (Org mode to Markdown exporter for Hugo static site
generator) with this dedicated and fully tested TOML generation library.

The source code is at https://github.com/kaushalmodi/tomelr.

Companion blog post: https://scripter.co/defining-tomelr/

The README.org on the repo has a lot more details, but here's a short
example of what this library does:

** Alist data

'((title . "Some Title") ;String
  (author . ("fn ln")) ;List
  (description . "some long description\nthat spans multiple\nlines")
;Multi-line string
  (date . 2022-03-14T01:49:00-04:00) ;RFC 3339 date format
  (tags . ("tag1" "tag2"))
  (draft . "false") ;Boolean
  (versions . ((emacs . "28.1.50") (org . "release_9.5-532-gf6813d"))) ;Map
or TOML Table
  (org_logbook . (((timestamp . 2022-04-08T14:53:00-04:00) ;Array of maps
or TOML Tables
                   (note . "This note addition prompt shows up on typing
the `C-c C-z` binding.\nSee [org#Drawers](
https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."))
                  ((timestamp . 2018-09-06T11:45:00-04:00)
                   (note . "Another note **bold** _italics_."))
                  ((timestamp . 2018-09-06T11:37:00-04:00)
                   (note . "A note `mono`.")))))

** Plist data

'(:title "Some Title" ;String
  :author ("fn ln") ;List
  :description "some long description\nthat spans multiple\nlines"
;Multi-line string
  :date 2022-03-14T01:49:00-04:00 ;RFC 3339 date format
  :tags ("tag1" "tag2")
  :draft "false" ;Boolean
  :versions (:emacs "28.1.50" :org "release_9.5-532-gf6813d") ;Map or TOML
Table
  :org_logbook ((:timestamp 2022-04-08T14:53:00-04:00 ;Array of maps or
TOML Tables
                 :note "This note addition prompt shows up on typing the
`C-c C-z` binding.\nSee [org#Drawers](
https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers).")
                (:timestamp 2018-09-06T11:45:00-04:00
                 :note "Another note **bold** _italics_.")
                (:timestamp 2018-09-06T11:37:00-04:00
                 :note "A note `mono`.")))

** TOML Output

You will get the below TOML output for either of the above input data.

title = "Some Title"
author = ["fn ln"]
description = """
some long description
that spans multiple
lines"""
date = 2022-03-14T01:49:00-04:00
tags = ["tag1", "tag2"]
draft = false
[versions]
  emacs = "28.1.50"
  org = "release_9.5-532-gf6813d"
[[org_logbook]]
  timestamp = 2022-04-08T14:53:00-04:00
  note = """
This note addition prompt shows up on typing the `C-c C-z` binding.
See [org#Drawers](
https://www.gnu.org/software/emacs/manual/html_mono/org.html#Drawers)."""
[[org_logbook]]
  timestamp = 2018-09-06T11:45:00-04:00
  note = "Another note **bold** _italics_."
[[org_logbook]]
  timestamp = 2018-09-06T11:37:00-04:00
  note = "A note `mono`."


Thanks!

--
Kaushal Modi

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

^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2022-05-06 23:19 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-03 10:57 Request to add tomelr package to GNU ELPA Kaushal Modi
2022-05-03 13:09 ` Stefan Monnier
2022-05-03 14:29   ` Kaushal Modi
2022-05-03 14:38     ` Stefan Monnier
2022-05-04  7:10       ` Robert Pluim
2022-05-04 13:02         ` Stefan Monnier
2022-05-05 18:36           ` Richard Stallman
2022-05-05 21:16             ` Kaushal Modi
2022-05-03 14:31   ` tomas
2022-05-03 16:07 ` João Pedro
2022-05-03 16:45   ` Kaushal Modi
2022-05-03 17:41     ` Stefan Monnier
2022-05-03 17:51       ` Kaushal Modi
2022-05-03 18:01     ` João Pedro
2022-05-03 21:39       ` Kaushal Modi
2022-05-03 22:41         ` Stefan Monnier
2022-05-03 22:56           ` Kaushal Modi
2022-05-03 23:02             ` Stefan Monnier
2022-05-04  0:40               ` Kaushal Modi
2022-05-04  2:10                 ` Stefan Monnier
2022-05-04  2:37                   ` Kaushal Modi
2022-05-04 12:40                 ` Unable to get .elpaignore to work [Was: Request to add tomelr package to GNU ELPA] Kaushal Modi
2022-05-04 12:52                   ` Kaushal Modi
2022-05-04 13:06                     ` Kaushal Modi
2022-05-04 13:18                       ` Stefan Monnier
2022-05-04 15:03                       ` Stefan Monnier
2022-05-04 15:06                         ` Kaushal Modi
2022-05-04 15:11                           ` Stefan Monnier
2022-05-04 21:14                             ` Kaushal Modi
2022-05-04 22:47 ` Request to add tomelr package to GNU ELPA Richard Stallman
2022-05-05 21:05   ` Kaushal Modi
2022-05-06 23:19     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).