Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Export quote blocks as blockquote #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

coldacid
Copy link

Adds HTML export of quote blocks within <blockquote> tags. The quoted content itself remains within a <p> tag as this appears to be the correct practice even as far back as HTML 4.0 (per its DTD, <blockquote> may only contain block elements inside, not free text as most people used).

Closes #5

@balddotcat
Copy link
Owner

hey @coldacid!

Thank you for the clean pull request! Very much appreciated, as I mentioned in the other ticket, my apologies for being absent. I was trying to find some time to plug this in myself, as it is utilized way more than I initially thought.

However, I'd have to disagree on the inclusion of the paragraph by default. I checked the spec, and it does state that for short snippets, one does not have to use p element inside blockquote elements.

From what I see, even more importantly, blockquotes are also considered to be 'sectioning roots', meaning that they really could have any content - including headers and the like. Making sure that this works downstream could really complicate things, as there just isn't one way that'll work for everybody - primarily, I'm thinking about the org markup around how one would handle these cases. I'll have to check what variations it can handle by default, as I have a feeling that this in itself might be a little iffy, but in the meantime, I am open to suggestions.

Thanks again!

@coldacid
Copy link
Author

The inclusion of the paragraph is based on HTML 4.0's DTD. Like you mentioned as a sectioning root <blockquote> can contain anything, but sectioning roots are an HTML5 concept. Putting the content inside a paragraph inside a block quote is most compatible for both HTML versions.

@balddotcat
Copy link
Owner

Without going into too much detail, my general workflow with slimhtml is to extend the base functionality it provides with derived backends.

That is to say, in your case, I'd do something like this;

(org-export-define-derived-backend
 'html4project
 :translate-alist
 '((blockquote . html4project-blockquote)))

With this method, I can create a set of project-specific layout logic within this function, instead of littering up the org source. From my perspective, this isolates each task's complexity into small components I can re-use, usually at the expense of copying a couple lines over. slimhtml outputs html, but that is only a by-product of the flexibility of org's export mechanism.

Therefore, what I'd suggest, is leaving the default blockquote tag without a paragraph element (this meets the slimhtml's minimal requirement) - but creating a function that does have the paragraph element, which can be hooked up as above. This would work for any other elements as well - it could become a little library of functions... (in this case I'd also suggest a version where the cite (etc) elements are present within the dom.)

I am in the process of circling back to a more detailed explanation, but hopefully this communicates some of my intents with this this package - I'll keep you posted when it's ready.

@coldacid
Copy link
Author

Well, if the goal is that default slimhtml output is just plain HTML5, I have no problem changing this to pull out the paragraph tag.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support quote blocks
2 participants