Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Sith
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
59
Issues
59
List
Boards
Labels
Service Desk
Milestones
Merge Requests
9
Merge Requests
9
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AE
Sith
Commits
ecbfe082
Commit
ecbfe082
authored
Dec 30, 2016
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another version of the indice/exposants
parent
579a6836
Pipeline
#747
passed with stage
in 3 minutes and 7 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
22 deletions
+18
-22
core/markdown.py
core/markdown.py
+18
-22
No files found.
core/markdown.py
View file @
ecbfe082
...
...
@@ -26,15 +26,15 @@ class SithInlineGrammar(InlineGrammar):
underline
=
re
.
compile
(
r
'^_{2}([\s\S]+?)_{2}(?!_)'
# __word__
)
exposant
=
re
.
compile
(
r
'^\^([\s\S]+?)\^
(?!\^)
'
# ^text^
r
'|'
r
'^\^(\S*
)'
# ^word
exposant
=
re
.
compile
(
# FIXME Does not work for now
r
'^\^([\s\S]+?)\^'
# ^text^
# r'|' # FIXME doesn't properly works like this
# r'^\^(\S+
)' # ^word
)
indice
=
re
.
compile
(
# XXX FIXME: don't work with inline code
r
'^_([\s\S]+?)_
(?!_)'
# _text_
r
'|'
r
'^_(\S*
)'
# _word
indice
=
re
.
compile
(
r
'^_([\s\S]+?)_
'
# _text_ (^` hack, because no other solution were found :/ this sadly prevent code in indices)
# r'|' # FIXME doesn't properly works like this
# r'^_(\S+
)' # _word
)
class
SithInlineLexer
(
InlineLexer
):
...
...
@@ -49,11 +49,11 @@ class SithInlineLexer(InlineLexer):
'link'
,
'reflink'
,
'nolink'
,
'exposant'
,
'double_emphasis'
,
'emphasis'
,
'underline'
,
# 'indice',
'exposant'
,
'indice'
,
'code'
,
'linebreak'
,
'strikethrough'
,
...
...
@@ -66,11 +66,11 @@ class SithInlineLexer(InlineLexer):
'link'
,
'reflink'
,
'nolink'
,
'exposant'
,
'double_emphasis'
,
'emphasis'
,
'underline'
,
# 'indice',
'exposant'
,
'indice'
,
'code'
,
'linebreak'
,
'strikethrough'
,
...
...
@@ -82,11 +82,11 @@ class SithInlineLexer(InlineLexer):
return
self
.
renderer
.
underline
(
text
)
def
output_exposant
(
self
,
m
):
text
=
m
.
group
(
1
)
or
m
.
group
(
2
)
text
=
m
.
group
(
1
)
return
self
.
renderer
.
exposant
(
text
)
def
output_indice
(
self
,
m
):
text
=
m
.
group
(
1
)
or
m
.
group
(
2
)
text
=
m
.
group
(
1
)
return
self
.
renderer
.
indice
(
text
)
# Double emphasis rule changed
...
...
@@ -124,11 +124,6 @@ class SithInlineLexer(InlineLexer):
renderer
=
SithRenderer
()
inline
=
SithInlineLexer
(
renderer
)
# enable the features
# inline.enable_indice()
# inline.enable_exposant()
# inline.enable_underline()
markdown
=
Markdown
(
renderer
,
inline
=
inline
)
if
__name__
==
"__main__"
:
...
...
@@ -145,10 +140,9 @@ if __name__ == "__main__":
* ~~Barrer du texte~~ : `~~texte~~`
* ^Mettre du texte^ en ^exposant : `^mot` ou `^texte^`
just ^another test
* Mettre ^du texte^ en ^exposant^ : `^mot` ou `^texte^`
* _Mettre du texte_ en _indice : `_mot` ou `_texte_`
* _Mettre du texte_ en _indice
_
: `_mot` ou `_texte_`
* Pied de page [^en pied de page]
...
...
@@ -167,6 +161,8 @@ Un bloc de citation se crée ainsi :
Il est possible d'intégrer de la syntaxe Markdown-AE dans un tel bloc.
Petit *test* _sur_ ^une^ **seule** ^ligne pour voir^
"""
print
(
markdown
(
text
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment