Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
e2ef3810
Commit
e2ef3810
authored
Nov 06, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix parsing of section names
parent
6af5757d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
50 deletions
+75
-50
doc/cmake/caf-generate-rst.cpp
doc/cmake/caf-generate-rst.cpp
+75
-50
No files found.
doc/cmake/caf-generate-rst.cpp
View file @
e2ef3810
...
...
@@ -841,55 +841,6 @@ BEGIN_STATE(await_section)
END_STATE
(
await_section
)
BEGIN_STATE
(
await_section_label
)
void
entry
(
const
std
::
string
&
section_name
,
char
highlighting
)
{
spaces
.
clear
();
this
->
section_name
=
section_name
;
this
->
highlighting
=
highlighting
;
}
void
operator
()(
label
&
x
)
{
out
()
<<
".. _"
<<
x
.
name
<<
":
\n\n
"
<<
section_name
<<
'\n'
<<
std
::
string
(
section_name
.
size
(),
highlighting
)
<<
"
\n\n
"
;
transition
(
parent_
->
read_body
);
}
void
operator
()(
text
&
x
)
{
// Ignore whitespaces between \section and \label commands.
if
(
x
.
str
.
empty
())
return
;
if
(
!
spaces
.
empty
())
{
x
.
str
.
insert
(
x
.
str
.
begin
(),
spaces
.
begin
(),
spaces
.
end
());
delegate
();
return
;
}
if
(
std
::
all_of
(
x
.
str
.
begin
(),
x
.
str
.
end
(),
::
isspace
))
spaces
=
std
::
move
(
x
.
str
);
else
delegate
();
}
template
<
class
T
>
void
operator
()(
T
&
)
{
delegate
();
}
void
delegate
()
{
out
()
<<
section_name
<<
'\n'
<<
std
::
string
(
section_name
.
size
(),
highlighting
)
<<
"
\n\n
"
;
epsilon
(
parent_
->
read_body
);
}
std
::
string
section_name
;
std
::
string
spaces
;
char
highlighting
;
END_STATE
(
await_section_label
)
struct
string_stream
{
std
::
string
&
result
;
};
...
...
@@ -973,9 +924,13 @@ Out& operator<<(Out& out, experimental&) {
}
// namespace rst_ops
template
<
class
Out
>
struct
rst_ops_visitor
{
struct
rst_ops_visitor
:
abstract_consumer
{
Out
&
out
;
rst_ops_visitor
(
Out
&
out
)
:
out
(
out
)
{
// nop
}
template
<
class
T
>
detail
::
enable_if_t
<
is_inline
<
T
>::
value
>
operator
()(
T
&
x
)
{
using
namespace
rst_ops
;
...
...
@@ -986,8 +941,78 @@ struct rst_ops_visitor {
detail
::
enable_if_t
<!
is_inline
<
T
>::
value
>
operator
()(
T
&
)
{
throw
std
::
runtime_error
(
"expected an inline command"
);
}
void
consume
(
node
x
)
override
{
caf
::
visit
(
*
this
,
x
);
}
template
<
class
T
>
void
consume
(
T
x
)
{
(
*
this
)(
x
);
}
void
cmd
(
const
std
::
string
&
name
,
std
::
vector
<
std
::
string
>
args
)
{
consume
(
make_node
(
name
,
std
::
move
(
args
)));
}
};
BEGIN_STATE
(
await_section_label
)
void
entry
(
const
std
::
string
&
section_name
,
char
highlighting
)
{
spaces
.
clear
();
this
->
section_name
.
clear
();
this
->
highlighting
=
highlighting
;
// TODO: The tokenzier should parse TeX inside section names, too. Remove
// this hack once the sections contains nodes instead of just a
// string.
string_stream
str_out
{
this
->
section_name
};
rst_ops_visitor
<
string_stream
>
v
{
str_out
};
using
iterator_type
=
std
::
string
::
const_iterator
;
parser_state
<
iterator_type
>
res
{
section_name
.
begin
(),
section_name
.
end
()};
read_tex
(
res
,
v
);
}
void
operator
()(
label
&
x
)
{
out
()
<<
".. _"
<<
x
.
name
<<
":
\n\n
"
<<
section_name
<<
'\n'
<<
std
::
string
(
section_name
.
size
(),
highlighting
)
<<
"
\n\n
"
;
transition
(
parent_
->
read_body
);
}
void
operator
()(
text
&
x
)
{
// Ignore whitespaces between \section and \label commands.
if
(
x
.
str
.
empty
())
return
;
if
(
!
spaces
.
empty
())
{
x
.
str
.
insert
(
x
.
str
.
begin
(),
spaces
.
begin
(),
spaces
.
end
());
delegate
();
return
;
}
if
(
std
::
all_of
(
x
.
str
.
begin
(),
x
.
str
.
end
(),
::
isspace
))
spaces
=
std
::
move
(
x
.
str
);
else
delegate
();
}
template
<
class
T
>
void
operator
()(
T
&
)
{
delegate
();
}
void
delegate
()
{
out
()
<<
section_name
<<
'\n'
<<
std
::
string
(
section_name
.
size
(),
highlighting
)
<<
"
\n\n
"
;
epsilon
(
parent_
->
read_body
);
}
std
::
string
section_name
;
std
::
string
spaces
;
char
highlighting
;
END_STATE
(
await_section_label
)
BEGIN_STATE
(
read_body
)
void
entry
()
{
...
...
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