Giter Site home page Giter Site logo

Comments (7)

cmhughes avatar cmhughes commented on June 21, 2024

I present two options, both give your desired output.

option 1

Use noIndentBlock as in https://latexindentpl.readthedocs.io/en/latest/sec-fine-tuning.html?highlight=href#lst-href3

onlyOneBackUp: 1
defaultIndent: '    '
removeTrailingWhitespace: 1

modifyLineBreaks:
  commands:
    label:
      CommandStartsOnOwnLine: 1

noIndentBlock:
   subfloat:
     begin: \\subfloat\h*\{\h*\\label\{
     body: [^}]*?
     end: \}\h*\}

option 2

Using the replacement switch as in https://latexindentpl.readthedocs.io/en/latest/sec-replacements.html

onlyOneBackUp: 1
defaultIndent: '    '
removeTrailingWhitespace: 1

modifyLineBreaks:
  commands:
    label:
      CommandStartsOnOwnLine: 1

replacements:
  -
    when: after
    substitution: |-
        s/(\\subfloat\{)\s*(\\label)/$1$2/sg

from latexindent.pl.

tdegeus avatar tdegeus commented on June 21, 2024

Thanks for the solution! I agree that it is quite nice, and that it could be used in multiple circumstances.

However, I would still plea that the suggestion that I make here is quite nice too. In particular, it does not warrant the user to figure out a regex for every 'edge'-case it wants to ignore for some (but not all) feature of latexindent. Of course, it could be that the implementation of latexindent makes this option very hard?

from latexindent.pl.

cmhughes avatar cmhughes commented on June 21, 2024

So you want the user to be able annotate lines in their file using a comment such as % noqa: modifyLineBreaks?

from latexindent.pl.

tdegeus avatar tdegeus commented on June 21, 2024

That is indeed my suggestion, per similarity with common use in Python e.g. with flake8, see e.g. https://stackoverflow.com/questions/45346575/what-does-noqa-mean-in-python-comments .

It is true that latexindent.pl is extremely versatile (likely much more than similar tools used e.g. for Python code). So it seems that even weird edge-cases can be treated in .latexindent.yaml. However, finding the right regular expressions can be more cumbersome than just ignoring a line.

from latexindent.pl.

cmhughes avatar cmhughes commented on June 21, 2024

OK, understood, it's on the list :)

from latexindent.pl.

cmhughes avatar cmhughes commented on June 21, 2024

I'm hoping to get to this soon, apologies for the delay :)

Do you have a sense for what the YAML user interface might look like for this?

from latexindent.pl.

cmhughes avatar cmhughes commented on June 21, 2024

I'm sorry, Tom, but I don't think that this is going to go anywhere.

My experience with the text wrap routine has made me very hesitant to implement a feature that seems simple but actually has a great number of subtleties,and leads to a number of questions, issues, edge cases.

If you, or anyone else, feels like taking this on, then do feel encouraged to submit a pull request. But, for the moment, I'm going to close this.

from latexindent.pl.

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.