public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: <denis.maier-NSENcxR/0n0@public.gmane.org>
To: <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: AW: Best Markdown markup for LaTeX environment with arguments
Date: Wed, 15 Jun 2022 07:27:31 +0000	[thread overview]
Message-ID: <4756d51d223d433a9ea76b6695902ffc@unibe.ch> (raw)
In-Reply-To: <6667603d-bd7c-4a1f-aa97-4198aabfddc8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>

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

The syntax is this:
::: {.quote type="hebrew" ref="Jer 32.1–5"}
blabla
:::

This here:

::: quote
:::

is just a shorthand for
::: {.quote}
:::

See: https://pandoc.org/MANUAL.html#extension-fenced_code_attributes and https://pandoc.org/MANUAL.html#extension-fenced_divs

Anyway, here’s a minimal example how you can access the attributes :

```lua
function Div(el)
                if el.attributes.print == "yes" then return el end
                return {}
end
```

Run this on :

```md
asdf

::: {print="yes"}
this should show up
:::

::: {print="no"}
this should not show up
:::

asdf
```

Denis




Von: pandoc-discuss@googlegroups.com <pandoc-discuss@googlegroups.com> Im Auftrag von Lyndon Drake
Gesendet: Mittwoch, 15. Juni 2022 05:16
An: pandoc-discuss <pandoc-discuss@googlegroups.com>
Betreff: Best Markdown markup for LaTeX environment with arguments

Hi,

In my LaTeX preamble, I have a LaTeX environment which takes an argument, and I would like to map from my Markdown input document to that environment.

Specifically, I want to generate `csquotes` environments similar to these examples:

```
\begin{foreigndisplayquote}{hebrew}[Jer 32.1–5]
 הַדָּבָר אֲשֶׁר־הָיָה אֶל־יִרְמְיָהוּ מֵאֵת יְהוָה בִּשְׁנַת [בַּ][שָּׁנָה] הָעֲשִׂרִית לְצִדְקִיָּהוּ מֶלֶךְ יְהוּדָה הִיא הַשָּׁנָה שְׁמֹנֶה־עֶשְׂרֵה שָׁנָה לִנְבוּכַדְרֶאצַּר׃ ‎2‏ וְאָז חֵיל מֶלֶךְ בָּבֶל צָרִים עַל־יְרוּשָׁלִָם וְיִרְמְיָהוּ הַנָּבִיא הָיָה כָלוּא בַּחֲצַר הַמַּטָּרָה אֲשֶׁר בֵּית־מֶלֶךְ יְהוּדָה׃ ‎3‏ אֲשֶׁר כְּלָאוֹ צִדְקִיָּהוּ מֶלֶךְ־יְהוּדָה לֵאמֹר מַדּוּעַ אַתָּה נִבָּא לֵאמֹר כֹּה אָמַר יְהוָה הִנְנִי נֹתֵן אֶת־הָעִיר הַזֹּאת בְּיַד מֶלֶךְ־בָּבֶל וּלְכָדָהּ׃ ‎4‏ וְצִדְקִיָּהוּ מֶלֶךְ יְהוּדָה לֹא יִמָּלֵט מִיַּד הַכַּשְׂדִּים כִּי הִנָּתֹן יִנָּתֵן בְּיַד מֶלֶךְ־בָּבֶל וְדִבֶּר־פִּיו עִם־פִּיו וְעֵינָיו אֶת־עֵינָו [עֵינָיו] תִּרְאֶינָה׃ ‎5‏ וּבָבֶל יוֹלִךְ אֶת־צִדְקִיָּהוּ וְשָׁם יִהְיֶה עַד־פָּקְדִי אֹתוֹ נְאֻם־יְהוָה כִּי תִלָּחֲמוּ אֶת־הַכַּשְׂדִּים לֹא תַצְלִיחוּ׃ פ
\end{foreigndisplayquote}
\begin{displayquote}[Jer 32.1–5]
The word that came to Jeremiah from the LORD in the tenth year of King Zedekiah of Judah, which was the eighteenth year of Nebuchadrezzar. 2 At that time the army of the king of Babylon was besieging Jerusalem, and the prophet Jeremiah was confined in the court of the guard that was in the palace of the king of Judah...
\end{displayquote}
```
I had wondered about doing something similar to this:

```
::: quote {type="hebrew" ref="Jer 32.1–5"}
 הַדָּבָר אֲשֶׁר־הָיָה אֶל־יִרְמְיָהוּ מֵאֵת יְהוָה בִּשְׁנַת [בַּ][שָּׁנָה] הָעֲשִׂרִית לְצִדְקִיָּהוּ מֶלֶךְ יְהוּדָה הִיא הַשָּׁנָה שְׁמֹנֶה־עֶשְׂרֵה שָׁנָה לִנְבוּכַדְרֶאצַּר׃ ‎2‏ וְאָז חֵיל מֶלֶךְ בָּבֶל צָרִים עַל־יְרוּשָׁלִָם וְיִרְמְיָהוּ הַנָּבִיא הָיָה כָלוּא בַּחֲצַר הַמַּטָּרָה אֲשֶׁר בֵּית־מֶלֶךְ יְהוּדָה׃ ‎3‏ אֲשֶׁר כְּלָאוֹ צִדְקִיָּהוּ מֶלֶךְ־יְהוּדָה לֵאמֹר מַדּוּעַ אַתָּה נִבָּא לֵאמֹר כֹּה אָמַר יְהוָה הִנְנִי נֹתֵן אֶת־הָעִיר הַזֹּאת בְּיַד מֶלֶךְ־בָּבֶל וּלְכָדָהּ׃ ‎4‏ וְצִדְקִיָּהוּ מֶלֶךְ יְהוּדָה לֹא יִמָּלֵט מִיַּד הַכַּשְׂדִּים כִּי הִנָּתֹן יִנָּתֵן בְּיַד מֶלֶךְ־בָּבֶל וְדִבֶּר־פִּיו עִם־פִּיו וְעֵינָיו אֶת־עֵינָו [עֵינָיו] תִּרְאֶינָה׃ ‎5‏ וּבָבֶל יוֹלִךְ אֶת־צִדְקִיָּהוּ וְשָׁם יִהְיֶה עַד־פָּקְדִי אֹתוֹ נְאֻם־יְהוָה כִּי תִלָּחֲמוּ אֶת־הַכַּשְׂדִּים לֹא תַצְלִיחוּ׃ פ
:::
```

Then I could use BJP's lua filter to map the div to a class.

Does that seem like a plausible approach?

Within the lua Div(el) function, how can I get the attributes of the class, in my case `type` and `ref`?

Best regards,
Lyndon
--
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@googlegroups.com<mailto:pandoc-discuss+unsubscribe@googlegroups.com>.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6667603d-bd7c-4a1f-aa97-4198aabfddc8n%40googlegroups.com<https://groups.google.com/d/msgid/pandoc-discuss/6667603d-bd7c-4a1f-aa97-4198aabfddc8n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4756d51d223d433a9ea76b6695902ffc%40unibe.ch.

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

      parent reply	other threads:[~2022-06-15  7:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-15  3:15 Lyndon Drake
     [not found] ` <6667603d-bd7c-4a1f-aa97-4198aabfddc8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-15  7:27   ` denis.maier-NSENcxR/0n0 [this message]

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=4756d51d223d433a9ea76b6695902ffc@unibe.ch \
    --to=denis.maier-nsencxr/0n0@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).