How To Migrate a Parse App to Parse Server on Ubuntu 14.04

render.pl 826B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env perl
  2. use strict;
  3. use warnings;
  4. use 5.10.0;
  5. use Text::Markdown::Discount;
  6. # Enable html5 block-level tags:
  7. Text::Markdown::Discount::with_html5_tags();
  8. my $flags = Text::Markdown::Discount::MKD_EXTRA_FOOTNOTE();
  9. my $markdown = Text::Markdown::Discount->new;
  10. my $full_source = '';
  11. while (my $source = get_input()) {
  12. $full_source .= $source;
  13. }
  14. print replace_some_stuff($markdown->markdown($full_source, $flags));
  15. sub get_input {
  16. local $/ = undef;
  17. my $source = <>;
  18. return $source;
  19. }
  20. # Super cheeseball, man.
  21. sub replace_some_stuff {
  22. my ($markup) = @_;
  23. $markup =~ s{&lt;\^&gt;(.*?)&lt;\^&gt;}{<span style="color: red;">$1</span>}g;
  24. $markup =~ s{\[label (.*?)\]}{<strong>$1</strong><br>}g;
  25. $markup =~ s{\[secondary_label (.*?)\]}{<span style="color: gray;">$1</span><br>}g;
  26. return $markup;
  27. }