Skip to content

Commit

Permalink
feat(parser): support double punctuation in quoted text (#39)
Browse files Browse the repository at this point in the history
add a `LIMITATIONS.adoc` file to report limitations or
differences with Asciidoc/Asciidoctor when using nested
quotes or unbalanced quotes.

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
  • Loading branch information
xcoulon authored Oct 31, 2017
1 parent 56d7119 commit f7f82e9
Show file tree
Hide file tree
Showing 12 changed files with 1,610 additions and 460 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Don’t get discouraged if you don't get an immediate response, this is a side-p

== Bug triage

* You can help report bugs by filing them https://github.com/bytesparadise/libasciidoc/issues[here].
* You can help report bugs by filling them https://github.com/bytesparadise/libasciidoc/issues[here].

* You can help us diagnose and fix existing bugs by asking and providing answers for the following:
** Is the bug reproducible as explained?
Expand Down
67 changes: 67 additions & 0 deletions CONTRIBUTE.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>This is the contribute.md of our project. Great to have you here. Here are a few ways you can help make this project better!</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_adding_new_features">Adding new features</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Please open an issue <a href="https://github.com/bytesparadise/libasciidoc/issues">here</a> to discuss about the feature you would like to see in Libasciidoc,
If you&#8217;re in the mood to implement it (that&#8217;s awesome!), then submit a pull-request along with enough tests (both at the parser level and at the renderer level) to validate the behaviour of your code.</p>
</div>
<div class="paragraph">
<p>Don’t get discouraged if you don&#8217;t get an immediate response, this is a side-project.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_bug_triage">Bug triage</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p>You can help report bugs by filling them <a href="https://github.com/bytesparadise/libasciidoc/issues">here</a>.</p>
</li>
<li>
<p>You can help us diagnose and fix existing bugs by asking and providing answers for the following:</p>
<div class="ulist">
<ul>
<li>
<p>Is the bug reproducible as explained?</p>
</li>
<li>
<p>Are the steps to reproduce the bug clear? If not, can you describe how you might reproduce it?</p>
</li>
<li>
<p>What tags should the bug have?</p>
</li>
<li>
<p>Is this bug something you have run into? Would you appreciate it being looked into faster?</p>
</li>
</ul>
</div>
</li>
<li>
<p>You can close fixed bugs by testing old tickets to see if they are still happening.</p>
</li>
<li>
<p>You can update our changelog here:</p>
</li>
<li>
<p>You can remove duplicate bug reports by:</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_beta_testing">Beta testing</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Testing existing features is a good way to contribute to the project, too!</p>
</div>
</div>
</div>
36 changes: 36 additions & 0 deletions LIMITATIONS.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
= Known limitations and differences with Asciidoc/Asciidoctor

This document reports the known limitations and differences with Asciidoc/Asciidoctor.
In any case, feel free to https://github.com/bytesparadise/libasciidoc/issues[open an issue]
if you want to discuss about an actual limitation of Libasciidoc or if you want to report a new one.

== Quoted Text

Quoted text rendering can differ in the following cases:

- when the punctuation is unbalanced. Eg:
```
some **bold content*.
```
will be rendered as the raw input:
```
some **bold content*.
```
instead of :
```
<p>some <strong>*bold content</strong></p>
```

- when quoted text uses the same punctuation. Eg:
```
*some *nested bold* content*.
```
Libasciidoc will detect the nested bold quote and renderer accordingly:
```
<strong>some <strong>nested bold</strong> content</strong>.
```
whereas Asciidoc/Asciidoctor will produce :
```
<p><strong>some *nested bold</strong> content*.</p>
```

73 changes: 73 additions & 0 deletions LIMITATIONS.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>This document reports the known limitations and differences with Asciidoc/Asciidoctor.
In any case, feel free to <a href="https://github.com/bytesparadise/libasciidoc/issues">open an issue</a>
if you want to discuss about an actual limitation of Libasciidoc or if you want to report a new one.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_quoted_text">Quoted Text</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Quoted text rendering can differ in the following cases:</p>
</div>
<div class="ulist">
<ul>
<li>
<p>when the punctuation is unbalanced. Eg:</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>some **bold content*.</code></pre>
</div>
</div>
<div class="paragraph">
<p>will be rendered as the raw input:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>some **bold content*.</code></pre>
</div>
</div>
<div class="paragraph">
<p>instead of :</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>&lt;p&gt;some &lt;strong&gt;*bold content&lt;/strong&gt;&lt;/p&gt;</code></pre>
</div>
</div>
<div class="ulist">
<ul>
<li>
<p>when quoted text uses the same punctuation. Eg:</p>
</li>
</ul>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>*some *nested bold* content*.</code></pre>
</div>
</div>
<div class="paragraph">
<p>Libasciidoc will detect the nested bold quote and renderer accordingly:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>&lt;strong&gt;some &lt;strong&gt;nested bold&lt;/strong&gt; content&lt;/strong&gt;.</code></pre>
</div>
</div>
<div class="paragraph">
<p>whereas Asciidoc/Asciidoctor will produce :</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code>&lt;p&gt;&lt;strong&gt;some *nested bold&lt;/strong&gt; content*.&lt;/p&gt;</code></pre>
</div>
</div>
</div>
</div>
5 changes: 4 additions & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ It is is available under the terms of the https://raw.githubusercontent.com/byte
* Block images (`image:://`)
* Element attributes (ID, link and title, when applicable) on block images, paragraphs, lists and sections


See the http://LIMITATIONS.adoc[known limitations] page for differences between Asciidoc/Asciidoctor and Libasciidoc.

Further elements will be supported in the future. Feel free to open issues https://github.com/bytesparadise/libasciidoc/issues[here] to help prioritizing the upcoming work.

== Installation
Expand All @@ -43,4 +46,4 @@ where the returned `types.DocumentAttributes` object contains the document's tit

== How to contribute

Please refer to the http://CONTRIBUTE.adoc[Contribute] file.
Please refer to the http://CONTRIBUTE.adoc[Contribute] page.
110 changes: 110 additions & 0 deletions README.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p><span class="image"><a class="image" href="https://travis-ci.org/bytesparadise/libasciidoc"><img src="https://travis-ci.org/bytesparadise/libasciidoc.svg?branch=master" alt="Build Status"></a></span>
<span class="image"><a class="image" href="https://codecov.io/gh/bytesparadise/libasciidoc"><img src="https://codecov.io/gh/bytesparadise/libasciidoc/branch/master/graph/badge.svg" alt="Codecov"></a></span>
<span class="image"><a class="image" href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a></span></p>
</div>
<div class="paragraph">
<p>Libasciidoc is an open source Go library that converts Asciidoc content into HTML (other output formats may be supported in the future).
It is is available under the terms of the <a href="https://raw.githubusercontent.com/bytesparadise/libasciidoc/LICENSE">Apache License 2.0</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_supported_syntax">Supported syntax</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p>Title and Sections (level 1 to 6)</p>
</li>
<li>
<p>Document attribute declaration (after the title and within the rest of the document) and substitution</p>
</li>
<li>
<p>Paragraphs</p>
</li>
<li>
<p>Delimited Source Blocks (using the ``` delimiter, a.k.a "fences")</p>
</li>
<li>
<p>Literal blocks (paragraph starting with a space, with the "&#8230;&#8203;." delimiter or with the <code>[literal]</code> attribute)</p>
</li>
<li>
<p>Quoted text (bold, <em>italic</em> and <code>monospace</code>)</p>
</li>
<li>
<p>Unordered lists, using the <code>-</code> marker for simple lists, or the <code>*</code> marker for nested lists (and <code>**</code>, <code>***</code>, etc. for the sublists) .</p>
</li>
<li>
<p>External links in paragraphs (<code>https://</code>, <code>http://</code>, <code>ftp://</code>, <code>irc://</code>, <code>mailto:</code>)</p>
</li>
<li>
<p>Inline images in paragraphs (<code>image://</code>)</p>
</li>
<li>
<p>Block images (<code>image:://</code>)</p>
</li>
<li>
<p>Element attributes (ID, link and title, when applicable) on block images, paragraphs, lists and sections</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>See the <a href="http://LIMITATIONS.adoc">known limitations</a> document for differences between Asciidoc/Asciidoctor and Libasciidoc.</p>
</div>
<div class="paragraph">
<p>Further elements will be supported in the future. Feel free to open issues <a href="https://github.com/bytesparadise/libasciidoc/issues">here</a> to help prioritizing the upcoming work.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_installation">Installation</h2>
<div class="sectionbody">
<div class="literalblock">
<div class="content">
<pre>$ go get -u github.com/bytesparadise/libasciidoc</pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_usage">Usage</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Libasciidoc provides 2 functions to convert an Asciidoc content into HTML:</p>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Converting to a complete HTML document:</p>
<div class="literalblock">
<div class="content">
<pre>func ConvertToHTML(context.Context, io.Reader, io.Writer, renderer.Options) error</pre>
</div>
</div>
</li>
<li>
<p>Converting to a <code>body</code> element only:</p>
<div class="literalblock">
<div class="content">
<pre>func ConvertToHTMLBody(context.Context, io.Reader, io.Writer) (*types.DocumentAttributes, error)</pre>
</div>
</div>
</li>
</ol>
</div>
<div class="paragraph">
<p>where the returned <code>types.DocumentAttributes</code> object contains the document&#8217;s title (which is not rendered in the HTML&#8217;s body) and its other attributes.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_how_to_contribute">How to contribute</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Please refer to the <a href="http://CONTRIBUTE.adoc">Contribute</a> file.</p>
</div>
</div>
</div>
Loading

0 comments on commit f7f82e9

Please sign in to comment.