public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: BP Jonsson <bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Org to Markdown PHP_extra
Date: Wed, 16 Oct 2019 11:38:09 +0200	[thread overview]
Message-ID: <CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM=hFCg@mail.gmail.com> (raw)
In-Reply-To: <F995005F-67D2-4F84-961B-E9A4E9778219-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2899 bytes --]

This should be possible to fix with a Lua filter. If, as is likely,
Pandoc's org reader converts the org asides into divs with a class "aside"
a filter can "catch" those divs and insert the necessary raw HTML before
and after their content. I have attached a filter which should do the trick
if the Pandoc internal document data created by the org reader are as I
think they are. Usage instructions can be found at the top of the file.
Please let me know if this solves your problem. Quite likely you will get
blank lines between the opening and closing aside tags and the text between
them, but those should be harmless.

Den ons 16 okt. 2019 02:11Devin Prater <r.d.t.prater-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:

> Hi all. I’m attempting to move from org-mode exported HTML in Moodle
> courses I manage to simple, easily updated markdown, which I hope will be
> as powerful to write as Org-mode. Moodle, for some reason, uses PHP
> Markdown, instead of Pandoc Markdown or even Multi-markdown. So, we do have
> definition lists, thankfully, but the <aside> element is made, from
> Org-mode, to the <div> with simply the class of aside, markdown =“1”. The
> only problem is, screen readers, which is why I use <aside> anyway, for
> blind people like myself to know that something is a note. This helps
> audit-orally separate notes from the main text, and probably does something
> visual too. I’d like this to simply be <aside markdown=“1”>
> Input:
>
> * Test of aside conversion to Markdown
> This is a paragraph.
>
> #+begin_aside
> This is a /note/.
> #+end_aside
> End of test.
>
> Output:
>
> Test of aside conversion to Markdown
> {#test-of-aside-conversion-to-markdown}
> ====================================
>
> This is a paragraph.
>
> <div class="aside" markdown="1">
>
> This is a *note*.
>
> </div>
>
> End of test.
>
>
> I hope this makes sense. I’m not a programmer, just the one in a million
> blind person that actually cares about formatting.
>
> --
> You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/F995005F-67D2-4F84-961B-E9A4E9778219%40gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM%3DhFCg%40mail.gmail.com.

[-- Attachment #1.2: Type: text/html, Size: 3888 bytes --]

[-- Attachment #2: div-to-aside.lua --]
[-- Type: application/octet-stream, Size: 899 bytes --]

-- div-to-aside.lua
--
-- Pandoc filter which converts divs with an "aside" class into HTML `<aside>` elements.
--
-- To use it place the filter file in the folder you are running pandoc from and add 
-- "--lua-filter=div-to-aside.lua" (without the quotes) to the pandoc command line.

local List = assert(
  pandoc.List or require"pandoc.List",
  "Couldn't find pandoc.List"
)

local open_aside = pandoc.RawBlock('html', '<aside>')
local close_aside = pandoc.RawBlock('html', '</aside>')

function Div (div)
  -- Do nothing unless we have an "aside" class
  if not div.classes:includes("aside") then return nil end
  -- Initialize the list to be returned
  -- with the opening aside tag
  local aside = List:new{open_aside}
  -- Add the contents of the div
  aside:extend(div.content)
  -- Add the closing aside tag
  aside:extend{close_aside}
  -- replace the div with the aside
  return aside
end

  parent reply	other threads:[~2019-10-16  9:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16  0:11 Devin Prater
     [not found] ` <F995005F-67D2-4F84-961B-E9A4E9778219-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-16  9:38   ` BP Jonsson [this message]
     [not found]     ` <CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM=hFCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-16 13:11       ` Devin Prater

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

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

  git send-email \
    --in-reply-to='CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM=hFCg@mail.gmail.com' \
    --to=bpjonsson-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.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.
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 NNTP newsgroup(s).