Loading...
 
Features / Usability

Features / Usability


~np~ not working as expected

posts: 3

Is there s way to completely disable wiki-syntax for Articles?

Here is what I am trying to add to my article

Image
{CODE()}
~np~
nello::where

  1. include

struct my_exc1 : std::exception { char const* what() const throw(); };
struct my_exc2 : std::exception { char const* what() const throw(); };
struct your_exc3 : my_exc1, my_exc2 {};

int main()
{
try { throw your_exc3(); }
catch(std::exception const& e) {}
catch(...) { std::cout

posts: 3

Agrrr, my post got cut after "<<", but was OK after "Previev":(

Original code:

Image
nello::where

#include 
struct my_exc1 : std::exception { char const* what() const throw(); };
struct my_exc2 : std::exception { char const* what() const throw(); };
struct your_exc3 : my_exc1, my_exc2 {};

int main()
{
   try { throw your_exc3(); }
   catch(std::exception const& e) {}
   catch(...) { std::cout << "whoops!" << std::endl; }
}


The result is on attached image


posts: 289 United States

Can't you use the {CODE} plugin to display program code in your articles, the same way you did for this forum post?

If that's not an option, what is the issue with using ~np~ tags? Certain symbols get interpreted as Tiki markup? You probably need to encode the greater than and/or less than symbols into Tiki markup such that:

"<" becomes ~60~
">" becomes ~62~

This also applies to the {CODE} plugin too I believe.

Also you should try using ~pp~ tags rather than ~np~ because the ~pp~ tags preserve formatting.

posts: 3

I did not know about CODE plugin at the time of posting, sorry.
I just wished to be able to insert some code to the article with no need to modify it. So I expected all text inside ~np~ to be unchanged.

You are right about the behavior of CODE plugin with ~np~.

posts: 289 United States

The problem is, if you put your entire article in ~np~ tags then you can't use markup on any of the text, even text where you might want to. This also means you can't put any links either internal or external.

In my humble opinion it's better to only use those types of tags where you absolutely need to. The advantage of using the {CODE} plugin is that it helps make your program code stand out, rather than make it just like look ordinary text. Furthermore, it defines the structure of the text so that the portions of text that contain program code are clearly identifiable.

There's no right way or wrong way, it is entirely up to you how you want to do it, I just thought I'd post some suggestions.