public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Org to Markdown PHP_extra
@ 2019-10-16  0:11 Devin Prater
       [not found] ` <F995005F-67D2-4F84-961B-E9A4E9778219-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Devin Prater @ 2019-10-16  0:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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.


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

* Re: Org to Markdown PHP_extra
       [not found] ` <F995005F-67D2-4F84-961B-E9A4E9778219-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2019-10-16  9:38   ` BP Jonsson
       [not found]     ` <CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM=hFCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: BP Jonsson @ 2019-10-16  9:38 UTC (permalink / raw)
  To: pandoc-discuss


[-- 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

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

* Re: Org to Markdown PHP_extra
       [not found]     ` <CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM=hFCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2019-10-16 13:11       ` Devin Prater
  0 siblings, 0 replies; 3+ messages in thread
From: Devin Prater @ 2019-10-16 13:11 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

Yes, this works. Thank you so much!

> On Oct 16, 2019, at 4:38 AM, BP Jonsson <bpjonsson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> <div-to-aside.lua>


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

end of thread, other threads:[~2019-10-16 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16  0:11 Org to Markdown PHP_extra Devin Prater
     [not found] ` <F995005F-67D2-4F84-961B-E9A4E9778219-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-10-16  9:38   ` BP Jonsson
     [not found]     ` <CAFC_yuTgZCtpd5fNVBOR5ZaYF4G6jowF_9k2igOLq8nDM=hFCg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-16 13:11       ` Devin Prater

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).