You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@aurora.apache.org by "John Sirois (JIRA)" <ji...@apache.org> on 2016/04/16 19:34:25 UTC
[jira] [Commented] (AURORA-1668)
http://aurora.apache.org/documentation/latest/ is mainly broken for 0.13.0
[ https://issues.apache.org/jira/browse/AURORA-1668?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244318#comment-15244318 ]
John Sirois commented on AURORA-1668:
-------------------------------------
Gave a quick go at this but its not right. Noting it since I'm stopping progress for now in case anyone else want to pick this up:
{noformat}
$ svn diff --diff-cmd diff -- Rakefile
Index: Rakefile
===================================================================
--- Rakefile (revision 1739482)
+++ Rakefile (working copy)
@@ -101,7 +101,7 @@
FileUtils.mv(contributing_doc, contributing_doc.downcase)
end
- Dir.glob('*.md').each { |doc|
+ Dir.glob('**/*.md').each { |doc|
puts "working on: #{doc}"
# Hacks to make markdown intended for GitHub work.
@@ -110,9 +110,9 @@
# Rewrite links to '../CONTRIBUTING.md'.
gsub(/\.\.\/CONTRIBUTING\.md/, 'contributing/').
# Rewrite links pointing to source files in the repository.
- gsub(/\]\(\.\.\/([^\)]+\))/, '](https://github.com/apache/aurora/blob/#{git_tag}/\1)').
+ gsub(/\]\(\.\.\/([^\)]+\))/, "](https://github.com/apache/aurora/blob/#{git_tag}/\\1)").
# Remove .md extension in links.
- gsub(/\(([A-Za-z0-9-]+)\.md(#[^\)]+)?\)/, "(/documentation/#{title}/\\1/\\2)").
+ gsub(/\(((?:[_A-Za-z0-9-]+\/)*[_A-Za-z0-9-]+)\.md(#[^\)]+)?\)/, "(/documentation/#{title}/\\1/\\2)").
# Fix anchor links and names, which GitHub prefixes with 'user-content-'
# See AURORA-726.
gsub(/#user-content\-/, '#').
{noformat}
> http://aurora.apache.org/documentation/latest/ is mainly broken for 0.13.0
> --------------------------------------------------------------------------
>
> Key: AURORA-1668
> URL: https://issues.apache.org/jira/browse/AURORA-1668
> Project: Aurora
> Issue Type: Bug
> Components: Documentation
> Reporter: John Sirois
> Assignee: John Sirois
>
> The [Rakefile|https://svn.apache.org/repos/asf/aurora/site/Rakefile] for generating the site documentation [assumes a single flat directory|http://svn.apache.org/viewvc/aurora/site/Rakefile?view=markup#l104] of markdown files, see line 104 below:
> {noformat}
> 54 desc 'Fetch markdown from the source tree and generate docs for a specific git tag.'
> 55 task :generate_docs, [:title, :git_tag] do |t, args|
> 56 if !args[:title] or !args[:git_tag]
> 57 puts args, 'Usage: generate_docs[TITLE, GIT_TAG]'
> 58 exit 1
> 59 end
> 60
> 61 title = args[:title]
> 62 git_tag = args[:git_tag]
> 63
> 64 puts "Generating docs from git tag #{git_tag} with title #{title}"
> 65
> 66 tmp_dir = File.join(File.dirname(__FILE__), 'tmp')
> 67 #Rake::Task[:clean].invoke if File.exist?(tmp_dir)
> 68
> 69 FileUtils.mkdir_p(tmp_dir)
> 70
> 71 zip_name = "#{git_tag}.zip"
> 72 is_master = ['master', 'HEAD'].include? git_tag
> 73 archive_root = if is_master then "aurora-#{git_tag}" else "aurora-rel-#{git_tag}" end
> 74 archive_rel_url = if is_master then zip_name else "rel/#{zip_name}" end
> 75
> 76 Dir.chdir(tmp_dir) {
> 77 if File.exist?(zip_name) and not is_master
> 78 puts 'Skipping archive fetch'
> 79 else
> 80 puts "Fetching archive of #{git_tag}"
> 81 system("wget https://github.com/apache/aurora/archive/#{archive_rel_url} -O #{zip_name}")
> 82 end
> 83 system("unzip -o #{zip_name} '#{archive_root}/docs/*'")
> 84 }
> 85
> 86 docs_in_dir = File.join(tmp_dir, archive_root, 'docs')
> 87 docs_out_dir = File.join('source', 'documentation', title)
> 88 FileUtils.rm_f(docs_out_dir)
> 89 FileUtils.mkdir_p(docs_out_dir)
> 90
> 91 FileUtils.cp_r(Dir.glob(File.join(docs_in_dir, '*')), docs_out_dir)
> 92
> 93 puts 'Translating documentation'
> 94 Dir.chdir(docs_out_dir) {
> 95 FileUtils.mv('README.md', 'index.html.md')
> 96
> 97 # Rename the contributing page to lower case. This doesn't exist in all releases, so we
> 98 # check first if it exists.
> 99 contributing_doc = 'CONTRIBUTING.md'
> 100 if File.exist?(contributing_doc)
> 101 FileUtils.mv(contributing_doc, contributing_doc.downcase)
> 102 end
> 103
> 104 Dir.glob('*.md').each { |doc|
> 105 puts "working on: #{doc}"
> 106
> 107 # Hacks to make markdown intended for GitHub work.
> 108 IO.write(doc, File.open(doc, :encoding => 'utf-8') { |f|
> 109 f.read.
> 110 # Rewrite links to '../CONTRIBUTING.md'.
> 111 gsub(/\.\.\/CONTRIBUTING\.md/, 'contributing/').
> 112 # Rewrite links pointing to source files in the repository.
> 113 gsub(/\]\(\.\.\/([^\)]+\))/, '](https://github.com/apache/aurora/blob/#{git_tag}/\1)').
> 114 # Remove .md extension in links.
> 115 gsub(/\(([A-Za-z0-9-]+)\.md(#[^\)]+)?\)/, "(/documentation/#{title}/\\1/\\2)").
> 116 # Fix anchor links and names, which GitHub prefixes with 'user-content-'
> 117 # See AURORA-726.
> 118 gsub(/#user-content\-/, '#').
> 119 # Fix image links. This is necessary because middleman turns each markdown page
> 120 # into a directory name. During this process, relative image tags in HTML are not
> 121 # adjusted accordingly.
> 122 gsub(/img src="images\//, "img src=\"/documentation/#{title}/images/")
> 123 })
> 124 }
> 125 }
> 126 end
> {noformat}
> As a result most of the documentation is left untranslated.
> The Rakefile will need a re-work to handle a general directory tree of markdown files to process.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)