Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
spec2md
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Specification Tools
spec2md
Commits
c43a6753
Commit
c43a6753
authored
5 months ago
by
Andreas Kraft
Browse files
Options
Downloads
Patches
Plain Diff
Support for html character entities when replacing certain characters
parent
47f3f6cb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
config.ini
+17
-2
17 additions, 2 deletions
config.ini
spec2md.py
+10
-2
10 additions, 2 deletions
spec2md.py
with
27 additions
and
4 deletions
config.ini
+
17
−
2
View file @
c43a6753
...
@@ -90,11 +90,26 @@ ignore = toc 1, toc 2, toc 3, toc 4, toc 5, toc 6, toc 7, toc 8, toc 9
...
@@ -90,11 +90,26 @@ ignore = toc 1, toc 2, toc 3, toc 4, toc 5, toc 6, toc 7, toc 8, toc 9
; The characters to be replaced and the characters that make the
; The characters to be replaced and the characters that make the
; replacement string must be specified as hex values
; replacement string must be specified as hex values
; To remove a character from the file set it to 00 (2 zeros)
; To remove a character from the file set it to 00 (2 zeros)
;
; The following are some common characters that can be replaced as well.
; Registered trademark (®) — (`®`)
; Trademark (™) — (`™`)
; Euro (€) — (`€`)
; Left arrow (←) — (`←`)
; Up arrow (↑) — (`↑`)
; Right arrow (→) — (`→`)
; Down arrow (↓) — (`↓`)
; Degree (°) — (`°`)
; Pi (π) — (`π`)
; "(c)"
; "(c)"
a9
=
286329
; a9 = 286329
a9
=
©
; "(R)"
; "(R)"
ae
=
285229
; ae = 285229
ae
=
®
; space
; space
a0
=
20
a0
=
20
; double quote
; double quote
...
...
This diff is collapsed.
Click to expand it.
spec2md.py
+
10
−
2
View file @
c43a6753
...
@@ -192,8 +192,16 @@ class DocumentConfiguration(object):
...
@@ -192,8 +192,16 @@ class DocumentConfiguration(object):
self
.
generateToc
=
config
.
getboolean
(
'
toc
'
,
'
generateToc
'
,
fallback
=
False
)
self
.
generateToc
=
config
.
getboolean
(
'
toc
'
,
'
generateToc
'
,
fallback
=
False
)
# characters
# characters
self
.
characters
=
{
int
(
c
,
16
)
:
binascii
.
unhexlify
(
config
.
get
(
'
characters
'
,
c
)).
decode
(
'
utf-8
'
)
# type: ignore [attr-defined]
# self.characters = { int(c, 16) : binascii.unhexlify(config.get('characters', c)).decode('utf-8') # type: ignore [attr-defined]
for
c
in
config
[
'
characters
'
]
}
# for c in config['characters'] }
self
.
characters
=
{}
for
c
,
v
in
config
[
'
characters
'
].
items
():
if
v
.
startswith
(
'
&
'
):
# HTML entity
self
.
characters
[
int
(
c
,
16
)]
=
v
else
:
# Unicode character
self
.
characters
[
int
(
c
,
16
)]
=
binascii
.
unhexlify
(
config
.
get
(
'
characters
'
,
c
)).
decode
(
'
utf-8
'
)
# type: ignore [attr-defined]
# Media & Converter
# Media & Converter
self
.
emfConverterPng
=
config
.
get
(
'
media
'
,
'
emfConverterPng
'
,
fallback
=
None
)
self
.
emfConverterPng
=
config
.
get
(
'
media
'
,
'
emfConverterPng
'
,
fallback
=
None
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment