Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html/xhtml: put <P> inside <BLOCKQUOTE> #1

Open
GoogleCodeExporter opened this issue Apr 18, 2015 · 4 comments
Open

html/xhtml: put <P> inside <BLOCKQUOTE> #1

GoogleCodeExporter opened this issue Apr 18, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

In XHTML, the BLOCKQUOTE tag must have block elements inside. So any paragraph 
must be 
declared inside it:

<blockquote><p>Hello World.</p></blockquote>

Currently txt2tags doesn't add the P tag.

This rule may not be true in HTML, check it.

Original issue reported on code.google.com by aureliojargas@gmail.com on 5 Aug 2008 at 8:14

@GoogleCodeExporter
Copy link
Author

Comments by Raicho Nikolov:

I think I have an idea which can help you to solve the problem.

I have made a filter which put blockquotes without a problem.  Txt2tags 
naturally puts <p> tag inside. The filter is this:

%!postproc(xhtml):  {"  <blockquote>
%!postproc(xhtml):  "}  </blockquote>

So I have to write:

""" {"
alabala

""" "}

to have <blockquote> block

That's ugly and is not my suggestion - it only shows how it works. (although it 
has one advantage over the "natural way" - you 
can use it in web pages)

The idea is to have some close element for this kind of blocks. For example for 
lists we have a closing with two blank lines. 
Thus the program will know where the element starts and where the element ends. 

Opening and closing tag must differ - for example tab opens and two blank lines 
close. This way the markup will not change 
much. Probably this is doable with Pre-Post-Processing.

I hope that I am on the right way and you get the idea
Raicho

Original comment by aureliojargas@gmail.com on 5 Aug 2008 at 8:16

@GoogleCodeExporter
Copy link
Author

Check if in XHTML we can omit the P tag if there's only one paragraph inside 
it: <blockquote>Foo 
bar.</blockquote>.

If yes, an ideal solution would be to add the P tags only if there's two or 
more paragraph inside the quote.

But this could cause CSS troubles since we would have BLOCKQUOTE with and 
without P tags inside. Maybe it's 
best to just add it everytime, so the user knows it's always there.

Original comment by aureliojargas@gmail.com on 16 Dec 2008 at 1:43

@GoogleCodeExporter
Copy link
Author

Another change to the txt2tags would be to detect consecutive quotes (even with 
blank lines between) and join 
them in one big quote (fixing a longstanding txt2tags limitation of 
one-paragraph-only quotes).

It's easy to do in the current code, checking for BlockMaster.last contents.

Original comment by aureliojargas@gmail.com on 16 Dec 2008 at 1:45

@GoogleCodeExporter
Copy link
Author

I worked around this problem by modifying txt2tags to place the '<p>' & '</p>' 
tags on the first & last lines of the paragraph's 
text.  This makes it easy to add <div> as well as <blockquote> & any others 
that shouldn't be placed inside  <p>…</p>.

With my change I then also need to add the following to strip the superfluous 
<p>s:
    %!postproc: '<p>(<(div|blockquote)[ >])'    '\1'
    %!postproc: '</(div|blockquote)></p>'       '</\1>'

I originally made the change because I needed to add 'class' properties to 
certain block tags to assist CSS styling.

The patch is quite small.  I'll post it if there's interest.

Original comment by chris...@gmail.com on 19 May 2010 at 2:31

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

No branches or pull requests

1 participant