o.write(line)
o.write("\\itemsep -0.3em\n")
continue
+ # find headings and create name-refs, including filename
+ if line.startswith("#"):
+ iname = input_name.split("/")
+ if iname[0] == 'openpower': iname.pop(0)
+ l = line.strip().split(" ")[1:3]
+ l = map(lambda x: ''.join(filter(str.isalnum, x)), l)
+ l = map(str.lower, l)
+ l = filter(lambda x:x, l)
+ l = list(dict.fromkeys(iname + list(l)))
+ l = '_'.join(l)
+ line = '%s <a name="%s"> </>\n' % (line.strip(), l)
# find actual inlines
if not line.startswith("[[!inline"):
o.write(line)
find_brack = v.find(']]')
if find_brack == -1:
return
+ hashtag = ""
link = v[2:find_brack]
+ rest = link.split("#") # can be joined up again with '#'.join(rest)
+ link = rest[0]
out.write(" link %s\n" % link)
lookups = {'sv': 'Scalable Vectors for Power ISA',
'SV|sv': 'Scalable Vectors for Power ISA',
out.write(" found RFC %s\n" % link)
return [Link(['', [], []],
[Str("{RFC "+link+"}")],
- ['#%s' % link, '']), Str(v[find_brack+2:])]
+ ['#%s' % link, '']),
+ Str(v[find_brack+2:])]
if link in lookups:
out.write(" found %s\n" % lookups[link])
return [Link(['', [], []],
[Str("{"+lookups[link]+"}")],
- ['#%s' % link, '']), Str(v[find_brack+2:])]
+ ['#%s' % linklookups(rest), '']),
+ Str(v[find_brack+2:])]
if '|' in link:
link, ref = link.split("|")
return [Link(['', [], []],
[Str(link)],
- [ref, '']), Str(v[find_brack+2:])]
+ [ref, '']),
+ Str(v[find_brack+2:])]
if k == 'Link':
out.write(" link type %s\n" %
(type(v[1][0])))
if re.fullmatch(r"< */ *small *>", v[1]):
return [RawInline('latex', '}')]
+def linklookups(rest):
+ res = '#'.join(rest)
+ if len(rest[0]) == 0:
+ res = '_'.join(rest[1:])
+ return res
if __name__ == "__main__":
toJSONFilter(inlinenotes)