posix compatible awk
This commit is contained in:
parent
c41e65b551
commit
d28a7889b4
|
@ -55,7 +55,7 @@ function appendNav( t ){
|
||||||
}
|
}
|
||||||
|
|
||||||
function wikiLink( t ){
|
function wikiLink( t ){
|
||||||
i = match( t, /{.+}/)
|
i = match( t, /\{.+\}/)
|
||||||
if ( i ){
|
if ( i ){
|
||||||
ifinal = index(t, "}") # índice del } final
|
ifinal = index(t, "}") # índice del } final
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ NR == 1{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/^\+ /{ # include literal
|
sub(/^\+[[:blank:]]+/,""){ # include literal
|
||||||
sub(/^+ /,"",$0) # elimina el +
|
# sub(/^+ /,"",$0) # elimina el +
|
||||||
appendContenido( $0 )
|
appendContenido( $0 )
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -183,8 +183,8 @@ NR == 1{
|
||||||
sub(".gmi$",".html",$1)
|
sub(".gmi$",".html",$1)
|
||||||
|
|
||||||
# quita { }
|
# quita { }
|
||||||
sub("{","",texto)
|
sub(/\{/,"",texto)
|
||||||
sub("}","",texto)
|
sub(/\}/,"",texto)
|
||||||
|
|
||||||
# crea link <a>
|
# crea link <a>
|
||||||
appendContenido("<p><a href='"$1"' class=arrow>"texto"</a></p>")
|
appendContenido("<p><a href='"$1"' class=arrow>"texto"</a></p>")
|
||||||
|
@ -203,7 +203,7 @@ NR == 1{
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
/^* /{ # lista
|
/^\* /{ # lista
|
||||||
if(!modo_pre){
|
if(!modo_pre){
|
||||||
if(!modo_lista){ # inicia la lista
|
if(!modo_lista){ # inicia la lista
|
||||||
if(modo_parrafo){
|
if(modo_parrafo){
|
||||||
|
@ -213,8 +213,8 @@ NR == 1{
|
||||||
modo_lista = 1
|
modo_lista = 1
|
||||||
appendContenido( "<ul>" )
|
appendContenido( "<ul>" )
|
||||||
}
|
}
|
||||||
sub("*[[:blank:]]+","<li>",$0)
|
sub(/\*[[:blank:]]+/,"<li>",$0)
|
||||||
sub("$","</li>",$0)
|
sub(/$/,"</li>",$0)
|
||||||
appendContenido( wikiLink($0) )
|
appendContenido( wikiLink($0) )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -60,9 +60,9 @@ BEGIN{
|
||||||
print "<title>" $2 "</title>" >> atomgempath
|
print "<title>" $2 "</title>" >> atomgempath
|
||||||
print "<updated>" $1 "</updated>" >> atomgempath
|
print "<updated>" $1 "</updated>" >> atomgempath
|
||||||
|
|
||||||
if ( match($3, /{.+}/) ){ # si hay wikilink
|
if ( match($3, /\{.+\}/) ){ # si hay wikilink
|
||||||
gsub("{","",$3)
|
gsub(/\{/,"",$3)
|
||||||
gsub("}","",$3)
|
gsub(/\}/,"",$3)
|
||||||
filename = $3
|
filename = $3
|
||||||
gsub(" ","_",filename)
|
gsub(" ","_",filename)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ function nombre2Link( t, r ){ # convierte un nombre con espacios, a uno con r (e
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
/^+ /{ # literal html
|
/^\+ /{ # literal html
|
||||||
next # salta la línea
|
next # salta la línea
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ function nombre2Link( t, r ){ # convierte un nombre con espacios, a uno con r (e
|
||||||
# si tienen sintaxis de wikilink, y no son líneas de enlace, agrega el link
|
# si tienen sintaxis de wikilink, y no son líneas de enlace, agrega el link
|
||||||
# (el % es por las líneas de uxn jaja)
|
# (el % es por las líneas de uxn jaja)
|
||||||
/^[^=%]*{.+}/{
|
/^[^=%]*{.+}/{
|
||||||
i = match( $0, /{.+}/)
|
i = match( $0, /\{.+\}/)
|
||||||
ifinal = index($0, "}") # índice del } final
|
ifinal = index($0, "}") # índice del } final
|
||||||
|
|
||||||
link = substr($0, i, ifinal-i+1) # {link}
|
link = substr($0, i, ifinal-i+1) # {link}
|
||||||
|
|
Loading…
Reference in New Issue