Git Product home page Git Product logo

Comments (5)

sbdchd avatar sbdchd commented on July 28, 2024

Hmm.

With the following file test.pandoc

- [] a

When I pipe it to the command that Neoformat is supposed to run, like follows:

cat test.pandoc | pandoc -f markdown+abbreviations+autolink_bare_uris+markdown_attribute+mmd_header_identifiers+mmd_link_attributes+mmd_title_block+tex_math_double_backslash+emoji -t markdown+raw_tex-native_spans-simple_tables-multiline_tables+emoji --normalize -s --wrap=auto --atx-headers | sed -e 's/\[/[/g' -e 's/\]/]/g'

I get the following output

-   \[\] a

And when I pipe the output to sed it also doesn't work.

echo "-   \[\] a" |  sed -e 's/\[/[/g' -e 's/\]/]/g'

produces

-   \[\] a

Edit: actually, I think sed is fine, but vim is escaping it weird.

sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'
// goes to

sed -e 's/\[/[/g' -e 's/\]/]/g'

Will investigate further.

from neoformat.

alok avatar alok commented on July 28, 2024

I think the number of backslashes in the regex may be the issue, but I can't see why that'd break now all of a sudden.

from neoformat.

sbdchd avatar sbdchd commented on July 28, 2024

I think vim might be messing with the sed regex when it is used with system()

Docs related to system()

Some outputs to ponder

" 1. Pipe data to pandoc, which pipes to sed
let stdin = '-   [] a'
let cmd = 'pandoc -f markdown -t markdown --normalize -s --wrap=auto --atx-headers'
let sed = "sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'"
let exe = cmd . ' | ' . sed
let stdout = systemlist(exe, stdin)

echom string(stdout)
" ['-   \[\] a']

" 2. Pass data to sed via stdin
let stdin = '-   \[\] a'
let sed = "sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'"
let stdout = systemlist(sed, stdin)

echom string(stdout)
" ['-   \[\] a']

" 3. Echo data in shell to sed
let cmd = "echo '-   \[\] a'"
let sed = "sed -e 's/\\\[/[/g' -e 's/\\\]/]/g'"
let exe = cmd . ' | ' . sed
let stdout = systemlist(exe)

echom string(stdout)
" ['-   [] a']

from neoformat.

sbdchd avatar sbdchd commented on July 28, 2024

Try out the latest version.

It's not pretty, but I think I fixed it.

from neoformat.

alok avatar alok commented on July 28, 2024

That looks awful, but it does work.

from neoformat.

Related Issues (20)

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.