Tags:
tag this topic
create new tag
view all tags
%STARTINCLUDE% ---+ Page Rendering Process _Overview of how TWiki works_ To achieve a goal in TWiki either by making use of existing features or implementing new features, good understanding of how TWiki works is crucial. That said, this topic explains how TWiki processes various TWiki operations - view, edit, save, attach, upload, etc. %TOC% ---++ Basics Here's the basic steps of the page rendering by TWiki. 1. Preferences variables are read. TWikiVariables#PreferencesVariables describes what exactly happens in this step. This step is taken regardless of script (view, edit, etc.) while the steps below may not happen. For example, the save script saves the topic text and then redirects to the corresponding view URL hence the script doesn't take the following steps 1. The page template for the script is read and expanded. TWikiTemplates explains this step 1. TWiki variables in the template are expanded. A view and edit templates have =%<nop>TEXT%=, which is expanded to the raw text of the page 1. TWiki markup is converted into HTML ---+++ Preferences variables are read Preferences variables are defined at an early stage of TWiki processing. After this step, no preferences variables are set. Please note that topics INCLUDE'd by the current topic are not read for preferences variables. =%<nop>SET{"<i>VARIABLE</i>" value="<i>VALUE</i>"}%= and =%<nop>CALCULATE{"$SET(<i>VARIABLE</i>, <i>VALUE</i>)"}%= in an INCLUDE'd topic take effect since =%<nop>INCLUDE{...}%=, =%<nop>SET{...}%=, and =%<nop>CALCULATE{...}%= are variables expanded in a later stage. But =" * Set <i>VARIABLE</i> = <i>VALUE</i>"= in an INCLUDE'd topic doesn't have a chance to be read. ---+++ Template is read and expanded As mentioned above, TWikiTemplates describes how a template is selected and read. It's worth mentioning that template expansion happens before variable expansion. At the end of step, all template directives are resolved, hence there aren't any =%<nop>TMPL:XXX{...}%= or =%<nop>TMPL:XXX%=. ---+++ Variable expansion Variables may be nested - a variable may be a parameter of another variable and there is no limitation of nesting level. If variables are nested, they are processed from the inner-most to the outer-most. A topic may have any number of variables. Variables at the same nesting level are processed from top to bottom. You can see it from the example below. Raw text: <verbatim> %SET{"foo" value="abc"}% %GET{"foo"}% %SET{"foo" value="def"}% %GET{"foo"}% </verbatim> Result: <blockquote> %SET{"foo" value="abc"}% %GET{"foo"}% %SET{"foo" value="def"}% %GET{"foo"}% </blockquote> ---+++ TWiki markup to HTML At this point, all variables are expanded. Markup described on TextFormattingRules are converted into HTML You may want to suppress this step to see the result of variable expansion not converted into HTML. You can do that by supplying raw=expandvariables URL parameter to a view URL: e.g. %SCRIPTURL{view}%/%USERSWEB%/?raw=expandvariables ---++ Plugins So far, how plugins are involved with page rendering hasn't been discused. Here's how. In many cases, plugins introduce predefined variables such as =%<nop>CALCULATE{...}%= and =%<nop>GET{...}%=. Those don't make structural difference to how a TWiki topic is written. Those variables are introduced by calling e.g. =TWiki::Func::registerTagHandler('CALCULATE', \&_CALCULATE)= in =initPlugin()= in the plugin code file. Some plugins extend TWiki markup. For example, the table notation in TWiki (an example shown below) is provided by the TablePlugin. Though the table notation is regarded as an integral part of TWiki markup, it is implemented by a plugin rather than the TWiki core. <verbatim> | One One | One Two | One Three | | ^ | Two Two | Two Three | | Three One | ^ | Three Three | </verbatim> There are various places in the TWiki core where functions provided by plugins are called. For example, TablePlugin has a function named =preRenderingHandler()= defined. It's called before the TWiki markup to HTML conversion takes place. As you can imagine, if a plugin has =postRenderingHandler()= defined, it's called after the core TWiki markup to HTML processing. A plugin may have =commonTagsHandler()= defined, which is called immediately after normal TWiki variables are expanded. Since a =commonTagsHandler()= may yield TWiki variables, normal TWiki variable expansion is conducted again after that. SpreadSheetPlugin has =commonTagsHandler()= defined to process =%<nop>CALC{...}%=. You may think =%<nop>CALC{...}%= can be implemented simply by =TWiki::Func::registerTagHandler()= but it cannot be since =%<nop>CALC{...}%= needs to look outside its parameters to do things such as =%<nop>CALC{"$SUM($ABOVE())"}%=. In addition to =preRenderingHandler()=, =postRenderingHandler()=, and =commonTagsHandler()=, there are other functions called from TWiki core as well. You can see the complete list of such functions on !EmptyPlugin.pm in the !EmptyPlugin. %STOPINCLUDE% __Related Topics:__ DeveloperDocumentationCategory, TWikiTemplates, TWikiVariables, TextFormattingRules
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r1
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r1 - 2013-08-30
-
TWikiContributor
Log In
or
Register
TWiki Web
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
AdminToolsCategory
InterWikis
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Prenotazioni esami
Laurea Triennale ...
Laurea Triennale
Algebra
Algoritmi
Introduzione agli algoritmi
Algoritmi 1
Algoritmi 2
Algoritmi per la
visualizzazione
Architetture
Prog. sist. digitali
Architetture 2
Basi di Dati
Basi di Dati 1 Inf.
Basi di Dati 1 T.I.
Basi di Dati (I modulo, A-L)
Basi di Dati (I modulo, M-Z)
Basi di Dati 2
Calcolo
Calcolo differenziale
Calcolo integrale
Calcolo delle Probabilitą
Metodi mat. per l'inf. (ex. Logica)
canale AD
canale PZ
Programmazione
Fond. di Programmazione
Metodologie di Programmazione
Prog. di sistemi multicore
Programmazione 2
AD
EO
PZ
Esercitazioni Prog. 2
Lab. Prog. AD
Lab. Prog. EO
Lab. Prog. 2
Prog. a Oggetti
Reti
Arch. di internet
Lab. di prog. di rete
Programmazione Web
Reti di elaboratori
Sistemi operativi
Sistemi Operativi (12 CFU)
Anni precedenti
Sistemi operativi 1
Sistemi operativi 2
Lab. SO 1
Lab. SO 2
Altri corsi
Automi, Calcolabilitą
e Complessitą
Apprendimento Automatico
Economia Aziendale
Elaborazione Immagini
Fisica 2
Grafica 3D
Informatica Giuridica
Laboratorio di Sistemi Interattivi
Linguaggi di Programmazione 3° anno Matematica
Linguaggi e Compilatori
Sistemi Informativi
Tecniche di Sicurezza dei Sistemi
ACSAI ...
ACSAI
Computer Architectures 1
Programming
Laurea Magistrale ...
Laurea Magistrale
Percorsi di studio
Corsi
Algoritmi Avanzati
Algoritmica
Algoritmi e Strutture Dati
Algoritmi per le reti
Architetture degli elaboratori 3
Architetture avanzate e parallele
Autonomous Networking
Big Data Computing
Business Intelligence
Calcolo Intensivo
Complessitą
Computer Systems and Programming
Concurrent Systems
Crittografia
Elaborazione del Linguaggio Naturale
Estrazione inf. dal web
Fisica 3
Gamification Lab
Information Systems
Ingegneria degli Algoritmi
Interazione Multi Modale
Metodi Formali per il Software
Methods in Computer Science Education: Analysis
Methods in Computer Science Education: Design
Prestazioni dei Sistemi di Rete
Prog. avanzata
Internet of Things
Sistemi Centrali
Reti Wireless
Sistemi Biometrici
Sistemi Distribuiti
Sistemi Informativi Geografici
Sistemi operativi 3
Tecniche di Sicurezza basate sui Linguaggi
Teoria della
Dimostrazione
Verifica del software
Visione artificiale
Attivitą complementari
Biologia Computazionale
Design and development of embedded systems for the Internet of Things
Lego Lab
Logic Programming
Pietre miliari della scienza
Prog. di processori multicore
Sistemi per l'interazione locale e remota
Laboratorio di Cyber-Security
Verifica e Validazione di Software Embedded
Altri Webs ...
Altri Webs
Dottorandi
Commissioni
Comm. Didattica
Comm. Didattica_r
Comm. Dottorato
Comm. Erasmus
Comm. Finanziamenti
Comm. Scientifica
Comm Scientifica_r
Corsi esterni
Sistemi Operativi (Matematica)
Perl e Bioperl
ECDL
Fondamenti 1
(NETTUNO)
Tecniche della Programmazione 1° modulo
(NETTUNO)
Seminars in Artificial Intelligence and Robotics: Natural Language Processing
Informatica generale
Primo canale
Secondo canale
II canale A.A. 10-11
Informatica
Informatica per Statistica
Laboratorio di Strumentazione Elettronica e Informatica
Progetti
Nemo
Quis
Remus
TWiki ...
TWiki
Tutto su TWiki
Users
Main
Sandbox
Home
Site map
AA web
AAP web
ACSAI web
AA2021 web
Programming web
AA2021 web
AN web
ASD web
Algebra web
AL web
AA1112 web
AA1213 web
AA1920 web
AA2021 web
MZ web
AA1112 web
AA1213 web
AA1112 web
AA1314 web
AA1415 web
AA1516 web
AA1617 web
AA1819 web
Old web
Algo_par_dis web
Algoreti web
More...
TWiki Web
User registration
Users
Groups
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
View
Raw View
Print version
Find backlinks
History
More topic actions
Edit
Raw edit
Attach file or image
Edit topic preference settings
Set new parent
More topic actions
User Reference
ATasteOfTWiki
TextFormattingRules
TWikiVariables
FormattedSearch
QuerySearch
TWikiDocGraphics
TWikiSkinBrowser
InstalledPlugins
Admin Maintenance
Reference Manual
InterWikis
ManagingUsers
ManagingWebs
TWikiSiteTools
TWikiPreferences
WebPreferences
Categories
Admin Documentation
Admin Tools
Developer Doc
User Documentation
User Tools
Account
Log In
Register User
Questo sito usa cookies, usandolo ne accettate la presenza. (
CookiePolicy
)
Torna al
Dipartimento di Informatica
E
dit
A
ttach
Copyright © 1999-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback
Note:
Please contribute updates to this topic on TWiki.org at
TWiki:TWiki.PageRenderingProcess
.