2
I don’t know if it’s better Javascript, PHP, or even the sublime text, but,
I copied the text of cf and pasted on a txt (to get rid of those weird tags)
then in the sublime text, I:
- selected everything crt+to
- tightening crt+shift+l to insert per line
- tightening alt+shift+w to insert html tags in each line
- digit
li
, then already creates the opening and closing tags for each line
Then I ask you to select all:
</li>
<li>TÍTULO
and replace with:
</li>
</ul>
<ul id="titulo" class="titulo">
<li>TÍTULO
And then, I repeated this phase for each subsection: titulo>capítulo>seção>subseção>artigo
I managed to reach this result: cf_step_1.txt
I would like the algorithm to search each ul
and assess the value of id
according to the content of each ul
.
for example, it’s like this:
<ul id="titulo" class="titulo">
<li>
TÍTULO I ...
<ul id="artigo" class="artigo">
<li>
Art. 1º A ...
I’d like to keep it that way:
<ul id="titulo1" class="titulo">
<li>
TÍTULO I ...
<ul id="artigo1" class="artigo">
<li>
Art. 1º A ...
Only result link & #Xa;http://preliminarte.com.br/cf_passo_1.txt Vlw missing
– Alê Moraes
From what I understand, you want to make one parse from the text and extract some information (type, title number, article, etc.), possibly modified (type, Roman numbers for Arabic). Right? If the content is static - and you’re already making "manual" transformations - I suggest experimenting with regular expressions first, maybe it’s enough for what you want. I don’t know the sublime text, but you probably have this option on find/replace...
– mgibsonbr