PHP整理标题标签和js标签内的新空行

时间:2013-01-19 09:55:39

标签: php tidy

我有一个关于整洁的问题。

我的问题就像这个HTML Tidy new empty line after closing tags

我的当前设置不会为body标记和head标记内的html添加新的空行,期望title tagjs tag

输出如下。

     <title>
      XXXX
    </title>
     <script src="core.js" type="text/javascript">
</script>

我当前的设置

$config = array(
            'doctype' => '<!doctype html>',
            "char-encoding" => "utf8",
            'vertical-space' => false,
            'indent' => true,
            'wrap' => 0,
            'word-2000' => 1,
            'break-before-br' => true,
        );

我已添加'vertical-space' => false,我不知道为什么以及如何解决此问题。

我希望他们成为

         <title> XXXX </title>
         <script src="core.js" type="text/javascript">  </script>

非常感谢你的建议。

2 个答案:

答案 0 :(得分:0)

尝试添加选项

thomasreggi@zx:super-octopus$ babel-node graphql-test.js 
{ '0': null,
  '1': { id: '1' },
  '2': null,
  '3': 
   { fieldName: 'user',
     fieldASTs: [ [Object] ],
     returnType: 
      GraphQLObjectType {
        name: 'User',
        description: undefined,
        isTypeOf: undefined,
        _typeConfig: [Object],
        _interfaces: [],
        _fields: [Object] },
     parentType: 
      GraphQLObjectType {
        name: 'Query',
        description: undefined,
        isTypeOf: undefined,
        _typeConfig: [Object],
        _interfaces: [],
        _fields: [Object] },
     path: [ 'user' ],
     schema: 
      GraphQLSchema {
        _queryType: [Object],
        _mutationType: [Object],
        _subscriptionType: undefined,
        _directives: [Object],
        _typeMap: [Object],
        _implementations: {} },
     fragments: {},
     rootValue: null,
     operation: 
      { kind: 'OperationDefinition',
        operation: 'query',
        name: [Object],
        variableDefinitions: [Object],
        directives: [],
        selectionSet: [Object],
        loc: [Object] },
     variableValues: { id: '1' } } }
{ '0': {},
  '1': 
   { [Function: require]
     resolve: [Function: resolve],
     main: 
      Module {
        id: '.',
        exports: {},
        parent: null,
        filename: '/Users/thomasreggi/Desktop/super-octopus/graphql-test.js',
        loaded: true,
        children: [Object],
        paths: [Object] },
     extensions: 
      { '.js': [Function],
        '.json': [Function],
        '.node': [Function],
        '.jsx': [Function],
        '.es6': [Function],
        '.es': [Function] },
     cache: {...requireCache}
    }
  '2': 
   Module {
     id: '.',
     exports: {},
     parent: null,
     filename: '/Users/thomasreggi/Desktop/super-octopus/graphql-test.js',
     loaded: true,
     children: [ [Object], [Object], [Object] ],
     paths: 
      [ '/Users/thomasreggi/Desktop/super-octopus/node_modules',
        '/Users/thomasreggi/Desktop/node_modules',
        '/Users/thomasreggi/node_modules',
        '/Users/node_modules' ] },
  '3': '/Users/thomasreggi/Desktop/super-octopus/graphql-test.js',
  '4': '/Users/thomasreggi/Desktop/super-octopus' }
{ data: { createUser: { name: 'meow' } } }
{ data: { user: { name: 'meow' } } }

答案 1 :(得分:0)

    $tidy_config = array(
        'indent' => true,
        'wrap' => 0,
        'output-xml' => true);