├── .circleci
└── config.yml
├── .editorconfig
├── .github
├── ISSUE_TEMPLATE.md
├── ISSUE_TEMPLATE
│ ├── NEW_FEATURE_REQUEST.md
│ └── REPRODUCIBLE_BUG_REPORT.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .php_cs.dist
├── .plugin_includes
├── CONTRIBUTING.md
├── LICENSE.Apache-2.0
├── LICENSE.GPL-2.0-or-later
├── LICENSE.txt
├── Makefile
├── README.md
├── assets
├── sample-page.txt
└── screenshot.png
├── composer.json
├── composer.lock
├── conf
├── default.php
└── metadata.php
├── docker-compose.yml
├── lang
├── en
│ ├── lang.php
│ └── settings.php
└── ja
│ ├── lang.php
│ └── settings.php
├── phpunit.xml.dist
├── plugin.info.txt
├── scripts
├── archive.bash
├── copy-to-docker-volume.bash
└── push-release-tag.bash
├── src
├── DokuWiki
│ └── Plugin
│ │ └── Mdpage
│ │ ├── Markdown.php
│ │ ├── Markdown
│ │ ├── GitHubFlavored.php
│ │ ├── MarkdownExtra.php
│ │ └── Traditional.php
│ │ └── MarkdownRendererTrait.php
└── bootstrap.php
├── syntax.php
└── tests
├── DokuWiki
└── Test
│ └── Plugin
│ └── Mdpage
│ └── MarkdownSpecTest.php
├── bootstrap.php
└── specs
├── cannot-lookup-ref
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── dokuwiki-internal
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── features
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── htmlok
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── issue-24
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── issue-35
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── issue-40
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── issue-50
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
├── metadata
├── Content.md
└── Content_GFM.meta.txt
└── without-htmlok
├── Content.md
├── Content_GFM.html
├── Content_MarkdownExtra.html
└── Content_Traditional.html
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 |
3 | jobs:
4 | build:
5 | docker:
6 | - image: circleci/php:7.3-node-browsers
7 | steps:
8 | - checkout
9 |
10 | - run: sudo composer self-update
11 |
12 | - run: make
13 | - run: mkdir -p /tmp/artifacts
14 | - run: cp archive.tar.gz /tmp/artifacts/plugin-package.tar.gz
15 |
16 | - persist_to_workspace:
17 | root: /tmp/artifacts
18 | paths:
19 | - plugin-package.tar.gz
20 |
21 | test:
22 | docker:
23 | - image: circleci/php:7.3-node-browsers
24 | steps:
25 | - checkout
26 |
27 | - run: sudo composer self-update
28 |
29 | - restore_cache:
30 | keys:
31 | - composer-v1-{{ checksum "composer.lock" }}
32 | # fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/)
33 | - composer-v1-
34 | - run: composer install --no-ansi --no-interaction --prefer-dist
35 | # `_test` directory of dokuwiki is not included by `--prefer-dist` (maybe, this is GitHub issue).
36 | # This is the fallback.
37 | - run: |
38 | if [ ! -d vendor/splitbrain/dokuwiki/_test ]; then
39 | rm -rf vendor/splitbrain/dokuwiki
40 | composer install --no-ansi --no-interaction --prefer-source
41 | fi
42 | - save_cache:
43 | key: composer-v1-{{ checksum "composer.lock" }}
44 | paths:
45 | - vendor
46 |
47 | - run: ./bin/php-cs-fixer fix --dry-run
48 |
49 | - run: |
50 | curl -o cc-test-reporter -sSL https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
51 | chmod +x ./cc-test-reporter
52 |
53 | - run: |
54 | sudo docker-php-ext-enable xdebug
55 |
56 | - run: |
57 | ./cc-test-reporter before-build
58 | phpdbg -qrr ./bin/phpunit --coverage-clover clover.xml
59 | ./cc-test-reporter after-build --exit-code $? \
60 | --coverage-input-type clover
61 |
62 | docker-test:
63 | machine: true
64 | steps:
65 | - checkout
66 |
67 | - run: docker-compose build
68 |
69 | - restore_cache:
70 | keys:
71 | - composer-v1-{{ checksum "composer.lock" }}
72 | # fallback to using the latest cache if no exact match is found (See https://circleci.com/docs/2.0/caching/)
73 | - composer-v1-
74 |
75 | - run: |
76 | docker-compose up -d
77 | sleep 10
78 |
79 | - run: |
80 | ./scripts/copy-to-docker-volume.bash
81 |
82 | - run: |
83 | curl -v http://localhost:8080/doku.php?start | \
84 | grep 'simple paragraph: emph, strong and mono
.'
85 |
86 | - run: docker-compose down
87 |
88 | deploy:
89 | docker:
90 | - image: circleci/golang:1.13
91 | steps:
92 | - checkout
93 |
94 | - attach_workspace:
95 | at: /tmp/artifacts
96 |
97 | - run: go get github.com/tcnksm/ghr
98 |
99 | - run: |
100 | VERSION="${CIRCLE_TAG}"
101 | ghr \
102 | -t ${GITHUB_TOKEN} \
103 | -u ${CIRCLE_PROJECT_USERNAME} \
104 | -r ${CIRCLE_PROJECT_REPONAME} \
105 | -c ${CIRCLE_SHA1} \
106 | -n "Release ${VERSION}" \
107 | "${VERSION}" \
108 | /tmp/artifacts
109 |
110 | - run: |
111 | VERSION="${CIRCLE_TAG}"
112 | git config user.email "release-bot@users.noreply.github.com"
113 | git config user.name "release-bot"
114 | git checkout release || git checkout -b release
115 | cp /tmp/artifacts/plugin-package.tar.gz .
116 | git add -f plugin-package.tar.gz
117 | git commit -m "Automatic release $VERSION"
118 | git remote add for-release \
119 | "https://${GITHUB_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}"
120 | git push -u for-release release
121 |
122 | workflows:
123 | version: 2
124 | test:
125 | jobs:
126 | - test:
127 | filters:
128 | branches:
129 | ignore: release
130 | - docker-test:
131 | requires:
132 | - test
133 | filters:
134 | branches:
135 | ignore: release
136 | build-and-deploy:
137 | jobs:
138 | - build:
139 | filters:
140 | branches:
141 | only: master
142 | tags:
143 | only: /.*/
144 | - deploy:
145 | requires:
146 | - build
147 | filters:
148 | branches:
149 | ignore: /.*/
150 | tags:
151 | only: /^v\d+\.\d+\.\d+$/
152 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | indent_size = 4
7 | indent_style = space
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [Makefile]
12 | indent_style = tab
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
17 | [tests/specs/**/*.{html,txt}]
18 | indent_style = tab
19 | trim_trailing_whitespace = false
20 | insert_final_newline = false
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Please fill out one of the templates on: https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues/new/choose
2 |
3 | We will close issues asking questions or requesting changes without comment.
4 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/NEW_FEATURE_REQUEST.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: New Feature Request
3 | about: Request new feature you want
4 |
5 | ---
6 |
7 | This repository is abondoned. Issues will be left.
8 |
9 |
19 |
20 | **This is a feature request.**
21 |
22 | Specification:
23 |
24 | Motivations:
25 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/REPRODUCIBLE_BUG_REPORT.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Reproducible Bug Report
3 | about: Submit an issue so we can investigate
4 |
5 | ---
6 |
7 | This repository is abondoned. Issues will be left.
8 |
9 |
15 |
16 | **This is a bug report.**
17 |
18 | | Name | Value |
19 | | --- | --- |
20 | | DokuWiki Version | |
21 | | PHP Version | |
22 | | OS | |
23 | | Web Server | |
24 |
25 | Expect behavior:
26 |
27 | Actual behavior:
28 |
29 | Details:
30 |
31 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | - [ ] Have you followed the [guidelines for contributing](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/blob/master/CONTRIBUTING.md)?
2 | - [ ] Have you checked that there aren't other open [pull requests](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/pulls) for the same update/change?
3 |
4 | ---
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.tar.gz
2 | /coverage/
3 |
4 | # for DokuWiki
5 | /manager.dat
6 |
7 | # for Composer
8 | /vendor/
9 | /bin/
10 |
11 | # for CS Fixer
12 | .php_cs.cache
13 |
--------------------------------------------------------------------------------
/.php_cs.dist:
--------------------------------------------------------------------------------
1 | files()
5 | ->in(__DIR__.'/conf')
6 | ->in(__DIR__.'/lang')
7 | ->in(__DIR__.'/src')
8 | ->in(__DIR__.'/tests')
9 | ->name('*.php')
10 | ;
11 |
12 | return PhpCsFixer\Config::create()
13 | ->setFinder($finder)
14 | ->setRules([
15 | '@Symfony' => true,
16 | 'yoda_style' => false,
17 | 'braces' => [
18 | 'position_after_functions_and_oop_constructs' => 'same',
19 | ],
20 | 'phpdoc_summary' => false,
21 | ])
22 | ;
23 |
--------------------------------------------------------------------------------
/.plugin_includes:
--------------------------------------------------------------------------------
1 | conf
2 | lang
3 | src
4 | vendor
5 | README.md
6 | LICENSE.txt
7 | LICENSE.Apache-2.0
8 | LICENSE.GPL-2.0-or-later
9 | plugin.info.txt
10 | syntax.php
11 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing Guide
2 |
3 | Read the section for your purpose.
4 |
5 | ## Report a bug
6 |
7 | 1. Check FAQ on https://www.dokuwiki.org/plugin:mdpage#faq
8 | 2. Check known issues on https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues
9 | 3. [Open an issue](https://github.com/mizunashi-mana/dokuwiki-plugin-mdpage/issues/new) according to the template
10 |
11 | ## Contribute a fix
12 |
13 | 1. `composer install --prefer-source --dev`
14 | 2. `./bin/php-cs-fixer fix`
15 | 3. `composer test` and fix any failing tests
16 | 4. `git commit` with message
17 | 5. Open a pull request and fix any failing tests
18 |
19 | NOTICE:
20 |
21 | This plugin includes source codes of dependent libraries.
22 | When we add a new library to depend, we should check license compatibles.
23 |
--------------------------------------------------------------------------------
/LICENSE.Apache-2.0:
--------------------------------------------------------------------------------
1 | Copyright 2018- Mizunashi Mana
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
14 |
--------------------------------------------------------------------------------
/LICENSE.GPL-2.0-or-later:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | htmlok
on DokuWiki configuration.';
120 | var_dump(htmlspecialchars($match));
121 | var_dump(htmlspecialchars($result));
122 | echo '
';
123 | */
124 |
125 | return true;
126 | }
127 |
128 | protected function _debug($message, $err, $line, $file = __FILE__) {
129 | if ($this->getConf('debug')) {
130 | msg($message, $err, $line, $file);
131 | }
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/tests/DokuWiki/Test/Plugin/Mdpage/MarkdownSpecTest.php:
--------------------------------------------------------------------------------
1 | specsDirPath = PROJECT_ROOT_DIR_PATH.'/tests/specs';
19 | $this->defaultFlavors = [
20 | Markdown::GITHUB_FLAVORED,
21 | Markdown::MARKDOWN_EXTRA,
22 | Markdown::TRADITIONAL,
23 | ];
24 | }
25 |
26 | public function testFeatures() {
27 | $this->assertSpec(
28 | 'features/Content',
29 | $this->defaultFlavors
30 | );
31 | }
32 |
33 | public function testHtmlok() {
34 | global $conf;
35 | $conf['htmlok'] = 1;
36 |
37 | $this->assertSpec(
38 | 'htmlok/Content',
39 | $this->defaultFlavors
40 | );
41 | }
42 |
43 | public function testWithoutHtmlok() {
44 | $this->assertSpec(
45 | 'without-htmlok/Content',
46 | $this->defaultFlavors
47 | );
48 | }
49 |
50 | public function testDokuwikiInternal() {
51 | $this->assertSpec(
52 | 'dokuwiki-internal/Content',
53 | $this->defaultFlavors
54 | );
55 | }
56 |
57 | public function testCannotLookupRef() {
58 | $this->assertSpec(
59 | 'cannot-lookup-ref/Content',
60 | $this->defaultFlavors
61 | );
62 | }
63 |
64 | public function testIssue24() {
65 | $this->assertSpec(
66 | 'issue-24/Content',
67 | $this->defaultFlavors
68 | );
69 | }
70 |
71 | public function testIssue35() {
72 | $this->assertSpec(
73 | 'issue-35/Content',
74 | $this->defaultFlavors
75 | );
76 | }
77 |
78 | public function testIssue40() {
79 | $this->assertSpec(
80 | 'issue-40/Content',
81 | $this->defaultFlavors
82 | );
83 | }
84 |
85 | public function testIssue50() {
86 | $this->assertSpec(
87 | 'issue-50/Content',
88 | $this->defaultFlavors
89 | );
90 | }
91 |
92 | public function testMetadata() {
93 | $this->assertMetaSpec(
94 | 'metadata/Content',
95 | [
96 | Markdown::GITHUB_FLAVORED,
97 | ]
98 | );
99 | }
100 |
101 | private function getDokuWikiVersion() {
102 | return getVersionData()['date'];
103 | }
104 |
105 | private function renderMarkdownToXHTML($text, $flavor) {
106 | $renderer = new Doku_Renderer_xhtml();
107 | $data = [
108 | 'pos' => 0,
109 | ];
110 | $context = [
111 | 'dokuwiki_version' => $this->getDokuWikiVersion(),
112 | 'flavor' => $flavor,
113 | ];
114 |
115 | $result = Markdown::parseWithRenderer($renderer, $text, $data, $context);
116 | $this->assertEquals($renderer->doc, $result);
117 |
118 | return $result;
119 | }
120 |
121 | private function renderMarkdownToMetadata($text, $flavor) {
122 | $renderer = new Doku_Renderer_metadata();
123 | $data = [
124 | 'pos' => 0,
125 | ];
126 | $context = [
127 | 'dokuwiki_version' => $this->getDokuWikiVersion(),
128 | 'flavor' => $flavor,
129 | ];
130 |
131 | $result = Markdown::parseWithRenderer($renderer, $text, $data, $context);
132 | $this->assertEquals($renderer->doc, $result);
133 |
134 | return $result;
135 | }
136 |
137 | private function assertXHTML($target_md, $expected_xhtml, $flavor) {
138 | $expected = new DOMDocument();
139 | $expected->loadHTML($expected_xhtml);
140 |
141 | $actual = new DOMDocument();
142 | $actual->loadHTML($this->renderMarkdownToXHTML($target_md, $flavor));
143 |
144 | $this->assertEquals(
145 | $expected,
146 | $actual,
147 | 'Failed asserting markdown and XHTML for '.$flavor
148 | );
149 | }
150 |
151 | private function assertMetadata($target_md, $expected_metadata, $flavor) {
152 | $expected = $expected_metadata;
153 |
154 | $actual = $this->renderMarkdownToMetadata($target_md, $flavor);
155 |
156 | $this->assertEquals(
157 | $expected,
158 | $actual,
159 | 'Failed asserting markdown and Metadata for '.$flavor
160 | );
161 | }
162 |
163 | private function assertSpec($basename, $flavors) {
164 | $basepath = $this->specsDirPath.'/'.$basename;
165 |
166 | $content_md = file_get_contents($basepath.'.md');
167 | foreach ($flavors as $flavor) {
168 | $content_xhtml = file_get_contents($basepath.'_'.$flavor.'.html');
169 | $this->assertXHTML($content_md, $content_xhtml, $flavor);
170 | }
171 | }
172 |
173 | private function assertMetaSpec($basename, $flavors) {
174 | $basepath = $this->specsDirPath.'/'.$basename;
175 |
176 | $content_md = file_get_contents($basepath.'.md');
177 | foreach ($flavors as $flavor) {
178 | $content_xhtml = file_get_contents($basepath.'_'.$flavor.'.meta.txt');
179 | $this->assertMetadata($content_md, $content_xhtml, $flavor);
180 | }
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/tests/bootstrap.php:
--------------------------------------------------------------------------------
1 |
2 | [link-ref][link-ref]
3 |
6 | ![image-ref][image-ref] 7 |
8 | -------------------------------------------------------------------------------- /tests/specs/cannot-lookup-ref/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |2 | [link-ref][link-ref] 3 |
4 | 5 |6 | ![image-ref][image-ref] 7 |
8 | -------------------------------------------------------------------------------- /tests/specs/cannot-lookup-ref/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |2 | [link-ref][link-ref] 3 |
4 | 5 |6 | ![image-ref][image-ref] 7 |
8 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content.md: -------------------------------------------------------------------------------- 1 |  2 | 3 | [internal-link](:wiki:syntax) 4 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content_GFM.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |6 | internal-link 7 |
8 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |6 | internal-link 7 |
8 | -------------------------------------------------------------------------------- /tests/specs/dokuwiki-internal/Content_Traditional.html: -------------------------------------------------------------------------------- 1 | 4 | 5 |6 | internal-link 7 |
8 | -------------------------------------------------------------------------------- /tests/specs/features/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | 4 | 5 | simple paragraph: *emph*, **strong**, ~~strike~~ and `mono`. 6 | 7 |htmlok
on DokuWiki configuration.
4 | simple paragraph: emph, strong, strike and mono
.
5 |
<summary>inline html 7 | <details>You need to enable <code>htmlok</code> on DokuWiki configuration.</details> 8 | </summary>
14 |9 | 10 |11 | quote 12 |
13 |
code block15 | 16 |
17 | https://www.dokuwiki.org/ 18 |
19 | 20 |21 | https://www.dokuwiki.org/ 22 |
23 | 24 |25 | noreply@noreply.com 26 |
27 | 28 |29 | link 30 |
31 | 32 | 35 | 36 |37 | link-ref 38 |
39 | 40 | 43 |head 1 | head 2 | head 3 | head 4 | 77 |
---|---|---|---|
col 1x1 | col 1x2 | col 1x3 | col 1x4 | 79 |
col 2x1 | col 2x2 | col 2x3 | col 2x4 | 82 |
4 | simple paragraph: emph, strong, ~~strike~~ and mono
.
5 |
<summary>inline html 7 | <details>You need to enable <code>htmlok</code> on DokuWiki configuration.</details> 8 | </summary>
14 |9 | 10 |11 | quote 12 |
13 |
code block15 | 16 |
17 | https://www.dokuwiki.org/ 18 |
19 | 20 |21 | https://www.dokuwiki.org/ 22 |
23 | 24 |25 | noreply@noreply.com 26 |
27 | 28 |29 | link 30 |
31 | 32 | 35 | 36 |37 | link-ref 38 |
39 | 40 | 43 |head 1 | head 2 | head 3 | head 4 | 77 |
---|---|---|---|
col 1x1 | col 1x2 | col 1x3 | col 1x4 | 79 |
col 2x1 | col 2x2 | col 2x3 | col 2x4 | 82 |
4 | simple paragraph: emph, strong, ~~strike~~ and mono
.
5 |
<summary>inline html 7 | <details>You need to enable <code>htmlok</code> on DokuWiki configuration.</details> 8 | </summary>
14 | 15 |9 | 10 |11 | quote 12 |
13 |
16 | `
plain
17 | code block
18 | `
19 |
22 | https://www.dokuwiki.org/ 23 |
24 | 25 |26 | https://www.dokuwiki.org/ 27 |
28 | 29 |30 | noreply@noreply.com 31 |
32 | 33 |34 | link 35 |
36 | 37 | 40 | 41 |42 | link-ref 43 |
44 | 45 | 48 |81 | | head 1 | head 2 | head 3 | head 4 | 82 | |:---: | :---| ---: | --- | 83 | | col 1x1 | col 1x2 | col 1x3 | col 1x4 | 84 | | col 2x1 | col 2x2 | col 2x3 | col 2x4 | 85 |
86 | -------------------------------------------------------------------------------- /tests/specs/htmlok/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | Inline HTML: 4 | 5 |4 | Inline HTML: 5 |
6 | 7 |
8 | deleted
9 |
4 | Inline HTML: 5 |
6 | 7 |
8 | deleted
9 |
4 | Inline HTML: 5 |
6 | 7 |
8 | deleted
9 |
2 | This is includes HTML special characters: < > & " ' 3 |
4 | -------------------------------------------------------------------------------- /tests/specs/issue-24/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |2 | This is includes HTML special characters: < > & " ' 3 |
4 | -------------------------------------------------------------------------------- /tests/specs/issue-24/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |2 | This is includes HTML special characters: < > & " ' 3 |
4 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content.md: -------------------------------------------------------------------------------- 1 | [external link](https://example.com "title") 2 | [internal link](wiki:syntax "title") 3 | [external link without title](https://example.com) 4 | [internal link without title](wiki:syntax) 5 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content_GFM.html: -------------------------------------------------------------------------------- 1 |2 | external link 3 | internal link 4 | external link without title 5 | internal link without title 6 |
7 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |2 | external link 3 | internal link 4 | external link without title 5 | internal link without title 6 |
7 | -------------------------------------------------------------------------------- /tests/specs/issue-35/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |2 | external link 3 | internal link 4 | external link without title 5 | internal link without title 6 |
7 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content.md: -------------------------------------------------------------------------------- 1 | aaa 2 | bbb 3 | ccc 4 | 5 | aaa 6 | bbb 7 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content_GFM.html: -------------------------------------------------------------------------------- 1 |
2 | aaa
3 | bbb
4 | ccc
5 |
8 | aaa 9 | bbb 10 |
11 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |
2 | aaa
3 | bbb
4 | ccc
5 |
8 | aaa 9 | bbb 10 |
11 | -------------------------------------------------------------------------------- /tests/specs/issue-40/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |
2 | aaa
3 | bbb
4 | ccc
5 |
8 | aaa 9 | bbb 10 |
11 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content.md: -------------------------------------------------------------------------------- 1 | # Test 1, Test 2 & More tests 2 | 3 | This is text 4 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content_GFM.html: -------------------------------------------------------------------------------- 1 |4 | This is text 5 |
6 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |4 | This is text 5 |
6 | -------------------------------------------------------------------------------- /tests/specs/issue-50/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |4 | This is text 5 |
6 | -------------------------------------------------------------------------------- /tests/specs/metadata/Content.md: -------------------------------------------------------------------------------- 1 | # Header 2 | 3 | 4 | 5 | simple paragraph: *emph*, **strong**, ~~strike~~ and `mono`. 6 | 7 |htmlok
on DokuWiki configuration.4 | Inline HTML: 5 |
6 | 7 | 10 | -------------------------------------------------------------------------------- /tests/specs/without-htmlok/Content_MarkdownExtra.html: -------------------------------------------------------------------------------- 1 |4 | Inline HTML: 5 |
6 | 7 | 10 | -------------------------------------------------------------------------------- /tests/specs/without-htmlok/Content_Traditional.html: -------------------------------------------------------------------------------- 1 |4 | Inline HTML: 5 |
6 | 7 | 10 | --------------------------------------------------------------------------------