Coder Social home page Coder Social logo

anki-json-new-line's Introduction

New line in strings in configurations/json

Rationale

In standard json, string should not contain newlines. They should contain "\n" instead, the standard symbols to represents a newline. Which clearly create a readability problem. In particular when an add-on configuration contains code (python, latex, whatever).

Thus, I wanted to have the right to have newlines in strings in json. And when I use the configuration editor, I want to see new lines insteads of \n.

Usage

This add-on allow you to write new line in your string. The add-on will replace them by "\n" before json load the configuration. This works both for configuration in the file meta.json, and for the the add-on manager's configuration editor.

Warning

Note that it will not put newlines in the configuration written in meta.conf. Indeed, this would create at least two problems:

  • We can't control the order in which add-ons are loaded. Thus all add-ons loaded before this current add-on would fail when trying to read their configuration.
  • If you decide to uninstall this add-on, no configuration with new lines could be read anymore. (In particular, this would happen if you synchronize your configuration using another add-on).

Internal

This add-on has an effect on ALL json strings read by the program. New lines in strings will always be removed and replaced by \n. Thus this add-on may affect more than configurations. However, this add-on call the standard json.loads() function, thus even another add-on affecting json.loads() should still be compatible with the current addon. Futhermore, this add-on has no effect on valid json. Thus the potential change would only be that some invalid json would be accepted, it seems harmless.

Furthermore, this add-on change ConfigEditor.updateText in module aqt.addons. It does not call the previous function, thus the current add-on will be incompatible with another add-on changing this method.

Links, licence and credits

Key Value
Copyright Arthur Milchior [email protected]
Based on Anki code by Damien Elmes [email protected]
License GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
Source in https://github.com/Arthur-Milchior/anki-json-new-line
Addon number 112201952

anki-json-new-line's People

Contributors

arthur-milchior avatar

Watchers

 avatar James Cloos avatar

anki-json-new-line's Issues

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.