AsciiDoc export: Escape '[' and ']' in URIs.
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
861232ab38
commit
622ccb9a03
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.2)
|
cmake_minimum_required (VERSION 3.2)
|
||||||
project(remwharead
|
project(remwharead
|
||||||
VERSION 0.4.1
|
VERSION 0.4.2
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
13
src/adoc.cpp
13
src/adoc.cpp
|
@ -57,7 +57,7 @@ void Export::AsciiDoc::print() const
|
||||||
}
|
}
|
||||||
|
|
||||||
_out << "[[dt_" << timepoint_to_string(entry.datetime) << "]]\n";
|
_out << "[[dt_" << timepoint_to_string(entry.datetime) << "]]\n";
|
||||||
_out << "* link:" << entry.uri;
|
_out << "* link:" << replace_in_uri(entry.uri);
|
||||||
if (!entry.title.empty())
|
if (!entry.title.empty())
|
||||||
{
|
{
|
||||||
_out << '[' << replace_in_title(entry.title) << ']';
|
_out << '[' << replace_in_title(entry.title) << ']';
|
||||||
|
@ -71,7 +71,8 @@ void Export::AsciiDoc::print() const
|
||||||
_out << '_' << get_time(entry).substr(0, 5) << '_';
|
_out << '_' << get_time(entry).substr(0, 5) << '_';
|
||||||
if (!entry.archive_uri.empty())
|
if (!entry.archive_uri.empty())
|
||||||
{
|
{
|
||||||
_out << " (link:" << entry.archive_uri << "[archived version])";
|
_out << " (link:" << replace_in_uri(entry.archive_uri)
|
||||||
|
<< "[archived version])";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool separator = false;
|
bool separator = false;
|
||||||
|
@ -167,6 +168,14 @@ const string Export::AsciiDoc::replace_in_title(const string &text) const
|
||||||
return replace(text, {{ "]", "\\]" }});
|
return replace(text, {{ "]", "\\]" }});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const string Export::AsciiDoc::replace_in_uri(const string &text) const
|
||||||
|
{
|
||||||
|
return replace(text,
|
||||||
|
{
|
||||||
|
{ "[", "%5B" }, { "]", "%5D" }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void Export::AsciiDoc::print_tags(const tagmap &tags) const
|
void Export::AsciiDoc::print_tags(const tagmap &tags) const
|
||||||
{
|
{
|
||||||
_out << "== Tags\n\n";
|
_out << "== Tags\n\n";
|
||||||
|
|
|
@ -43,6 +43,8 @@ namespace Export
|
||||||
const string replace_in_tag(const string &text) const;
|
const string replace_in_tag(const string &text) const;
|
||||||
//! Replaces characters in title that asciidoctor doesn't like.
|
//! Replaces characters in title that asciidoctor doesn't like.
|
||||||
const string replace_in_title(const string &text) const;
|
const string replace_in_title(const string &text) const;
|
||||||
|
//! Replaces characters in URI that asciidoctor doesn't like.
|
||||||
|
const string replace_in_uri(const string &text) const;
|
||||||
void print_tags(const tagmap &tags) const;
|
void print_tags(const tagmap &tags) const;
|
||||||
const string get_day(const Database::entry &entry) const;
|
const string get_day(const Database::entry &entry) const;
|
||||||
const string get_time(const Database::entry &entry) const;
|
const string get_time(const Database::entry &entry) const;
|
||||||
|
|
Loading…
Reference in New Issue