-
While trying to render a bibliography in Markdown, I noticed it is extremely similar to the HTML render, apart from a couple minor discrepancies. The two differences I spotted are:
HTML rendered code: [8]: Wikipedia Contributors. <em>Cartesian coordinate system</em>. June, 2019. <a href="https://en.wikipedia.org/wiki/Cartesian_coordinate_system">https://en.wikipedia.org/wiki/Cartesian_coordinate_system</a>. What the Markdown should be rendered as: [8]: Wikipedia Contributors. *Cartesian coordinate system*. June, 2019. <https://en.wikipedia.org/wiki/Cartesian_coordinate_system>. The only modifications required in the HTML code to render as Markdown, are the following:
For example, here: Drasil/code/drasil-printers/lib/Language/Drasil/HTML/Print.hs Lines 426 to 456 in 85cf74d What is the best way to leverage the HTML bib renderer, while minimizing code duplication? This is similar to the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
@JacquesCarette Bilal and I briefly spoke about this in person before deciding to move to here. Do you think a plate-based design for defining rendering functions would be helpful in solving these issues without needing to resort to more complicated recursion patterns? I only recently (briefly) read into it, but haven't practised it yet, so I can't confidently say anything about it. |
Beta Was this translation helpful? Give feedback.
-
I forgot about this. Another solution is to do something like the following:
data Typewriter = Typewriter {
s :: Doc -> Doc, -- this one for plain strings (i.e., this one needs to be responsible for escaping special characters)
ital :: Doc -> Doc,
bold :: Doc -> Doc,
italBold :: Doc -> Doc,
underscore :: Doc -> Doc
}
mdTypewriter :: Typewriter
mdTypewriter = Typewriter { ... }
htmlTypewriter :: Typewriter
htmlTypewriter = Typewriter { ... }
mdBookMLA :: ...
mdBookMLA = bookMLA mdTypewriter
htmlBookMLA :: ...
htmlBookMLA = bookMLA htmlTypewriter What do you think @BilalM04 ? I think the plate approach is unneeded. This is just as good. |
Beta Was this translation helpful? Give feedback.
I forgot about this. Another solution is to do something like the following:
Typewriter
for both flavoursTypewriter
as an argument to the existingbookMLA
andpSpec
and use the feature…