Site Notice

hello, world

Difference between revisions of "Module:SongsInAnime"

From Project-EPB Commons
([InPageEdit] 没有编辑摘要)
 
m (机智的小鱼君 moved page Module:SongInAnime to Module:SongsInAnime without leaving a redirect)
(No difference)

Revision as of 23:59, 10 April 2020

Edit Module:SongsInAnime/doc

Lua error in package.lua at line 80: module 'Module:Songs/table' not found.

Lua error in package.lua at line 80: module 'Module:Songs/table' not found.


-- Module Name: 动画音乐表
-- Description:
--- 动画出现的全部音乐都可以使用这个模块查询,
--- 完善歌曲信息请前往子页面[[Module:SongsInAnime/table]]
local p = {}
local getArgs = require('Module:Arguments').getArgs
local util = require('Module:Util')
local songsTable = require('Module:Songs/table')

-- 某集动画中的全部歌曲
function p.anime(frame)
  local args = getArgs(frame)
  local episode = args['episode'] or args[1]
  -- 参数错误
  if episode == nil then
    return '[[Module:Songs]]模块错误:未指定剧集。'
  end
  local songs = songsTable[episode]
  -- 没有该集信息
  if songs == nil then
    return '注意:没有找到动画剧集[[' .. episode .. ']]!'
  end
  -- 没有音乐
  if util.tableLength(songs) < 1 then
    return '注意:动画[[' .. episode .. ']]中未找到相关音乐!'
  end
  -- 创建列表
  local text = '<ul class="song-table songs-in-anime">'
  for k, v in pairs(songs) do
    local songName = k
    local time = songs[k]['time'] or '未知时间'
    local description = songs[k]['description'] or ''
    text =
      text ..
      '<li class="song"><b class="time-appear">' ..
        time ..
          '</b> [[' ..
            songName ..
              '|<span class="song-name">' ..
                songName .. '</span>]] <i class="song-description">' .. description .. '</i></li>'
  end
  -- 结束,返回列表
  text = text .. '</ul>'
  return text
end

-- 出现某歌曲的动画剧集
function p.song()
  return '还没做好!!!'
end

function p.main(frame)
  return '[[Module:Songs]]模块说明:\n* 使用<code>anime</code>显示某集动画中的全部歌曲。\n* 使用<code>song</code>显示出现某歌曲的动画剧集。'
end

return p