mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-21 08:45:04 -05:00
XEP-0393: clarify quote and plain behavior
This commit is contained in:
parent
d7bbbc330e
commit
b391222d92
95
xep-0393.xml
95
xep-0393.xml
@ -25,6 +25,16 @@
|
|||||||
<supersededby/>
|
<supersededby/>
|
||||||
<shortname>styling</shortname>
|
<shortname>styling</shortname>
|
||||||
&sam;
|
&sam;
|
||||||
|
<revision>
|
||||||
|
<version>0.1.2</version>
|
||||||
|
<date>2018-01-13</date>
|
||||||
|
<initials>ssw</initials>
|
||||||
|
<remark>
|
||||||
|
<p>
|
||||||
|
Clarify block quote and plain text parsing and formatting behavior.
|
||||||
|
</p>
|
||||||
|
</remark>
|
||||||
|
</revision>
|
||||||
<revision>
|
<revision>
|
||||||
<version>0.1.1</version>
|
<version>0.1.1</version>
|
||||||
<date>2018-01-12</date>
|
<date>2018-01-12</date>
|
||||||
@ -98,6 +108,22 @@
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</section1>
|
</section1>
|
||||||
|
<section1 topic='Use Cases' anchor='usecases'>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
As a user sending an instant message to a friend, I want to be able to
|
||||||
|
emphasize an important part of my message.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
As a software developer, I want to be able to send code as pre-formatted,
|
||||||
|
monospace, block or inline text to another developer.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
As a multi-user chat user I want to add context to my reply by quoting an
|
||||||
|
earlier message in the chat.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</section1>
|
||||||
<section1 topic='Glossary' anchor='glossary'>
|
<section1 topic='Glossary' anchor='glossary'>
|
||||||
<p>
|
<p>
|
||||||
Many important terms used in this document are defined in &unicode;.
|
Many important terms used in this document are defined in &unicode;.
|
||||||
@ -175,32 +201,15 @@
|
|||||||
</di>
|
</di>
|
||||||
</dl>
|
</dl>
|
||||||
</section1>
|
</section1>
|
||||||
<section1 topic='Use Cases' anchor='usecases'>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
As a user sending an instant message to a friend, I want to be able to
|
|
||||||
emphasize an important part of my message.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
As a software developer, I want to be able to send pre-formatted,
|
|
||||||
monospace, block or inline text to another developer.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
As a multi-user chat user I want to quote something someone said earlier
|
|
||||||
in the chat and make it evident that the text is a quotation.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</section1>
|
|
||||||
<section1 topic='Business Rules' anchor='rules'>
|
<section1 topic='Business Rules' anchor='rules'>
|
||||||
<section2 topic='Spans' anchor='span'>
|
<section2 topic='Spans' anchor='span'>
|
||||||
<p>
|
<p>
|
||||||
Matches of spans between two styling directives MUST contain some text
|
Matches of spans between two styling directives MUST contain some text
|
||||||
between the two styling directives and the opening styling directive MUST
|
between the two styling directives and the opening styling directive MUST
|
||||||
be located at the beginning of the line, or after a whitespace character.
|
be located at the beginning of the line, or after a whitespace character.
|
||||||
The opening styling directive MUST also not be followed by a whitespace
|
The opening styling directive MUST NOT be followed by a whitespace
|
||||||
character.
|
character and the closing styling directive MUST NOT be preceeded by a
|
||||||
The closing styling directive MUST NOT be preceeded by a whitespace
|
whitespace character.
|
||||||
character.
|
|
||||||
Spans are always parsed from the beginning of the byte stream to the end
|
Spans are always parsed from the beginning of the byte stream to the end
|
||||||
and are lazily matched.
|
and are lazily matched.
|
||||||
Characters that would be styling directives but do not follow these rules
|
Characters that would be styling directives but do not follow these rules
|
||||||
@ -229,10 +238,21 @@
|
|||||||
<li>**</li>
|
<li>**</li>
|
||||||
<li>****</li>
|
<li>****</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<section3 topic='Plain' anchor='plain'>
|
||||||
|
<p>
|
||||||
|
Any text inside of a block that is not part of another span is
|
||||||
|
implicitly considered to be inside of a "plain text" span.
|
||||||
|
</p>
|
||||||
|
<example caption='Plain'><![CDATA[
|
||||||
|
<body>
|
||||||
|
(Two spans, both )(*alike in dignity*)
|
||||||
|
</body>
|
||||||
|
]]></example>
|
||||||
|
</section3>
|
||||||
<section3 topic='Strong' anchor='strong'>
|
<section3 topic='Strong' anchor='strong'>
|
||||||
<p>
|
<p>
|
||||||
Text enclosed by '*' (U+002A ASTERISK) is strong SHOULD be displayed as
|
Text enclosed by '*' (U+002A ASTERISK) is strong and SHOULD be displayed
|
||||||
bold.
|
with a heavier font weight than the surrounding text (bold).
|
||||||
</p>
|
</p>
|
||||||
<example caption='Strong'><![CDATA[
|
<example caption='Strong'><![CDATA[
|
||||||
<body>
|
<body>
|
||||||
@ -268,7 +288,7 @@
|
|||||||
<p>
|
<p>
|
||||||
Text enclosed by a '`' (U+0060 GRAVE ACCENT) is a preformatted span SHOULD
|
Text enclosed by a '`' (U+0060 GRAVE ACCENT) is a preformatted span SHOULD
|
||||||
be displayed inline in a monospace font.
|
be displayed inline in a monospace font.
|
||||||
A preformatted span may only contain plaintext.
|
A preformatted span may only contain a single plain span.
|
||||||
Inline formatting directives inside the preformatted span are not
|
Inline formatting directives inside the preformatted span are not
|
||||||
rendered.
|
rendered.
|
||||||
For example, the following all contain valid preformatted spans:
|
For example, the following all contain valid preformatted spans:
|
||||||
@ -286,7 +306,28 @@
|
|||||||
</section3>
|
</section3>
|
||||||
</section2>
|
</section2>
|
||||||
<section2 topic='Blocks' anchor='block'>
|
<section2 topic='Blocks' anchor='block'>
|
||||||
<section3 topic='Preformatted Block' anchor='pre-block'>
|
<p>
|
||||||
|
Parsers implementing message styling will first parse blocks and then
|
||||||
|
parse child blocks or spans if allowed by the specific block type.
|
||||||
|
</p>
|
||||||
|
<section3 topic='Plain' anchor='line-block'>
|
||||||
|
<p>
|
||||||
|
Groups of lines that are not part of any other block are considered a
|
||||||
|
"plain" block, as are individual lines of text that are not inside of a
|
||||||
|
preformatted text block.
|
||||||
|
Plain blocks are not bound by styling directives and do not imply
|
||||||
|
formatting themselves, but they may contain spans which imply
|
||||||
|
formatting.
|
||||||
|
</p>
|
||||||
|
<example caption='Plain block text'><![CDATA[
|
||||||
|
<body>
|
||||||
|
((There are four blocks in this body marked by parens,)
|
||||||
|
(but there is no *formatting)
|
||||||
|
(as spans* may not escape blocks.))
|
||||||
|
</body>
|
||||||
|
]]></example>
|
||||||
|
</section3>
|
||||||
|
<section3 topic='Preformatted Text' anchor='pre-block'>
|
||||||
<p>
|
<p>
|
||||||
A preformatted text block is started by a line beginning with "```"
|
A preformatted text block is started by a line beginning with "```"
|
||||||
(U+0060 GRAVE ACCENT), and ended by a line containing only three grave
|
(U+0060 GRAVE ACCENT), and ended by a line containing only three grave
|
||||||
@ -316,11 +357,13 @@
|
|||||||
</section3>
|
</section3>
|
||||||
<section3 topic='Quotations' anchor='quote'>
|
<section3 topic='Quotations' anchor='quote'>
|
||||||
<p>
|
<p>
|
||||||
A quotation is indicated by one or more lines with a byte stream beginning
|
A quotation is indicated by one or more lines with a byte stream
|
||||||
with a '>' (U+003E GREATER-THAN SIGN).
|
beginning with a '>' (U+003E GREATER-THAN SIGN).
|
||||||
Block quotes may contain any child block, including other quotations.
|
Block quotes may contain any child block, including other quotations.
|
||||||
Lines inside the block quote MUST have leading spaces trimmed before
|
Lines inside the block quote MUST have leading spaces trimmed before
|
||||||
parsing the child block.
|
parsing the child block.
|
||||||
|
It is RECOMMENDED that text inside of a block quote be indented or
|
||||||
|
distinguished from the surrounding text in some other way.
|
||||||
</p>
|
</p>
|
||||||
<example caption='Quotation (LTR)'><![CDATA[
|
<example caption='Quotation (LTR)'><![CDATA[
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user