Smart Paste not converting CRs to new <p>s?

Having trouble installing Oxygen? Got a bug to report? Post it all here.
DanTemple
Posts: 26
Joined: Tue Oct 28, 2014 1:19 pm

Smart Paste not converting CRs to new <p>s?

Post by DanTemple »

I have a pretty simple "Smart Paste" wish: I just want it to convert carriage returns into new <p> elements.

I have "Convert external content on paste" enabled, along with all the other options under "Schema Aware".

However whether I paste from a text editor, Word or whatever, it still just creates one massive <p> element.

Shouldn't this work?

I'm using XML Editor 16.2.

regards, Dan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Smart Paste not converting CRs to new <p>s?

Post by sorin_ristache »

Hi,

What puts the "Smart" in "Smart Paste" is preserving the markup semantics between source and destination, for example replacing a ul/li sequence of elements in the browser (the source of the copy operation) with a sequence itemizedlist/listitem in the destination (a DocBook XML document). Adding (inventing) a synthetic markup element like <p> in the destination when no semantic equivalent was present in the source (only a LF character or a CR LF sequence was present in the source) would violate this markup preservation property, which would be kind of surprising from the user's perspective. If the used had meant a new paragraph element at the location of the newline character she would have used a <p> element in the source document instead of a newline character.

Having said that, it is always possible to customize the processing of the source markup in your Oxygen installation. If you tell us the destination language (DITA, or DocBook, or TEI) and give an example of input fragment and expected output markup, maybe I can help you to do this customization.
DanTemple wrote:However whether I paste from a text editor, Word or whatever, it still just creates one massive <p> element.
Does that mean that you get no markup at all in the destination language in Oxygen Author editing mode? If yes, you may have just hit the fallback for the case when some text content in the source fragment is lost by Smart Paste's normal processing: skip the Smart Paste processing (which would lose some text content) and only join the text content in the source into one long text and surround it with a <p> element in the destination document. Please can you send us a sample Word document for reproducing this problem, or point us to a web page where we can copy some fragment and reproduce this problem?
Regards,
Sorin

<oXygen/> XML Editor Support
DanTemple
Posts: 26
Joined: Tue Oct 28, 2014 1:19 pm

Re: Smart Paste not converting CRs to new <p>s?

Post by DanTemple »

An example to reproduce would be any .txt file from Notepad with at least one newline. I.e the source has no actual markup, apart from the CR/LF.

If I paste this into Word or Frame, I get two paragraphs as expected. It also works as expected pasting from Word/Frame/Browser -> emacs/Frame/Word whatever.

But not in Oxygen. I'm not sure from your mail whether you are saying this is expected or not?

When editing by hand, if I press Enter within a <p> element I get asked if I want to "split <p>" - basically I want this same functionality when I paste text with newlines, except I would like it to default to "yes".

I also note that pasting multiple paragraphs from Word -> Oxygen or Browser-> Oxygen also strips the paragraphs out and results in one long <p>.

regards, Dan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Smart Paste not converting CRs to new <p>s?

Post by sorin_ristache »

DanTemple wrote:An example to reproduce would be any .txt file from Notepad with at least one newline. I.e the source has no actual markup, apart from the CR/LF.

If I paste this into Word or Frame, I get two paragraphs as expected. It also works as expected pasting from Word/Frame/Browser -> emacs/Frame/Word whatever.

But not in Oxygen. I'm not sure from your mail whether you are saying this is expected or not?
This is expected. Smart Paste acts on structural markup in the source document, like paragraphs, lists and sections in a Word document (copy from MS Word, or LibreOffice, or OpenOffice, etc) or in a web page (copy from Chrome, or Firefox, etc), not on plain text.

We will consider applying this basic processing on plain text in a future version: convert newline characters to new paragraph elements, so that one <p> element is created in the target document for each newline in the source document.
DanTemple wrote:I also note that pasting multiple paragraphs from Word -> Oxygen or Browser-> Oxygen also strips the paragraphs out and results in one long <p>.
This is not expected. You should get one distinct paragraph in the destination for each paragraph in the source. You may have hit the fallback case for Smart Paste processing because apparently the normal Smart Paste processing was not able to transfer the entire text context to the target document. If you can send us an example Word document or give us a web page URL pointer then we will look into it and fix it.
DanTemple wrote:I'm using XML Editor 16.2.
The latest version is 16.1. Did you mean Oxygen version 15.2?
Regards,
Sorin

<oXygen/> XML Editor Support
DanTemple
Posts: 26
Joined: Tue Oct 28, 2014 1:19 pm

Re: Smart Paste not converting CRs to new <p>s?

Post by DanTemple »

Sorry - 16.1 it is.

But yes - that would be a better default (I think) to create new <p>s. Hope you decide to implement!

I should maybe mention I am running on Oxygen on Linux over VNC? This might affect the paste function? I just checked, and on Word it works OK pasting to Oxygen on Windows.

As a test file you can just type any two paragraphs into a new Word document.

regards, Dan
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Smart Paste not converting CRs to new <p>s?

Post by sorin_ristache »

DanTemple wrote:I should maybe mention I am running on Oxygen on Linux over VNC? This might affect the paste function?
That could explain why copy from Word to Oxygen creates only one <p> element in Oxygen Author mode instead of one <p> element for each paragraph in the Word document. The only solution that I can see in this case is to copy and paste between Word and Oxygen directly, as applications running on the local machine, not through a VNC client window.
DanTemple wrote:I just checked, and on Word it works OK pasting to Oxygen on Windows.

As a test file you can just type any two paragraphs into a new Word document.
If I select two or more paragraphs in a Word document, copy them and paste in Author mode, I get one <p> element in Author mode per each paragraph in the Word document.
Regards,
Sorin

<oXygen/> XML Editor Support
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: Smart Paste not converting CRs to new <p>s?

Post by Radu »

Hi,

Just to update this older thread, with Oxygen 18.0 if you copy a couple of lines of text from Notepad, Oxygen by default will attempt to create paragraphs for each of them.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply