[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Raw Org AST snippets for "impossible" markup
From: |
Juan Manuel Macías |
Subject: |
Re: Raw Org AST snippets for "impossible" markup |
Date: |
Thu, 09 Dec 2021 22:27:08 +0000 |
Juan Manuel Macías writes:
> Jumping into the "real world", how about these two examples of nested
> emphasis?
By the way, what do you think about allowing the use of some kind of
aliases, so that the aspect is less verbose? Maybe something like "(i::"
instead of "(italic () ..."? I came up with this hasty sketch over your
latest code, *just* to see how it looks (I don't know if I prefer it to
stay verbose):
#+begin_src emacs-lisp :results silent
(setq orgia-alias-alist '(("i" "italic")
("b" "bold")
("u" "underline")
("s" "strike-through")))
(defun orgia-replace (before after)
(interactive)
(save-excursion
(goto-char (point-min))
(while (re-search-forward before nil t)
(replace-match after t nil))))
(defun orgia--transform-path (path)
(with-temp-buffer
(insert path)
(mapc (lambda (el)
(orgia-replace (concat "(" (car el) "::") (concat "(" (cadr el) "
() ")))
orgia-alias-alist)
(buffer-string)))
(defun orgia--transform-link (data)
(if (not (string-equal "orgia" (org-element-property :type data)))
data
(let* ((path (org-element-property :path data)))
(if (not (eq ?\( (aref path 0)))
(or path (org-element-contents data))
(read (orgia--transform-path path)))))) ;; <====
;;;;;;;;;;;;;;;;;;
#+end_src
#+begin_src elisp
(org-export-string-as "An <orgia:(\"in\" (s:: \"ter\"))>word"
'odt t)
#+end_src
#+RESULTS:
:
: <text:p text:style-name="Text_20_body">An in<text:span
text:style-name="Strikethrough">ter</text:span>word</text:p>
#+begin_src org :results latex :results replace
[[orgia:(i:: "The English versions of the " (b:: (i:: "Iliad")) " and the "
(b:: (i::
"Odyssey")))]]
#+end_src
#+RESULTS:
#+begin_export latex
\emph{The English versions of the \textbf{\emph{Iliad}} and the
\textbf{\emph{Odyssey}}}
#+end_export
------------------------------------------------------
Juan Manuel Macías
https://juanmanuelmacias.com/
- Re: Org-syntax: Intra-word markup, (continued)
- Re: Org-syntax: Intra-word markup, Juan Manuel Macías, 2021/12/04
- Raw Org AST snippets for "impossible" markup, Max Nikulin, 2021/12/06
- Re: Raw Org AST snippets for "impossible" markup, Juan Manuel Macías, 2021/12/06
- Re: Raw Org AST snippets for "impossible" markup, Juan Manuel Macías, 2021/12/06
- Re: Raw Org AST snippets for "impossible" markup, Max Nikulin, 2021/12/08
- Re: Raw Org AST snippets for "impossible" markup, Juan Manuel Macías, 2021/12/08
- Re: Raw Org AST snippets for "impossible" markup, John Kitchin, 2021/12/08
- Re: Raw Org AST snippets for "impossible" markup, Juan Manuel Macías, 2021/12/09
- Re: Raw Org AST snippets for "impossible" markup, Max Nikulin, 2021/12/09
- Re: Raw Org AST snippets for "impossible" markup, Juan Manuel Macías, 2021/12/09
- Re: Raw Org AST snippets for "impossible" markup,
Juan Manuel Macías <=
- Re: Org-syntax: Intra-word markup, Timothy, 2021/12/04
- Re: Org-syntax: Intra-word markup, Tom Gillespie, 2021/12/04
- Re: Org-syntax: Intra-word markup, Max Nikulin, 2021/12/06
- Re: Org-syntax: Intra-word markup, Denis Maier, 2021/12/06
Re: Org-syntax: Intra-word markup, autofrettage, 2021/12/02