I think this is a reasonable solution. The helper MARKMIN could be smarter
and use autolinks expand_one.
On Saturday, 28 July 2012 14:14:50 UTC-5, dbdeveloper wrote:
>
> I think, the best way is to use autolinks as a render()'s parameter (
> autolinks replaces auto parameter):
>
> def default_autolinks(url):
> """ default autolinks for links, pictures and
> videos using video tag
> """
> return '<a href="%s">%s</a>' % (url, url)
>
> render(....., autolinks=default_autolinks)
>
> disable autolinks:
>
> render(....., autolinks=None)
>
> use other autolinks:
>
> from gluon.contrib.autolinks import expand_one
>
> render(...., autolinks=lambda url: expand_one(url, {}) )
>
>
> Your decision?
>
> Vladyslav Kozlovskyy
>
>
>
> 28.07.12 17:36, Massimo Di Pierro написав(ла):
>
> 1.2. I wrote autolinks and it is not used by anything else. We can change
> the licence and - in principle - we can move the code we need in
> markmin2html.py.
>
> 3. yes
> 4. perhaps we can pass a dict to markmin?
> 5. I do not think embed is documented in the book. If we silently ignore
> embed and treat embed:http://... the same as http://.. and the url points
> to an oembed service, it should still embed using the oembed rules. If not
> it will use a link instead of an iframe. Technically is a minor change of
> behavior but it will not break any app. Alternatively we can use embed: as
> alias of iframe:... if no oembed rule. What do you think?
>
> On Saturday, 28 July 2012 08:21:20 UTC-5, dbdeveloper wrote:
>>
>> autolinks is right module. but I have some questions:
>>
>> 1. markmin doesn't have dependencies. Now it will be dependent on
>> autolinks. Solution: we can "disable" autolink if it isn't found on path.
>> Right?
>> 2. Autolink is LGPL, makmin is MIT/BSD/GPL. I do not understand
>> differentiation between them. Is there all alright ?
>> 3. now the regex expression for search autolinks must be: http(s)://*
>> Yes?
>> 4. second parameter for expand_one: {} - do we always need to use empty
>> dict here or better to use variable to cache repeated urls ?
>> 5. if embed will be depricated, how about backward compatibility?
>>
>> Vladyslav Kozlovskyy
>>
>>
>> 28.07.12 01:57, Massimo Di Pierro написав(ла):
>>
>> I think embed:http://url.... should be deprecated in MARKMIN.
>>
>> It think if a url is found and not marked-up whether or not prefixed
>> with "embed:" the url should be precessed by the function
>>
>>
>> gluon/contrib/autolinks.py/expand_one(url,{})<http://autolinks.py/expand_one%28url,%7B%7D%29>
>>
>> This function uses the oembed protocol to figure out the best way to
>> embed the content pointed by the url (whether it is an image, a video, a
>> youtube page, etc.) The {} argument is a dictionary that will be used for
>> caching.
>>
>> The iframe prefix should be left alone but may need to discuss
>> security. Should it be enabled by default?
>>
>> This may actually simplify markmin.
>>
>> Massimo
>>
>>
>> On Thursday, 26 July 2012 17:30:21 UTC-5, Massimo Di Pierro wrote:
>>>
>>> Before you change it, let me think about this some more...
>>>
>>> On Thursday, 26 July 2012 17:03:35 UTC-5, dbdeveloper wrote:
>>>>
>>>> well, give me an example of correct iframe and embed output and I'll
>>>> change markmin. ok?
>>>>
>>>> Vladyslav Kozlovskyy (Ukraine)
>>>>
>>>> 26.07.12 16:40, Jose написав(ла):
>>>>
>>>>
>>>>
>>>> El jueves, 26 de julio de 2012 02:04:21 UTC-3, dbdeveloper escribió:
>>>>>
>>>>> Hi, Jose!
>>>>>
>>>>> try 'iframe' instead of 'embed':
>>>>>
>>>>> iframe:http://www.youtube.com/embed/x1w8hKTJ2Co
>>>>>
>>>>
>>>> Ok Vladyslav, but I think the same as Massimo, this breaks backwards
>>>> compatibility.
>>>>
>>>> Jose
>>>> --
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> --
>>
>>
>>
>>
>>
>> --
>
>
>
>
>
>
--