Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StartTag: invalid element name #1019

Closed
mabushey opened this issue Sep 1, 2016 · 8 comments
Closed

StartTag: invalid element name #1019

mabushey opened this issue Sep 1, 2016 · 8 comments

Comments

@mabushey
Copy link

mabushey commented Sep 1, 2016

I haven't touched any code in grav in a few days... I've added maybe 7 or 8 pages and all of a sudden after going to one [only one] of my four menu items I get:

Twig_Error_Runtime An exception has been thrown during the rendering of a template ("DOMDocumentFragment::appendXML(): Entity: line 1: parser error : StartTag: invalid element name") in "partials/blog_item.html.twig" at line 53.

I'm running antimatter commit 5d98b400a and grav commit 7843b30 (1.1.3).

sudo -u www-data bin/composer.phar diagnose                 
Checking composer.json: FAIL
require.erusev/parsedown : unbound version constraints (dev-master as 1.6.0) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: Warning: Accessing packagist.org over http which is an insecure protocol.
OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
@rhukster
Copy link
Member

rhukster commented Sep 2, 2016

The only place I can think of that DomDocument is used is in the Truncator class. This is used to truncate HTML and is used by Page::summary(). This makes total sense as your error references partials/blog_item.html.twig which does have a call to page.summary.

Ok, that said, the Truncator tries to close any open tags that occur at the truncation point. This is usually very solid, and i've not really found a scenario that breaks it, but clearly you have!

A quick workaround is if you know the page which is causing this problem, use a manual summary seperator rather than letting it use the character limit (from site.yaml). Another option is to tweak the summary size in site.yaml. Try 10 or 20 chars smaller or larger, see if it makes a difference.

More Info: https://learn.getgrav.org/content/content-pages#summary-size-and-separator

I would love to get the actual page that is causing this, but that obviously is not easy to track down. If you do know the page, or can find out which one is causing it, can you provide me an exact copy of this page, plus your site.yaml configuration so I can try to replicate it???

@mabushey
Copy link
Author

mabushey commented Sep 3, 2016

Found the culprit. I changed the character limit in site.yaml from 300 to 200 but it made no difference. Here is the offender:

29.quinled/item.md

---
title: QuinLED
---

#### Power Supplies
Meanwell: IRM-60-12ST    $16.70 (10 @ 13.69)  <.1W no load
Mean Well IRM-60-12      $14.90 (10 @ 12.21)  <.1W no load
RPS-60-12                $14.00 (10 @ 12.13)  <.75W no load#

@mabushey
Copy link
Author

mabushey commented Sep 3, 2016

Here's my site.yaml:

title: sendthemtomir
author:
  name: 'Michael Bushey'
  email: mirgrav@sendthemtomir.com
taxonomies:
  - category
  - tag
  - month
metadata:
  description: 'Grav is an easy to use, yet powerful, open source flat-file CMS'
summary:
  enabled: true
  format: short
  size: 300
  delimiter: '==='
redirects:
  /changelog: /blog/the-urban-jungle
routes:
  /something/else: /blog/focus-and-blur
  '/another/one/(.*)': /blog/$1
blog:
  route: ''

@rhukster rhukster added the bug label Sep 3, 2016
@rhukster
Copy link
Member

rhukster commented Sep 3, 2016

Thanks, it's definitely those < symbols that are causing the problem. I'll see what can be done.

@rhukster
Copy link
Member

rhukster commented Sep 6, 2016

Ok, step 1, replicated locally!

@rhukster rhukster added investigating and removed bug labels Sep 6, 2016
@rhukster
Copy link
Member

rhukster commented Sep 6, 2016

Ok, had to rewrite the Truncator completely, but i think this is good!

@mabushey
Copy link
Author

Fixed (in Grav 1.1.5) here too. After upgrading I got a "Class 'DOMLettersIterator' not found" but bin/composer.phar update fixed it. Thanks for the awesome support and amazing CMS!

@Mikdadali
Copy link

please help to solve this

https://del.dog/yudebitawa

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants