2014-11-02 3 views
0

Я изучаю способ упрощения процесса публикации. Я получаю исходный текст и изображения от автора, отформатируйте его в формате MS Word, URL процесса/загрузки и ссылки на изображение в таблице с двумя столбцами, а затем конвертируйте текст в HTML. Я беру HTML и обертываю его в CSS, чтобы изображения и текст отображались заранее, чтобы соответствовать формату наших сайтов.Автоматизация создания HTML

Для меня процесс довольно прост в использовании через Word, Safari, Automator (я создал скрипт, который автоматизирует большую часть вставки CSS и HTML) и скобки, но теперь, когда мы расширяемся, мне нужно дополнительное помощь, и этот процесс для некоторых является довольно сложным. Вместо того, чтобы пытаться научить CSS-кодированию кому-то, и потому что не у всех есть MAC, чтобы использовать автомат таким образом, как я его настроил, я бы хотел найти способ идеально вставить HTML в форму и иметь его выплюнуть код с помощью CSS, завернутого в него и готового к работе.

Пример выполненной работы выглядит следующим образом:

<div class="divv12"> 
<p style="text-align:center;"><span style="font-size:18px;"><span style="color:#000;"><strong>Aerosoft - Bologna X</strong></span></span> 
    <p style="text-align:center;"><span style="font-size:14px;"><span style="color:#000;"><em>A review by Maxim Pyankov</em></span></span> 
    </div> 
<div class="divv11"> 
    <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/040.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/040_T.jpg" class="img111"></a> 
<p>&nbsp;</p> 
<p>Bologna Airport (LIPE; BLQ), officially known as Bologna Guglielmo Marconi Airport, is an international airport serving the city of Bologna, Italy.&nbsp; The airport is smaller in size, when compared to some other international airports, with just the one runway and 20-plus gates.&nbsp; Nevertheless, it is the seventh busiest airport in Italy, with a wide range of European destinations.</p> 
<p>&nbsp;</p> 
<p>For me personally, this was my first payware package, representing an Italian airport.&nbsp; I have been looking for an Italian gateway for some time, and as such was very excited to have an opportunity to evaluate this product.&nbsp; This product was developed by MK Studios, and is available from the Aerosoft website, as a download, for a little over $18.</p> 
<p>&nbsp;</p> 
<p><strong>Purchase, Install, and Manual</strong></p> 
<p>The purchase of this scenery, and the installation thereof, is a straightforward process, and will be familiar to those of you have purchased other products from the Aerosoft's site.&nbsp; The size of the installation file is 267 MB, and the installation wizard will seamlessly take you through the installation process.</p> 
<p>&nbsp;</p> 
<table align="center" border="0" cellpadding="5" cellspacing="0"> 
    <tbody> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/001.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/001_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/002.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/002_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
    </tbody> 
</table> 
<p>&nbsp;</p> 
<p>The version installed, on which I did all of my testing, is v1.01.&nbsp; This package is compatible with the FSX and P3D V2 applications.&nbsp; This review is based on FSX, running in DirectX10 compatibility mode.</p> 
<p>&nbsp;</p> 
<p>Once the product is installed, the familiarity with the other Aerosoft products ends, to some extent.&nbsp; First of all, upon the completion of the installation, you are not presented with an option to adjust the airport's traffic density, which is present in most other Aerosoft sceneries I own.&nbsp; Second, this package is not installed inside the ..&#092;Aerosoft folder, within the FSX root folder.&nbsp; Instead, you will find it in the ..&#092;MK-Studios folder.&nbsp; And third, this package does not show up in the Aerosoft Launcher.&nbsp; This is neither bad, nor good.&nbsp; I just felt I needed to point that out.</p> 
<p>&nbsp;</p> 
<p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/114.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/114_T.jpg" class="img111"></a> 
<p>&nbsp;</p> 
<p>Within the BolognaX folder (and in the Program Files group, under the MK-Studios folder) you will find a couple of PDF files - Charts.pdf and Manual.pdf.&nbsp; The manual is about 10 pages long, and is only marginally useful (the airline parking assignment table, on page 8).&nbsp; The charts document, on the other hand, is a 38-page document&nbsp; containing high-quality airport approach and departure charts.</p> 
<p>&nbsp;</p> 
<p>The three screenshots below display the default FSX Bologna airport, the after the installation look of the area, and the outline of the areas provided as part of this package.</p> 
<p>&nbsp;</p> 
<table align="center" border="0" cellpadding="5" cellspacing="0"> 
    <tbody> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/110.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/110_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/111.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/111_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
     <tr> 
      <td colspan="2" style="width:638px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/112.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/112_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
    </tbody> 
</table> 
<p>&nbsp;</p> 
<p>As you can judge for yourself, even though this airport has just the one runway, the developers included quite a bit of the surrounding areas.&nbsp; Let us see how things look on the ground.</p> 
<p>&nbsp;</p> 
<p><strong>Airport Features and First Impressions</strong></p> 
<p>I have done probably close to a dozen flights into and out of Bologna, prior to sitting down to write this review.&nbsp; My favorite route, for this airport, became the short hop (about 90 minutes) from Vienna into Bologna, and back.</p> 
<p>&nbsp;</p> 
<p>First and foremost - I absolutely fell in love with the geographic positioning of the airport; mainly, where the airport is located added a lot of immersion into my sim experience.&nbsp; The mountains and hills, surrounding the airport on the North, West, and to the South, and the Adriatic sea to the East, create an interesting mix for weather opportunities, and results in all kinds of interesting and challenging scenarios - the low clouds, hovering right above the ground level, the fog, creeping along the valley, the rain and, sometimes, a completely clear and crisp approach, uninhabited by any of the above!</p> 
<p>&nbsp;</p> 
<table align="center" border="0" cellpadding="5" cellspacing="0"> 
    <tbody> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/056.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/056_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/067.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/067_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/068.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/068_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/074.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/074_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
    </tbody> 
</table> 
<p>&nbsp;</p> 
<p>Generally speaking, the airport is well visible and identifiable from the air.&nbsp; However, it often hides right underneath the low clouds, and I have found myself employing the ILS system far more often (and keeping it engaged for much more of the approach leg), than I have had to with my other payware sceneries.&nbsp; Other times (on multiple occasions), when blanketed by the dense fog, I actually found myself getting ready to abort the landing because I did not see the runway all the way down to the decision height (truth be told, I should have aborted a couple of times).&nbsp; Exhilarating!&nbsp; One point to note - the approach guiding lights, once (and when) visible, are easy to see and follow.</p> 
<p>&nbsp;</p> 
<table align="center" border="0" cellpadding="5" cellspacing="0"> 
    <tbody> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/091.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/091_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/096.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/096_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
    </tbody> 
</table> 
<p>&nbsp;</p> 
<p>Another point - the airport is located in a beautiful place, geographically speaking.&nbsp; While challenging and exciting during the weather-intense landings and takeoffs, it is quiet and beautiful on the clear days, and especially in the dusk, dawn, and the night hours.</p> 
<p>&nbsp;</p> 
<table align="center" border="0" cellpadding="5" cellspacing="0"> 
    <tbody> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/007.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/007_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/014.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/014_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/015.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/015_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/070.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/070_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
     <tr> 
      <td colspan="2" style="width:638px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/006.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/006_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
    </tbody> 
</table> 
<p>&nbsp;</p> 
<p>Now that I have praised where the airport is located, and how great it looks during the approaches and departures, it is time to look at the airport at the ground level.</p> 
<p>&nbsp;</p> 
<p>Thank you, developers, for not skimping on the surrounding areas and giving us dense house and warehouse areas to enjoy during the descents and climb-outs.</p> 
<p>&nbsp;</p> 
<table align="center" border="0" cellpadding="5" cellspacing="0"> 
    <tbody> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/034.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/034_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/092.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/092_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
     <tr> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/100.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/100_T.jpg" class="img111"></a> 
      </td> 
      <td style="width:319px;"> 
       <p style="text-align:center"><a href= 
"http://www.avsim.com/pages/1014/bol/005.jpg"><img alt="" 
src= 
"http://www.avsim.com/pages/1014/bol/005_T.jpg" class="img111"></a> 
      </td> 
     </tr> 
    </tbody> 
</table> 
<p>&nbsp;</p> 
</div> 
<style> 

    .img111 
      {border:3px solid #000; 
      -webkit-border-radius: 20px; 
      -moz-border-radius: 20px; 
      border-radius: 20px; 
      } 
    .divv11 { 
      border:2px solid #000; 
      padding:15px; 
      background:clear; 
      width:auto; 
      border-radius:15px; 
      text-align:justify; 

     } 
      .divv12 { 
      border:2px solid #000; 
      padding:15px; 
      background:#9fa7e8; 
      width:auto; 
      height:60px; 
      border-radius:15px; 
      text-align:center; 
      background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzFlNTc5OSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiM3ZGI5ZTgiIHN0b3Atb3BhY2l0eT0iMCIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+); 
background: -moz-linear-gradient(top, rgba(30,87,153,1) 0%, rgba(125,185,232,0) 100%); /* FF3.6+ */ 
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(30,87,153,1)), color-stop(100%,rgba(125,185,232,0))); /* Chrome,Safari4+ */ 
background: -webkit-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(125,185,232,0) 100%); /* Chrome10+,Safari5.1+ */ 
background: -o-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(125,185,232,0) 100%); /* Opera 11.10+ */ 
background: -ms-linear-gradient(top, rgba(30,87,153,1) 0%,rgba(125,185,232,0) 100%); /* IE10+ */ 
background: linear-gradient(to bottom, rgba(30,87,153,1) 0%,rgba(125,185,232,0) 100%); /* W3C */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#1e5799', endColorstr='#007db9e8',GradientType=0); /* IE6-8 */ 
     } 

    ul.a {list-style-type: circle; 
    list-style-position:inside;} 
    ul.b {list-style-type:square; 
    list-style-position:inside;} 

    /* IE9 SVG, needs conditional override of 'filter' to 'none' */ 
.gradient 
    { 
    } 
</style> 
<!--[if gte IE 9]> 
    <style type="text/css"> 
    .gradient { 
     filter: none; 
    } 
</style> 
<![endif]--> 

ответ

0

У меня было почти точно такое же упражнение делать, когда я создал блог, который я бегу (см мой профиль). Я сделал это так, потому что мои сообщения всегда в заданном формате (как ваши веб-документы), и я не хотел писать все теги HTML без необходимости, это слишком утомительно для повторяющихся документов.

Главное, что такое скриптовый язык, такой как PHP или аналогичный. Это позволяет читать текстовый файл и переформатировать его любым способом. Если вы не знаете PHP, вам может потребоваться задействовать программиста для одноразовой задачи, хотя это не слишком сложно для изучения языка.

Я просто пишу свои сообщения в текстовом редакторе. Чтобы избежать написания HTML, я использую очень маленький набор очень простых тегов, начиная с символа маркера тега (скажем, символа |). Пустая строка разделяет абзацы, которые позже обернуты в <p> .... </p > теги по PHP. Затем | h1, | h2 в начале строки средних заголовков, и у меня всегда есть только заголовок на строке, поэтому конец строки указывает конец заголовка. PHP обертывает всю строку в < h1,2 ... > ... </h1 > теги. В вашем случае вам также понадобится тег для таблицы с разделительными символами для маркировки новых ячеек и строк и тега изображения.

Если я хочу сделать что-то особенно экзотическое для одного документа, я все еще могу напечатать необработанный HTML (для этого вам, возможно, потребуется позвонить вам). Но этот подход делает HTML намного проще и быстрее.

Тогда у меня есть основная PHP-процедура (довольно большая), которая просто читается в тексте и применяет приведенные выше правила для создания HTML. (Вы начнете переформатирование либо из необработанных текстовых файлов, которые вы получаете от автора, либо в том случае, если они удобны для разборчивости, либо после того, как вы переформатировали их в Word (но делайте это как .txt-файлы, а не .docs)). Я просто показываю HTML во время выполнения (для этого PHP имеет функцию эхо-сигнала). Но PHP может сохранить вывод HTML в постоянные .html-файлы, если вы предпочитаете.

Что касается CSS, поскольку вы говорите, что ваши страницы находятся в установленном формате, это упрощает процесс. Просто создайте постоянную внешнюю таблицу стилей самостоятельно с заданными стилями для ваших абзацев, заголовков, изображений и т. Д. (Вы должны это делать сейчас). Иногда вам может понадобиться добавить дополнительные бит в конце, чтобы справиться с чем-то, что нужно сделать, но это, надеюсь, не слишком часто.

Надеюсь, это даст вам только одну идею о том, как подойти к этому. Есть и другие способы.

+0

Благодарим вас за решение. Подумайте об этом и изучите PHP.Кажется, вы и я используем ту же логику с уникальными тегами в необработанном тексте, поэтому старая процедура «найти/заменить» сделает грязную работу по вставке фактического кода в правильные места. Я много узнал о Find/Replace и все, что он может сделать, когда мне захотелось, чтобы у вас было 100 или около того изображений от 001.jpg до полного URL. Еще раз спасибо! –

+0

Еще одна вещь: ваш веб-хостер, конечно же, должен установить PHP. Если это внешний коммерческий хост, у них будет это средство (но проверьте, что вы с ними правильно настроены). Если это собственный сервер, вам может потребоваться установить его, но это относительно просто. Счастливое обучение PHP! – GuyH

Смежные вопросы