diff options
author | Victor Kareh <vkareh@redhat.com> | 2023-03-09 12:55:38 -0500 |
---|---|---|
committer | Victor Kareh <vkareh@redhat.com> | 2023-03-09 16:06:08 -0500 |
commit | b697b11fd4004ddf3f0da2404071c5a561c69ec2 (patch) | |
tree | a181471b58e6a1b88f9b8c11c377c3dfb7a075e8 | |
parent | ae23351a5d5115b84a0209ad52a406f8f634532a (diff) | |
download | gtksourceview-b697b11fd4004ddf3f0da2404071c5a561c69ec2.tar.gz |
language-specs: Add support for todo.txt format
The todo.txt format is a simple set of rules that make todo.txt both
human and machine-readable. The format supports priorities, creation and
completion dates, projects and contexts.
- Project website: http://todotxt.org
- Format definition: https://github.com/todotxt/todo.txt
-rw-r--r-- | data/language-specs/todotxt.lang | 92 | ||||
-rw-r--r-- | tests/syntax-highlighting/todo.txt | 8 |
2 files changed, 100 insertions, 0 deletions
diff --git a/data/language-specs/todotxt.lang b/data/language-specs/todotxt.lang new file mode 100644 index 00000000..c8a4c9ed --- /dev/null +++ b/data/language-specs/todotxt.lang @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + This file is part of GtkSourceView + + Author: Victor Kareh <vkareh@vkareh.net> + Copyright (C) 2023 by Victor Kareh <vkareh@vkareh.net> + + GtkSourceView is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + GtkSourceView is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, see <http://www.gnu.org/licenses/>. +--> + +<!-- + The todo.txt format is a simple set of rules that make todo.txt both + human and machine-readable. The format supports priorities, creation and + completion dates, projects and contexts. + + Project website: http://todotxt.org + Format rules: https://github.com/todotxt/todo.txt +--> + +<language id="todotxt" name="todo.txt" version="2.0" _section="Markup"> + <metadata> + <property name="mimetype">text/x-todo-txt</property> + <property name="line-comment-start">x </property> + </metadata> + + <styles> + <style id="done" name="Done" map-to="def:deletion"/> + <style id="priority" name="Priority" map-to="def:list-marker"/> + <style id="date" name="Date" map-to="def:preprocessor"/> + <style id="link" name="Link" map-to="def:link-destination"/> + <style id="context" name="Context" map-to="def:type"/> + <style id="project" name="Project" map-to="def:special-char"/> + <style id="metadata" name="Metadata" map-to="def:emphasis"/> + </styles> + + <definitions> + <context id="done" style-ref="done"> + <match>^x .*</match> + </context> + + <context id="priority" style-ref="priority"> + <match>^\([A-Z]\) </match> + </context> + + <context id="date" style-ref="date"> + <match>[0-9]+-[0-9]+-[0-9]+</match> + </context> + + <context id="link" style-ref="link"> + <prefix>(ftp|git|http|mailto|ssh)s?:</prefix> + <keyword>[^\s]+</keyword> + </context> + + <context id="context" style-ref="context"> + <prefix>(?!\s+)\@</prefix> + <keyword>[^\s]+</keyword> + </context> + + <context id="project" style-ref="project"> + <prefix>(?!\s+)\+</prefix> + <keyword>[^\s]+</keyword> + </context> + + <context id="metadata" style-ref="metadata"> + <match>(?!\s)\w+:\w+(?!\s)?</match> + </context> + + <context id="todotxt"> + <include> + <context ref="context" /> + <context ref="date" /> + <context ref="done" /> + <context ref="link" /> + <context ref="project" /> + <context ref="priority" /> + <context ref="metadata" /> + </include> + </context> + </definitions> +</language> diff --git a/tests/syntax-highlighting/todo.txt b/tests/syntax-highlighting/todo.txt new file mode 100644 index 00000000..78369968 --- /dev/null +++ b/tests/syntax-highlighting/todo.txt @@ -0,0 +1,8 @@ +(A) Call Mom @Phone +Family +(A) Schedule annual checkup +Health +(B) Outline chapter 5 +Novel @Computer +(C) Add cover sheets @Office +TPSReports +Plan backyard herb garden @Home +Pick up milk @GroceryStore +Research self-publishing services +Novel @Computer +x Download Todo.txt mobile app @Phone |