Re: Html Tag set classes

"Scott Walters [email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hello,
One way is as follows.cat data.html |  sed  '/<span *class *= *"time"/{h; x; s/.*\(....\)<\/span>/\1/; x;}/<span *class *= *"tags"/{H; x; s/\n.*>\(.*\)<\/a>/,\1/;  x;}G;s/<a href="\/blog\/\([^\n]*\)\/">\1\(.*\)\n\1,/<a class="active" href="\/blog\/\1\/">\1\2\n\1,/;s/<a href="\/blog\/tag\/\([^\n]*\)\/">\(.*\)\n\(.*\),\1/<a class="active" href="\/blog\/tag\/\1\/">\2\n\3,\1/;P;d;'
The output of the two lines would be as follows<li><a class="active" href="/blog/tag/society/">society (11)</a></li>
<li><a class="active" href="/blog/2015/">2015 (7)</a></li>

thanksScott W. 


     On Sunday, July 26, 2015 9:14 PM, "'[email protected]' [email protected] [sed-users]" <[email protected]> wrote:
   

     Hello,

i convert my page to other static generator which understand not liquid
template language and i can not convert in ruby template language. So 
i ask me i can fix my problem maybe with sed. 

Seeking a way to a particular term inside the head of a article (webpage)
and then in footer want set active to class. It goes with tags and years. 

For example in head, the tag is example together have five tags. 

<span class="time">02.05.2015</span>
<span class="tags"><a href="/blog/tags/society/">society</a>

In Header should search year and tag. 

Then in footer stand...

<aside class="blog">
<ul>
 <li><a href="/blog/tag/computer/">computer (3)</a></li>
 <li><a href="/blog/tag/society/">society (11)</a></li>
 <li><a href="/blog/tag/state/">state (10)</a></li>
 <li><a href="/blog/tag/media/">media (3)</a></li>
 <li><a href="/blog/tag/network/">network (2)</a></li>
</ul>
 
<ul>
 <li><a href="/blog/2015/">2015 (7)</a></li>
 <li><a href="/blog/2014/">2014 (14)</a></li>
 <li><a href="/blog/2013/">2013 (4)</a></li>
 <li><a href="/blog/2012/">2012 (4)</a></li>
</ul>
</aside>

This is footer should then set class="active" when year and tag is matched. 

Has someone an idea? This should work recursive, because middleman want me 
not set this chance and my coding expierence is limited. 

Thank You & Nice Day
----------------
Silvio Siefke

[Non-text portions of this message have been removed]

  #yiv8280509572 #yiv8280509572 -- #yiv8280509572ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv8280509572 #yiv8280509572ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv8280509572 #yiv8280509572ygrp-mkp #yiv8280509572hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv8280509572 #yiv8280509572ygrp-mkp #yiv8280509572ads {margin-bottom:10px;}#yiv8280509572 #yiv8280509572ygrp-mkp .yiv8280509572ad {padding:0 0;}#yiv8280509572 #yiv8280509572ygrp-mkp .yiv8280509572ad p {margin:0;}#yiv8280509572 #yiv8280509572ygrp-mkp .yiv8280509572ad a {color:#0000ff;text-decoration:none;}#yiv8280509572 #yiv8280509572ygrp-sponsor #yiv8280509572ygrp-lc {font-family:Arial;}#yiv8280509572 #yiv8280509572ygrp-sponsor #yiv8280509572ygrp-lc #yiv8280509572hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv8280509572 #yiv8280509572ygrp-sponsor #yiv8280509572ygrp-lc .yiv8280509572ad {margin-bottom:10px;padding:0 0;}#yiv8280509572 #yiv8280509572actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv8280509572 #yiv8280509572activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv8280509572 #yiv8280509572activity span {font-weight:700;}#yiv8280509572 #yiv8280509572activity span:first-child {text-transform:uppercase;}#yiv8280509572 #yiv8280509572activity span a {color:#5085b6;text-decoration:none;}#yiv8280509572 #yiv8280509572activity span span {color:#ff7900;}#yiv8280509572 #yiv8280509572activity span .yiv8280509572underline {text-decoration:underline;}#yiv8280509572 .yiv8280509572attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv8280509572 .yiv8280509572attach div a {text-decoration:none;}#yiv8280509572 .yiv8280509572attach img {border:none;padding-right:5px;}#yiv8280509572 .yiv8280509572attach label {display:block;margin-bottom:5px;}#yiv8280509572 .yiv8280509572attach label a {text-decoration:none;}#yiv8280509572 blockquote {margin:0 0 0 4px;}#yiv8280509572 .yiv8280509572bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv8280509572 .yiv8280509572bold a {text-decoration:none;}#yiv8280509572 dd.yiv8280509572last p a {font-family:Verdana;font-weight:700;}#yiv8280509572 dd.yiv8280509572last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv8280509572 dd.yiv8280509572last p span.yiv8280509572yshortcuts {margin-right:0;}#yiv8280509572 div.yiv8280509572attach-table div div a {text-decoration:none;}#yiv8280509572 div.yiv8280509572attach-table {width:400px;}#yiv8280509572 div.yiv8280509572file-title a, #yiv8280509572 div.yiv8280509572file-title a:active, #yiv8280509572 div.yiv8280509572file-title a:hover, #yiv8280509572 div.yiv8280509572file-title a:visited {text-decoration:none;}#yiv8280509572 div.yiv8280509572photo-title a, #yiv8280509572 div.yiv8280509572photo-title a:active, #yiv8280509572 div.yiv8280509572photo-title a:hover, #yiv8280509572 div.yiv8280509572photo-title a:visited {text-decoration:none;}#yiv8280509572 div#yiv8280509572ygrp-mlmsg #yiv8280509572ygrp-msg p a span.yiv8280509572yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv8280509572 .yiv8280509572green {color:#628c2a;}#yiv8280509572 .yiv8280509572MsoNormal {margin:0 0 0 0;}#yiv8280509572 o {font-size:0;}#yiv8280509572 #yiv8280509572photos div {float:left;width:72px;}#yiv8280509572 #yiv8280509572photos div div {border:1px solid #666666;height:62px;overflow:hidden;width:62px;}#yiv8280509572 #yiv8280509572photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv8280509572 #yiv8280509572reco-category {font-size:77%;}#yiv8280509572 #yiv8280509572reco-desc {font-size:77%;}#yiv8280509572 .yiv8280509572replbq {margin:4px;}#yiv8280509572 #yiv8280509572ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv8280509572 #yiv8280509572ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv8280509572 #yiv8280509572ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv8280509572 #yiv8280509572ygrp-mlmsg select, #yiv8280509572 input, #yiv8280509572 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv8280509572 #yiv8280509572ygrp-mlmsg pre, #yiv8280509572 code {font:115% monospace;}#yiv8280509572 #yiv8280509572ygrp-mlmsg * {line-height:1.22em;}#yiv8280509572 #yiv8280509572ygrp-mlmsg #yiv8280509572logo {padding-bottom:10px;}#yiv8280509572 #yiv8280509572ygrp-msg p a {font-family:Verdana;}#yiv8280509572 #yiv8280509572ygrp-msg p#yiv8280509572attach-count span {color:#1E66AE;font-weight:700;}#yiv8280509572 #yiv8280509572ygrp-reco #yiv8280509572reco-head {color:#ff7900;font-weight:700;}#yiv8280509572 #yiv8280509572ygrp-reco {margin-bottom:20px;padding:0px;}#yiv8280509572 #yiv8280509572ygrp-sponsor #yiv8280509572ov li a {font-size:130%;text-decoration:none;}#yiv8280509572 #yiv8280509572ygrp-sponsor #yiv8280509572ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv8280509572 #yiv8280509572ygrp-sponsor #yiv8280509572ov ul {margin:0;padding:0 0 0 8px;}#yiv8280509572 #yiv8280509572ygrp-text {font-family:Georgia;}#yiv8280509572 #yiv8280509572ygrp-text p {margin:0 0 1em 0;}#yiv8280509572 #yiv8280509572ygrp-text tt {font-size:120%;}#yiv8280509572 #yiv8280509572ygrp-vital ul li:last-child {border-right:none !important;}#yiv8280509572 

  

[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.