Tags:
tag this topic
create new tag
view all tags
---+ Package =TWiki::Render= This module provides most of the actual HTML rendering code in TWiki. %TOC% ---++ ClassMethod *new* <tt>($session)</tt> Creates a new renderer ---++ ObjectMethod *finish* <tt>()</tt> Break circular references. ---++ ObjectMethod *renderParent* <tt>($web,$topic,$meta,$params) -> $text</tt> Render parent meta-data ---++ ObjectMethod *renderMoved* <tt>($web,$topic,$meta,$params) -> $text</tt> Render moved meta-data ---++ StaticMethod *chompUtf8Fragment* <tt>($str) -> $str</tt> String truncation may happen in the middle of a UTF-8 byte sequence. This function gets rid of the truncated fragment. ---++ ObjectMethod *makeAnchorName* <tt>($anchorName,$compatibilityMode) -> $anchorName</tt> * =$anchorName= - the unprocessed anchor name * =$compatibilityMode= - SMELL: compatibility with *what*?? Who knows. :-( Build a valid HTML anchor name ---++ ObjectMethod *makeUniqueAnchorName* <tt>($web,$topic,$anchorName,$compatibility) -> $anchorName</tt> * =$anchorName= - the unprocessed anchor name * =$compatibilityMode= - SMELL: compatibility with *what*?? Who knows. :-( Build a valid HTML anchor name (unique w.r.t. the list stored in %anchornames) ---++ ObjectMethod *internalLink* <tt>($theWeb,$theTopic,$theLinkText,$theAnchor,$doLink,$doKeepWeb,$hasExplicitLinkLabel,$theParams) -> $html</tt> Generate a link. Note: Topic names may be spaced out. Spaced out names are converted to <nop>WikWords, for example, "spaced topic name" points to "SpacedTopicName". * =$theWeb= - the web containing the topic * =$theTopic= - the topic to be link * =$theLinkText= - text to use for the link * =$theAnchor= - the link anchor, if any * =$doLinkToMissingPages= - boolean: false means suppress link for non-existing pages * =$doKeepWeb= - boolean: true to keep web prefix (for non existing Web.TOPIC) * =$hasExplicitLinkLabel= - boolean: true in case of [[TopicName][explicit link label]] * =$theParams= - the URL parameters specified by ?name1=value1;name2=valu2;... excluding the leading ?. This is added as per Item7505. This parameter's natural position is before =$theAnchor=. But to minimize code changes, it's introduced as the laster one Called by _handleWikiWord and _handleSquareBracketedLink and by Func::internalLink Calls _renderWikiWord, which in turn will use Plurals.pm to match fold plurals to equivalency with their singular form SMELL: why is this available to Func? ---++ ObjectMethod *renderFORM* <tt>(%params,$topic,$web) -> $tml</tt> Returns TML of a TWiki Form, based on %FORM{}% variable. ---++ ObjectMethod *renderFORMFIELD* <tt>(%params,$topic,$web) -> $html</tt> Returns the fully rendered expansion of a %FORMFIELD{}% tag. ---++ ObjectMethod *renderEDITFORM* <tt>(%params,$topic,$web) -> $tml</tt> Returns TML of a TWiki Form, based on %EDITFORM{}% variable. ---++ ObjectMethod *renderEDITFORMFIELD* <tt>(%params,$topic,$web) -> $html</tt> Returns the fully rendered expansion of a %EDITFORMFIELD{}% tag. ---++ ObjectMethod *getRenderedVersion* <tt>($text,$theWeb,$theTopic) -> $html</tt> The main rendering function. ---++ StaticMethod *verbatimCallBack* <tt></tt> Callback for use with putBackBlocks that replaces < and > by their HTML entities &lt; and &gt; ---++ ObjectMethod *TML2PlainText* <tt>($text,$web,$topic,$opts) -> $plainText</tt> Clean up TWiki text for display as plain text without pushing it through the full rendering pipeline. Intended for generation of topic and change summaries. Adds nop tags to prevent TWiki subsequent rendering; nops get removed at the very end. Defuses TML. $opts: * showvar - shows !%VAR% names if not expanded * expandvar - expands !%VARS% * nohead - strips ---+ headings at the top of the text * showmeta - does not filter meta-data * entityencode - entity encode the resulting plain text (for title parameter) ---++ ObjectMethod *protectPlainText* <tt>($text) -> $tml</tt> Protect plain text from expansions that would normally be done duing rendering, such as wikiwords. Topic summaries, for example, have to be protected this way. ---++ ObjectMethod *makeTopicSummary* <tt>($theText,$theTopic,$theWeb,$theFlags) -> $tml</tt> Makes a plain text summary of the given topic by simply trimming a bit off the top. Truncates to $TMTRUNC chars or, if a number is specified in $theFlags, to that length. ---++ ObjectMethod *takeOutBlocks* <tt>(\$text,$tag,\%map) -> $text</tt> * =$text= - Text to process * =$tag= - XHTML-style tag. * =\%map= - Reference to a hash to contain the removed blocks Return value: $text with blocks removed Searches through $text and extracts blocks delimited by a tag, appending each onto the end of the @buffer and replacing with a token string which is not affected by TWiki rendering. The text after these substitutions is returned. Parameters to the open tag are recorded. This is _different_ to takeOutProtected, because it requires tags to be on their own line. it also supports a callback for post- processing the data before re-insertion. ---++ ObjectMethod *putBackBlocks* <tt>(\$text,\%map,$tag,$newtag,$callBack) -> $text</tt> Return value: $text with blocks added back * =\$text= - reference to text to process * =\%map= - map placeholders to blocks removed by takeOutBlocks * =$tag= - Tag name processed by takeOutBlocks * =$newtag= - Tag name to use in output, in place of $tag. If undefined, uses $tag. * =$callback= - Reference to function to call on each block being inserted (optional) Reverses the actions of takeOutBlocks. Each replaced block is processed by the callback (if there is one) before re-insertion. Parameters to the outermost cut block are replaced into the open tag, even if that tag is changed. This allows things like <verbatim class=''> to be mapped to <pre class=''> Cool, eh what? Jolly good show. And if you set $newtag to '', we replace the taken out block with the valuse itself * which i'm using to stop the rendering process, but then at the end put in the html directly (for <literal> tag. ---++ ObjectMethod *renderRevisionInfo* <tt>($web,$topic,$meta,$rev,$format) -> $string</tt> Obtain and render revision info for a topic. * =$web= - the web of the topic * =$topic= - the topic * =$meta= if specified, get rev info from here. If not specified, or meta contains rev info for a different version than the one requested, will reload the topic * =$rev= - the rev number, defaults to latest rev * =$format= - the render format, defaults to =$rev - $time - $wikiusername= =$format= can contain the following keys for expansion: | =$web= | the web name | | =$topic= | the topic name | | =$rev= | the rev number | | =$comment= | the comment | | =$username= | the login of the saving user | | =$wikiname= | the wikiname of the saving user | | =$wikiusername= | the web.wikiname of the saving user | | =$date= | the date of the rev (no time) | | =$time= | the time of the rev | | =$min=, =$sec=, etc. | Same date format qualifiers as GMTIME | ---++ ObjectMethod *summariseChanges* <tt>($user,$web,$topic,$orev,$nrev,$tml) -> $text</tt> * =$user= - user (null to ignore permissions) * =$web= - web * =$topic= - topic * =$orev= - older rev * =$nrev= - later rev * =$tml= - if true will generate renderable TML (i.e. HTML with NOPs. if false will generate a summary suitable for use in plain text (mail, for example) Generate a (max 3 line) summary of the differences between the revs. If there is only one rev, a topic summary will be returned. If =$tml= is not set, all HTML will be removed. In non-tml, lines are truncated to 70 characters. Differences are shown using + and - to indicate added and removed text. ---++ ObjectMethod *forEachLine* <tt>($text,\&fn,\%options) -> $newText</tt> Iterate over each line, calling =\&fn= on each. \%options may contain: * =pre= => true, will call fn for each line in pre blocks * =verbatim= => true, will call fn for each line in verbatim blocks * =literal= => true, will call fn for each line in literal blocks * =noautolink= => true, will call fn for each line in =noautolink= blocks The spec of \&fn is =sub fn( $line, \%options ) -> $newLine=. The %options hash passed into this function is passed down to the sub, and the keys =in_literal=, =in_pre=, =in_verbatim= and =in_noautolink= are set boolean TRUE if the line is from one (or more) of those block types. The return result replaces $line in $newText. ---++ StaticMethod *getReferenceRE* <tt>($web,$topic,%options) -> $re</tt> * $web, $topic - specify the topic being referred to, or web if $topic is undef. * %options - the following options are available * =interweb= - if true, then fully web-qualified references are required. * =grep= - if true, generate a GNU-grep compatible RE instead of the default Perl RE. * =url= - if set, generates an expression that will match a TWiki URL that points to the web/topic, instead of the default which matches topic links in plain text. Generate a regular expression that can be used to match references to the specified web/topic. Note that the resultant RE will only match fully qualified (i.e. with web specifier) topic names and topic names that are wikiwords in text. Works for spaced-out wikiwords for topic names. The RE returned is designed to be used with =s///= ---++ StaticMethod *replaceTopicReferences* <tt>($text,\%options) -> $text</tt> Callback designed for use with forEachLine, to replace topic references. \%options contains: * =oldWeb= => Web of reference to replace * =oldTopic= => Topic of reference to replace * =newWeb= => Web of new reference * =newTopic= => Topic of new reference * =inWeb= => the web which the text we are presently processing resides in * =fullPaths= => optional, if set forces all links to full web.topic form For a usage example see TWiki::UI::Manage.pm ---++ StaticMethod *replaceWebReferences* <tt>($text,\%options) -> $text</tt> Callback designed for use with forEachLine, to replace web references. \%options contains: * =oldWeb= => Web of reference to replace * =newWeb= => Web of new reference For a usage example see TWiki::UI::Manage.pm ---++ ObjectMethod *replaceWebInternalReferences* <tt>(\$text,\%meta,$oldWeb,$oldTopic)</tt> Change within-web wikiwords in $$text and $meta to full web.topic syntax. \%options must include topics => list of topics that must have references to them changed to include the web specifier. ---++ StaticMethod *breakName* <tt>($text,$args) -> $text</tt> * =$text= - text to "break" * =$args= - string of format (\d+)([,\s*]\.\.\.)?) Hyphenates $text every $1 characters, or if $2 is "..." then shortens to $1 characters and appends "..." (making the final string $1+3 characters long) _Moved from Search.pm because it was obviously unhappy there, as it is a rendering function_ ---++ StaticMethod *protectFormFieldValue* <tt>($value,$attrs) -> $html</tt> Given the value of a form field, and a set of attributes that control how to display that value, protect the value from further processing. The protected value is determined from the value of the field after: * newlines are replaced with value of $attrs->{newline} if defined * processing through breakName if $attrs->{break} is defined * escaping of $vars if $attrs->{protectdollar} is defined * | is replaced with &#124; or the value of $attrs->{bar} if defined
E
dit
|
A
ttach
|
Watch
|
P
rint version
|
H
istory
: r11
<
r10
<
r9
<
r8
<
r7
|
B
acklinks
|
V
iew topic
|
Ra
w
edit
|
M
ore topic actions
Topic revision: r11 - 2018-07-16
-
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.TWikiRenderDotPm
.