Add a brace "{" inside a monospaced text using UWC
Asked by F:

I'm currently using UWC to import a Trac wiki to Confluence.

I have a little problem when I tried to import some Trac syntax, especially, when it's monospaced text with brace inside.

Taking this Trac text:

```
{{{A text with {}}}}
```

{{{ and }}} delimited a monospaced in Trac syntax, like {{ and }} in Confluence syntax.

I want to convert the text above in Confluence wiki syntax, to render it like this:

```
A text with {}
```

If I tried the syntax below, it doesn't work:

```
{{A text with {}}}
```

My problem is very simple, how I can write } inside a monospaced text in confluence. A monospaced text use syntax like this {{ ... }}. And if I add a brace } inside this syntax, the text isn't display correctly. I tried to used the \\ character to tell to confluence to display the character } and not consider has a wiki syntax ({{A text with {\\}} }). But it's doesn't work.

To be able to parse this text, I added a new line to Trac properties file in UWC:

```
Trac.0102-monospace0.java-regex=\{{3}(.*?)\}{4}{replace-with}{{$1\} }}
```

But it's doesn't work.

Confluence doesn't support anymore an editor that could switch between the wiki syntax and the wysiwyg editor. So without it, I'm not able to find the special character in Confluence wiki syntax that can avoid to parse } has a part of the wiki syntax. And I don't find this information on their documentation, while this problem is no more present in the new wysiwyg Editor

Any one, can help me ?


Answers:
author: F
body: Thank you for these tests, even if it isn't a good news for me.

Perhaps it's something that isn't possible to do with wiki syntax on Confluence 3.x and now it's possible to do it in Confluence 4.x and + because the editor don't use anymore the wiki syntax internally.

comments: author: resah
body: I always thought, that the new converter uses the old wiki syntax and uses the Confluence internal converter to convert this to the new XHTML syntax.

But I could be wrong.

Anyway, good luck!


author: F
body: If I add the rule below, I have a problem during the conversion too.

```
Trac.0102-monospace1.java-regex=\}{4}{replace-with}} }}}
```

I have a question, if you type this text in the wiki syntax editor, does it work ? Is the last "}" before "}}" displayed in monospace style ?

```
{{A text with braces{}}}or{{A text with braces {}. }}
```

comments: author: resah
body: Bad news:

Here the brackets are simple vanished

```
{{A text with braces{}}}
```

With this example, the whole line is simply written including the double brackets:

```
{{A text with braces {}. }}
```

Sample problem here:

```
{{A text with braces {} inbetween}}
```

So I don't think that it's possible what you are trying to achieve, sry about that.


author: F
body: Hi Theresa,

thank you for your answer. It's near to a the solution I'm looking for, but it's not, while the a text between {{ and }} could be write in a middle of sentence, while using {noformat} go to a newline and create a border around the sentence without format.

If you have Confluence 3.x, perhaps you could help me.

In a sample page, could you write the sentence inside the wiki editor tab:

```
It's a sample text with {{no format string}} inside it.
```

Then, switch to the wysiwyg editor, and modified the sentence to insert {} betweeen "format" and "string" word to have something like this:

It's a sample text with *no format {} string* inside it.  
After this, If you go back to the wiki editor, what is the text/sentence displayed ? Which espace character are use to avoid parsing } (between {{ and }}) by the wiki syntax.  
regards,  
Fran?ois.

comments: author: resah
body: I tried, but sorry to disappoint you, there's no escape character.

Maybe the UWC adds escape characters, I had this problem a couple of times. Actually I am not using a Confluence 3.5, but I use it for wiki converter only and then upgrade the Confluence instance to the most current version.

However, mybe you could post the converter file you are using to import the stuff? Usually everything is about the order of the converter statements, so maybe we can figure it out with this?


author: F
body: Thank you for your test ! It's strange that there is no escape character. Perhaps, like you said, it's due to the configuration file and the order of the rules.

I joined to this post the modified configuration file I used to import my Trac page.

I added the rule "Trac.0102-monospace1" (line 41) to tried to handle my case, but it doesn't work well.

(converter.trac.properties.txt)


author: resah
body: Please comment your line 41 and change line 42 to the following:

```
Trac.0103-monospace1.java-regex-tokenizer=\{{3}(.*?)\}{3}(?=\s){replace-with}{{$1}}
```

How does this work for you?


author: F
body: I have an error with UWC.

I think that the change you give doesn't change the behavior with the original without "(?=\\s)".

Before posting, I tried to find a solution to handle four characters "}" with this rule, but I don't find a solution.

It's the reason I created an other rule (line 41) which handle specifically four "}".


author: resah
body: You could try another workaround by replacing four following brackets to a single one, a space character and then the three normal ones right before line 42?


author: resah
body: Hm, I am not sure either. Maybe it would work for you to usethe following as a replacement?

```
{noformat}A text with {}{noformat}
```

or even

```
{code}A text with {}{code}
```

I used the old UWC for Confluence 3.x quite often, but can't say too much about the new one.