Zim

Verbatim and Indented paragraphs need empty line around the block - breaks WYSIWYG

Bug #297932 reported by Simon
64
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Zim
Fix Released
High
Unassigned

Bug Description

It seems that Verbatim blocks only work when there is a clear line above the initial ''' syntax. After thinking about it for a while, I couldn't think of a good reason why, so I made a patch to change the behaviour. I'm not a Perl coder, so I daresay there are more elegant ways to achieve this, but this seems to work okay. If this is intended behaviour, and I've overlooked some pitfall or another, I'd be grateful to know about it.

Thanks!

Tags: wiki-source

Related branches

Revision history for this message
Simon (simonjwiles) wrote :
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

No direct example where this can go wrong but requiring the empty line makes it less likely to have conflicts with code snippets in the page. Since these blocks are always treated as paragraphs it feels logical to me to have empty lines surrounding them.

Changed in zim:
status: New → Incomplete
Revision history for this message
Simon (simonjwiles) wrote :

fair enough. since it was such a simple fix, I had a feeling it probably hadn't been overlooked by accident. I find the necessity of a blank line before code snippets to be inconvenient, personally, (and with this addition to the code I can have it either way), so I think I'll keep using mine with the changed code, but I'll consider it a 'hack' rather than a 'fix'!!

Thanks for your thoughts on this, and for all your hard work :))

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Thinking a bit more about this I came to realize that for code snippets that actually contain ''' (like say a piece of puthon code) the empty line is not going to make a difference. Guess I will need to escape these somehow anyway :S

So we could accept the verbatim blocks without empty lines. Unless anyone else comes up with a counter example where this causes an issues. However I propose to keep the empty lines when automatically generating output from zim.

Revision history for this message
Simon (simonjwiles) wrote :

Yeah, that sounds good. My concern was two-fold: firstly, I couldn't work out why verbatim blocks in notes converted from tomboy weren't coming out right; and secondly, I would select a block of text, use ctrl+t to put it into a fixed-width font, and a blank new line would be created. I would shrug, delete the unwanted blank line, and move on. However, revisiting the page would then show text without the verbatim formatting, and the orphaned `'''`.

This is why it struck me that perhaps I ought to report it as a bug.

Thanks again!

Changed in zim:
importance: Undecided → Low
status: Incomplete → Triaged
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Patch committed to trunk

Changed in zim:
status: Triaged → Fix Committed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fixed in 0.28

Changed in zim:
status: Fix Committed → Fix Released
Revision history for this message
Oliver Joos (oliver-joos) wrote :

I see this issue again in zim 0.43 (on Ubuntu 9.10).
Like Simon, I'd prefer too to be able to omit the empty lines around verbatim blocks.

Changed in zim:
status: Fix Released → Confirmed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Changed title of this issue to make it a bit more generic.

summary: - rendering of verbatim blocks breaks
+ Verbatim and Indented paragraphs need empty line around the block -
+ breaks WYSIWYG
Changed in zim:
importance: Low → High
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Committed quick HACK to rev216. Need to adjust semantics of the parse tree for a systematic fix.

Changed in zim:
status: Confirmed → In Progress
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

... make that rev217

Revision history for this message
Oliver Joos (oliver-joos) wrote :

I tested rev224 and confirm that the PRECEDING empty line is no more necessary and is also deletable within zim.

But I was not able to omit the empty line AFTER a verbatim block - not within zim, nor by editing the underlying txt-file and Reload it in zim. Without the empty line WYSIWYG breaks and I see the ''' in zim. The empty line after an indented block can be deleted, but only by editing the underlying txt-file and Reload it.

Revision history for this message
Fabian Stanke (fmos) wrote :

Although not connected to verbatim blocks, I would like to remark another small glitch:

Indenting the second of three lines in paragraph, inserts an empty line below it in the underlying txt-file but does not show that new empty line in the editor without a manual reload of the page.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 297932] Re: Verbatim and Indented paragraphs need empty line around the block - breaks WYSIWYG

On Mon, May 24, 2010 at 8:33 AM, Fabian Moser
<email address hidden> wrote:
> Although not connected to verbatim blocks, I would like to remark
> another small glitch:

If you think this is not related please open a new bug report instead
of appending here. We can merge reports later, but untangling them is
difficult.

> Indenting the second of three lines in paragraph, inserts an empty line
> below it in the underlying txt-file but does not show that new empty
> line in the editor without a manual reload of the page.

Not sure what the bug is here. When you edit the underlying text file
while zim is still open you always need a manual reload to see the
changes.

-- Jaap

Revision history for this message
Fabian Stanke (fmos) wrote : Re: [Bug 297932] Re: Verbatim and Indented paragraphs need empty line around the block - breaks WYSIWYG

Am 25.05.2010 12:06, schrieb Jaap Karssenberg:
> If you think this is not related please open a new bug report instead
> of appending here. We can merge reports later, but untangling them is
> difficult.

OK, for the time being I have filed a separate bug under
https://bugs.launchpad.net/zim/+bug/586296

> Not sure what the bug is here. When you edit the underlying text file
> while zim is still open you always need a manual reload to see the
> changes.

Sorry for the misunderstanding, but I didn't edit the text file manually
at any point. Please read the bug report linked above and decide for
yourself if you consider this a bug or not.

Cheers,
Fabian

Revision history for this message
Fabian Stanke (fmos) wrote :

I would like to help fixing this bug, but I need to be sure to understand the intended behaviour.

From the previous comments (mainly comment #4 from Jaap) I understood that Zim should insert empty lines around verbatim blocks, if necessary, to separate them from adjacent blocks (be it other verbatim blocks or text paragraphs).
At the same time Zim should be able to cope with files that are missing those empty lines around verbatim blocks. Zim should display these files as if they contained the empty lines and save them accordingly (with the empty lines inserted).

Please confirm, if my description of the intended behaviour is correct.

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 297932] Re: Verbatim and Indented paragraphs need empty line around the block - breaks WYSIWYG

On Mon, Jun 7, 2010 at 7:02 PM, Fabian Moser
<email address hidden> wrote:
> I would like to help fixing this bug, but I need to be sure to
> understand the intended behaviour.
>
> >From the previous comments (mainly comment #4 from Jaap) I understood that Zim should insert empty lines around verbatim blocks, if necessary, to separate them from adjacent blocks (be it other verbatim blocks or text paragraphs).
> At the same time Zim should be able to cope with files that are missing those empty lines around verbatim blocks. Zim should display these files as if they contained the empty lines and save them accordingly (with the empty lines inserted).
>
> Please confirm, if my description of the intended behaviour is correct.

This was indeed how it was implemented in the perl version. However
recent discussions about WYSIWYG have led me to consider whether we
should remove the requirement to have empty lines completely.

Currently verbatim blocks are considered as paragraphs. However we
could change that to multi-line blocks within a paragraph.

-- Jaap

Revision history for this message
Fabian Stanke (fmos) wrote : Re: [Bug 297932] Re: Verbatim and Indented paragraphs need empty line around the block - breaks WYSIWYG

On Mon, 07 Jun 2010 18:49:57 -0000
Jaap Karssenberg <email address hidden> wrote:

> Currently verbatim blocks are considered as paragraphs. However we
> could change that to multi-line blocks within a paragraph.

To be sure everyone involved has the same understanding of the syntax
and proposed changes, I created a new page on the project wiki and
added a few example of how I understand it should work:

http://www.zim-wiki.org/wiki/doku.php?id=verbatim_syntax

I suggest, that any further discussion should move to that wiki page
and the general mailing list rather than stay within this bug report.

Ideally, we will be able to formulate an unambigous definition of the
syntax we want to implement starting from those examples. Only then
will we be able to effectively provide lasting solutions and fixes to
the numerous bug reports concerning verbatim syntax.

Hope that helps,
Fabian

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Fixed in rev300

Changed in zim:
status: In Progress → Fix Committed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Changed back to "In progress" since I still see some occasions where new lines are introduces for indented blocks :(

Changed in zim:
status: Fix Committed → In Progress
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Added bug #586296 as duplicate of this bug. Description to reproduce remaining issue from that tread:

If I create three lines

line one
line two
line three

then indent the middle line I get

line one
 line two
line three

in the display. Then hitting <Ctrl><r> shows me

line one
 line two

line three

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Added bug #630502 as duplicate of this bug. Either the same issue or closely related. Way to reproduce:

1) press enter several times, so that some spare empty lines are at a book
2) press up-arrow (or left-arrow) several times, so that you are at the top of the block of those new empty lines
3) press *, space, and write e.g. test (to have a bullet line)
4) press down-arrow once, so that you are just below the bullet
5) write something (e.g. some url, like http://test, but it can be even just string test - I just came into it with urls)
6) press enter, so that you are below the (url) line
7) repeat from 3) several times
8) reload

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Committed fix for empty line after indented block in rev304 - fixes cases describe in bug #630502 and bug #586296. Together with the fix by Fabian for verbatim blocks this should close this bug.

Changed in zim:
status: In Progress → Fix Committed
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Released in 0.49

Changed in zim:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related blueprints

Remote bug watches

Bug watches keep track of this bug in other bug trackers.