Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
b30836a2
Commit
b30836a2
authored
6 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
A good start on dokuwiki tables.
Still need to deal with alignment, sizing to terminal.
parent
255d0bc0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/markdown.js
+39
-8
39 additions, 8 deletions
exec/load/markdown.js
with
39 additions
and
8 deletions
exec/load/markdown.js
+
39
−
8
View file @
b30836a2
...
...
@@ -322,10 +322,25 @@ Markdown.prototype.render_line_console = function (line) {
this
.
state
.
list_stack
=
[];
}
row
=
ret
.
split
(
'
|
'
);
if
(
row
.
length
>
1
)
{
// Table
const
tre
=
/
([
|^
])([^
|^
]
+
)(?=[
|^
])
/g
;
match
=
tre
.
exec
(
ret
);
if
(
match
!==
null
)
{
const
_ret
=
match
.
input
;
const
row
=
[];
do
{
if
(
match
[
1
]
==
'
^
'
)
{
row
.
push
(
'
\
1+
'
+
this
.
config
.
console
.
heading_style
+
match
[
2
]
+
'
\
1-
'
);
}
else
{
row
.
push
(
match
[
2
]);
}
match
=
tre
.
exec
(
ret
);
}
while
(
match
!==
null
);
this
.
state
.
table
.
push
(
row
);
return
;
ret
=
ret
.
replace
(
_ret
,
''
);
return
ret
;
}
else
if
(
this
.
state
.
table
.
length
)
{
ret
+=
this
.
render_table
();
}
...
...
@@ -418,10 +433,26 @@ Markdown.prototype.render_line_html = function (line) {
ret
+=
'
</
'
+
this
.
state
.
list_stack
.
pop
()
+
'
>
'
;
}
row
=
ret
.
split
(
'
|
'
);
if
(
row
.
length
>
1
)
{
// Table
const
tre
=
/
([
|^
])([^
|^
]
+
)(?=[
|^
])
/g
;
match
=
tre
.
exec
(
ret
);
if
(
match
!==
null
)
{
const
_ret
=
match
.
input
;
const
row
=
[];
do
{
if
(
match
[
1
]
==
'
^
'
)
{
// This is lousy, but if you want table headings to look special,
// then include a 'doku_th' class in your stylesheet.
// You're welcome.
row
.
push
(
'
<span class="doku_th">
'
+
match
[
2
]
+
'
</span>
'
);
}
else
{
row
.
push
(
match
[
2
]);
}
match
=
tre
.
exec
(
ret
);
}
while
(
match
!==
null
);
this
.
state
.
table
.
push
(
row
);
return
;
ret
=
ret
.
replace
(
_ret
,
''
);
return
ret
;
}
else
if
(
this
.
state
.
table
.
length
)
{
ret
+=
this
.
render_table
();
}
...
...
@@ -484,9 +515,9 @@ Markdown.prototype.render_html = function (text) {
if
(
typeof
line
==
'
string
'
)
writeln
(
line
);
});
if
(
this
.
state
.
footnotes
.
length
)
{
writeln
(
'
<hr>
'
);
writeln
(
'
<hr>
Footnotes:<br>
'
);
this
.
state
.
footnotes
.
forEach
(
function
(
e
,
i
)
{
writeln
(
'
<a
name
="f
'
+
(
i
+
1
)
+
'
">
'
+
(
i
+
1
)
+
'
)
'
+
e
+
'
<br>
'
);
writeln
(
'
<a
id
="f
'
+
(
i
+
1
)
+
'
">
[
'
+
(
i
+
1
)
+
'
]
'
+
e
+
'
<
/a><
br>
'
);
});
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment