Skip to content

Commit

Permalink
Use hypertargets not hyperrefs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Grigg authored and Nathan Grigg committed May 17, 2013
1 parent 5a2bef6 commit 54d92d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions h2h.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
\fancyhf{}
\renewcommand{\headrulewidth}{0in}
\cfoot{\rightmark{} \textemdash{} \thepage}
\renewcommand\ll[2]{\hyperref[#1]{\si{#2}}}
\newcommand\ld[2]{\hyperref[#1]{\color{black}#2}}
\newcommand\ls[2]{\hyperref[#1]{\ss{#2}}}
\newcommand\lo[2]{\hyperref[#1]{\so{#2}}}
\newcommand\lc[2]{\hyperref[#1]{\sc{#2}}}
\renewcommand\ll[2]{\hyperlink{#1}{\si{#2}}}
\newcommand\ld[2]{\hyperlink{#1}{\color{black}#2}}
\newcommand\ls[2]{\hyperlink{#1}{\ss{#2}}}
\newcommand\lo[2]{\hyperlink{#1}{\so{#2}}}
\newcommand\lc[2]{\hyperlink{#1}{\sc{#2}}}
\newcommand\st[1]{{\color{t}#1}}
\newcommand\si[1]{{\color{i}#1}}
\newcommand\sn[1]{{\color{n}#1}}
Expand Down
7 changes: 2 additions & 5 deletions vimh2h.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
PAT_WORD = r'((?<!' + PAT_WORDCHAR + r')' + PAT_WORDCHAR + r'+' \
r'(?!' + PAT_WORDCHAR + r'))'

RE_STARWORD = re.compile(PAT_STARWORD)
RE_LINKWORD = re.compile(
PAT_OPTWORD + '|' +
PAT_CTRL + '|' +
Expand Down Expand Up @@ -123,8 +122,6 @@ def to_tex(self, filename, contents):
else:
out.extend((r'\se{', tex_escape[line], '}', '\n'))
continue
if RE_STARWORD.search(line):
out.append('\\phantomsection{}')
if RE_EG_START.match(line_tabs):
inexample = 1
line = line[0:-1]
Expand All @@ -145,8 +142,8 @@ def to_tex(self, filename, contents):
if pipeword is not None:
out.extend((' ', self.maplink(pipeword, 'l'), ' '))
elif starword is not None:
out.extend((' \\label{', starword.encode("hex"),
'}\\st{', tex_escape[starword], '}', ' '))
out.extend((' \\hypertarget{', starword.encode("hex"),
'}{\\st{', tex_escape[starword], '}} '))
elif opt is not None:
out.append(self.maplink(opt, 'o'))
elif ctrl is not None:
Expand Down

0 comments on commit 54d92d8

Please sign in to comment.