Hi Morgan, I will only try to answer number 1 on your list. On 6/23/07, Morgan Fletcher <[email protected]> wrote: [snip]
1. Pasting preformatted text
I have documents which are basically logs of software releases, complete with commands, hash ("#") marks, dot-separated version numbers, etc. All these things are getting parsed by xwiki, even when I place {pre} or {code} tags at either end of it. These documents can't really be adapted to not use xwiki syntax, and I'd really like to store them as pages in xwiki.
Are you using a clean install of the latest xwiki release? In theory I think this should work, but it seems that too often xwiki has problems escaping things. Sorry about this. Hopefully this will be improved with time.
If I can't store them as pages, I'll store them as attachments.
If you don't need to edit them afterwards then I would suggest you go this way for now. Attachments get an URL like pages do, so you should be able to link to the text files from your wiki.
I see a FAQ item that seems like it might address my question, but it paradoxically seems to display a failure to render because of syntax:
http://www.xwiki.org/xwiki/bin/view/FAQ/HowDoIEmbedXwikiCodeAsText
This is something I reported here: http://www.nabble.com/Escaping-velocity-code-inside-form-fields-does-not-wor... Unfortunately I'm not able to reproduce this on anything else than xwiki.org so finding the cause is not easy at all.
What is the Answer to that FAQ?
[snip]
Here you go (logged in, edited the FAQ page, and grabbed the source): 1 Including XWiki code as part of your text. (Escaping Xwiki code) Sometimes, especially when we are trying to create these FAQs and documentation for Xwiki, we will need to display XWiki programming code as part of our text. For example, if we are trying to write a tutorial on how to create a Blog in XWiki. If you simply put the code inside the standard *\{code\}* tags, the rendering engine will still execute it. The reason is that the special characters *"\#"* and *"\$"* must be *~~escaped~~*. When the rendering engine sees that this character is escaped, it ignores it as a processing instruction and then just displays it. *The escape character for Xwiki code is the ~~backslash~~ "\\\" character.* So, to include a code section, type it in like this: {code} \{code\} \\#set(\$page = \$doc.fullName) \\#includeForm("Test.BlogMacro") \{code\} {code} If you type the previous code into your document exactly as it appears, with the backslashes, the resulting output would look like: {code} \#set(\$page = \$doc.fullName) \#includeForm("Test.BlogMacro") {code} If it is a large piece of code, type or paste it into a seperate document that people wont see directly. In this example we will use a document that contains the Blog code most people use: [Doc.BlogMacro] Dev.BlogMacro contains no textual content, it is just the code for the Blog list. To get it into this document, use the following code: {code} \{code\} \{pre\} \#set(\$code = \$xwiki.getDocument("Doc.BlogMacro").content) \#set(\$code = \$code.replace("\#","\\\#")) \#set(\$code = \$code.replace("\$","\\\$")) \$code \{/pre\} \{code\} {code} An example of the output of the preceding code is: {code} #set($code = $xwiki.getDocument("Doc.BlogMacro").content) #set($code = $code.replace("#","\\#")) #set($code = $code.replace("$","\\$")) $code {code} And thats how you would embed code. It was wierd embeddeding code to show how to embed code, so if you wanna see my headache, view the code for this page. You'll *LOVE* it! In the meantime, if you want to know how I escaped the esacape character. Well, you can display a single backslash character by typing in three backshashes in a row, like: "\\\". However, if I had actually tried to show three escaped backslashes in a row, it would have been a mess, if not impossible, therefore, I simply used the backslash HTML Identity Reference, which is 92. Pretty slick huh? :-p Hope this helps :) Regards, Catalin