Skip to content
Snippets Groups Projects
Commit d63a5dbf authored by Canek Peláez Valdés's avatar Canek Peláez Valdés :slight_smile:
Browse files

Merge branch 'main' of aztlan.fciencias.unam.mx:canek/commonmark

parents 3f339c0b fb1851b4
Branches
Tags
No related merge requests found
Pipeline #1993 passed
......@@ -16,7 +16,7 @@ namespace Commonmark.Node {
*
* If a block has multiple lines, it will have a source span for each line.
*
* Note that the column index and length are measured in Java characters
* Note that the column index and length are measured in unichar characters
* (UTF-16 code units). If you're outputting them to be consumed by another
* programming language, e.g. one that uses UTF-8 strings, you will need to
* translate them, otherwise characters such as emojis will result in
......
namespace Commonmark.Parser {
/**
* Whether to include Commonmark.Node.SourceSpan or not while parsing, see
* Parser.Builder#include_source_spans(IncludeSourceSpans).
* Whether to include {@link Node.SourceSpan} or not while parsing, see
* {@link Parser.Builder.include_source_spans}.
*/
public enum IncludeSourceSpans {
......
......@@ -66,10 +66,15 @@ namespace Commonmark.Parser {
* responsible for closing the reader.
*
* {{{
* var file = GLib.File.new_for_path("file.md");
* var reader = new GLib.DataInputStream(file.read());
* var document = parser.parse_reader(reader);
* ...
* try {
* var file = GLib.File.new_for_path("file.md");
* var reader = new GLib.DataInputStream(file.read());
* var parser = Commonmark.Parser.Parser.builder().build();
* var document = parser.parse_reader(reader);
* ...
* } catch (GLib.Error error) {
* ...
* }
* }}}
*
* Note that if you have a file with a byte order mark (BOM), you need
......@@ -94,8 +99,8 @@ namespace Commonmark.Parser {
return post_process(document);
}
private Commonmark.Internal.DocumentParser create_document_parser() {
return new Commonmark.Internal.DocumentParser(
private Internal.DocumentParser create_document_parser() {
return new Internal.DocumentParser(
block_parser_factories, inline_parser_factory,
delimiter_processors, include_source_spans);
}
......@@ -292,7 +297,7 @@ namespace Commonmark.Parser {
public InlineParser
create(InlineParserContext inline_parser_context) {
return new Commonmark.Internal.InlineParserImpl(
return new Internal.InlineParserImpl(
inline_parser_context);
}
}
......
......@@ -3,7 +3,7 @@ namespace Commonmark.Renderer.Html {
/**
* Renders a tree of nodes to HTML.
*
* Start with the {@link HtmlRenderer.builder} method to configure the
* Start with the {@link Commonmark.Renderer.Html.HtmlRenderer.builder} method to configure the
* renderer. Example:
*
* {{{
......@@ -16,7 +16,7 @@ namespace Commonmark.Renderer.Html {
public class HtmlRenderer : GLib.Object, Renderer {
private string softbreak;
private bool escape_html;
private bool _escape_html;
private bool sanitize_urls;
private UrlSanitizer url_sanitizer;
private bool _percent_encode_urls;
......@@ -25,7 +25,7 @@ namespace Commonmark.Renderer.Html {
private HtmlRenderer(Builder builder) {
this.softbreak = builder._softbreak;
this.escape_html = builder.escape_html;
this._escape_html = builder._escape_html;
this.sanitize_urls = builder._sanitize_urls;
this._percent_encode_urls = builder._percent_encode_urls;
this.url_sanitizer = builder._url_sanitizer;
......@@ -82,7 +82,7 @@ namespace Commonmark.Renderer.Html {
public class Builder : GLib.Object {
public string _softbreak = "\n";
public bool escape_html = false;
public bool _escape_html = false;
public bool _sanitize_urls = false;
public UrlSanitizer _url_sanitizer = new DefaultUrlSanitizer();
public bool _percent_encode_urls = false;
......@@ -125,12 +125,11 @@ namespace Commonmark.Renderer.Html {
* text between an opening tag and a closing tag. So markup in the
* text will be parsed as normal and is not affected by this option.
*
* @param escape_html true for escaping, false for preserving raw
* HTML
* @param _escape_html true for escaping, false for preserving raw HTML
* @return ''this''
*/
public Builder escapeHtml(bool escape_html) {
this.escape_html = escape_html;
public Builder escape_html(bool _escape_html) {
this._escape_html = _escape_html;
return this;
}
......@@ -150,7 +149,7 @@ namespace Commonmark.Renderer.Html {
/**
* {@link UrlSanitizer} used to filter URL's if {@link
* HtmlRenderer.sanitize_urls} is true.
* Commonmark.Renderer.Html.HtmlRenderer.sanitize_urls} is true.
*
* @param _url_sanitizer Filterer used to filter {@link Node.Image}
* src and {@link Node.Link}.
......@@ -168,14 +167,10 @@ namespace Commonmark.Renderer.Html {
*
* If enabled, the following is done:
*
* <ul>
* <li>Existing percent-encoded parts are preserved (e.g. "%20" is
* kept as "%20")</li>
* <li>Reserved characters such as "/" are preserved, except for "["
* and "]" (see encodeURI in JS)</li>
* <li>Unreserved characters such as "a" are preserved</li>
* <li>Other characters such umlauts are percent-encoded</li>
* </ul>
* * Existing percent-encoded parts are preserved (e.g. "%20" is kept as "%20")
* * Reserved characters such as "/" are preserved, except for "[" and "]" (see encodeURI in JS)
* * Unreserved characters such as "a" are preserved
* * Other characters such umlauts are percent-encoded
*
* @param _percent_encode_urls true to percent-encode, false for
* leaving as-is
......@@ -282,7 +277,7 @@ namespace Commonmark.Renderer.Html {
}
public bool should_escape_html() {
return html_renderer.escape_html;
return html_renderer._escape_html;
}
public bool should_sanitize_urls() {
......
......@@ -14,7 +14,7 @@ namespace Commonmark.Renderer {
* Render the specified node.
*
* @param node the node to render, will be an instance of one of {@link
* NodeRenderer.get_node_types}
* Commonmark.Renderer.NodeRenderer.get_node_types}
*/
public abstract void render(Node.Node node);
}
......
......@@ -238,6 +238,7 @@ libcommonmark = library(
if valadoc.found()
pkgs = [ 'config', 'glib-2.0', 'gio-2.0', 'gee-0.8' ]
docdir = 'doc'
vdir = join_paths(meson.current_source_dir(), 'vapi')
command_pkgs = []
foreach pkg : pkgs
command_pkgs = command_pkgs + [ '--pkg=' + pkg ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment