Added asterix links
This commit is contained in:
parent
3243e85174
commit
458c4d84f9
6 changed files with 28 additions and 10 deletions
13
Rakefile
13
Rakefile
|
@ -69,6 +69,7 @@ task :html do
|
|||
require 'filters/mkd_post_latex_macros_to_html'
|
||||
require 'filters/html_template'
|
||||
require 'filters/mathjax'
|
||||
require 'filters/links'
|
||||
|
||||
class KrambookCompile
|
||||
require 'config_html.rb'
|
||||
|
@ -98,7 +99,7 @@ task :html do
|
|||
txt.sub!( /<!-- INCLUDES -->/ ) do
|
||||
puts "HERE"
|
||||
@filelist.map do |source,dest|
|
||||
%{<div class="block left">
|
||||
%{<div class="block">
|
||||
<h3>
|
||||
<a href="#{dest.sub(/^site\//,'')}">
|
||||
#{File::basename(dest,'.html').sub(/^\d+_/,'')}
|
||||
|
@ -137,6 +138,7 @@ task :html do
|
|||
html_template.author=@author
|
||||
html_template.html_headers=@html_headers
|
||||
html_template.homeURL="index.html"
|
||||
@postfilters<<=Links.new
|
||||
@postfilters<<=html_template
|
||||
@postfilters<<=MathJax.new
|
||||
|
||||
|
@ -154,15 +156,16 @@ task :html do
|
|||
puts source
|
||||
|
||||
# read and compile in LaTeX the .md file
|
||||
templateindex=2
|
||||
if (i+1)<@filelist.size
|
||||
@postfilters[1].nextURL = '/' + @filelist[i + 1][1].gsub('site/','')
|
||||
@postfilters[templateindex].nextURL = '/' + @filelist[i + 1][1].gsub('site/','')
|
||||
else
|
||||
@postfilters[1].nextURL = "#"
|
||||
@postfilters[templateindex].nextURL = "#"
|
||||
end
|
||||
if (i-1)>=0
|
||||
@postfilters[1].prevURL = '/' + @filelist[i - 1][1].gsub('site/','')
|
||||
@postfilters[templateindex].prevURL = '/' + @filelist[i - 1][1].gsub('site/','')
|
||||
else
|
||||
@postfilters[1].prevURL = "#"
|
||||
@postfilters[templateindex].prevURL = "#"
|
||||
end
|
||||
text=compile_text( File.new(source,"r").read )
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
MACRO(markdown) = `markdown` ENDMACRO
|
||||
MACRO(kramdown) = [`kramdown`](http://kramdown.rubyforge.org) ENDMACRO
|
||||
|
||||
POSTMACRO(beginbox) = LATEX: \medskip\fbox{\colorbox{boxcolor}{\begin{minipage}{.80\linewidth}% HTML: <div class="encadre"> ENDMACRO
|
||||
POSTMACRO(beginbox) = LATEX: \medskip\fbox{\colorbox{boxcolor}{\begin{minipage}{.80\linewidth}% HTML: <div class="encadre"> ENDMACRO
|
||||
|
||||
POSTMACRO(endbox) = LATEX: \end{minipage}}}\medskip HTML: </div> ENDMACRO
|
||||
POSTMACRO(endbox) = LATEX: \end{minipage}}}\medskip HTML: </div> ENDMACRO
|
||||
|
||||
|
||||
POSTMACRO(xelatex) = LATEX: \XeLaTeX HTML: <span style="text-transform: uppercase">X<sub style="vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em; font-size: 1em">Ǝ</sub>L<sup style="vertical-align: 0.15em; margin-left: -0.36em; margin-right: -0.15em; font-size: .85em">a</sup>T<sub style="vertical-align: -0.5ex; margin-left: -0.1667em; margin-right: -0.125em; font-size: 1em">e</sub>X</span> ENDMACRO
|
||||
|
|
11
filters/links.rb
Normal file
11
filters/links.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
class Links
|
||||
def run (content)
|
||||
content.gsub(/(<a [^>]*href="(.)[^>]*>)(.*?)(<\/a>)/) do
|
||||
if $2 == '#'
|
||||
$&
|
||||
else
|
||||
$1+$3+%{<sup>*</sup>}+$4
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -13,6 +13,8 @@
|
|||
# %%% macro_name %%% macro_value %%%
|
||||
#
|
||||
|
||||
require "cgi"
|
||||
|
||||
class MarkdownPostLatexMacrosToHTML
|
||||
attr_accessor :macro
|
||||
def initialize()
|
||||
|
@ -35,7 +37,7 @@ class MarkdownPostLatexMacrosToHTML
|
|||
def run (content)
|
||||
content.gsub(/(^<p>\s*)?POSTMACRO\((\w(\w|\d|\\_)*)\) = LATEX: ((.|\n)*?) (HTML: ((.|\n)*?) )?ENDMACRO((\s|\n)*<\/p>)?/m) do |m|
|
||||
name=$2
|
||||
value=$7.gsub('<','<').gsub('>','>').gsub('&','&')
|
||||
value=CGI::unescapeHTML($7).gsub("”",'"')
|
||||
puts "SAVE HTML MACRO: #{name} => #{value}"
|
||||
@macro[name.intern]=value
|
||||
""
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -17,7 +17,9 @@
|
|||
<h3><em>by</em> <!-- Author --> </h3>
|
||||
</div>
|
||||
<div id="afterhead" style="padding-top: 2em; font-size: 1.3em;">
|
||||
<!-- INCLUDES -->
|
||||
<div style="padding-left: 4em">
|
||||
<!-- INCLUDES -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue