Страницы Github, добавляющие случайные теги к моим сообщениям

Если вы посетите мой веб-сайт, вы заметите, что название самой последней статьи (на главной странице) заключено в тег <pre> и повторяется. Я понятия не имею, почему это происходит.

Вот сообщение, которое отображается:

---
layout: default
---

Stop distributing .doc files
----------------------------
Monday March 19th, 2012

`.doc` started as a file format used by many operating systems and used to store only plain-text. In the 90's, Microsoft decided to use the extension for Word -- their new word processor. Not only did they decide to use the extension, but they also broke the standard by using a proprietary format, instead of the plain-text most people were used to. Despite the `.doc` extension being more than **10 years old** and the fact that most documents formatted this way render horribly in operating systems other than Windows, I still regularly receive documents in this format. Stop it.

However aggravating the above paragraph is, this article isn't solely targeted at the `.doc` extension -- it is a public plea for people to stop distributing application specific documents and to start distrubting all documents in `.pdf`.

Yesterday I received an email from an engineering society I'm a part of. They were notifying all members of the upcoming annual general meeting that is taking place next week. I immediately lost interest in the email when I saw that their meeting schedule and their nomination form were both in `.docx` format. I don't like being forced to download the file, minimize my browser, launch an Office application (in my case, LibreOffice) and then read the content. Had it been distributed in `.pdf`, Chrome would have immediately opened a new tab for me displaying the document and giving me options to save, zoom or print it. I'm sure Firefox, Opera and (maybe) Internet Explorer have similar features.

We are increasingly collaborating on the web, and the need for bulky desktop applications are almost gone with the wind. Had I not had an office application on my computer (which could have been possible seeing as I do most of my documentation and report with LaTeX), I would have had an extra step before viewing the content that was sent to me. It's not like it is difficult either. All major office applications I know of allow easy exporting to `.pdf` file format and LibreOffice also allows you to save a hybrid `.pdf` and `.odt` together in one file. This allows you to distribute the PDF as is and also open it for editing.

There is virtually no need to distribute documents in any format, proprietary or not, other than PDF. Don't make your users work and fiddle with your flatform-specific or application-dependent documents.

И вот мой макет по умолчанию (соответствующая часть, вы можете просмотреть исходный код для чего-либо еще):

<div id="right-side">

            {{ content }}

            <div id="footer">
                <p>
                    &copy; {{ site.author.name }} 2012 with help from
                    <a href="http://jekyllbootstrap.com" target="_blank">Jekyll Bootstrap</a>
                </p>
            </div>
        </div>

как видите, макет просто сбрасывает содержимое файла уценки в div right-side. Если вы посетите другие страницы/публикацию на моем сайте, вы увидите, что эти страницы работают, но не домашняя страница (несмотря на то, что они имеют тот же формат уценки и используют тот же макет).

Любые идеи?


person n0pe    schedule 22.03.2012    source источник
comment
я не вижу? (Это эта страница?)   -  person huon    schedule 23.03.2012
comment
@dbaupp, страница maxmackie.com работает неправильно. Страница, на которую вы ссылаетесь, — это та же статья, но она работает правильно (потому что ее нет на главной странице).   -  person n0pe    schedule 23.03.2012


Ответы (1)


Проблема заключается в зацикливании на вашей индексной странице. Отступ (как бы) сохраняется Liquid: замена текста является буквальной заменой, что означает, что первая строка будет иметь отступ, а последующие — нет. Обработка уценки index.md (first.content уже является HTML) происходит после запуска Liquid, поэтому отступ интерпретируется как блок кода.

Этапы обработки (это не обязательно дословный вывод на каждом этапе, но он будет близок):

{% for first in site.posts limit:1 %}
    {{ first.title }}
    {{ first.content }}
{% endfor %} 

После запуска Liquid на index.md:

    Stop distributing .doc files
    <h2>[...]</h2>

<p>Monday March 19th, 2012</p>

[...]

Теперь запускается Markdown, и отступ означает, что первые две строки являются блоком кода:

<pre><code>Stop Distributing .doc Files
&lt;h2 id='stop_distributing_doc_files'&gt;Stop distributing .doc files&lt;/h2&gt;</code></pre>
<p>Monday March 19th, 2012</p>

Это можно исправить, не имея такого большого отступа элементов цикла for: отступ в 4 пробела или табуляции делает блок кода. Так

{% for first in site.posts limit:1 %}
  {{ first.title }}
  {{ first.content }}
{% endfor %} 
person huon    schedule 23.03.2012
comment
Большое спасибо! Это сработало отлично. У вас очень острый глаз, считайте, что за вами следят на Github. - person n0pe; 23.03.2012
comment
@MaxMackie не проблема :) (я уже сталкивался с подобной проблемой, поэтому знал, что ищу) - person huon; 23.03.2012
comment
@dbaupp Будет ли другим решением уценка содержимого внутри цикла с помощью {{ first.content | markdownify }}? - person Alex Lockwood; 04.01.2014