Base classes used by nitweb.

Introduced classes

class APIError

nitc :: APIError

An error returned by the API.
abstract class APIHandler

nitc :: APIHandler

Specific handler for the nitweb API.
class APIRouter

nitc :: APIRouter

A Rooter dedicated to APIHandlers.
class NitwebConfig

nitc :: NitwebConfig

Nitweb config file.

Redefined classes

redef class CmdContribFile

nitc :: api_base $ CmdContribFile

Cmd that finds the contributing file related to an mentity
redef class CmdLicenseFile

nitc :: api_base $ CmdLicenseFile

Cmd that finds the license file related to an mentity
redef abstract class Deserializer

nitc :: api_base $ Deserializer

Abstract deserialization service
redef class HtmlightVisitor

nitc :: api_base $ HtmlightVisitor

Visitor used to produce a HTML tree based on a AST on a Source
redef class HttpResponse

nitc :: api_base $ HttpResponse

A response to send over HTTP
redef class MClassDef

nitc :: api_base $ MClassDef

A definition (an introduction or a refinement) of a class in a module
redef class MClassType

nitc :: api_base $ MClassType

A type based on a class.
redef abstract class MEntity

nitc :: api_base $ MEntity

A named and possibly documented entity in the model.
redef class MEntityRef

nitc :: api_base $ MEntityRef

A reference to another mentity.
redef class MNullableType

nitc :: api_base $ MNullableType

A type prefixed with "nullable"
redef class MParameterType

nitc :: api_base $ MParameterType

The type associated to a formal parameter generic type of a class
redef abstract class MPropDef

nitc :: api_base $ MPropDef

A definition of a property (local property)
redef abstract class MType

nitc :: api_base $ MType

A global static type
redef class MVirtualType

nitc :: api_base $ MVirtualType

A virtual formal type.

All class definitions

class APIError

nitc $ APIError

An error returned by the API.
abstract class APIHandler

nitc $ APIHandler

Specific handler for the nitweb API.
class APIRouter

nitc $ APIRouter

A Rooter dedicated to APIHandlers.
redef class CmdContribFile

nitc :: api_base $ CmdContribFile

Cmd that finds the contributing file related to an mentity
redef class CmdLicenseFile

nitc :: api_base $ CmdLicenseFile

Cmd that finds the license file related to an mentity
redef abstract class Deserializer

nitc :: api_base $ Deserializer

Abstract deserialization service
redef class HtmlightVisitor

nitc :: api_base $ HtmlightVisitor

Visitor used to produce a HTML tree based on a AST on a Source
redef class HttpResponse

nitc :: api_base $ HttpResponse

A response to send over HTTP
redef class MClassDef

nitc :: api_base $ MClassDef

A definition (an introduction or a refinement) of a class in a module
redef class MClassType

nitc :: api_base $ MClassType

A type based on a class.
redef abstract class MEntity

nitc :: api_base $ MEntity

A named and possibly documented entity in the model.
redef class MEntityRef

nitc :: api_base $ MEntityRef

A reference to another mentity.
redef class MNullableType

nitc :: api_base $ MNullableType

A type prefixed with "nullable"
redef class MParameterType

nitc :: api_base $ MParameterType

The type associated to a formal parameter generic type of a class
redef abstract class MPropDef

nitc :: api_base $ MPropDef

A definition of a property (local property)
redef abstract class MType

nitc :: api_base $ MType

A global static type
redef class MVirtualType

nitc :: api_base $ MVirtualType

A virtual formal type.
class NitwebConfig

nitc $ NitwebConfig

Nitweb config file.
package_diagram nitc::api_base api_base popcorn popcorn nitc::api_base->popcorn popcorn::pop_repos pop_repos nitc::api_base->popcorn::pop_repos popcorn::pop_json pop_json nitc::api_base->popcorn::pop_json nitc::commands_http commands_http nitc::api_base->nitc::commands_http nitc::json_commands json_commands nitc::api_base->nitc::json_commands nitc::html_commands html_commands nitc::api_base->nitc::html_commands github github popcorn->github config config popcorn->config csv csv popcorn->csv json json popcorn->json logger logger popcorn->logger realtime realtime popcorn->realtime mongodb mongodb popcorn->mongodb nitcorn nitcorn popcorn->nitcorn pthreads pthreads popcorn->pthreads template template popcorn->template popcorn::pop_config pop_config popcorn::pop_repos->popcorn::pop_config mongodb::queries queries popcorn::pop_repos->mongodb::queries popcorn::pop_json->json popcorn::pop_handlers pop_handlers popcorn::pop_json->popcorn::pop_handlers popcorn::pop_validation pop_validation popcorn::pop_json->popcorn::pop_validation nitc::commands_catalog commands_catalog nitc::commands_http->nitc::commands_catalog nitc::commands_graph commands_graph nitc::commands_http->nitc::commands_graph nitc::commands_ini commands_ini nitc::commands_http->nitc::commands_ini nitc::commands_main commands_main nitc::commands_http->nitc::commands_main nitc::commands_usage commands_usage nitc::commands_http->nitc::commands_usage nitcorn::vararg_routes vararg_routes nitc::commands_http->nitcorn::vararg_routes nitc::json_commands->nitc::commands_catalog nitc::json_commands->nitc::commands_graph nitc::json_commands->nitc::commands_ini nitc::json_commands->nitc::commands_main nitc::json_commands->nitc::commands_usage nitc::json_model json_model nitc::json_commands->nitc::json_model json::static static nitc::json_commands->json::static nitc::commands_docdown commands_docdown nitc::html_commands->nitc::commands_docdown nitc::commands_parser commands_parser nitc::html_commands->nitc::commands_parser nitc::html_model html_model nitc::html_commands->nitc::html_model markdown::wikilinks wikilinks nitc::html_commands->markdown::wikilinks ...github ... ...github->github ...config ... ...config->config ...csv ... ...csv->csv ...json ... ...json->json ...logger ... ...logger->logger ...realtime ... ...realtime->realtime ...mongodb ... ...mongodb->mongodb ...nitcorn ... ...nitcorn->nitcorn ...pthreads ... ...pthreads->pthreads ...template ... ...template->template ...popcorn::pop_config ... ...popcorn::pop_config->popcorn::pop_config ...mongodb::queries ... ...mongodb::queries->mongodb::queries ...popcorn::pop_handlers ... ...popcorn::pop_handlers->popcorn::pop_handlers ...popcorn::pop_validation ... ...popcorn::pop_validation->popcorn::pop_validation ...nitc::commands_catalog ... ...nitc::commands_catalog->nitc::commands_catalog ...nitc::commands_graph ... ...nitc::commands_graph->nitc::commands_graph ...nitc::commands_ini ... ...nitc::commands_ini->nitc::commands_ini ...nitc::commands_main ... ...nitc::commands_main->nitc::commands_main ...nitc::commands_usage ... ...nitc::commands_usage->nitc::commands_usage ...nitcorn::vararg_routes ... ...nitcorn::vararg_routes->nitcorn::vararg_routes ...nitc::json_model ... ...nitc::json_model->nitc::json_model ...json::static ... ...json::static->json::static ...nitc::commands_docdown ... ...nitc::commands_docdown->nitc::commands_docdown ...nitc::commands_parser ... ...nitc::commands_parser->nitc::commands_parser ...nitc::html_model ... ...nitc::html_model->nitc::html_model ...markdown::wikilinks ... ...markdown::wikilinks->markdown::wikilinks nitc::api_auth api_auth nitc::api_auth->nitc::api_base nitc::api_model api_model nitc::api_model->nitc::api_base nitc::api_metrics api_metrics nitc::api_metrics->nitc::api_base nitc::api_feedback api_feedback nitc::api_feedback->nitc::api_base nitc::api_light api_light nitc::api_light->nitc::api_base nitc::api api nitc::api->nitc::api_auth nitc::api->nitc::api_metrics nitc::api->nitc::api_feedback nitc::api->nitc::api_light nitc::api... ... nitc::api...->nitc::api nitc::api_docdown api_docdown nitc::api_docdown->nitc::api_model nitc::api_docdown... ... nitc::api_docdown...->nitc::api_docdown

Ancestors

module abstract_collection

core :: abstract_collection

Abstract collection classes and services.
module abstract_text

core :: abstract_text

Abstract class for manipulation of sequences of characters
module abstract_tree

trees :: abstract_tree

Introduce tree structures abstraction
module actors_injection_phase

nitc :: actors_injection_phase

Injects model for the classes annotated with "is actor" so
module annotation

nitc :: annotation

Management and utilities on annotations
module array

core :: array

This module introduces the standard array structure.
module astbuilder

nitc :: astbuilder

Instantiation and transformation of semantic nodes in the AST of expressions and statements
module astutil

nitc :: astutil

Additional features on Nit AST
module auto_super_init

nitc :: auto_super_init

Computing of super-constructors that must be implicitly called at the begin of constructors.
module base64

base64 :: base64

Offers the base 64 encoding and decoding algorithms
module bintree

trees :: bintree

Binary Tree data-structure
module bitset

core :: bitset

Services to handle BitSet
module bktree

trees :: bktree

Implementation of BKTree
module bootstrap

html :: bootstrap

HTML templates for Bootstrap components.
module bytes

core :: bytes

Services for byte streams and arrays
module c

c :: c

Structures and services for compatibility with the C language
module caching

serialization :: caching

Services for caching serialization engines
module catalog

nitc :: catalog

Basic catalog generator for Nit packages
module check_annotation

nitc :: check_annotation

Check that annotation present in the AST are either primitive or user-declared
module circular_array

core :: circular_array

Efficient data structure to access both end of the sequence.
module codec_base

core :: codec_base

Base for codecs to use with streams
module codecs

core :: codecs

Group module for all codec-related manipulations
module collection

core :: collection

This module define several collection classes.
module commands_base

nitc :: commands_base

Documentation commands
module commands_catalog

nitc :: commands_catalog

Commands to retrieve Catalog related data
module commands_docdown

nitc :: commands_docdown

Doc down related queries
module commands_graph

nitc :: commands_graph

Graph commands
module commands_model

nitc :: commands_model

Doc commands about a Model or a MEntity
module commands_parser

nitc :: commands_parser

A parser that create DocCommand from a string
module commands_usage

nitc :: commands_usage

Commands about how mentities are used
module config

config :: config

Configuration options for nit tools and apps
module console

console :: console

Defines some ANSI Terminal Control Escape Sequences.
module core

core :: core

Standard classes and methods used by default by Nit programs and libraries.
module counter

counter :: counter

Simple numerical statistical analysis and presentation
module csv

csv :: csv

CSV document handling.
module deriving

nitc :: deriving

Injection of automatic method definitions for standard methods, based on the attributes of the classes
module digraph

graph :: digraph

Implementation of directed graphs, also called digraphs.
module div_by_zero

nitc :: div_by_zero

Detection of divisions by zero in obvious cases
module dot

dot :: dot

Dot rendering library
module engine_tools

serialization :: engine_tools

Advanced services for serialization engines
module environ

core :: environ

Access to the environment variables of the process
module error

json :: error

Intro JsonParseError which is exposed by all JSON reading APIs
module error

core :: error

Standard error-management infrastructure.
module exec

core :: exec

Invocation and management of operating system sub-processes.
module file

core :: file

File manipulations (create, read, write, etc.)
module file_server

nitcorn :: file_server

Provides the FileServer action, which is a standard and minimal file server
module fixed_ints

core :: fixed_ints

Basic integers of fixed-precision
module fixed_ints_text

core :: fixed_ints_text

Text services to complement fixed_ints
module flat

core :: flat

All the array-based text representations
module flow

nitc :: flow

Intraprocedural static flow.
module frontend

nitc :: frontend

Collect and orchestration of main frontend phases
module gc

core :: gc

Access to the Nit internal garbage collection mechanism
module glsl_validation

nitc :: glsl_validation

Check shader code within Nit modules using the tool glslangValidator
module hash_collection

core :: hash_collection

Introduce HashMap and HashSet.
module highlight

nitc :: highlight

Highlighting of Nit AST
module html

html :: html

HTML output facilities
module html_model

nitc :: html_model

Translate mentities to html blocks.
module htmlight

nitc :: htmlight

Highlighting of Nit AST with HTML
module http_errors

nitcorn :: http_errors

Offers ErrorTemplate to display error pages
module http_request

nitcorn :: http_request

Provides the HttpRequest class and services to create it
module http_request_buffer

nitcorn :: http_request_buffer

Http request parsing for buffered inputs.
module http_response

nitcorn :: http_response

Provides the HttpResponse class and http_status_codes
module i18n_phase

nitc :: i18n_phase

Basic support of internationalization through the generation of id-to-string tables
module ini

ini :: ini

Read and write INI configuration files
module inspect

serialization :: inspect

Refine Serializable::inspect to show more useful information
module iso8859_1

core :: iso8859_1

Codec for ISO8859-1 I/O
module json

json :: json

Read and write JSON formatted text using the standard serialization services
module json_model

nitc :: json_model

Make model entities Serializable.
module kernel

core :: kernel

Most basic classes and methods.
module lexer

nitc :: lexer

Lexer and its tokens.
module lexer_work

nitc :: lexer_work

Internal algorithm and data structures for the Nit lexer
module libevent

libevent :: libevent

Low-level wrapper around the libevent library to manage events on file descriptors
module list

core :: list

This module handle double linked lists
module literal

nitc :: literal

Parsing of literal values in the abstract syntax tree.
module loader

nitc :: loader

Loading of Nit source files
module local_var_init

nitc :: local_var_init

Verify that local variables are initialized before their usage
module location

nitc :: location

Nit source-file and locations in source-file
module logger

logger :: logger

A simple logger for Nit
module markdown

markdown :: markdown

Markdown parsing.
module math

core :: math

Mathematical operations
module md5

md5 :: md5

Native MD5 digest implementation as Text::md5
module md_commands

nitc :: md_commands

Render commands results as Markdown
module mdoc

nitc :: mdoc

Documentation of model entities
module media_types

nitcorn :: media_types

Services to identify Internet media types (or MIME types, Content-types)
module meta

meta :: meta

Simple user-defined meta-level to manipulate types of instances as object.
module mmodule

nitc :: mmodule

modules and module hierarchies in the metamodel
module mmodule_data

nitc :: mmodule_data

Define and retrieve data in modules
module model

nitc :: model

Classes, types and properties
module model_base

nitc :: model_base

The abstract concept of model and related common things
module model_collect

nitc :: model_collect

Collect things from the model.
module model_examples

nitc :: model_examples

Examples for Model entities
module model_index

nitc :: model_index

Search things from the Model
module modelbuilder_base

nitc :: modelbuilder_base

Load nit source files and build the associated model
module modelize

nitc :: modelize

Create a model from nit source files
module modelize_class

nitc :: modelize_class

Analysis and verification of class definitions to instantiate model element
module modelize_property

nitc :: modelize_property

Analysis and verification of property definitions to instantiate model element
module mongodb

mongodb :: mongodb

MongoDB Nit Driver.
module more_collections

more_collections :: more_collections

Highly specific, but useful, collections-related classes.
module mpackage

nitc :: mpackage

Modelisation of a Nit package
module native

core :: native

Native structures for text and bytes
module native_mongodb

mongodb :: native_mongodb

Native wrapper for the MongoDB C Driver
module nitcorn

nitcorn :: nitcorn

The nitcorn Web server framework creates server-side Web apps in Nit
module nitpm_shared

nitc :: nitpm_shared

Services related to the Nit package manager
module no_warning

nitc :: no_warning

Fill toolcontext information about blacklisting of warnings.
module numeric

core :: numeric

Advanced services for Numeric types
module opts

opts :: opts

Management of options on the command line
module ordered_tree

ordered_tree :: ordered_tree

Manipulation and presentation of ordered trees.
module parallelization_phase

nitc :: parallelization_phase

Phase generating threads for functions annotated with threaded annotation
module parse_annotations

nitc :: parse_annotations

Simple annotation parsing
module parser

nitc :: parser

Parser.
module parser_base

parser_base :: parser_base

Simple base for hand-made parsers of all kinds
module parser_nodes

nitc :: parser_nodes

AST nodes of the Nit language
module parser_prod

nitc :: parser_prod

Production AST nodes full definition.
module parser_util

nitc :: parser_util

Utils and tools related to parsers and AST
module parser_work

nitc :: parser_work

Internal algorithm and data structures for the Nit parser
module phase

nitc :: phase

Phases of the processing of nit programs
module pipeline

pipeline :: pipeline

Pipelined filters and operations on iterators.
module pop_config

popcorn :: pop_config

Configuration file and options for Popcorn apps
module pop_handlers

popcorn :: pop_handlers

Route handlers.
module pop_routes

popcorn :: pop_routes

Internal routes representation.
module pop_sessions

popcorn :: pop_sessions

Session handlers
module pop_tasks

popcorn :: pop_tasks

Popcorn threaded tasks
module pop_validation

popcorn :: pop_validation

Quick and easy validation framework for Json inputs
module poset

poset :: poset

Pre order sets and partial order set (ie hierarchies)
module protocol

core :: protocol

module pthreads

pthreads :: pthreads

Main POSIX threads support and intro the classes Thread, Mutex and Barrier
module queries

mongodb :: queries

Mongo queries framework
module queue

core :: queue

Queuing data structures and wrappers
module range

core :: range

Module for range of discrete objects.
module rbtree

trees :: rbtree

A red–black tree is a data structure which is a type of self-balancing binary search tree.
module re

core :: re

Regular expression support for all services based on Pattern
module reactor

nitcorn :: reactor

Core of the nitcorn project, provides HttpFactory and Action
module realtime

realtime :: realtime

Services to keep time of the wall clock time
module regex_phase

nitc :: regex_phase

Check for error in regular expressions from string literals
module ropes

core :: ropes

Tree-based representation of a String.
module safe

serialization :: safe

Services for safer deserialization engines
module scope

nitc :: scope

Identification and scoping of local variables and labels.
module semantize

nitc :: semantize

Process bodies of methods in regard with the model.
module serialization

serialization :: serialization

General serialization services
module serialization_core

serialization :: serialization_core

Abstract services to serialize Nit objects to different formats
module serialization_model_phase

nitc :: serialization_model_phase

Phase generating methods (model-only) to serialize Nit objects
module serialization_read

json :: serialization_read

Services to read JSON: deserialize_json and JsonDeserializer
module serialization_write

json :: serialization_write

Services to write Nit objects to JSON strings: serialize_to_json and JsonSerializer
module server_config

nitcorn :: server_config

Classes and services to configure the server
module sessions

nitcorn :: sessions

Automated session management
module signal_handler

nitcorn :: signal_handler

Handle SIGINT and SIGTERM to close the server after all active events
module simple_misc_analysis

nitc :: simple_misc_analysis

Simple vavious processing on a AST
module sorter

core :: sorter

This module contains classes used to compare things and sorts arrays.
module static

json :: static

Static interface to read Nit objects from JSON strings
module stream

core :: stream

Input and output streams of characters
module tables

nitc :: tables

Module that interfaces the parsing tables.
module template

template :: template

Basic template system
module text

core :: text

All the classes and methods related to the manipulation of text entities
module time

core :: time

Management of time and dates
module token

nitcorn :: token

Simple generate_token service, independent of the rest of the nitcorn framework
module toolcontext

nitc :: toolcontext

Common command-line tool infrastructure than handle options and error messages
module trees

trees :: trees

General module for tree data structures
module trie

trees :: trie

A trie (or prefix tree) is a datastructure used to perform prefix searches.
module typing

nitc :: typing

Intraprocedural resolution of static types and OO-services
module uml

nitc :: uml

Group head module for UML generation services
module uml_base

nitc :: uml_base

Exposes the base class for UML generation of a Model
module uml_class

nitc :: uml_class

Provides facilities of exporting a Model to a UML class diagram
module uml_module

nitc :: uml_module

Services for generation of a UML package diagram based on a Model
module union_find

core :: union_find

union–find algorithm using an efficient disjoint-set data structure
module utf8

core :: utf8

Codec for UTF-8 I/O
module vararg_routes

nitcorn :: vararg_routes

Routes with parameters.
module version

nitc :: version

This file was generated by git-gen-version.sh

Parents

module commands_http

nitc :: commands_http

Initialize commands from HTTP requests
module html_commands

nitc :: html_commands

Render commands results as HTML
module json_commands

nitc :: json_commands

Translate command results to json
module pop_json

popcorn :: pop_json

Introduce useful services for JSON REST API handlers.
module pop_repos

popcorn :: pop_repos

Repositories for data management.
module popcorn

popcorn :: popcorn

Application server abstraction on top of nitcorn.

Children

module api_auth

nitc :: api_auth

module api_feedback

nitc :: api_feedback

Feedback related features
module api_light

nitc :: api_light

Highlight and collect messages from a piece of code
module api_model

nitc :: api_model

Descendants

module a_star-m

a_star-m

module api

nitc :: api

Components required to build a web server about the nit model.
module api_docdown

nitc :: api_docdown

Nitdoc specific Markdown format handling for Nitweb
module nitweb

nitc :: nitweb

Runs a webserver based on nitcorn that render things from model.
# Base classes used by `nitweb`.
module api_base

import popcorn
import popcorn::pop_config
import popcorn::pop_repos
import popcorn::pop_json

import commands::commands_http

import templates::json_commands
import templates::html_commands

# Nitweb config file.
class NitwebConfig
	super AppConfig

	redef fun default_db_name do return "nitweb"

	# Model to use.
	var model: Model

	# MModule used to flatten model.
	var mainmodule: MModule

	# Modelbuilder used to access sources.
	var modelbuilder: ModelBuilder

	# The JSON API does not filter anything by default.
	var filter: nullable ModelFilter

	# Catalog to pass to handlers.
	var catalog: Catalog
end

# Specific handler for the nitweb API.
abstract class APIHandler
	super Handler

	# App config.
	var config: NitwebConfig

	# Find the MEntity ` with `full_name`.
	fun find_mentity(full_name: nullable String): nullable MEntity do
		if full_name == null then return null
		var mentity = config.model.mentity_by_full_name(full_name.from_percent_encoding, config.filter)
		if mentity == null then return null

		var filter = config.filter
		if filter == null or filter.accept_mentity(mentity) then return mentity
		return null
	end

	# Try to load the mentity from uri with `/:id`.
	#
	# Send 400 if `:id` is null.
	# Send 404 if no entity is found.
	# Return null in both cases.
	fun mentity_from_uri(req: HttpRequest, res: HttpResponse): nullable MEntity do
		var id = req.param("id")
		if id == null then
			res.api_error(400, "Expected mentity full name")
			return null
		end
		var mentity = find_mentity(id)
		if mentity == null then
			res.api_error(404, "MEntity `{id}` not found")
		end
		return mentity
	end

	# Paginate a json array
	#
	# Returns only a subset of `results` depending on the current `page` and the
	# number of elements to return set by `limit`.
	#
	# Transforms the json array into an object:
	# ~~~json
	# {
	#	"page": 2,
	#	"limit": 10,
	#	"results: [ ... ],
	#	"max": 5,
	#	"total": 49
	# }
	# ~~~
	fun paginate(results: JsonArray, count: Int, page, limit: nullable Int): JsonObject do
		if page == null or page <= 0 then page = 1
		if limit == null or limit <= 0 then limit = 20

		var max = count / limit
		if max == 0 then
			page = 1
			max = 1
		else if page > max then
			page = max
		end

		var lstart = (page - 1) * limit
		var lend = limit
		if lstart + lend > count then lend = count - lstart

		var res = new JsonObject
		res["page"] = page
		res["limit"] = limit
		res["results"] = new JsonArray.from(results.subarray(lstart, lend))
		res["max"] = max
		res["total"] = count
		return res
	end
end

# A Rooter dedicated to APIHandlers.
class APIRouter
	super Router

	# App config
	var config: NitwebConfig
end

redef class HttpResponse

	# Return an HTTP error response with `status`
	#
	# Like the rest of the API, errors are formated as JSON:
	# ~~~json
	# { "status": 404, "message": "Not found" }
	# ~~~
	fun api_error(status: Int, message: String) do
		json(new APIError(status, message), status)
	end

	# Return `serializable` as a json string
	#
	# Uses `req` to define serialization options.
	fun api_json(req: HttpRequest, serializable: nullable Serializable, status: nullable Int, plain, pretty: nullable Bool) do
		json(serializable, status, plain, req.bool_arg("pretty"))
	end
end

# An error returned by the API.
#
# Can be serialized to json.
class APIError
	serialize

	# Reponse status
	var status: Int

	# Response error message
	var message: String
end

redef class MEntity

	# URL to `self` within the web interface.
	fun web_url: String do return "/doc/" / full_name

	# URL to `self` within the JSON api.
	fun api_url: String do return "/api/entity/" / full_name

	redef fun html_url do return web_url

	redef fun core_serialize_to(v) do
		super
		v.serialize_attribute("web_url", web_url)
		v.serialize_attribute("api_url", api_url)
	end
end

redef class MEntityRef
	redef fun core_serialize_to(v) do
		super
		v.serialize_attribute("web_url", mentity.web_url)
		v.serialize_attribute("api_url", mentity.api_url)
	end
end

redef class MClassDef
	redef fun web_url do return "{mclass.web_url}/lin#{full_name}"
end

redef class MPropDef
	redef fun web_url do return "{mproperty.web_url}/lin#{full_name}"
end

redef class MType
	redef fun core_serialize_to(v) do
		super
		v.serialize_attribute("web_url", web_url)
		v.serialize_attribute("api_url", api_url)
	end
end

redef class MClassType
	redef var web_url = mclass.web_url is lazy
	redef var api_url = mclass.api_url is lazy
end

redef class MNullableType
	redef var web_url = mtype.web_url is lazy
	redef var api_url = mtype.api_url is lazy
end

redef class MParameterType
	redef var web_url = mclass.web_url is lazy
	redef var api_url = mclass.api_url is lazy
end

redef class MVirtualType
	redef var web_url = mproperty.web_url is lazy
	redef var api_url = mproperty.api_url is lazy
end

redef class HtmlightVisitor
	redef fun hrefto(mentity) do return mentity.html_url
end

redef class CmdLicenseFile
	redef var file_url is lazy do
		var mentity = self.mentity
		if mentity == null then return super
		return "{mentity.web_url}/license"
	end
end

redef class CmdContribFile
	redef var file_url is lazy do
		var mentity = self.mentity
		if mentity == null then return super
		return "{mentity.web_url}/contrib"
	end
end

src/doc/api/api_base.nit:15,1--247,3