Unexpected behavior in DonutProcessor.token2json with strings containing multilines (\n) 
Author: issahammoud
Pull request: no

### System Info

- `transformers` version: 4.39.0
- Platform: Linux-5.10.0-28-cloud-amd64-x86_64-with-glibc2.31
- Python version: 3.9.19
- Huggingface_hub version: 0.21.4
- Safetensors version: 0.4.2
- Accelerate version: not installed
- Accelerate config: not found
- PyTorch version (GPU?): 2.2.1 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: no

### Who can help?

@amyeroberts @ArthurZucker There is a bug in the implementation of the function token2json in the DonutProcessor class. It doesn't work when there are multilines in a value as shown in the example below. It is related the regex code.

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

```
from transformers import DonutProcessor
processor = DonutProcessor.from_pretrained("naver-clova-ix/donut-base")

def json2token(
        obj,
        sort_json_key: bool = True,
    ):
    """
    Convert an ordered JSON object into a token sequence
    """
    if isinstance(obj, dict):
        if len(obj) == 1 and "text_sequence" in obj:
            return obj["text_sequence"]
        else:
            output = ""
            if sort_json_key:
                keys = sorted(obj.keys(), reverse=True)
            else:
                keys = obj.keys()

            for k in keys:
                output += (
                    rf"<s_{k}>"
                    + json2token(
                        obj[k], sort_json_key
                    )
                    + rf"</s_{k}>"
                )
            return output
    elif isinstance(obj, list):
        return r"<sep/>".join(
            [
                json2token(
                    item, sort_json_key
                )
                for item in obj
            ]
        )
    else:
        obj = str(obj)
        return obj

json_example= {
  "field1": {
    "subfield1": "value"
  },
  "field2": [{
    "subfield2": "value1\nvalue1",
  },
  {
    "subfield2": "value2",
  }],
}
processor.token2json(json2token(json_example))
```

### Expected behavior

Applying token2json(json2token(dict)) should output the initial dict. However, this is not the case when there are multilines (\n). This problem is related to the regex code that implements token2json function. It is also present in the original Donut implementation.

The output of the given code is `{'field1': {'subfield1': 'value'}}`.

Comments:
Hi, thanks a lot for reporting it!

I found that it could be fixed by `re.DOTALL` in `token2json`

https://github.com/huggingface/transformers/blob/e4ea19b958c89d61e42461fac6ac8441787121f8/src/transformers/models/donut/processing_donut.py#L152

```python
content = re.search(f"{start_token_escaped}(.*?){end_token_escaped}", tokens, re.IGNORECASE | re.DOTALL)
```