public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Own syntax-highlighting not working properly
@ 2020-10-03 10:23 'Karl Weber' via pandoc-discuss
       [not found] ` <8723849e-be6b-4571-b8ca-2ae76865bc42o-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: 'Karl Weber' via pandoc-discuss @ 2020-10-03 10:23 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1745 bytes --]

Hi,

I am trying to build my own syntax-highlighting but it is not working 
properly. I have two problems, which are related to new *itemData* elements.

(1) KDE-style XML syntax does not require a *defStyleNum* attribute in the  
*itemData* elements of the *itemDatas* group. It is also possible, to 
specify attributes like *bold="true"* *color="$AAAAAA"* directly in an 
*itemData* element.

This, however, is not working with pandoc, so I wonder, if I make a mistake 
or whether this is not supported?

(2) Link between *itemData* elements and styles in the themes file.

The *idemData* elements usually contain *defStyleNum* attributes of the 
form e.g. *defStyleNum="dsKeyword"* The themes file (at least for pygments) 
however contains styles for e.g. *"Keyword"*. 

So, *my assumption* is, these specifications are related as follows: for 
every *defStyleNum="dsXYZ"* attribute in an itemData element I may specify 
style properties for *"XYZ"* in the themes file.

However, this is not working with pandoc. So again: is my understanding 
correct and to I make a mistake, or is it not supported to add new 
style-"numbers" like i tried?

It would be great, if I could leave all styles in pygments unchanged and 
*add* my own styles in one of the two ways, I tried. Or is there another 
way that works?

Thanks in advance
Karl

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/8723849e-be6b-4571-b8ca-2ae76865bc42o%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 2454 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Own syntax-highlighting not working properly
       [not found] ` <8723849e-be6b-4571-b8ca-2ae76865bc42o-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-10-04 15:26   ` John MacFarlane
       [not found]     ` <m2r1qerp0l.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2020-10-04 15:26 UTC (permalink / raw)
  To: 'Karl Weber' via pandoc-discuss, pandoc-discuss

"'Karl Weber' via pandoc-discuss"
<pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> writes:

> Hi,
>
> I am trying to build my own syntax-highlighting but it is not working 
> properly. I have two problems, which are related to new *itemData* elements.
>
> (1) KDE-style XML syntax does not require a *defStyleNum* attribute in the  
> *itemData* elements of the *itemDatas* group. It is also possible, to 
> specify attributes like *bold="true"* *color="$AAAAAA"* directly in an 
> *itemData* element.
>
> This, however, is not working with pandoc, so I wonder, if I make a mistake 
> or whether this is not supported?

No, we don't support that.  (We just ignore these additions.)

> (2) Link between *itemData* elements and styles in the themes file.
>
> The *idemData* elements usually contain *defStyleNum* attributes of the 
> form e.g. *defStyleNum="dsKeyword"* The themes file (at least for pygments) 
> however contains styles for e.g. *"Keyword"*. 
>
> So, *my assumption* is, these specifications are related as follows: for 
> every *defStyleNum="dsXYZ"* attribute in an itemData element I may specify 
> style properties for *"XYZ"* in the themes file.

We actually have a hard-coded list of standard token types
(corresponding to defStyleNum values -- see TokenType at
https://hackage.haskell.org/package/skylighting-core-0.10.0.2/docs/Skylighting-Types.html)

If you've just invented your own, it won't work.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Own syntax-highlighting not working properly
       [not found]     ` <m2r1qerp0l.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-10-04 18:58       ` 'Karl Weber' via pandoc-discuss
  0 siblings, 0 replies; 3+ messages in thread
From: 'Karl Weber' via pandoc-discuss @ 2020-10-04 18:58 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3766 bytes --]



On Sunday, October 4, 2020 at 5:26:37 PM UTC+2, John MacFarlane wrote:
>
> "'Karl Weber' via pandoc-discuss" 
> <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>> writes: 
> > 
> > (1) KDE-style XML syntax does not require a *defStyleNum* attribute in 
> the   
> > *itemData* elements of the *itemDatas* group. It is also possible, to 
> > specify attributes like *bold="true"* *color="$AAAAAA"* directly in an 
> > *itemData* element. 
> > 
> > This, however, is not working with pandoc, so I wonder, if I make a 
> mistake 
> > or whether this is not supported? 
>
> No, we don't support that.  (We just ignore these additions.) 
>
>
For the target format HTML I do no longer need this anyway. I think it is 
not very usefull.


> (2) Link between *itemData* elements and styles in the themes file. 
> > 
> > The *idemData* elements usually contain *defStyleNum* attributes of the 
> > form e.g. *defStyleNum="dsKeyword"* The themes file (at least for 
> pygments) 
> > however contains styles for e.g. *"Keyword"*. 
> > 
> > So, *my assumption* is, these specifications are related as follows: for 
> > every *defStyleNum="dsXYZ"* attribute in an itemData element I may 
> specify 
> > style properties for *"XYZ"* in the themes file. 
>
> We actually have a hard-coded list of standard token types 
> (corresponding to defStyleNum values -- see TokenType at 
>
> https://hackage.haskell.org/package/skylighting-core-0.10.0.2/docs/Skylighting-Types.html) 
>
>
> If you've just invented your own, it won't work. 
>

In view of the fact, that there is a schema for die KDE-style XML syntax 
files, this may indeed be the correct approach.

For target format HTML I do not need this either. For this case I have a 
solution. Whether this will work for other target formats, I don't know. 
(My solution involves providing my own css style.)

The point is the following: Basically, a KDE-style XML syntax is defined 
for a particular mimetype. This is great, if a view displays one document 
with one particular mimetype: One has the relation

One document -> one mimetype -> one XML style.

In pandoc the situation is quite different:

One document -> N code blocks -> M different XML styles.

Here 1 <= M <= N

This situation might occur, if a document contains, for example, three code 
blocks with C++ code, two code blocks with python code, and a couple of 
code blocks with bash shell scripts. Each KDE-style XML syntax has a 
different coloring scheme. It may be difficult, do find one theme that 
works for all styles. Or simply may not want to accept this constraint.

For HTML the problem is readily solved. Currently the meta variable 
$highlighting-css$ will result in css of the following form:

code span.bn { color: #40a070; } /* BaseN */

I have not tried to find out which of the M different themes pandoc uses in this case. However, the code element has a class attribute indicating the respective style of the code block. 
Hence, for HTML pandoc can readily support different styles by writing

code.java span.bn { color: #40a070; } /* BaseN */

code.python span.bn { color: #00FF20; font-weight: bold; font-style: italic;} /* BaseN */

code.myownsyntaxhighlighting span.bn { color: #DD3399; font-style: italic;} /* BaseN */

I have no idea, whether this will work for different target formats as well.

Regards
Karl



-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/e5057cbc-d30f-499a-8031-54069ad2e8c4o%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 6362 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-04 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-03 10:23 Own syntax-highlighting not working properly 'Karl Weber' via pandoc-discuss
     [not found] ` <8723849e-be6b-4571-b8ca-2ae76865bc42o-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-10-04 15:26   ` John MacFarlane
     [not found]     ` <m2r1qerp0l.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-10-04 18:58       ` 'Karl Weber' via pandoc-discuss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).