Do you think IIT Guwahati certified course can help you in your career?
No
Introduction
In this article, we will learn about MARKMIN basics and Oembed protocol in web2py.
But before we get into that, we will learn about the Web2Py framework which is a framework of Python Programming Language.
About Web2Py
Web2py can be understood as a free, open-source web framework for agile development which involves database-driven web applications; it is written in Python and programmable in Python. It is a full-stack framework consisting of all the components a developer needs to build a fully functional web application.
MARKMIN Basics
Markmin can be understood as a markup language included with Web2py. It is intended to be straightforward, quick, and simple to expand. It supports HTML5, floating pictures, auto-links, class style, tables, LaTeX formulas (via Google), syntax highlighting (with web2py CODE aid), and in-text citations.
This will output as “5-8-1'' and executes the join function using the arguments "5,8,1" that were supplied to env.
Oembed Protocol
Oembed is a format that enables an embedded URL representation on outside websites. When a user shares a link to a resource, the straightforward API enables a website to display embedded content (such photographs or videos) without having to explicitly parse the resource.
Any URL can be entered (or copied and pasted) into a wiki page and will be displayed as a link to that URL.
But there are some exceptions:
The link is incorporated as an image if the URL contains an image extension.
The link is included as HTML5 audio if the URL includes an audio extension.
The link is included as an HTML5 video if the URL includes a video extension.
If the URL ends in MS Office or PDF, Google Doc Viewer is embedded and displays the document's content (it only works for public documents).
Web2py contacts the relevant web service and inquires about the right way to embed the material if the URL leads to a YouTube, Vimeo, or Flickr website. To accomplish this, the oembed protocol is used.
The full list of supported formats is provided below:
This is the implementation that is done in the web2py file gluon.contrib.autolinks and specifically in the function expand_one. You can extend oembed support by registering more services.
This is achieved by adding an entry to the list i.e., “EMBED_MAPS”:
from gluon.contrib.autolinks import EMBED_MAPS
EMBED_MAPS.append((re.compile('http://youtube.com/\S*'),
'http://youtube.com/api/oembed.json'))
You can also try this code with Online Python Compiler
However, because "app," "controller," and "function" are lacking, default is assumed.
Similarly, you can submit a media asset (such as an image) that is connected to the page using the wiki menu. All of the files you have uploaded are displayed on the "manage media" tab, along with the correct syntax for linking media files. The link phrase will look like this if, for instance, you upload a file with the name "beach" and the extension "test.jpg."
@////15/codingninjas.jpg
You can also try this code with Online Python Compiler
There is a prefix @//// that is identical to the one that is previously described. The record holding the media file has the id 15. “codingninjas'' is the name of the image, and the original file's extension is “.jpg.”
“@////15/beach.jpg” can be embedded into wiki pages by copying and pasting.
Be aware that media files are connected to pages and receive access rights from the pages.
Frequently Asked Questions
What is web2py used for?
Python dynamic web content programming is made possible via Web2py. Web2py is made to make laborious web development jobs more accessible, such as creating web forms from scratch, while a web developer can still do it if necessary.
Which is better, web2py or Django?
Due to its smaller size, short learning curve, and lack of project-level configuration files, web2py differs from Django. Compared to PHP-based frameworks and Java-based frameworks, web2py is far less verbose and has a lot clearer syntax. This makes applications easier to comprehend, maintain, and create.
Should I learn web2py?
More than web-development purposes, web2py is primarily used as a teaching tool. Because of its graphical interface and built-in web IDE, it makes it easy for the developer to learn server-side web development.
Does web2py support Python 3?
web2py actually runs with CPython (the C implementation) and PyPy (Python written in Python) on Python 2.7 and Python 3.
Is web2py a good framework?
To summarize, Web2py is a free, fast, secure web development framework that is entirely written in python and encourages using python in every way possible (model, view, controller). It is an excellent framework for small web applications or prototypes but fails to fulfill the enterprise-class quality requirements.
Conclusion
In this article, we learned markmin basics and oembed protocol in web2py. After reading about markmin and oembed in web2py, are you not feeling excited to read/explore more articles on the topic of web2py? Don't worry; Coding Ninjas has you covered.