View previous topic :: View next topic |
Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Fri Feb 01, 2019 1:41 pm Post subject: Markdown |
|
|
Does anyone have code to convert markdown to html? I am going to try to write my own, but wanted to ask first. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Fri Feb 01, 2019 3:02 pm Post subject: |
|
|
Made one. This is for use with the extText element.
%t = @markdown(<String>)
Code: |
:markdown
if @not(%1)
exit
end
%%md = @new(list)
%%out = @new(list)
list assign,%%md,%1
%x = 0
repeat
%i = @trim(@item(%%md,%x))
%i = @rep(%i,**,<B>,</B>)
%i = @rep(%i,__,<U>,</U>)
%i = @rep(%i,//,<I>,</I>)
if @equal(@substr(%i,1,2),##)
list add,%%out,<H2>@strdel(%i,1,2)</H2>
elsif @equal(@substr(%i,1,1),#)
list add,%%out,<H1>@strdel(%i,1,1)</H1>
else
list add,%%out,%i
end
%x = @succ(%x)
until @equal(%x,@count(%%md))
%%exit = @text(%%out)
list close,%%md
list close,%%out
exit %%exit
:rep
#replace matching frist and second characters
#%t = @rep(<string>,<matching characters>,<First>,<second>)
#ex: %t = @rep(**Bold Text**,**,<B>,</B>)
if @not(%1)
exit
end
if @not(%2)
exit
end
if @not(%3)
exit
end
if @not(%4)
exit
end
%a = %1
%d =
repeat
%b = %a
if @greater(@pos(%2,%a,EXACT),0)
%%p1 = @pos(%2,%a,EXACT)
%a = @strdel(%a,%%p1,@succ(%%p1))
%a = @strins(%a,%%p1,%3)
if @greater(@pos(%2,%a,EXACT),0)
%%p1 = @pos(%2,%a,EXACT)
%a = @strdel(%a,%%p1,@succ(%%p1))
%a = @strins(%a,%%p1,%4)
else
%a = %b
%d = T
end
else
%d = T
end
until @equal(@pos(**,%a,EXACT),0)%d
exit %a
|
_________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 642 Location: Eastern Indiana
|
Posted: Tue Apr 16, 2019 5:05 pm Post subject: hello hello |
|
|
howdys
Sure do miss all this.
Anyways, nice POST, but I guess I'm a big dummy on
how it works.
I'm guessing it needs a MAIN DIALOG to get it working?
I compiled it as it is, but it got below error:
Invalid function at line 15
I'm sure its just me, but couldn't resist posting.
cheers
Oh yeah, ignore the VDS5 on my profile pic, its outdated.
I'm using VDS6 on Windows 10 /7 /XP /98 /95 /2k and DOS 1
Forgot Commedore 64 |
|
Back to top |
|
|
DaveR Valued Contributor
Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Sun Apr 21, 2019 5:21 am Post subject: Re: hello hello |
|
|
vtol wrote: | I compiled it as it is, but it got below error:
Invalid function at line 15 |
As the code is just 2 user defined functions, you need to define those 2 functions at the top of your script:
Code: | #define function,markdown,rep |
vtol wrote: | Oh yeah, ignore the VDS5 on my profile pic, its outdated.
I'm using VDS6 on Windows 10 /7 /XP /98 /95 /2k and DOS 1
Forgot Commedore 64 |
I'd like to see VDS6 running on a Commodore 64. I'd be happy just to see a working Commodore 64 in the flesh again.
Now I've forgotten why I came here today... Must have been to search for an answer to something. _________________ cheers
Dave |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|