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

table colors and delimiter inconsistencies #24

Open
fjuenger opened this issue Dec 14, 2022 · 4 comments · May be fixed by #31
Open

table colors and delimiter inconsistencies #24

fjuenger opened this issue Dec 14, 2022 · 4 comments · May be fixed by #31
Labels
bug Something isn't working

Comments

@fjuenger
Copy link

fjuenger commented Dec 14, 2022

Hello all,

First of all, thanks @bbatsov for maintaining adoc-mode.
I am using latest version of adoc-mode (20220919.659 from melpa).
The colouring scheme for table delimiter seems to be not capturing more than 4 delimiters.
Update (added screenshot):

2022-12-15_13h23_44

Are there any guidelines to not have more than 4 delimiter per row?
I guess the issue comes from regex string starting at line 1765 in adoc-mode.el
that seems to concat a fixed number of patterns. I was not able to really
figure out that pattern, but I tried changing the original:

   (list (concat "^"                  "\\(" (adoc-re-cell-specifier) "\\)" "\\(|\\)"
                 "\\(?:[^|\n]*?[ \t]" "\\(" (adoc-re-cell-specifier) "\\)" "\\(|\\)"
                 "\\(?:[^|\n]*?[ \t]" "\\(" (adoc-re-cell-specifier) "\\)" "\\(|\\)"
                 "\\(?:[^|\n]*?[ \t]" "\\(" (adoc-re-cell-specifier) "\\)" "\\(|\\)" "\\)?\\)?\\)?")

to:

   (list (concat "\\(^|\\)\\(?:[^\n\|]*\\)"
                 "\\(|\\)?\\(?:[^\|\n]*\\)"
                 "\\(|\\)?\\(?:[^\|\n]*\\)"
                 "\\(|\\)?\\(?:[^\|\n]*\\)"
                 "\\(|\\)?\\(?:[^\|\n]*\\)"
                 "\\(|\\)?\\(?:[^\|\n]*\\)")

which at least shows that I was now able to capture 6 delimiters (which is ok for most of my tables).

Also the colouring of those delimiters (tested with zenburn-scheme)
sticks out compared to otherwise appealing colours.
So I changed the relevant markup-table-face in markup-faces.el
to drop the background colors of those delimiters
and use a pale green tone for dark schemes.

(defface markup-table-face
  '((default (:inherit markup-meta-face))
    (((background light)) (:foreground "royal blue"))
    (((background dark)) (:foreground "pale green")))
@bbatsov bbatsov added the bug Something isn't working label Dec 15, 2022
@bbatsov
Copy link
Owner

bbatsov commented Dec 15, 2022

Are there any guidelines to not have more than 4 delimiter per row?

No, that's some bug with the regexp as you've guessed. We'll have to make it more flexible.

So I changed the relevant markup-table-face in markup-faces.el
to drop the background colors of those delimiters
and use a pale green tone for dark schemes.

It's still on my todo to kill the dependency to markup-face and just inline all those faces in adoc-mode. I'm guessing they are also missing in zenburn, if you've seeing some weird colours. Some screenshots would be useful.

@dunmaksim
Copy link

@bbatsov , do I think this table is from a ReStructured Text, not AsciiDoc. In the AsciiDoc table must be defined like:

[cols="1,1"]
|===
|Cell in column 1, header row |Cell in column 2, header row 

|Cell in column 1, row 2
|Cell in column 2, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|===

@bbatsov
Copy link
Owner

bbatsov commented Mar 6, 2023

I'm guessing there are a few different syntaxes for tables and the one you mentioned might be the newer one - we'll have to check the AsciiDoc specification for more details.

@fjuenger
Copy link
Author

fjuenger commented Mar 6, 2023

The example that I referenced is from the adoc-mode table generation function. It uses adoc prefix delimited tables as in https://asciidoc-py.github.io/chunked/ch23.html which should be fine. @dunmaksim I think the only difference to your example is, that you split cell definitions into multiple lines. It is all about the | for defining a cell.

@dunmaksim dunmaksim linked a pull request Apr 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants