posix compatible awk

This commit is contained in:
sejo 2022-01-08 11:59:43 -06:00
parent c41e65b551
commit d28a7889b4
3 changed files with 13 additions and 13 deletions

View File

@ -55,7 +55,7 @@ function appendNav( t ){
}
function wikiLink( t ){
i = match( t, /{.+}/)
i = match( t, /\{.+\}/)
if ( i ){
ifinal = index(t, "}") # índice del } final
@ -109,8 +109,8 @@ NR == 1{
/^\+ /{ # include literal
sub(/^+ /,"",$0) # elimina el +
sub(/^\+[[:blank:]]+/,""){ # include literal
# sub(/^+ /,"",$0) # elimina el +
appendContenido( $0 )
next
}
@ -183,8 +183,8 @@ NR == 1{
sub(".gmi$",".html",$1)
# quita { }
sub("{","",texto)
sub("}","",texto)
sub(/\{/,"",texto)
sub(/\}/,"",texto)
# crea link <a>
appendContenido("<p><a href='"$1"' class=arrow>"texto"</a></p>")
@ -203,7 +203,7 @@ NR == 1{
next
}
/^* /{ # lista
/^\* /{ # lista
if(!modo_pre){
if(!modo_lista){ # inicia la lista
if(modo_parrafo){
@ -213,8 +213,8 @@ NR == 1{
modo_lista = 1
appendContenido( "<ul>" )
}
sub("*[[:blank:]]+","<li>",$0)
sub("$","</li>",$0)
sub(/\*[[:blank:]]+/,"<li>",$0)
sub(/$/,"</li>",$0)
appendContenido( wikiLink($0) )
}
else

View File

@ -60,9 +60,9 @@ BEGIN{
print "<title>" $2 "</title>" >> atomgempath
print "<updated>" $1 "</updated>" >> atomgempath
if ( match($3, /{.+}/) ){ # si hay wikilink
gsub("{","",$3)
gsub("}","",$3)
if ( match($3, /\{.+\}/) ){ # si hay wikilink
gsub(/\{/,"",$3)
gsub(/\}/,"",$3)
filename = $3
gsub(" ","_",filename)

View File

@ -3,7 +3,7 @@ function nombre2Link( t, r ){ # convierte un nombre con espacios, a uno con r (e
return t
}
/^+ /{ # literal html
/^\+ /{ # literal html
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
# (el % es por las líneas de uxn jaja)
/^[^=%]*{.+}/{
i = match( $0, /{.+}/)
i = match( $0, /\{.+\}/)
ifinal = index($0, "}") # índice del } final
link = substr($0, i, ifinal-i+1) # {link}