Codebase list mdp-src / 82f400b
New upstream version 1.0.11 Lev Lamberov 6 years ago
11 changed file(s) with 100 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
+0
-14
.gitignore less more
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
1212 mnalt
1313 guobin2312
1414 lukebond
15 namhyung
1516
99 mdp needs the ncursesw headers to compile.
1010 So make sure you have them installed:
1111
12 - on Cygwin you need `libncursesw10` and `libncurses-devel`
1312 - on Raspbian (Raspberry Pi) you need `libncurses5-dev` and `libncursesw5-dev`
1413
1514 Now download and install mdp:
2120 $ mdp sample.md
2221
2322 - 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.
2424 - On Debian, you can use the existing [DEB package](https://tracker.debian.org/pkg/mdp-src), or run `apt-get install mdp`.
2525 - On FreeBSD, you can use the port [misc/mdp](http://www.freshports.org/misc/mdp).
2626 - On OS-X, use the existing [Homebrew Formula](http://brewformulas.org/Mdp) by running `brew install mdp`.
2424
2525 #define MDP_VER_MAJOR 1
2626 #define MDP_VER_MINOR 0
27 #define MDP_VER_REVISION 9
27 #define MDP_VER_REVISION 11
2828
2929 #endif // !defined( MAIN_H )
4747 IS_QUOTE,
4848 IS_CODE,
4949 IS_TILDE_CODE,
50 IS_GFM_CODE,
5051 IS_HR,
5152 IS_UNORDERED_LIST_1,
5253 IS_UNORDERED_LIST_2,
5858 int next_blank(cstring_t *text, int i);
5959 int next_word(cstring_t *text, int i);
6060 int next_nontilde(cstring_t *text, int i);
61 int next_nonbacktick(cstring_t *text, int i);
6162
6263 #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
114114 becomes
115115
116116 ~~~ {.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!");
119119 }
120120 ~~~~~~~~~~~~~~~~~~
121121
122122 Pandoc attributes (like ".numberlines" etc.)
123123 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
124148
125149 -------------------------------------------------
126150
157157 slide = next_slide(slide);
158158 sc++;
159159
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)) &&
161162 CHECK_BIT(bits, IS_EMPTY)) {
162163 // remove tilde code markers
163164 (text->reset)(text);
399400 static int unordered_list_level = 0;
400401 static int unordered_list_level_offset[] = {-1, -1, -1, -1};
401402 static int num_tilde_characters = 0;
403 static int num_backticks = 0;
402404
403405 int i = 0; // increment
404406 int bits = 0; // markdown bits
443445 if (num_tilde_characters > 0) {
444446 SET_BIT(bits, IS_CODE);
445447 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);
446469 return bits;
447470 }
448471
830853 return i;
831854 }
832855
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
164164 for (; *i; i++) {
165165 if (*i == '\\') {
166166 i++;
167 } else if ( *i == '[' && *(i+1) != ']') {
167 } else if ( *i == '[' && *(i+1) && *(i+1) != ']') {
168168 while (*i && *i != ']') i++;
169169 i++;
170170 if (*i == '(' && wcschr(i, ')')) {
184184 for (; *i; i++) {
185185 if (*i == '\\') {
186186 i++;
187 } else if ( *i == '[' && *(i+1) != ']') {
187 } else if ( *i == '[' && *(i+1) && *(i+1) != ']') {
188188 while (*i && *i != ']') i++;
189189 i++;
190190 if (*i == '(' && wcschr(i, ')')) {
655655 // IS_CODE
656656 if(CHECK_BIT(line->bits, IS_CODE)) {
657657
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)) {
659660 // set static offset for code
660661 offset = CODE_INDENT;
661662 }