History: Parsing contexts
Source of version: 21 (current)
Copy to clipboard
The ((parser)) has to deal with different contexts.
! Main contexts
Different document types support different contexts. With default preference values, a wiki page can contain ((doc:Wiki syntax)) and HTML would be displayed literally. But if so configured, pages can contain HTML. And if so configured, pages can be edited with a WYSIWYG editor.
! Database
Wiki pages are stored in tiki_pages. There are 2 relevant columns in tiki_pages, is_html and wysiwyg. WYSIWYG pages have tiki_pages.wysiwyg=y.
With default configuration, pages are by default created with tiki_pages.is_html=0 and tiki_pages.wysiwyg=n.
“Allow HTML” (non-WYSIWYG HTML) pages have is_html=1 and tiki_pages.wysiwyg=n.
“WYSIWYG HTML” pages have tiki_pages.is_html=1 and tiki_pages.wysiwyg=y.
“WYSIWYG wiki” pages have tiki_pages.is_html=0 and tiki_pages.wysiwyg=y.
Tracking of WYSIWYG or HTML support is not consistent in all object types. For example, blog posts only track whether they use WYSIWYG or not. If WYSIWYG is enabled, HTML is supported, but if tiki_blog_posts.wysiwyg is "n", HTML is displayed literally.
! Preferences and settings
When the ''feature_wiki_allowhtml'' preference ("Allow HTML") is enabled, each wiki page gets a "Allow HTML" setting making it possible to allow HTML.
The ''wysiwyg_htmltowiki'' preference affects all new pages, but none of the pages created before it was enabled. To switch an old page, it must be converted to non-WYSIWYG, saved, then converted back to WYSIWYG.
The ''wysiwyg_wiki_parsed'' preference was added to disable parsing in a non-WYSIWYG page if "Allow HTML" is enabled, but also affects WYSIWYG pages as of 2018-02-05. [https://sourceforge.net/p/tikiwiki/mailman/message/36170373/|Thread "~np~The Epic Story of wysiwyg_wiki_[semi_]parsed - Is the End Coming~/np~?"] has more information on that preference.
The effect of the "Allow HTML" setting is the same as putting the whole content of a page in a call to the HTML plugin.
! Plugins
Besides the INCLUDE plugin, 2 plugins enable to change the context: HTML, which supports HTML and Tiki syntax or just HTML, and WYSIWYG, which supports either HTML or Tiki syntax.
! Map of contexts
This list attempts to picture all possible contexts and sub-contexts where parsable texts may occur, but this recurses with no limit. Arrows in a yellow disk indicate subcontexts to which an infinity of subcontexts could be added.
Incorrect behavior is in red. Behavior which could be considered wrong looking at part of the tree but right looking at another part is in orange.
# __WYSIWYG page__
## __wysiwyg_htmltowiki enabled__
### Regular: ~~#090:HTML is escaped. Tiki markup is interpreted.~~
### __In HTML plugin__. Problematic according to https://dev.tiki.org/item4741
#### Wiki syntax parameter enabled: ~~#090:HTML interpreted, Tiki markup not parsed.~~
#### Wiki syntax parameter disabled: ~~#090:HTML interpreted~~, Tiki markup only parsed if wysiwyg_wiki_parsed is enabled. (:arrow:)
### __In WYSIWYG plugin – must be rare__
#### use_html enabled: ~~#090:HTML is interpreted~~ but converted to Tiki markup on edition. ~~#F90:Tiki markup is interpreted~~. (:arrow:)
#### use_html disabled: ~~#F00:HTML is interpreted~~, ~~#090:Tiki markup is interpreted~~. (:arrow:)
## __wysiwyg_htmltowiki disabled__
### wysiwyg_wiki_parsed enabled : ~~#090:HTML is interpreted~~. Tiki syntax is interpreted. As of 2018-02-06, affected by ~~#F00:"What you see in WYSIWYG editor is NOT NECESSARILY what you get" (see ticket #6523)~~ (:arrow:)
### wysiwyg_wiki_parsed disabled : ~~#090:HTML is interpreted.~~ Tiki syntax not interpreted. As of 2018-02-06, affected by ~~#F00:No plugins and WYSIWYG help is wrong/broken (see ticket #6527)~~
# __Non-WYSIWYG page__
## __HTML not allowed__
### Regular content (outside WYSIWYG or HTML): ~~#090:HTML is escaped. Tiki syntax is parsed.~~
### __Content in HTML plugin__
#### __Wiki syntax parameter enabled__
##### Regular content (outside WYSIWYG or HTML): ~~#090:HTML is interpreted. Tiki syntax is parsed.~~ Broken prior to 19 (65157) (:arrow:)
##### __Content in WYSIWYG plugin__
###### use_html enabled : ~~#090:HTML is interpreted.~~ ~~#F90:Tiki syntax is interpreted.~~ (:arrow:)
###### use_html disabled : ~~#F90:HTML is interpreted.~~~~#090: Tiki syntax is interpreted.~~ (:arrow:)
#### Wiki syntax parameter disabled: ~~#090:HTML is interpreted.~~ ~~#090:Tiki syntax is not interpreted.~~
### __Content in WYSIWYG plugin__
#### use_html enabled : ~~#090:HTML is interpreted. Tiki markup is interpreted~~, so "What you see in WYSIWYG editor is NOT NECESSARILY what you get" (see ticket #6523), but plugins are still invisible as of 2018-02-06. (:arrow:)
#### __use_html disabled__
##### Regular content : ~~#F90:HTML is interpreted.~~ ~~#090:Tiki markup is interpreted~~, plugins are invisible as of 2018-02-06 (see ticket #6551).
##### Content in HTML plugin?
## __HTML allowed.__ Simply enabling HTML affects newlines.
### wysiwyg_wiki_parsed enabled: ~~#090:HTML is interpreted.~~ ~~#090:Tiki markup is interpreted~~ (:arrow:)
### wysiwyg_wiki_parsed disabled: ~~#090:HTML is interpreted. Tiki markup is not interpreted.~~
! Tests
* ((Parser_wiki_test)) - Test wiki page for the default context
* {attach id="211"} (just a file containing the source, since HTML pages cannot be created on dev.tiki.org)