public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Best Markdown markup for LaTeX environment with arguments
@ 2022-06-15  3:15 Lyndon Drake
       [not found] ` <6667603d-bd7c-4a1f-aa97-4198aabfddc8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Lyndon Drake @ 2022-06-15  3:15 UTC (permalink / raw)
  To: pandoc-discuss


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

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6667603d-bd7c-4a1f-aa97-4198aabfddc8n%40googlegroups.com.

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

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

* AW: Best Markdown markup for LaTeX environment with arguments
       [not found] ` <6667603d-bd7c-4a1f-aa97-4198aabfddc8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-06-15  7:27   ` denis.maier-NSENcxR/0n0
  0 siblings, 0 replies; 2+ messages in thread
From: denis.maier-NSENcxR/0n0 @ 2022-06-15  7:27 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

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

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

end of thread, other threads:[~2022-06-15  7:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15  3:15 Best Markdown markup for LaTeX environment with arguments Lyndon Drake
     [not found] ` <6667603d-bd7c-4a1f-aa97-4198aabfddc8n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-15  7:27   ` AW: " denis.maier-NSENcxR/0n0

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