As a continuation of Creating node should automatically add "<br>".

How about an option near the text box to say what style you want. HTML (current style), TEXT and as a plus POD and ePod.

Will be very nice to can write our posts this:


HTML (the current style just for comparison).
This is just a sample <p> Here's a new paragraph and a <b>bold</b> word. <p> Now some code: <code> #!/usr/bin/perl print "Hello World!\n" ; exit; <//code> Some itens: <ul> <li>item 1</li><br> bla bla bla <p> <li>item 2</li><br> bla bla bla <p> <li>item 3</li><br> bla bla bla <ul> By!
output

This is just a sample

Here's a new paragraph and a bold word.

Now some code:

#!/usr/bin/perl print "Hello World!\n" ; exit;
Some itens: By!
TEXT
This is just a sample Here's a new paragraph and no support for bold. Now some code, since the only tag suported is code: <code> #!/usr/bin/perl print "Hello World!\n" ; exit; <//code> Some itens: * item 1 bla bla bla * item 2 bla bla bla *item 3 bla bla bla By!

output

This is just a sample

Here's a new paragraph and no support for bold.

Now some code, since the only tag suported is code:

#!/usr/bin/perl print "Hello World!\n" ; exit;
Some itens:

* item 1 bla bla bla

* item 2 bla bla bla

*item 3 bla bla bla

By!


POD
This is just a sample Here's a new paragraph and a B<bold> word. Now some code: #!/usr/bin/perl print "Hello World!\n" ; exit; Some itens: =over 4 =item item 1 bla bla bla =item item 2 bla bla bla =item item 3 bla bla bla =back By!

output

This is just a sample

Here's a new paragraph and a bold word.

Now some code:

#!/usr/bin/perl print "Hello World!\n" ; exit;
Some itens: By!
ePod
This is just a sample Here's a new paragraph and a B<bold> word. Now some code: #!/usr/bin/perl print "Hello World!\n" ; exit; Some itens: *> item 1 bla bla bla *> item 2 bla bla bla *> item 3 bla bla bla => A sub title Some test => By Enjoy!

output

This is just a sample

Here's a new paragraph and a bold word.

Now some code:

  #!/usr/bin/perl
  
  print "Hello World!\n" ;
  
  exit;

Some itens:

A sub title

Some test

By

Enjoy!


Now some sample code to enable this 3 new styles:

TEXT:

$input =~ s/\r\n?/<p>\n/gs ; # after this is just the normal process for HTML (current process).
POD:
use Pod::HtmlEasy ; my $p = Pod::HtmlEasy->new() ; $input = $p->pod2html($input , only_content => 1 , no_index => 1 ); # note that Pod::HtmlEasy can personalize the content generation, # where is possible to handle VERBATIM data directly to <code> # after this is just the normal process for HTML (current process).
ePod:
use ePod ; $input = epod2pod($input) ; # after this is just like POD process: use Pod::HtmlEasy ; my $p = Pod::HtmlEasy->new() ; $input = $p->pod2html($input , only_content => 1 , no_index => 1 );

Replies are listed 'Best First'.
Re: How about different input styles when posting? (HTML , TEXT, POD, ePod...)
by castaway (Parson) on Nov 24, 2004 at 18:53 UTC
    Examples are all very well, but since this has been discussed at least a few times before, what's needed is code, and actual ideas of where in the sequence this encoding takes place, etc. (previous discussion)

    If you don't know, the problem (as I gather it) is: Either we parse on input (ie when the user hits the 'Create' button), once, and store the HTML result. In which case when someone tries to edit their post, they may not recognise it, and complaints will ensue. Or, we parse on output, ie every time someone views the page, which puts more strain on the server. (Can't be cached, because there are user specific psuedo links, etc.

    Then theres the whole: 'How do we parse what' discussion..

    Anyhow, nice idea, but suggesting what, and not saying how, probably won't get you very far.

    C.

    Personally, I'd like a whole cute little editor with buttons for italics, bold etc.. but pigs may well fly..

      Of course, there is another option, but methinks it would be quite a bit of work (perhaps not practical).

      Parse on input, storing the original in a separate table, and the HTML in a "cache" table. The server load would increase a little, as there would be an extra query when a user views their own node, but not horrible.

      Of course, that might take a serious restructure of the code, so I'm not sure how good an idea it would be. Just something to ponder...


      radiantmatrix
      require General::Disclaimer;
      Perl is

      Did you saw the codes in the end of the node? There is how.
        That's just a general 'convert from A to B' (yes, I did miss it, the node was just too long to read it all) .. we're still missing a definition of how it fits in with the node creation/display business. And if you don't know the code (who does) you can go look at Everything2 to see how PM works (more or less).

        C.

Re: How about different input styles when posting? (HTML , TEXT, POD, ePod...)
by diotalevi (Canon) on Nov 24, 2004 at 22:32 UTC

    As an experiment, run this command. This is what user-written clients will have to deal with - your data as given to PM. If you propose to have people post in plain text, HTML, pod, LaTeX, etc, you'd better be prepared to deal with the people whose PM clients no longer work because PM isn't being given HTML anymore. Its a good thing that we expect everyone to post using the same format. It makes other people's lives easier.

    perl -MXML::Simple -MLWP::Simple -e "print XMLin(get 'http://perlmonks.org/?node_id=410186;displaytype=xml')->{data}{field}{content}"
      That's really the biggest issue: interoperability. All this extra stuff being suggested kinda smells of Windows design philosophy. "Let's add FEATURES!!!"

      I'd rather not. I'm happy with (X)HTML — especially since, in the end, whatever format one chooses for posting will have to be rendered in (X)HTML anyway, and thus the formatting used by the poster will be necessarily limited to what works for that output.

      - apotheon
      CopyWrite Chad Perrin

      That doesn't necessarily mean much. You can still give PM clients the HTML they expect by virtue of the same mechanism you use to give it to browsers.

      Makeshifts last the longest.

Re: How about different input styles when posting? (HTML , TEXT, POD, ePod...)
by parv (Parson) on Nov 24, 2004 at 22:03 UTC
    (La)TeX will be even better.