html-proxy

Redlang documentation | internet scheme

html-proxy is an html page that can embed red code so that it is more convenient to have one single url that can be used for both script documentation or any html page and make the script accessible remotely to Red console or program.
For example: using chrome, firefox or internet explorer you can browse to:

https://readable.red

and execute Red code using the same url by typing in the Red console or a script for example:

do https://readable.red ; load library
markdown-gen ; call function to generate markdown

The trick is to paste this Red snippet code after the </html> tag


<!--
Red []    
set to-word rejoin ["--" ">"] ""
; below your custom code, remove comment symbol ";"
; do https://redlang.red/index.red
-->

and you must also absolutely html encode the letter "R" with &#82; in any word containing Red in the html content (between tags).

Html template

You can use this minimal html-proxy template or craft your own:

html template:


<!doctype html>

<html lang="fr">
    <head>
    <meta charset="utf-8">

    <title>redlang.red</title>
    <meta name="description" content="The HTML5 Herald">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="me">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

	<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" />
	<link href='https://fonts.googleapis.com/css?family=Abel|Open+Sans:400,600' rel='stylesheet'>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <!--[if lt IE 9]>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
    <![endif]-->
    <style>       
        body, html {
        height: 100%;
        display: grid;
        background-color: rgba(233, 25, 19);
        color: white;
        text-align: center;
        font: 400 15px/1.8 "Lato", sans-serif;
        padding: 18px;
        font-size: 25px;
        letter-spacing: 10px;          
        }
        pre {
        height: 100%;
        width: 90vw;
        display: grid;
        background-color: rgba(233, 25, 19);
        color: white;
        text-align: center;
        font: 400 15px/1.8 "Lato", sans-serif;
        padding: 18px;
        font-size: 25px;
        letter-spacing: 5px;             
        }
        span {
            margin: auto;
        }
        a:link {
            color: white;
        }  
        a:visited {
            color: white;
        }   
        /* mouse over link */
        a:hover {
            color: rgb(199, 5, 111);
        }

        /* selected link */
        a:active {
            color: rgb(199, 5, 111);
        }                   
    </style>     
    </head>

    <body>
        <span>
            <br>Don't forget to html encode <a href=https://www.red-lang.org/>&#82;ed</a>,
        </span>        
    </body>
</html>    

<!--
Red []    
set to-word rejoin ["--" ">"] ""
; below your custom code, remove comment symbol ";"
; do https://redlang.red/index.red
-->

    

Get proxied url

to get the proxied url do library:

https://redlang.red/get-proxied-url

then call function .get-proxied-url or get-proxied-url


do https://redlang.red/get-proxied-url ; load library
.get-proxied-url https://readable.red ; call .get-proxied-url function
    

will return the true script url behind html proxy:

https://readable.red/index.red