[gtksourceview: 1/2] t2t.lang: Use markup styles
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview: 1/2] t2t.lang: Use markup styles
- Date: Tue, 14 Jan 2020 19:32:35 +0000 (UTC)
commit 938a26445c92c75fa8e6deadd0861b235e4367e8
Author: Jeffery To <jeffery to gmail com>
Date: Tue Jan 14 18:58:08 2020 +0800
t2t.lang: Use markup styles
This also updates the test file with content from
https://raw.githubusercontent.com/txt2tags/txt2tags/v2/samples/sample.t2t
(linked from https://txt2tags.org/sample.html).
data/language-specs/t2t.lang | 18 +--
data/styles/kate.xml | 7 --
tests/syntax-highlighting/file.t2t | 227 ++++++++++++++++++++++++++++++++++++-
3 files changed, 231 insertions(+), 21 deletions(-)
---
diff --git a/data/language-specs/t2t.lang b/data/language-specs/t2t.lang
index 10912b11..0da7220c 100644
--- a/data/language-specs/t2t.lang
+++ b/data/language-specs/t2t.lang
@@ -27,21 +27,21 @@
</metadata>
<styles>
- <style id="comment" name="Comment"/>
- <style id="option" name="Option"/>
- <style id="option-name" name="Option Name" map-to="def:keyword"/>
- <style id="header" name="Header" map-to="def:keyword"/>
- <style id="section" name="Section" map-to="def:keyword"/>
+ <style id="comment" name="Comment" map-to="def:comment"/>
+ <style id="option" name="Option" map-to="def:preprocessor"/>
+ <style id="option-name" name="Option Name" map-to="def:preprocessor"/>
+ <style id="header" name="Header" map-to="def:heading"/>
+ <style id="section" name="Section" map-to="def:heading"/>
<style id="section-1" name="Section 1" map-to="t2t:section"/>
<style id="section-2" name="Section 2" map-to="t2t:section"/>
<style id="section-3" name="Section 3" map-to="t2t:section"/>
<style id="section-4" name="Section 4" map-to="t2t:section"/>
<style id="section-5" name="Section 5" map-to="t2t:section"/>
<style id="anchor" name="Anchor" map-to="t2t:section"/>
- <style id="italic" name="Italic"/>
- <style id="bold" name="Bold"/>
- <style id="verbatim" name="Verbatim"/>
- <style id="verbatim-block" name="Verbatim Block"/>
+ <style id="italic" name="Italic" map-to="def:emphasis"/>
+ <style id="bold" name="Bold" map-to="def:strong-emphasis"/>
+ <style id="verbatim" name="Verbatim" map-to="def:inline-code"/>
+ <style id="verbatim-block" name="Verbatim Block" map-to="def:preformatted-section"/>
</styles>
<definitions>
diff --git a/data/styles/kate.xml b/data/styles/kate.xml
index 0ddf1f51..617ba583 100644
--- a/data/styles/kate.xml
+++ b/data/styles/kate.xml
@@ -174,11 +174,4 @@
<style name="sh:dollar" foreground="dark-green" bold="true"/>
<style name="makefile:trailing-tab" background="#FFC0CB"/>
-
- <style name="t2t:italic" italic="true"/>
- <style name="t2t:bold" bold="true"/>
- <style name="t2t:verbatim" background="#lightgrey"/>
- <style name="t2t:verbatim-block" line-background="#lightgrey"/>
- <style name="t2t:comment" foreground="dark-green"/>
- <style name="t2t:option" foreground="dark-green"/>
</style-scheme>
diff --git a/tests/syntax-highlighting/file.t2t b/tests/syntax-highlighting/file.t2t
index fa290aee..55e0217f 100644
--- a/tests/syntax-highlighting/file.t2t
+++ b/tests/syntax-highlighting/file.t2t
@@ -1,8 +1,225 @@
-! gtk-source-lang: t2t
+TXT2TAGS SAMPLE
+Aurelio Jargas
+%%mtime(%m/%d/%Y)
-%!include ``something``
-% Comment
-``verbatim`` //italic//
+%!encoding: UTF-8
+
+This text is before the introduction.
+
+But it's OK.
+
+ = Introduction =
+
+Welcome to the txt2tags sample file.
+
+Here you have examples and a brief explanation of all
+marks.
+
+The first 3 lines of this file are used as headers,
+on the following format:
```
-verbatim block
+line1: document title
+line2: author name, email
+line3: date, version
```
+
+Lines with balanced equal signs = around are titles.
+
+% a secret comment!
+%TODO link to program site http://txt2tags.org
+
+
+ = Fonts and Beautifiers =
+
+We have two sets of fonts:
+
+The NORMAL type that can be improved with beautifiers.
+
+The TYPEWRITER type that uses monospaced font for
+pre-formatted text.
+
+We will now enter on a subtitle...
+
+
+ == Beautifiers ==
+
+The text marks for beautifiers are simple, just as you
+type on a plain text email message.
+
+We use double *, /, - and _ to represent **bold**,
+//italic//, --strike-- and __underline__.
+
+The **//bold italic//** style is also supported as a
+combination.
+
+
+ == Pre-Formatted Text ==
+
+We can put a code sample or other pre-formatted text:
+```
+ here is pre-formatted
+//marks// are **not** ``interpreted``
+```
+
+And also, it's easy to put a one line pre-formatted
+text:
+``` prompt$ ls /etc
+
+Or use ``pre-formatted`` inside sentences.
+
+
+ == More Cosmetics ==
+
+Special entities like email (duh somewhere com) and
+URL (http://www.duh.com) are detected automagically,
+as long as the horizontal line:
+
+--------------------------------------------------------
+^ thin or large v
+========================================================
+
+You can also specify an [explicit link http://duh.org]
+or an [explicit email duh somewhere com] with label.
+
+And remember,
+ A TAB in front of the line does a quotation.
+ More TABs, more depth (if allowed).
+Nice.
+
+
+ = Lists =
+
+A list of items is natural, just putting a **dash** or
+a **plus** at the beginning of the line.
+
+
+ == Plain List ==
+
+The dash is the default list identifier. For sublists,
+just add **spaces** at the beginning of the line. More
+spaces, more sublists.
+
+- Earth
+ - America
+ - South America
+ - Brazil
+ - How deep can I go?
+ - Europe
+ - Lots of countries
+- Mars
+ - Who knows?
+
+
+The list ends with **two** consecutive blank lines.
+
+
+ == Numbered List ==
+
+The same rules as the plain list, just a different
+identifier (plus).
+
++ one
++ two
++ three
+ - mixed lists!
+ - what a mess
+ + counting again
+ + ...
++ four
+
+
+ == Definition List ==
+
+The definition list identifier is a colon, followed by
+the term. The term contents is placed on the next line.
+
+: orange
+ a yellow fruit
+: apple
+ a green or red fruit
+: other fruits
+ - wee!
+ - mixing lists
+ + again!
+ + and again!
+
+
+ = Tables =
+
+Use pipes to compose table rows and cells.
+Double pipe at the line beginning starts a heading row.
+Natural spaces specify each cell alignment.
+
+ | cell 1.1 | cell 1.2 | cell 1.3 |
+ | cell 2.1 | cell 2.2 | cell 2.3 |
+ | cell 3.1 | cell 3.2 | cell 3.3 |
+
+|| heading 1 | heading 2 | heading 3 |
+ | cell 1.1 | cell 1.2 | cell 1.3 |
+ | cell 2.1 | cell 2.2 | cell 2.3 |
+
+ |_ heading 1 | cell 1.1 | cell 1.2 |
+ | heading 2 | cell 2.1 | cell 2.2 |
+ | heading 3 | cell 3.1 | cell 3.2 |
+
+|/ heading | heading 1 | heading 2 |
+ | heading 1 | cell 1.1 | cell 1.2 |
+ | heading 2 | cell 2.1 | cell 2.2 |
+
+Without the last pipe, no border:
+
+ | cell 1.1 | cell 1.2 | cell 1.3
+ | cell 2.1 | cell 2.2 | cell 2.3
+ | cell 3.1 | cell 3.2 | cell 3.3
+
+|| heading 1 | heading 2 | heading 3
+ | cell 1.1 | cell 1.2 | cell 1.3
+ | cell 2.1 | cell 2.2 | cell 2.3
+
+ |_ heading 1 | cell 1.1 | cell 1.2
+ | heading 2 | cell 2.1 | cell 2.2
+ | heading 3 | cell 3.1 | cell 3.2
+
+|/ heading | heading 1 | heading 2
+ | heading 1 | cell 1.1 | cell 1.2
+ | heading 2 | cell 2.1 | cell 2.2
+
+ = Special Entities =
+
+Because things were too simple.
+
+
+ == Images ==
+
+The image mark is as simple as it can be: ``[filename]``.
+
+ [img/photo.jpg]
+
+And with some targets the image is linkable :
+
+ [[img/photo.jpg] http://www.txt2tags.org]
+
+- The filename must end in PNG, JPG, GIF, or similar.
+- No spaces inside the brackets!
+
+
+ == Other ==
+When the target needs, special chars like <, > and &
+are escaped.
+
+The handy ``%%date`` macro expands to the current date.
+
+So today is %%date on the ISO ``YYYYMMDD`` format.
+
+You can also specify the date format with the %? flags,
+as ``%%date(%m-%d-%Y)`` which gives: %%date(%m-%d-%Y).
+
+That's all for now.
+
+-------------------------------------------------------
+%%% TRANSLATOR: Uncomment and translate the next two lines
+%Translated by John Smith.
+%-------------------------------------------------------
+[img/t2tpowered.png] ([%%infile %%infile])
+
+% vim: tw=55
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]