Update upstream source from tag 'upstream/1.0.11'
Update to upstream version '1.0.11'
with Debian dir db095c5349bb4954ecd9449f1c46b986c87aab3a
Lev Lamberov
6 years ago
0 | |
# temporary compile results
|
1 | |
*.o
|
2 | |
|
3 | |
# Binary excutions
|
4 | |
mdp
|
5 | |
mdp.exe
|
6 | |
|
7 | |
# Other temporary files
|
8 | |
.DS_Store
|
9 | |
*~
|
10 | |
*.swp
|
11 | |
*.sublime-workspace
|
12 | |
*.out
|
13 | |
tags
|
9 | 9 |
mdp needs the ncursesw headers to compile.
|
10 | 10 |
So make sure you have them installed:
|
11 | 11 |
|
12 | |
- on Cygwin you need `libncursesw10` and `libncurses-devel`
|
13 | 12 |
- on Raspbian (Raspberry Pi) you need `libncurses5-dev` and `libncursesw5-dev`
|
14 | 13 |
|
15 | 14 |
Now download and install mdp:
|
|
21 | 20 |
$ mdp sample.md
|
22 | 21 |
|
23 | 22 |
- On Arch, you can use the existing [AUR package](https://aur.archlinux.org/packages/mdp-git/).
|
|
23 |
- on Cygwin you can use the existing [package](https://cygwin.com/cgi-bin2/package-grep.cgi?grep=mdp.exe) from the setup program.
|
24 | 24 |
- On Debian, you can use the existing [DEB package](https://tracker.debian.org/pkg/mdp-src), or run `apt-get install mdp`.
|
25 | 25 |
- On FreeBSD, you can use the port [misc/mdp](http://www.freshports.org/misc/mdp).
|
26 | 26 |
- On OS-X, use the existing [Homebrew Formula](http://brewformulas.org/Mdp) by running `brew install mdp`.
|
24 | 24 |
|
25 | 25 |
#define MDP_VER_MAJOR 1
|
26 | 26 |
#define MDP_VER_MINOR 0
|
27 | |
#define MDP_VER_REVISION 9
|
|
27 |
#define MDP_VER_REVISION 11
|
28 | 28 |
|
29 | 29 |
#endif // !defined( MAIN_H )
|
58 | 58 |
int next_blank(cstring_t *text, int i);
|
59 | 59 |
int next_word(cstring_t *text, int i);
|
60 | 60 |
int next_nontilde(cstring_t *text, int i);
|
|
61 |
int next_nonbacktick(cstring_t *text, int i);
|
61 | 62 |
|
62 | 63 |
#endif // !defined( PARSER_H )
|
|
0 |
# package name
|
|
1 |
NAME="mdp"
|
|
2 |
VERSION=1.0.9
|
|
3 |
RELEASE=1
|
|
4 |
|
|
5 |
# .hint generation
|
|
6 |
CATEGORY="Utils"
|
|
7 |
SUMMARY="A command-line based markdown presentation tool"
|
|
8 |
DESCRIPTION="A ncurses-based command-line presentation tool, which makes
|
|
9 |
it easy to create slides using the popular markdown format."
|
|
10 |
|
|
11 |
# source and patch files
|
|
12 |
SRC_URI="https://github.com/visit1985/mdp/archive/${VERSION}.tar.gz"
|
|
13 |
DOCS="sample.md"
|
|
14 |
|
|
15 |
# Build dependencies only
|
|
16 |
DEPEND="gcc-core libncurses-devel make"
|
|
17 |
# runtime deps to go in setup.hint
|
|
18 |
#REQUIRES="libncursesw10"
|
|
19 |
|
|
20 |
# custom src_compile, src_install and src_test
|
|
21 |
|
|
22 |
src_compile() {
|
|
23 |
cd ${S}
|
|
24 |
cygmake
|
|
25 |
}
|
|
26 |
|
|
27 |
src_install() {
|
|
28 |
cd ${S}
|
|
29 |
PREFIX=/usr cyginstall
|
|
30 |
}
|
|
31 |
|
|
32 |
src_test() { :; }
|
|
33 |
|
114 | 114 |
becomes
|
115 | 115 |
|
116 | 116 |
~~~ {.numberLines}
|
117 | |
int main(int argc, char \*argv[]) {
|
118 | |
printf("%s\\n", "Hello world!");
|
|
117 |
int main(int argc, char *argv[]) {
|
|
118 |
printf("%s\n", "Hello world!");
|
119 | 119 |
}
|
120 | 120 |
~~~~~~~~~~~~~~~~~~
|
121 | 121 |
|
122 | 122 |
Pandoc attributes (like ".numberlines" etc.)
|
123 | 123 |
will be ignored
|
|
124 |
|
|
125 |
-------------------------------------------------
|
|
126 |
|
|
127 |
-> # Supported markdown formatting <-
|
|
128 |
|
|
129 |
You can also use [github](https://guides.github.com/features/mastering-markdown/#GitHub-flavored-markdown) flavored markdown's
|
|
130 |
code block. Use at least three backticks to open
|
|
131 |
and at least as many or more backticks for closing.
|
|
132 |
|
|
133 |
\```
|
|
134 |
\int main(int argc, char \*argv[]) {
|
|
135 |
\ printf("%s\\n", "Hello world!");
|
|
136 |
\}
|
|
137 |
\```
|
|
138 |
|
|
139 |
becomes
|
|
140 |
|
|
141 |
```
|
|
142 |
int main(int argc, char *argv[]) {
|
|
143 |
printf("%s\n", "Hello world!");
|
|
144 |
}
|
|
145 |
```
|
|
146 |
|
|
147 |
Language hint will be ignored
|
124 | 148 |
|
125 | 149 |
-------------------------------------------------
|
126 | 150 |
|
157 | 157 |
slide = next_slide(slide);
|
158 | 158 |
sc++;
|
159 | 159 |
|
160 | |
} else if(CHECK_BIT(bits, IS_TILDE_CODE) &&
|
|
160 |
} else if((CHECK_BIT(bits, IS_TILDE_CODE) ||
|
|
161 |
CHECK_BIT(bits, IS_GFM_CODE)) &&
|
161 | 162 |
CHECK_BIT(bits, IS_EMPTY)) {
|
162 | 163 |
// remove tilde code markers
|
163 | 164 |
(text->reset)(text);
|
|
399 | 400 |
static int unordered_list_level = 0;
|
400 | 401 |
static int unordered_list_level_offset[] = {-1, -1, -1, -1};
|
401 | 402 |
static int num_tilde_characters = 0;
|
|
403 |
static int num_backticks = 0;
|
402 | 404 |
|
403 | 405 |
int i = 0; // increment
|
404 | 406 |
int bits = 0; // markdown bits
|
|
443 | 445 |
if (num_tilde_characters > 0) {
|
444 | 446 |
SET_BIT(bits, IS_CODE);
|
445 | 447 |
SET_BIT(bits, IS_TILDE_CODE);
|
|
448 |
return bits;
|
|
449 |
}
|
|
450 |
|
|
451 |
// IS_GFM_CODE
|
|
452 |
if (wcsncmp(text->value, L"```", 3) == 0) {
|
|
453 |
int backticks_in_line = next_nonbacktick(text, 0);
|
|
454 |
if (backticks_in_line >= num_backticks) {
|
|
455 |
if (num_backticks > 0) {
|
|
456 |
num_backticks = 0;
|
|
457 |
} else {
|
|
458 |
num_backticks = backticks_in_line;
|
|
459 |
}
|
|
460 |
SET_BIT(bits, IS_EMPTY);
|
|
461 |
SET_BIT(bits, IS_GFM_CODE);
|
|
462 |
return bits;
|
|
463 |
}
|
|
464 |
}
|
|
465 |
|
|
466 |
if (num_backticks > 0) {
|
|
467 |
SET_BIT(bits, IS_CODE);
|
|
468 |
SET_BIT(bits, IS_GFM_CODE);
|
446 | 469 |
return bits;
|
447 | 470 |
}
|
448 | 471 |
|
|
830 | 853 |
return i;
|
831 | 854 |
}
|
832 | 855 |
|
|
856 |
int next_nonbacktick(cstring_t *text, int i) {
|
|
857 |
while ((i < text->size) && text->value[i] == L'`')
|
|
858 |
i++;
|
|
859 |
|
|
860 |
return i;
|
|
861 |
}
|
|
862 |
|
164 | 164 |
for (; *i; i++) {
|
165 | 165 |
if (*i == '\\') {
|
166 | 166 |
i++;
|
167 | |
} else if ( *i == '[' && *(i+1) != ']') {
|
|
167 |
} else if ( *i == '[' && *(i+1) && *(i+1) != ']') {
|
168 | 168 |
while (*i && *i != ']') i++;
|
169 | 169 |
i++;
|
170 | 170 |
if (*i == '(' && wcschr(i, ')')) {
|
|
184 | 184 |
for (; *i; i++) {
|
185 | 185 |
if (*i == '\\') {
|
186 | 186 |
i++;
|
187 | |
} else if ( *i == '[' && *(i+1) != ']') {
|
|
187 |
} else if ( *i == '[' && *(i+1) && *(i+1) != ']') {
|
188 | 188 |
while (*i && *i != ']') i++;
|
189 | 189 |
i++;
|
190 | 190 |
if (*i == '(' && wcschr(i, ')')) {
|
655 | 655 |
// IS_CODE
|
656 | 656 |
if(CHECK_BIT(line->bits, IS_CODE)) {
|
657 | 657 |
|
658 | |
if (!CHECK_BIT(line->bits, IS_TILDE_CODE)) {
|
|
658 |
if (!CHECK_BIT(line->bits, IS_TILDE_CODE) &&
|
|
659 |
!CHECK_BIT(line->bits, IS_GFM_CODE)) {
|
659 | 660 |
// set static offset for code
|
660 | 661 |
offset = CODE_INDENT;
|
661 | 662 |
}
|