Skip to content

remove tab on meta charset#12895

Merged
rdeutz merged 2 commits intojoomla:stagingfrom
810:patch6634
Nov 18, 2016
Merged

remove tab on meta charset#12895
rdeutz merged 2 commits intojoomla:stagingfrom
810:patch6634

Conversation

@810
Copy link
Copy Markdown
Contributor

@810 810 commented Nov 15, 2016

On the template source you will see a tab on the meta.

Before:
before
After:
after

@joomla-cms-bot
Copy link
Copy Markdown

Please add more information to your issue. Without test instructions and/or any description we will close this issue within 4 weeks. Thanks.
This is an automated message from the J!Tracker Application.

@infograf768
Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on ad2fb05

Simple cosmetic change to align the <meta charset="utf-8" /> with other meta in source


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12895.

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Nov 15, 2016

I have tested this item ✅ successfully on ad2fb05

It assumes that <jdoc:include type="head" /> is always correct intended.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12895.

@brianteeman
Copy link
Copy Markdown
Contributor

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12895.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Nov 15, 2016
@zero-24 zero-24 added this to the Joomla 3.7.0 milestone Nov 15, 2016
@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Nov 15, 2016

That is actually the wrong place as it only works for HTML5 templates. If isHtml5 is false, the double tab will still appear.
The real question is where the double tab is being generated, and the answer is simple: In the template is an initial tab:
https://github.com/joomla/joomla-cms/blob/staging/templates/protostar/index.php#L130

So you either trim the tab from the buffer before returning/echoing it or you remove the tab in the template.

@joomla-cms-bot joomla-cms-bot removed this from the Joomla 3.7.0 milestone Nov 15, 2016
@Bakual Bakual removed the RTC This Pull Request is Ready To Commit label Nov 15, 2016
@brianteeman
Copy link
Copy Markdown
Contributor

But the code says this is only for html5


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12895.

@810
Copy link
Copy Markdown
Contributor Author

810 commented Nov 15, 2016

if you remove the tab on the template itself, you have the same issue, but then on template:
dd

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Nov 15, 2016

You'd have to ltrim() the tab off when returning the contents. If you're not in HTML5 mode, then whatever your first tag is will still have a tab, and we really don't need to litter the method with a $isFirst variable to decide whether to include the tab on stuff.

@andrepereiradasilva
Copy link
Copy Markdown
Contributor

if you are going to that, please do it for all templates, including installation

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Nov 15, 2016

If you return ltrim($buffer, $tab); at the end of JDocumentRendererHtmlHead::fetchHead() that does fix it for all templates, instead of this specific fix which only works correctly if the template's in HTML5 mode.

@810
Copy link
Copy Markdown
Contributor Author

810 commented Nov 15, 2016

Ok, updated the code.

Works fine now.
Next ocd todo: order by type

@jeckodevelopment
Copy link
Copy Markdown
Member

Can we go back to RTC?

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Nov 16, 2016

Can we go back to RTC?

Without any tests?

@jeckodevelopment
Copy link
Copy Markdown
Member

I saw your "Approval". Then let's go with tests

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Nov 16, 2016

Ah, that's just the new "Review" feature from GitHub 😄

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Nov 17, 2016

I would just do trim($buffer); then all the blancks and new lines are gone, or is this too radical?

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Nov 17, 2016

We're spitting back a "formatted" HTML string, so doing that would break all of that formatting. Great if you're trying to compress the size of your HTML response but IMO not appropriate as a default behavior.

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Nov 17, 2016

trim would only remove whitespace from the beginning and end of the string. But since we know for sure there is only the tab in front of it, there is no reason to let trim look for other cases as well. It's just added work for trim without added value 😄

@dgrammatiko
Copy link
Copy Markdown
Contributor

@laoneo I've tried something like what you're proposing couple years ago: #3413

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Nov 18, 2016

@Bakual trim does also remove tabs and new lines without a second argument http://php.net/manual/en/function.trim.php

@laoneo
Copy link
Copy Markdown
Member

laoneo commented Nov 18, 2016

@DGT41 it is just about removing the beginning and ending characters, not the whole output

@mbabker
Copy link
Copy Markdown
Contributor

mbabker commented Nov 18, 2016

We don't want to be trimming the ending line break from the end of the processed head, so what this patch is doing now is just fine.

@Bakual
Copy link
Copy Markdown
Contributor

Bakual commented Nov 18, 2016

@laoneo Exactly. tabs and newlines count as whitespace as well. 😄

@810
Copy link
Copy Markdown
Contributor Author

810 commented Nov 18, 2016

ok,then we can merge this one

@rdeutz rdeutz added this to the Joomla 3.7.0 milestone Nov 18, 2016
@rdeutz rdeutz merged commit bd7f1c4 into joomla:staging Nov 18, 2016
roland-d added a commit to roland-d/joomla-cms that referenced this pull request Nov 25, 2016
* staging: (98 commits)
  Coding style. PHP constants true, false, and null MUST be in lower case. (joomla#13010)
  Removing duplicated AS in sql query (joomla#13006)
  Fixed typo in comment (joomla#12992)
  Correcting strings in TFA Google plugin (joomla#12980)
  code style changes (joomla#12986)
  Error in sr-YU installation ini file (joomla#12984)
  New DateTime picker (replaces calendar) (joomla#11138)
  Export of Banners Tracks Does Not Export the Banner Name
  fix rues get data (joomla#12763)
  Added Feature items filter to mod_articles_news (joomla#12547)
  fix them all (joomla#12943)
  a11y regression fix (joomla#12935)
  Set correct component id for system links (joomla#12938)
  Fix for Undefined offset in Content History preview popup (joomla#12791)
  remove tab on meta charset (joomla#12895)
  JSession patched to set session _state to 'inactive' when session is closed. (joomla#12928)
  [JHtmlNumber::bytes] Format number according to language (joomla#12929)
  Update edit.php (joomla#12818)
  Update default.xml (joomla#12917)
  Adding the ability to use the global value for character count in newsfeeds (joomla#12869)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.