indentation

Can you get ERB to properly indent when rendered?

。_饼干妹妹 提交于 2020-06-10 13:21:54
问题 I have several partials that I'm including in my Rails application.html.erb file , but the resulting HTML doesn't preserve my indenting (formatting). I've been told that the first line gets rendered with the same indentation-level as the call to _partial.html.erb , but all subsequent lines in the partial just get left-aligned. This results in code like (see my comments for positioning): <body> <div id="outer"> <div class="contentwidth main"> <div class="logo"> <<<<< Shouldn't be this far to

Can you get ERB to properly indent when rendered?

徘徊边缘 提交于 2020-06-10 13:21:51
问题 I have several partials that I'm including in my Rails application.html.erb file , but the resulting HTML doesn't preserve my indenting (formatting). I've been told that the first line gets rendered with the same indentation-level as the call to _partial.html.erb , but all subsequent lines in the partial just get left-aligned. This results in code like (see my comments for positioning): <body> <div id="outer"> <div class="contentwidth main"> <div class="logo"> <<<<< Shouldn't be this far to

How to detect and indent json substrings inside longer non-json text?

做~自己de王妃 提交于 2020-05-17 06:25:47
问题 I have an existing Python application, which logs like: import logging import json logger = logging.getLogger() some_var = 'abc' data = { 1: 2, 'blah': { ['hello'] } } logger.info(f"The value of some_var is {some_var} and data is {json.dumps(data)}") So the logger.info function is given: The value of some_var is abc and data is {1: 2,"blah": {["hello"]}} Currently my logs go to AWS CloudWatch, which does some magic and renders this with indentation like: The value of some_var is abc and data

How to detect and indent json substrings inside longer non-json text?

徘徊边缘 提交于 2020-05-17 06:25:28
问题 I have an existing Python application, which logs like: import logging import json logger = logging.getLogger() some_var = 'abc' data = { 1: 2, 'blah': { ['hello'] } } logger.info(f"The value of some_var is {some_var} and data is {json.dumps(data)}") So the logger.info function is given: The value of some_var is abc and data is {1: 2,"blah": {["hello"]}} Currently my logs go to AWS CloudWatch, which does some magic and renders this with indentation like: The value of some_var is abc and data

What is the preferred way to indent cases in a switch? [closed]

主宰稳场 提交于 2020-02-27 04:11:16
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . As I was writing another switch in Eclipse, I once again came across a rather weird (to me, at least) default indentation, which is

Looking for a PHP Indentation tool? [closed]

北城以北 提交于 2020-02-05 06:27:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Is there something like the "phpCodeBeautifier" from waterproof that is open source? 回答1: The best tool I know to reformat PHP code is the PHP_Beautifier PEAR package, which is both free (open source) and free (costs no money) . It's a bit complicated, has a lot of options, and is maybe a bit slow, but does

Is possible to parse “off-side” (indentation-based) languages with fparsec?

别说谁变了你拦得住时间么 提交于 2020-02-03 04:58:26
问题 I wish to use FParsec for a python-like language, indentation-based. I understand that this must be done in the lexing phase, but FParsec don't have a lexing phase. Is possible to use FParsec, or, how can feed it after lexing? P.D: I'm new at F#, but experienced in other languages 回答1: Yes, it's possible. Here is a relevant article by FParsec author. If you want to go deeper on the subject, this paper might worth a read. The paper points out that there are multiple packages for indentation

Is possible to parse “off-side” (indentation-based) languages with fparsec?

怎甘沉沦 提交于 2020-02-03 04:58:16
问题 I wish to use FParsec for a python-like language, indentation-based. I understand that this must be done in the lexing phase, but FParsec don't have a lexing phase. Is possible to use FParsec, or, how can feed it after lexing? P.D: I'm new at F#, but experienced in other languages 回答1: Yes, it's possible. Here is a relevant article by FParsec author. If you want to go deeper on the subject, this paper might worth a read. The paper points out that there are multiple packages for indentation

WCF DataService indent xml response

别来无恙 提交于 2020-01-25 10:35:25
问题 How can i indent the xml response from my data service? All my request to the wcf data service are in xml wihout indent. I am using OData3 WCF Data Service 5.0 . Before in Odata WCF Dataservice 4, all my response data was in indent xml. 回答1: It seems that since wcf dataservice 4.0 was update in WCF Data Services 5.0 with OData 3.0, all the xml response is not intent, i solved this by implement the IDispatchMessageInspector interface and modify the current content by xdocument and