Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doxverilog
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
doxverilog
Commits
3598e8fd
Commit
3598e8fd
authored
Mar 17, 2014
by
Dimitri van Heesch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 726294 - Markdown Extra - fenced code block: '>' before tab width parsed as block quote
parent
fdc81edc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
10 deletions
+27
-10
markdown.cpp
src/markdown.cpp
+27
-10
No files found.
src/markdown.cpp
View file @
3598e8fd
...
...
@@ -1925,12 +1925,29 @@ static void findEndOfLine(GrowBuf &out,const char *data,int size,
//printf("findEndOfLine pi=%d i=%d end=%d {%s}\n",pi,i,end,QCString(data+i).left(end-i).data());
}
static
void
writeFencedCodeBlock
(
GrowBuf
&
out
,
const
char
*
data
,
const
char
*
lng
,
int
blockStart
,
int
blockEnd
)
{
QCString
lang
=
lng
;
if
(
!
lang
.
isEmpty
()
&&
lang
.
at
(
0
)
==
'.'
)
lang
=
lang
.
mid
(
1
);
out
.
addStr
(
"@code"
);
if
(
!
lang
.
isEmpty
())
{
out
.
addStr
(
"{"
+
lang
+
"}"
);
}
out
.
addStr
(
data
+
blockStart
,
blockEnd
-
blockStart
);
out
.
addStr
(
"
\n
"
);
out
.
addStr
(
"@endcode"
);
}
static
QCString
processQuotations
(
const
QCString
&
s
,
int
refIndent
)
{
GrowBuf
out
;
const
char
*
data
=
s
.
data
();
int
size
=
s
.
length
();
int
i
=
0
,
end
=
0
,
pi
=-
1
;
int
blockStart
,
blockEnd
,
blockOffset
;
QCString
lang
;
while
(
i
<
size
)
{
findEndOfLine
(
out
,
data
,
size
,
pi
,
i
,
end
);
...
...
@@ -1938,7 +1955,15 @@ static QCString processQuotations(const QCString &s,int refIndent)
if
(
pi
!=-
1
)
{
if
(
isBlockQuote
(
data
+
pi
,
i
-
pi
,
refIndent
))
if
(
isFencedCodeBlock
(
data
+
pi
,
size
-
pi
,
refIndent
,
lang
,
blockStart
,
blockEnd
,
blockOffset
))
{
writeFencedCodeBlock
(
out
,
data
+
pi
,
lang
,
blockStart
,
blockEnd
);
i
=
pi
+
blockOffset
;
pi
=-
1
;
end
=
i
+
1
;
continue
;
}
else
if
(
isBlockQuote
(
data
+
pi
,
i
-
pi
,
refIndent
))
{
i
=
pi
+
writeBlockQuote
(
out
,
data
+
pi
,
size
-
pi
);
pi
=-
1
;
...
...
@@ -2089,15 +2114,7 @@ static QCString processBlocks(const QCString &s,int indent)
{
//printf("Found FencedCodeBlock lang='%s' start=%d end=%d code={%s}\n",
// lang.data(),blockStart,blockEnd,QCString(data+pi+blockStart).left(blockEnd-blockStart).data());
if
(
!
lang
.
isEmpty
()
&&
lang
.
at
(
0
)
==
'.'
)
lang
=
lang
.
mid
(
1
);
out
.
addStr
(
"@code"
);
if
(
!
lang
.
isEmpty
())
{
out
.
addStr
(
"{"
+
lang
+
"}"
);
}
out
.
addStr
(
data
+
pi
+
blockStart
,
blockEnd
-
blockStart
);
out
.
addStr
(
"
\n
"
);
out
.
addStr
(
"@endcode"
);
writeFencedCodeBlock
(
out
,
data
+
pi
,
lang
,
blockStart
,
blockEnd
);
i
=
pi
+
blockOffset
;
pi
=-
1
;
end
=
i
+
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment