Coder Social home page Coder Social logo

filter's People

Contributors

adityam avatar christopher2505 avatar dependabot[bot] avatar gerion0 avatar hernot avatar ousia avatar paulepanter avatar reviczky avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

filter's Issues

Escaping with /BTEX ... /ETEX

It would be cool if one could escape to ConTeXt within /BTEX ... /ETEX like for regular typing. This is extremely useful for annotating code. Currently only automatic escaping in comments works.

\usemodule[vim]

\definevimtyping
  [python]
  [syntax=python,
   escape=on]

\starttext

\starttyping[escape=yes]
# Returns /BTEX\m{\sum_{i=1}^{n}i}/ETEX
def sum_upto(/BTEX\m{n \in \mathbb{N}}/ETEX)
    r = range(1, /BTEX\m{n}/ETEX + 1)
    return sum(r)
\stoptyping

\startpython
# Returns \m{\sum_{i=1}^{n}i}
def sum_upto(\m{n \in \mathbb{N}}w)
    r = range(1, \m{n} + 1)
    return sum(r)
\stoppython

\stoptext

Multichunk processing

Is there an option to process multiple chunks as a single external document? I think codebraid and pythontex support that, and that can be handy at times.

This is related to the discussion on using pandoc for citation processing. I was thinking you could use this to build a complete fake markdown document containing only the citations. Something like this:

\defineexternalfilter 
  [pandoccitation]
  [filter={pandoc -t context --citeproc --csl mystyle.csl --bibliography refs.bib},
   mode=continuous]

\starttext

Bla bla this is normal context text.
As has been said before this is really important \pandoccitation{[@foo, 45]}.

Back in context mode. 
This is again super important \pandoccitation{[@bar, 12]}.

\startpandoccitation
::: refs
:::
\stoppandoccitation

Does that make sense?

Decide if and how to map style `command` parameter to CSS

While for style and color parameter a rather straight forward mapping between ConTeXt and CSS for html/xml/xhtml seems to be handled by merging pull-request #38 and the further improvements applied before next release. On the other hand the mapping between command parameter is still neither solved nor decided yet.

I went through the list of possible CSS attributes which could be used as shortcut for handling content of command parameter. In general to map command onto HTML and/or XHTML/XML using CSS there are two general possibilities:

A) the command implements tagging either using \dostarttagging \dostoptagging or \startelement \stopelement properly and provides its own CSS snipped.

  • The advantage is that no further action is necessary exempt ensuring that tag(s) inserted by command either are properly enclosed within <syntaxgroup> or properly decorate it.
  • The disadvantage is that each <div> tag resembles an individual box with a content area, a boarder and a margin. In worst each <div> adds in addition to the desired decoration additional space between its boundary and the inner content thereby changing layout of document unexpectedly.
  • solution to this disadvantage could be to enclose command within an additional set of <div> tag which predefines reasonable values for margin boarder distances etc assuming that <div> tags added by command inherit everything from their parent exempt the decoration and style they add explicitly. In some cases the extra set of tags might not even be required as the corresponding settings could be introduced by <syntaxgroup> directly.
  • Second disadvantage in case command does not emit tags than corresponding style is lost on html and xml/xhtml output or must be added manually to styles which is possible in default and name mode but not auto.

B) do not rely upon implementation of command and establish a mapping between ConTeXt styling commands / styles and CSS style attributes.

  • The advantage is no dependency upon implementation and CSS styling of <div> tags corresponding to command if any and the styling of <syntaxgroup> tags.
  • The disadvantage is requires strategy to map between command and CSS attribute or attributes if to be split onto multiple.
  • The second disadvantage is that mapping can grow quite complex task given the large number of possibilities to change all or only parts.

I have too little know-how upon ConTeXt inner workings and design guidelines related to XML/HTML export especially to be able to judge that or even express some helpful preference. I'm not sure if it would be helpful in decision between the two options above but i have compiled a list of CSS attributes which commands could be mapped to if mapping should be an option at all. As you will see the majority of CSS attributes does not add additional options but just limits style to some substyle or subitem of a more general style eg. boarder defines all four sides of the border whereas boarder-left limits the whole just to the left line of the boarder frame.

I have split the list into several sections. The first contains the attributes which i would consider reasonable within the context of vimtyping. The second contains attributes where i have the impression or the maybe false idea that these are handled anyway by ConTeXt implicitly or differently. It also contains those where I know that they are set by vimtyping to values which ensure proper display.
The third section contains basically stuff where i have no idea if they would be relevant at all for vimtyping and also do not feel having enough knowledge to judge about.
And the last section contains attributes where when playing around with CSS had the impression that they behave at least in Firefox and chrome differently when displaying html output or xml/xhtml output.

Feel free to ignore the list, or edit it in case mapping could be at least for some very common style commands be an option to make output in html and xml/xhtml appear as expected from corresponding pdf output.

context-css-mapable-attr.md.txt
(content is in markdown even though ending states txt)
Currently this files is just resorted version of CSS reference table of contents plus some extra notes where i was not sure what could be meant, no details yet what values would be available. In case mapping is an option how ever it will be implemented i will include the possible values for those attributes which are considered for mapping between command parameter and CSS style. In case you would need some more details for deciding let me know than i will amend the relevant parts.

\SYN command causes fuzzy paragraph warnings in xmlexporter

While once again working on generating an epub version of my lecture notes i noticed fuzzy paragraph warnings when turning on export trackers. Searching on the mailing list i found the following thread.
Inspired by this and remembering a suggestion by Hans i changed all my \paragraph, \section etc. to their \startchapter, \stopchapter etc. pairs. The same i did with all the \place<float> commands. This had the effect that the number of fuzzy paragraphs and improper content levels became less an the number of pages exported to html,xhtml and xml doubled.

Encouraged by this i investigated further and identified some further suspects. One thereof is the \SYN command. which is synonymous for \syntaxgroup. Therefore I decided to dedicate some of my time to test if replacing \syntaxgroup command by a pair of \starsyntaxgroup \stopsyntaxgroup and \SYN by \BSYN, \ESYN pairs. Thereby I would need some advice or support in writing proper ConTeXt TeX code. Especially how to properly represent lines 99-100 and 104 in the \startsyntaxgroup and \stopsyntaxgroup commands.

As soon as having first results and insights I either will post here or open a pull-request whichever is most suitable.

append and prepend buffer

Create options appendbuffer and prependbuffer to add material to the buffer before it is saved to an external file. This is needed for a lilypond module.

reusing cached filter output

I would like to reuse cached output between context runs but the following still makes all the calls to pandoc every time I execute context. Is it possible to run context without calling external program defined in \defineexternalfilter and still use the external filter output from previous runs?


\defineexternalfilter
  [pandoc]
  [
    filter={pandoc --no-wrap -f \externalfilterparameter{format} -t context 
                   -o \externalfilteroutputfile},
    format=twiki,
    directory=output,
    spacebefore=none,
    spaceafter=none,
    indentnext=yes,
    cache=yes
  ]

I am using ConTeXt standalone distribution and bundled modules, context  version is 2018.09.01 23:10

Minimum working example of t-vim

The concatenation of the scattered code in vim-README does not form a valid showcase. In particular, with shell_escape = t set in textmf.cnf, the following code produces [[output file missing on my machine:

\usemodule[vim]
\definevimtyping [RUBY]  [syntax=ruby]
\starttext
\startRUBY
  # Wow, my first ruby program
  print("Hello World")
\stopRUBY
\stoptext

It would be nice to have a MWE for t-vim. Besides,

... This data, along with the filter command, is useful for debugging what whet wrong. (END)

things are hardly useful without explanations of how they could be useful.

Typeset gists

Add the ability to pretty-print gists in t-vimor in a separate module.

Add \usepath support

Add\usepath like option to the filter module. It could either be a global option, like\useexternalfilterpath or a per-filter option like \setupexternalfilter[...][path=...]

Check whether the extermal program exists in the path

Check whether the binary is present in the path using which binary or where binary.

  • It is not always possible to know the name of all the binaries involved in invoking the filter command. A good approximation is to use the first word of the filtercommand and check if it is present in the path.
  • For macro writers, we could provide a check key to specify a list of binaries to check.
  • Another approach is to simply provide a macro \checkbinary and leave it up to the user to call that as part of filtersetup.

Alternative colorscheme per vimtyping env

Thanks for the module! I found one limitation/bug in that I cannot apply a unique colorscheme per vimtyping environment. Example where both comments are in blue in the pdf.

\usemodule[vim]

\definevimtyping [pythontest]
    [
        syntax=python,
        alternative=pythoncolor,
        directory=.,
    ]

\startcolorscheme [pythoncolor]
    \definesyntaxgroup
        [Comment]
        [color=red]
\stopcolorscheme

\definevimtyping [contexttest]
    [
        syntax=context,
        alternative=contextcolor,
        directory=.,
    ]

\startcolorscheme [contextcolor]
    \definesyntaxgroup
        [Comment]
        [color=blue]
\stopcolorscheme


\starttext

This is Python:
\startpythontest
# a comment
\stoppythontest

This is ConTeXt:
\startcontexttest
% a comment
\stopcontexttest

\stoptext

version info from log:
system > ConTeXt ver: 2020.01.30 14:13 MKIV beta fmt: 2020.6.9 int: english/english
loading > Vim syntax highlighting (ver: 2020.05.17)

VIM: Support attachfile

It may be useful to support attach=yes for code snippets

\setupinteraction [state=start]
\starttext
  \attachment[file=attachfile.tex, title=Some file, author=Me]
\stoptext

Test 51-colorscheme.tex is failing - both comments in blue color

This is related to issue #37. I had confirmed this was working after the issue was closed last year. I revisited this again today with the latest ConTeXt LMTX (I don't know if the root cause is new ConTeXt version or not).

I downloaded modules from https://modules.contextgarden.net and installed manually.
t-filter-2020.06.29.zip
t-vim-2020.09.15.zip

$ grep ver: 51-colorscheme.log

system > ConTeXt ver: 2021.02.05 17:45 LMTX fmt: 2021.2.5 int: english/english
loading > Vim syntax highlighting (ver: 2020.06.29)
loading > Filter (ver: 2020.06.29)
loading > Module Catcodes (ver: 2018.04.16)
loading > Code syntax highlighting (ver: 2020.06.29)
loading > Syntax highlighting groups (ver: 2020.06.29)

I tested with both
$ context 51-colorscheme.tex
system > ConTeXt ver: 2021.02.05 17:45 LMTX fmt: 2021.2.5 int: english/english
$ context --luatex 51-colorscheme.tex
system > ConTeXt ver: 2021.02.05 17:45 MKIV fmt: 2021.2.7 int: english/english

The result was the same in that the comment lines are both displayed as blue in the PDF.

Add tagging

Add tagging so that the exported xml is usable.

t-vim doesn't appear to set vimrc correctly

I was trying to make Julia syntax highlighting work. When I started looking in the logs, I saw that vim was called with vim -u NONE so I set

\definevimtyping[julia][
    syntax=julia,
    vimrc=~/.vimrc,
    escape=on
]

However after that the logs showed something weird:

vim -u sujet-temp-vimrc-~/.vimrc.tmp -X -i NONE --noplugin --clean -es -n -c "syntax manual" -c "set syntax=julia" -c "set tabstop=4" -c "let contextstartline=1| let contextstopline=0| let strip=1" -c "let escapecomments=1" -c "let highlight=[]"  -c "source /usr/share/texmf-dist/tex/context/third/vim/2context.vim" -c "qa" sujet-temp-julia-0.tmp sujet-temp-julia-0.vimout

To avoid confusion, my filename is "sujet.tex".

I'm still looking trying to understand the source code but this vimrc is just weird and without setting the correct vimrc the syntax highlighting doesn't work even in interactive mode. Is it normal behaviour?

Thanks for the work on this module btw, it's pretty great for other languages.

Best regards,

escape comments = yes|no

Provide an escape comments = yes|no option that will not escape \{} inside the Comment regions. The current behaviour is equivalent to escapecomments=no. With escapecomments=yes, one can say:

/* The following function computers the roots of \m{ax^2 + bx + c = 0} using the 
    determinant \m{\Delta = \frac {-b \pm \sqrt{b^2 - 2ac}}{2a}}                                  */
    double root (double a, double b, double c) {....}

so that the \ in the comments are not escaped and then the math is typeset using TeX.

how to pipe output of filter to vim syntax highlighter?

This is a question, not a bug or issue.

I want to process R, and then have the commands piped to the vimtyping filter.

So, how to I "wrap" the output from the filter module in another set of \startR \stopR commands that will trigger the vimtyping filter module?

Here is what I tried, without success:

First, the base case (largely based on your test case for R)

\definevimtyping [R][syntax=r]

\defineexternalfilter
[Rcode]
[filtercommand={R CMD BATCH -q --save --restore \externalfilterinputfile\space \externalfilteroutputfile},
  output=\externalfilterbasefile.out,
readcommand=\typefile,
directory=output,
continue=yes]

...(from your r test case)...

First a test of whether the workspace is persistent:
bla
\startRcode
a <- "bla"
b <- "blabla"
ls()
\stopRcode

One R run ends, another begins.

\startR
ls()
\stopR

The R code is executed and formatted as plain text. The "ls()" command is not executed, but is syntax colored. What I want to do is to put \startR and \stopR in the filter as follows:

\defineexternalfilter
[Rcode]
[filtercommand={R CMD BATCH -q --save --restore \externalfilterinputfile\space \externalfilteroutputfile},
  output=\externalfilterbasefile.out,
readcommand=\typefile,
directory=output,
before=\startR,
after=\stopR,
continue=yes]

However, that dies, with context hanging up on the stopR of the next bit of code:



tex error       > error on line 14 in file output/testfile.md.tex: ! Emergency stop

<to be read again> 
\else 
\externalfilterparameter ...rentexternalfilter :#1
                                                  \endcsname \????externalfi...
\directsetup ...me \??setup :#1\endcsname #1\else 
                                                  \letterpercent \fi \fi \en...
<argument> ...!setups ]\directsetup \externalfilterparameter 
                                                  \c!readcommand \externalfi...
\ctxcommand #1p-\directlua {commands.#1
                                       }
\buff_gobble ...ne =\plusone true\else false\fi )}
                                                  \buff_gobble \buff_finish 
l.14 \stopR


 4     \startRcode
 5     a <- "bla"
 6     b <- "blabla"
 7     ls()
 8     \stopRcode
 9     
10     One R run ends, another begins.
11     
12     \startR
13     ls()
14 >>  \stopR
15     
16     Now follows a hidden R run which cleans the R workspace
17     
18     \startRhidden
19     rm(list=ls())
20     save.image()
21     \stopRhidden
22     
23     What is in the workspace now?
24     

I don't really understand tex/context macros, but it just seems like there should be some way to "protect" the macro so that it is not executed, but rather is written out as a command first and then interpreted in a second pass?

Any help would be appreciated, or redirection to a more appropriate channel.

Reference Code Lines by number

When line Numbering is on it would be nice to have some means to be able to refer to tagg a specific line an refer to it in captions and text using standard refernce commands like \in producing the number of the line the tag was placed on

\start<vimcode>[..., numbering=yes,...]
\linetag[code:someexample:line:veryimportant]
\stop<vimcod>

So one could write [...] as can be deduced from \in{line}[code:someexample:line:veryimportant] in \in{Example}[code:someexample] [...]

It would be for a start perfectly OK if \linetag command would have to be placed inside comment to be properly processed as long as it would not appear in output

In case that would be already be possible by other means built in in context or t-filter pleas point me to proper search terms and manual sections.

Thanks
ps: this i meant as a feature request

t-vim: Problem with hyphens (TeX ligatures present in teletype fonts)

When my code contains multiple hyphens in a row, they are replaced with longer dashes. For example, in C code instead of i-- I have i–. Some of my comments also look incorrectly:

/*———————————————————————————-
* File: main.c
* Function: foo
* Description: bar
...

instead of

/*----------------------------------------------------------------------------------
* File: main.c
* Function: foo
* Description: bar
...

Is there a way to control this or is it a bug?

Accents are not displayed when using filter with R

Minimal example to reproduce the issue:


\usemodule[filter]

\startbuffer[r::before]
library(tidyverse)
\stopbuffer

\defineexternalfilter
  [R]
  [filtercommand={R CMD BATCH  \externalfilterinputfile\space \externalfilteroutputfile},
   output=\externalfilterbasefile.out,
   bufferbefore={r::before},
   continue=no,
   read=no]


\starttext

\startR
dt <- tibble(x = 1:5, y = x)
plot <- ggplot(data = dt, mapping = aes(x = x, y = y, color = factor(x))) + geom_point() + labs(title = "áéíóú")
ggsave('plot.pdf',plot = plot, device = cairo_pdf,width = 5,height=5,unit='cm')
\stopR

\externalfigure[plot.pdf]
\stoptext

The context output:
image

The same R code run with Rscript gives:

image

I would be very grateful for any help in this issue, because i don't wanna waste anyone time i tried to solve it myself, but i couldn't.

Thanks in advance,
Fernando H.

highlighting code in XML sources

@adityam,

to be able to use your module with XML sources for code highlighting, we would need to have two commands:

  • \vimtypebuffer
  • `\vimtypeinlinebuffer

They should have two options, the name of the buffer to be typeset and the syntax highlight to apply.

ConTeXt itself has two similar commands: \typebuffer and \typeinlinebuffer. And the m-scite has the commands \scitebuffer and \sciteinlinebuffer.

Could you consider adding both commands to the vim module?

BTW, it would be great when there is no need to use \definevimtyping if the user selects the right syntax highlight to be applied.

Question: Does filter module work with ConTeXtLMTX and can it be used in Windows?

Hello Mr. Aditya,
I would like to ask whether the "filter" module does work with (? newest) ConTeXtLMTX and if it does, how one can install it on Windows OS? There is already a guide on context garden here, but it assumes Linux OS (I guess, I dont have rsync command avaible on Windows10).
Currently, I am learning ConTeXt with Standalone version from 2019, sometimes switching to TeXlive. So far, I have been using LaTeX with PythonTeX, but recently I am in need to also use xml data, for which ConTeXt would be better suited, but I also need functionalities similar to PythonTeX, for which your modules fits quite nicely.
Thank you in advance for any help,
regards Tomas

t-vim xhtml driver code blocks typeset on single line

Another issue i like to look into is the following
when running in standard mode with backend set to pdf and export to false syntax highlighting works as expected especially with my suggested improvements (issue #29) which i submitted a pull request (#30) for intial review and further discussion.

As want to publish my document also as epub i have setup mode switching where in the epub mode the backend is set to xhtml and export to yes (\setupbackend[export=yes,xhtml=yes]) among others.
When xhtml output is active the line-breaks at the end of each syntax line are lost. All code is typeset/displayed on one long single line.

My questions for a start is, where would I have to look into the t-vim, t-filter syntax highlighting code to for a hook to insert appropriate xhtml/xml line endings when xhtml/xml output is active. Where else besides the t-vim, t-filter code i would have to take a look at? What additional documentation would you suggest to take a look at etc?

As far as i have time (currently not to little) i would take a look into this improvement/fixup my self and if i manage come up with as suggestion by creating a pull request for review and further discussion if you agree.

numberdistance not considering margin

\usemodule[vim]

\setupvimtyping[vimcommand=nvim]
\definevimtyping[CPP][syntax=cpp, numbering=yes, numberdistance=1em, margin=10em]

\starttext
\startCPP
#include <iostream>
using std::cout;

int main() {
    cout <<"Hello world!\n";
}
\stopCPP
\stoptext

t-vim-margin-numbering

Line numbers are way farther than 1em to the code.

t-vim Create custom color schemes

Disclaimer: I'm fairly new to ConTeXt, I have done some LaTeX, though I don't know much about TeX development. So this is probably possible but I just don't know how.

I've recently started to play around with the vim module for displaying code in a fancy way, and it's working really well.

However, I would like to customize the colour scheme for my document, preferably without modifying the module files themselves.

I imagine the \startcolorscheme[...] command does this in in the module, though I'm not sure how easily that could be used.

From t-vim.tex line 280

\startcolorscheme[pscolor]
    % Vim Preferred groups
    \definesyntaxgroup
        [Constant]
        [\c!color={h=007068}]

    \definesyntaxgroup
        [Identifier]
[\c!color={h=a030a0}]
.....
\stopcolorscheme

modes makes fails t-filter with python

Hi,

With this minimal example


\usemodule[filter]

\defineexternalfilter
    [python]
    [filtercommand={python \externalfilterinputfile\space > \externalfilteroutputfile},cache=force]


\starttext
\doifmode{solucions}{

\starttextrule{Solucions}

\startpython
from sympy.solvers import solve
from sympy import Symbol
from sympy import Eq

x = Symbol('x')
print(solve(Eq(3*x + 2, 35), x))
\stoppython

\stoptextrule

}

\stoptext

I get a "always-running".... if I do context --mode=solucions. I use latest MKIV.

Vim filter cannot process two files with same name but different extensions

e8a769e changed \splitoffname to \splitoffbase. \splitoffbase discards the file extension, which means that you cannot highlight two files with the same name and different extensions since the .vimout file will always be overwritten by the last file included.

Reproduction

ConTeXt: ver: 2021.09.26 17:00 LMTX fmt: 2021.10.4 int: english/english

vim/filter modules: 3873a0a

test.A

\def\AAA{\relax}

test.B

\def\BBB{\relax}

test.tex

\usemodule[vim]
\definevimtyping[TEX][syntax=tex]

\starttext
    \section{A}
    \typeTEXfile{test.A}
    \section{B}
    \typeTEXfile{test.B}
\stoptext

Result

result

t-vim `.vimout` file name clashing

Two following use cases do not work correctly:

\typeTEXTfile{folder1/file.txt}
\typeTEXTfile{folder2/file.txt}
\typeTEXTfile[start=1, stop=10]{file.txt}
\typeTEXTfile[start=11, stop=20]{file.txt}

In both cases only a single .vimout file is created.

Similar issue: #57.

Error compiling under MKIV

Hi Aditya,

your module worked perfect until tuesday, when I updated ConTeXt at that point I now get the following error when having t-vim enabled:

loading         : ConTeXt User Module / Filter
)
color           : unknown system hex
! Missing number, treated as zero.
<to be read again> 
               ^
<argument> ...`\} = \endgroupcatcode \catcode `\^^
                                              M = \activecatcode \catcod...
\startcatcodetable ... \the \setdefaultcatcodes #2
                                              \savecatcodetable #1\relax...
l.91 \stopcatcodetable

? 
! Missing number, treated as zero.
<to be read again> 
                   \savecatcodetable 
\startcatcodetable ...atcodes #2\savecatcodetable 
                                                  #1\relax \egroup 
l.91 \stopcatcodetable

any suggestions for a wayto fix it, as I'm not that firm with the internals in t-vim but like the support it provides for highlighting and/or coloring text parts with vim schemes... :)

Thanks for your help

numbering in conflict with itemize[columns]

\usemodule[vim]
\setupvimtyping[vimcommand=nvim]
\definevimtyping[code][numbering=yes]

\starttext
\startcode
foobar
foobar
foobar
\stopcode

\startitemize[columns] \stopitemize
\startitemize[columns] \stopitemize
\startitemize[columns] \stopitemize

\stoptext

t-vim-columns

inline command removes spaces

When using the \inlinepandoc command in the first paragraph below interword spacing
is supressed in random (?) locations and html entities are not interpreted
properly. This does not happen when using pandoc environment.

\defineexternalfilter
  [pandoc]
  [
    filter={pandoc -f \externalfilterparameter{format} -t context
                   -o \externalfilteroutputfile},
    format=twiki,
    directory=output,
  ]
\starttext
Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
nr nr 118 s. 2.  (\inlinepandoc{w artykule L&#42;&#42;&#42; (E.
Januszkiewicza)  "Notatki wspomnień z życia A. Mickiewicza"}).

\startpandoc
Inne tyt.: Wizyta pana Franciszka Grzymały, Exegi monumentum aere
perennius....  Powst. Paryż, na autografie podpis: "Paryż, 12 marca
1833. Wiersze natchnione wizytą Fr. Grzymały".   Pdr: {\it Czas} 1859
nr nr 118 s. 2.  (w artykule L&#42;&#42;&#42; (E. Januszkiewicza)
"Notatki wspomnień z życia A. Mickiewicza").
\stoppandoc
\stoptext

Utility of line 172 in 2context.vim

Hi,
Apologies, I'm rather new to ConTeXt and vim so i might be completely wrong. This comment is from the perspective of trying to make Julia be correctly highlighted. I have a suspicion that the question I'm asking is linked to the preferred groups and that I didn't quite understand the code right. If not, here's the question:

Does the line 172

let s:id      = synIDtrans (s:id)

still have a use? It seems to mangle the IDs and (at least for Julia) results in id_name=juliaNone for a lot of different IDs.

Best regards.

process LaTeX fragments?

Is it possible to process LaTeX fragments with this? Of course, I could use pandoc but that may add too much unnecessary complexity.

css path is inserted wrongly

Hi
It too me a long time to finally test what we have achieved last year til june on my lecturenotes.
What i have figured now is that when adding the css using

\setupexport[ ... , ... ,cssfile=\vimtypingcssfile]

Than the following line is included on my linux system using below mentioned standalone installation of context.

<!-- *-div.html -->
<link type="text/css" rel="stylesheet" href="styles/<prefixpath>/tex/texmf-modules/tex/context/third/vim/vimtyping-default.css" />

<!-- *-div.xhtml -->
<!-- not included and thus missing-->

<!-- *-raw.xml -->
<?xml-stylesheet type="text/css" href="styles/<prefixpath>/tex/texmf-modules/tex/context/third/vim/vimtyping-default.css" ?>

<!-- *-tag.xml -->
<?xml-stylesheet type="text/css" href="styles/<prefixpath>/tex/texmf-modules/tex/context/third/vim/vimtyping-default.css" ?>

I can't tell whether this is the fault of t-filter or t-vim module or a bug in context. The default workarround is to once include using \vimtypingscriptfile to get it copied and than for the next runs replace by cssfile=vimtyping-default.css.

mtx-context     | ConTeXt Process Management 1.04
mtx-context     |
mtx-context     | main context file: <prefixpath>/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context     | current version: 2021.02.14 16:39
mtx-context     | main context file: <prefixpath>/tex/texmf-context/tex/context/base/mkxl/context.mkxl
mtx-context     | current version: 2021.02.14 16:39

<prefixpath> ... the base directory path standalone context installation was installed to


ps.: I think i also have found why line numbering and vim-typing does not play well in float environments. I still have to check home with latest context installation and github t-vim sources. keep you posted

I can't read xml files

With this filter:

\usemodule[filter]

\defineexternalfilter
    [python]
    [filtercommand={python3 \externalfilterinputfile\space > \externalfilteroutputfile}, location=text]

and this code:

import os.path

with open('./b.txt', 'r') as f:
    r = f.read()
    print(len(r))

all is fine except when b.txt is an XML file. I get this

references      > start problematic references

references      > unknown >    1: [][]

references      > stop problematic references

What happens?

Add support for XML

From mailing list

Is it possible to use

 <paragraph> \startmarkdown bla... \stopmarkdown </paragraph>

With my code (xmlflush) the start/stopmarkdown is printed without interpretation.

t-vim in conflict with setupbodyfont

\usemodule[vim]

\definefontfamily [mainfont] [mono] [Latin Modern Mono]
\setupbodyfont [mainfont]

\setupvimtyping[vimcommand=nvim]
\definevimtyping[code]

\starttext
\startcode
--
\stopcode
\stoptext

Only one dash is shown. By removing \definefontfamily and \setupbodyfont, two dash are shown as expected.

Line numbers not visible if wrapped in float

Hi, I'm trying to use a vim typing block inside a float. If it's wrapped in a float the line numbers are not visible.
Here's a short example:

\usemodule[vim]
\definefloat[sourcecode][sourcecodes]
\definevimtyping[JSON][syntax=json,numbering=yes]

\starttext
    \startplacesourcecode
        \startJSON
            some code
        \stopJSON
    \stopplacesourcecode
\stoptext

If I comment \*placesourcecode the code get's typeset as expeced (numbering visible).

Is there anything I can do to make them visible inside floating areas?

Insufficient coloring of c++ code

\usemodule[vim]
\setupvimtyping[vimcommand=nvim]
\definevimtyping [CPP]  [syntax=cpp]
\starttext
\startCPP
#include <iostream>
using std::cout;

int main() {
  cout <<"Hello world\n";
}
\stopCPP
\stoptext

Not sure if this is intended, but all code are in black color, except for using and int which are blue.

The "changing the color scheme" section of vim-README seems to suggest that the default t-vim does not provide by default the color schemes of vim/nvim (:colorscheme).

Using filter twice gives same replaced output

Versions:

ConTeXt ver: 2022.01.21 20:13 LMTX fmt: 2022.2.16 int: english/english
t-filter (ver: 2022.02.17)

Use case

Using the same filter twice with different content.

Expected Result

In the produced output both filters are "replaced" with their corresponding content.

Observed Result

Both filters are indeed "replaced". But the replaced content is coming from the first filter invocation.

How To Reproduce

Use "dot.tex" from the test-cases in this repository as a starting point. Add a second invocation like in the code below. Both figures will appear, but the second one contains the dot-graph from the first filter invocation again.

\usemodule[filter]

\defineexternalfilter
  [graphviz]
  [
    filter=\externalfilterparameter{layout} -Tpdf -o\externalfilteroutputfile,
    layout=dot, % neato or twopi
    cache=yes,
    output=\externalfilterbasefile.pdf,
    readcommand=\ReadPDF,
  ]

\def\ReadPDF#1%
    {\externalfigure[#1][frame=on]}

\starttext

\startplacefigure[location=right]
  \startgraphviz
    digraph G {
        a_1-> a_2 -> a_3 -> a_1;
        }
  \stopgraphviz
\stopplacefigure
\input ward

% this is the second figure with (almost) the same graph

\startplacefigure[location=left]
  \startgraphviz
    digraph G {
        1_a-> 2_a ->3_a ->1_a;
        }
  \stopgraphviz
\stopplacefigure
\input ward

\stoptext

Test 19-linenumber-break is failing

The option numbering=line should disable numbering of lines long lines that are automatically split. But this is not happening, either in starttying or in startvimtyping.

Strange error

Hi,

With this code

\usemodule[filter]

\defineexternalfilter 
  [sympy]
  [filtercommand={python \externalfilterinputfile\space > \externalfilteroutputfile},
   bufferbefore=init]

\defineexternalfilter
  [sympycalc]
  [filtercommand={python \externalfilterinputfile\space > \externalfilteroutputfile},
   bufferbefore=init,
   readcommand=\DisplayCalcFile]

\startbuffer[init]
from sympy import apart
from sympy.abc import x
\stopbuffer

\starttext
\startsympy
print(apart( (x+1)/(x-1), x))
\stopsympy

\startsympycalc
print(apart( (x+1)/(x-1), x))
\stopsympycalc

\stoptext

I get:

tex error       > error on line 26 in file /home/xan/SYNC/cepasud-raw/classe/ESPA3/planificació/Tema2-Àlgebra/entorn-simple-cas.tex: ! Undefined control sequence


\@@@@externalfiltersympycalc:readcommand ...cFile 

\externalfilter@read_processed_file_indeed ...and 
                                                  \externalfilter@output_fil...
\externalfilter@process_filter ..._processed_file 
                                                  \iftraceexternalfilters \e...
l.26 \stopsympycalc


16     from sympy.abc import x
17     \stopbuffer
18     
19     \starttext
20     \startsympy
21     print(apart( (x+1)/(x-1), x))
22     \stopsympy
23     
24     \startsympycalc
25     print(apart( (x+1)/(x-1), x))
26 >>  \stopsympycalc
27     
28     \stoptext
29     
30     


? 

What's wrong?

In MkIV, don't call mtxrun

Calling mtxrun is complicated because of the manner in which quotes and pipe are handled. A cleaner solution is to use luatex to calculate the md5sum and call \executeexternalfilter only if the md5sum has changed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.