Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XDXF in StarDict formatting issues #532

Open
soshial opened this issue Nov 7, 2023 · 7 comments
Open

XDXF in StarDict formatting issues #532

soshial opened this issue Nov 7, 2023 · 7 comments

Comments

@soshial
Copy link
Contributor

soshial commented Nov 7, 2023

Issues:

  • spaces before kref tags are removed
  • \n not rendered
  • no indents
  • <ex> should be grey by default and with indent

Example file in MEGA in folder "LingvoUniversal 2008".

Here's a gloss as Goldendict shows it (2 consequent screenshots):

xdxf in stardict in goldendict 1
xdxf in stardict in goldendict 2

And this is how we convert it to HTML (3 consequent screenshots):

xdxf to html formatting issues 1 xdxf to html formatting issues 2 xdxf to html formatting issues 3
@ilius
Copy link
Owner

ilius commented Nov 20, 2023

Can you try with --read-options=xsl=true?

We set class=example, so you can change color in css.

@soshial
Copy link
Contributor Author

soshial commented Nov 20, 2023

Wow, now it looks much better. What did this parameter do?

How do I change the CSS? In the xdxf.xsl file?

Screenshot 2023-11-20 at 11 36 40

@soshial
Copy link
Contributor Author

soshial commented Nov 20, 2023

For example, I found this code about DSL:

	elif tag == "ex":
		tr.output += f'<span class="ex"><font color="{tr.exampleColor}">'

Can we change the style of ex class in CSS, not inlined inside HTML?

@soshial
Copy link
Contributor Author

soshial commented Nov 20, 2023

I wonder why do we have 2 different transformers? And why does XSL works better? Why does it have these settings:

_gram_color: str = "green"
_example_padding: int = 10

They are unused for some reason.

@soshial
Copy link
Contributor Author

soshial commented Nov 20, 2023

I think it would be great to have some editable CSS file (for CSS classesclass="ex") that would be added to output dictionaries. It would be pretty handy when converting XDXF/StarDict/DSL into HTML-based dicts.

@soshial
Copy link
Contributor Author

soshial commented Nov 20, 2023

I tried to use the same parameter --read-options=xsl=true when converting XDXF into AardSlob and it didn't work, probably because of this bug, that XSL transformer is always overwritten by another (?):

def makeTransformer(self) -> None:
	if self._xsl:
		from pyglossary.xdxf.xsl_transform import XslXdxfTransformer
		self._htmlTr = XslXdxfTransformer(encoding=self._encoding)

	from pyglossary.xdxf.transform import XdxfTransformer
	self._htmlTr = XdxfTransformer(encoding=self._encoding)

@soshial
Copy link
Contributor Author

soshial commented May 7, 2024

I think it would be great to have some editable CSS file (for CSS classesclass="ex") that would be added to output dictionaries. It would be pretty handy when converting XDXF/StarDict/DSL into HTML-based dicts.

Asked this question how to add custom CSS file here: #560

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants